Comments (5)
From the Gitter:
I don't think it's a big task
and I think it's just the Dirichlet BCs
https://github.com/JuliaDiffEq/DiffEqOperators.jl/blob/master/src/derivative_operators/boundary_operators.jl#L305
https://github.com/JuliaDiffEq/DiffEqOperators.jl/blob/master/src/derivative_operators/boundary_operators.jl#L353
you'd just have to modify these two in order to have them take into account the fact that the last point should just have the BC imposed.
https://github.com/JuliaDiffEq/DiffEqOperators.jl/blob/master/src/derivative_operators/boundary_operators.jl#L181
this is what ends up callin them
so from that you can look at the whole logic pretty quick
from diffeqoperators.jl.
But Dirichlet is a little weird, with that implementation what should we do if the BCs don't match what you put on the ends of the vector?
from diffeqoperators.jl.
From Gitter:
the left BC for Dirichlet is here: https://github.com/JuliaDiffEq/DiffEqOperators.jl/blob/master/src/derivative_operators/boundary_operators.jl#L53
for i in 1 : A.boundary_point_count[1]
for each point where the boundary would go over the edge
(so for 2nd order that's just the last point)
it calls dirichlet_1!(x_temp, x, A.stencil_coefs, mid, i)
https://github.com/JuliaDiffEq/DiffEqOperators.jl/blob/master/src/derivative_operators/boundary_operators.jl#L353
so that's the function to find out
x_temp[i] is the output
coeffs is the stencil [-1 2 1]
x is the initial vector
i is the current location, so at the edge it's 1
need to find out what mid is
function dirichlet_1!(x_temp::AbstractVector{T}, x::AbstractVector{T}, coeffs::SVector, mid::Int, i::Int) where T<:Real
stencil_length = length(coeffs)
N = length(x)
#=
Here we are taking the weighted sum of a window of the input vector to calculate the derivative
at the middle point. Once the stencil goes out of the edge, we assume that it's has a constant
value outside for all points.
=#
xtempi = zero(T)
@inbounds for idx in 1:stencil_length
xtempi += coeffs[idx] * x[limit(i - (mid-idx), N)]
end
x_temp[i] = xtempi
end
so something about x[limit(i - (mid-idx), N)] is making the x's all do something
but whatever it is, that's a weird line of code and should be changed.
it should have the user's BC there
and basically if i-idx<1, it's a point over the boundary and should use the BC value.
so my guess is it needs to be something like
@inbounds for idx in 1:stencil_length
loc = i - idx
if loc < 0
xtempi += coeffs[idx]*bc_right
else
xtempi += coeffs[idx] * x[i-idx]
end
end
then the function needs to get passed bc_right
err, left
mb
so the function call dirichlet_1!(x_temp, x, A.stencil_coefs, mid, i)
needs to change
the type is defined here: https://github.com/JuliaDiffEq/DiffEqOperators.jl/blob/master/src/derivative_operators/derivative_operator.jl#L57
so you can see that A.boundary_condition is where that tuple is stored
so it should be passed
dirichlet_1!(x_temp, x, A.stencil_coefs, mid, i,A.boundary_condition[1])
the function should be expanded
and it should replace the loop to put in the BC like that
from diffeqoperators.jl.
Example problem: https://github.com/francispoulin/DiffEqOperators.jl/blob/master/docs/DiffusionEqTutorial.ipynb
from diffeqoperators.jl.
Here's a review of the BCs:
Dirichlet0
assumes the boundary points are the first points off the boundaryDirichet
assumes the last points are the boundary points and fixes themNeumann0
assumes the boundary points are the last points on the vectorNeumann
assumes the boundary points are the last points on the vectorPeriodic
assumes the first point is a BC and the last point is not (since they would be the same.
We should make these all CenterPeriodic
, etc., and then have Periodic
be the case where the boundary is included in the ends (and do error checks).
from diffeqoperators.jl.
Related Issues (20)
- Performance issues with nonlinear_diffusion! HOT 4
- Fix symbolic arrays test to allow MTK v5.21.0 HOT 7
- UndefVarError: dereference not defined when precompiling DiffEqOperators (Win10, julia 1.6.1-2) HOT 7
- Version Compatibility? HOT 1
- Error defining second-order differential HOT 8
- The latest versions of LoopVectorization (0.12.80-81) are not compatible and cause errors HOT 1
- Noob Help: Simple, Linear, Inhomogenous PDE HOT 3
- concretization of High Dimension PDE HOT 2
- LoopVectorization break HOT 5
- Unexpected concretization of Laplace operator HOT 3
- v4.35.0 failed to release HOT 2
- Feature request: Support Summation-By-Parts operators HOT 4
- Support Unitful HOT 6
- Incorrect boundary padded vector with composed PeriodicBC on 2d data HOT 6
- Implementing Drift-Diffusion model in higher dimensions HOT 3
- Uninitialized field `opnorm` in JacVecOperator HOT 4
- SplitODEProblem broken for MatrixFreeOperator HOT 3
- ERROR: LoadError: Some tests did not pass: 30 passed, 0 failed, 4 errored, 4 broken. HOT 18
- Warning related to "LoopVectorization.check_args"
- Lots of precompilation errors and noise HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffeqoperators.jl.