Comments (5)
I have seen this one recently, I will look closer soon
from methodoflines.jl.
I see the problem, you need to supply bcs for any of your observables that contain derivatives else they are not well specified. This needs a better error though.
from methodoflines.jl.
Thanks for looking into it so quickly.
Why do I need to specify additional boundary conditions (bcs) when specifying the same grid by a vector compared to specifying the same grid by a grid spacing? I thought the problem description did not change semantically.
For me its not quite intuitive to specify bcs for observables, such as a local sink decomposition flux, that are not related to transport.
Would it be sensible to assume zero-fluxes by default? Could this be implemented as a standard in the package that is only changed if bcs are explicitly specified for some observables?
For the delta-grid control case, this seems to be already the case. Then, is the advection-observable in the example for the first layer actually taking into account the specified bc for Y(t,0) or does it assume a default no-flux bc? Although the overall solution is correct, the user should be made aware that observables related to transport are not fully corresponding to the solution at the boundary.
from methodoflines.jl.
Thinking a bit more about it: its not a zero-flux condition that is applied by default with the delta-grid with the upwind scheme, but the flux at the border is the same as between the adjacent two cells/layers. Hence, the default condition corresponds rather to a zero-gradient in the flux, i.e. a zero second derivative of the amount.
from methodoflines.jl.
Based on @xtalax advice, I constructed a modified working vector-grid example with specifying addtional bcs. It does not throw the Boundary error. It skips most of the observed variables.
The MWE works only, if I specify bcs for the non-transport related dec_Y
. The actual formulation of the boundary condition should not matter for the solution of the problem, but only for inspecting the observed variables at the borders.
When inspecting the simplified corresponding ODESystem (using symbolic_discretize
):
(dec_Y(t))[15] ~ (Y(t))[15]*k_Y # expected
(dec_Y(t))[1] ~ 0.0002(12500.000000000002(dec_Y(t))[2] - 10000.000000000004(dec_Y(t))[3] + 2500.0000000000014(dec_Y(t))[4])
(dec_Y(t))[16] ~ 0.00019999999999999963(2499.9999999999936(dec_Y(t))[13] - 9999.999999999982(dec_Y(t))[14] + 12499.999999999996(dec_Y(t))[15])
I would expect an observed variable: (dec_Y(t))[16] ~ (Y(t))[16]*k_Y
The example demonstrates that equations of observed variables unrelated to transport are currently strange at the borders - should be treated differently, and the user should not be required to specify boundary conditions for them.
Further, a default bc corresponding to the dz-number based discretization for the transport-related observed variables would be really helpful.
discretization_grid = MOLFiniteDifference([z => z_grid], t;
advection_scheme = UpwindScheme(), approx_order = 2)
∂_zz = Differential(z)^2
eqs2 = [
∂_t(Y(t, z)) ~ i_Yz(t, z, i_Y) - dec_Y(t, z) + adv_Yo(t, z),
dec_Y(t, z) ~ k_Y * Y(t, z), # observable of decomposition
adv_Yo(t, z) ~ -ω * ∂_z(Y(t, z)), # observable advective flux of Y
]
bcs2 = [
Y(0, z) ~ 1/z_m * Y0,
∂_z(Y(t, 0)) ~ (Y(t, 0) - fagr(t,i_Y_agr, i_Y_agr_pulse)/ω) / dzs[1],
∂_zz(Y(t, z_m)) ~ 0.0,
∂_zz(dec_Y(t, 0)) ~ 0.0,
∂_zz(dec_Y(t, z_m)) ~ 0.0,
#∂_zz(adv_Yo(t, 0)) ~ 0.0,
∂_z(adv_Yo(t, 0)) ~ (fagr(t,i_Y_agr, i_Y_agr_pulse) - ω * Y(t, 0))/dzs[1],
∂_zz(adv_Yo(t, z_m)) ~ 0.0,
]
state_vars2 = [Y(t, z), dec_Y(t, z), adv_Yo(t,z)]
@named pdesys2 = PDESystem(eqs2, bcs2, domains, [t, z], state_vars2, params)
# Convert the PDE problem into an ODE problem
prob2 = discretize(pdesys2, discretization_grid)
from methodoflines.jl.
Related Issues (20)
- ArgumentError: Differential w.r.t. multiple variables Any[t, ...] are not allowed. HOT 2
- Interpolate grid values for staggered grid discretization
- Symbolic tracing in staggered grid can return Nans
- Move to using SymbolicUtils chains
- Package installation error HOT 1
- `discretize` errrors when a subset of equations have no time derivatives HOT 5
- Equation + State mismatch dependent on grid spacing
- MethodOfLines down-versions ModelingToolkit HOT 1
- Error with test/pde_systems/MOL_1D_Interface_Nonlinear.jl
- MOL & BoundaryConditions HOT 3
- PDAE example HOT 5
- PDESystem & arguments
- "ExtraVariablesSystemException: The system is unbalanced" Error while solving a PDE! HOT 4
- System of PDEs Initial Failure warning and MethodError HOT 1
- System of PDEs `solve` error
- remake problem tutorial lets user accidentally re-order parameters HOT 3
- Complex boundary conditions HOT 1
- MoL : AssertionError: Boundary condition is not on a boundary of the domain, or is not a valid boundary condition
- MethodOfLines issue with coupled non-linear PDE system
- AssertionError: Boundary condition (...) is not on a boundary of the domain, or is not a valid boundary condition
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 methodoflines.jl.