-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bound error on Discretization when specifying a uniform grid as a vector #340
Comments
I have seen this one recently, I will look closer soon |
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. |
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. 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. |
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. |
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 When inspecting the simplified corresponding ODESystem (using
I would expect an observed variable: 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.
|
Describe the bug 🐞
When I provide a uniform grid as vector to MOLFiniteDifference, the discretization
of a pde results in bounds errors.
Contrary, the discretization works, if the same grid is specified by a single delta-number and the domain.
Expected behavior
I expect providing the grid as a vector would yield the same results as providing the grid by a delta-number. In the future, I want to specify a non-uniform grid with closer spacing near the top of the depth domain.
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
When trying to debug the issue I observed method
_upwind_difference(...){Number}
is going toa different branch than
_upwind_difference(...){AbstractVector}
.This was because
D.offside
was 1 in the Number-method, but 0 in the Vector method.The text was updated successfully, but these errors were encountered: