Comments (11)
we should supply the required information as type parameters as the direction of wave is unlikely to change frequently
No, the direction will change frequently. This is pretty much what makes the problem difficult. In a nonlinear problem, this is dependent on whatever multiplies the u_x
term. In KdV, this is easy since 6u*u_x
will always be the same direction on the chosen interval. But do something like (u-3)*u_x
and now the most important term for the evolution does change for maybe a few points every timestep.
So direction needs to be mutable. I'm thinking something like an array of Bools
(or maybe a BitArray
), interpreting true
as forward and false
as backward. Every time step, a user would need to update_directions!(A,coefficient)
, where you check the sign.(x)
on the terms of the terms in the coefficient.
Now that doesn't cover every case. Think about this one:
https://en.wikipedia.org/wiki/Upwind_differencing_scheme_for_convection
In this case, the Peclet number (realted to that flow rate, but divide out diffusion) determines if upwind differencing is stable. So in this case, we have three regimes:
- Direction is positive and large enough, upwind.
- Direction is negative and large enough, downwind.
- Direction is not large enough, central.
So maybe it's best to take (-1,0,1)
from the user as possible values for update_directions!(A,coefficient)
, so they can denote the cutoffs themselves.
where +0.7 tells us the fraction of points in the stencil for a point which lie in front of it. So automatically 30% of points lie behind it.
This won't work. The key is not the percentage of points which need up/downwind, its which points need upwind/downwind. It's very common to have a few domains [x_i,x_i + dx_i]
(of changing location and size)` which are downwind, in the middle of an operator where most everything else is upwind (eddies in fluid flows). It's important to know which domains are upwind and which domains are downwind.
from diffeqoperators.jl.
This is a good paper which describes pretty much what we want in the end.
http://www.sciencedirect.com/science/article/pii/S0377042705000634#bib5
from diffeqoperators.jl.
@ChrisRackauckas @dextorious Any thoughts on the API for integrating this?
from diffeqoperators.jl.
API for Upwind Operators
I think that instead of creating a new type for the Upwind Operators we should supply the required information as type parameters as the direction of wave is unlikely to change frequently. Instead of
A = LinearOperator{Float64}(2,2,1/99,100,:Robin,:Neumann;bndry_fn=((1,-3,-5),0));
we can now have
A = LinearOperator{Float64, +0.7}(2,2,1/99,100,:Robin,:Neumann;bndry_fn=((1,-3,-5),0));
where +0.7
tells us the fraction of points in the stencil for a point which lie in front of it. So automatically 30% of points lie behind it.
The full forward upwind operator would correspond to
A = LinearOperator{Float64, +1.0}(2,2,1/99,100,:Robin,:Neumann;bndry_fn=((1,-3,-5),0));
which means that only the points are in front are considered to calculate the derivative while +0.5
would correspond to the central differences.
And similarly negative fractions for the backward derivative.
from diffeqoperators.jl.
So I feel that this will require a new type. Something like UpwindOperator <: AbstractLinearOperator
.
Or should we go forward with LinearOperator
only?
from diffeqoperators.jl.
It probably needs a new type.
from diffeqoperators.jl.
But do something like
(u-3)*u_x
and now the most important term for the evolution does change for maybe a few points every timestep.
So you mean that every differential term will have it's own separate discretization. eg. u_xxx
in KdV will have a separate discretization?
So direction needs to be mutable. I'm thinking something like an array of
Bools
(or maybe aBitArray
), interpretingtrue
as forward andfalse
as backward. Every time step, a user would need toupdate_directions!(A,coefficient)
, where you check thesign.(x)
on the terms of the terms in the coefficient.
This boolean array will tell the direction associated with every differential operator? But if we change it after every update then won't it be too many times for the user. Can the direction be found automatically by any means?
from diffeqoperators.jl.
So you mean that every differential term will have it's own separate discretization. eg. u_xxx in KdV will have a separate discretization?
No, every point in space needs a direction. If dx=0.1
and x in [0,1]
, then there are 10 points, and the upwind operator needs a direction at all 10 points, which could change at each timestep.
from diffeqoperators.jl.
@ChrisRackauckas @dextorious
How does the direction of points change with time? Currently if the wave is moving to +
x-axis then I'm assigning an Upwind Operator for all the points and not changing with time. Is this correct?
from diffeqoperators.jl.
I think the Wiki explains it pretty concisely. In some cases, to be stable it needs to be upwind depending on whether the coefficient a
in front of the u_x
term is positive or negative. I also gave an example where stability requires that |a|<2
. It can be dependent on the problem, which is why I think you should just allow the user to update the directions with an array of directions. Note that a(t,x,u)
can be nonlinear an a function of position and state, and so it can be forward/backward at different points in space.
from diffeqoperators.jl.
I have left it upto the user to set the directions and update them with time. I was just trying it out on the KdV
equation but it's not working as expected so I thought that maybe I'm using it properly.
from diffeqoperators.jl.
Related Issues (20)
- Getting an error when running discretize on a PDESystem with MOLFiniteDifference HOT 27
- 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"
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.