I would like to know what kind of boundary conditions Mathematica implements in NDSolve
when not specifying any boundary conditions by hand. So for example solving the transport equation:
eq = With[{l= 2.}, D[u[t, x], t] + l D[u[t, x], x] == 0];
mol[n_Integer, o_Integer] := {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "DifferenceOrder" -> o, "Coordinates" -> N[-1 + 2/n*Range[0, n]]}}
solv = NDSolve[{eq, u[0, x] == Exp[-x^2/.1]}, u, {t, 0, 1}, {x, -1, 1}, Method -> mol[51, 4]]
Animate[Plot[Evaluate[u[t, x] /. solv], {x, -1, 1}], {t, 0, 1}]
This gives me a warning:
NDSolve::bcart: Warning: an insufficient number of boundary conditions have been specified for the direction of independent variable x. Artificial boundary effects may be present in the solution.
but the equation is still solved. The boundary conditions at $+1$ look like absorbing or periodic boundary conditions but at $-1$ there is something different going on.
- How does Mathematica treat problems when no boundary condition is given in
NDSolve
? - How can I implement in this case absorbing boundary conditions within
NDSolve
?
Edit: I was asked to edit the question to make it 'unique': Firstly my question refers only to the above stated (first order) transport equation, secondly my question also asks for implementing absorbing boundary condition which is kind of done automatically by mathematica at $+1$, thirdly I am not applying any boundary conditions at all which is different to the question mentioned in the comments and the mentioned question does not explain what NDSolve
is doing at the edges.
NDSolve
is doing at the edges." this is explained in the last link in that question, please read it carefully. $\endgroup$NDSolve
is constructing the derivative at the outermost points. Is it using a forward difference scheme on the rhs and a backward scheme on the lhs? Or adding discretization points to the edges and applying some values to them? I cant see this being answered clearly in the link. $\endgroup$