Elimination of numerical error in initial data

Elimination of numerical error in initial data can be crucial for its subsequent evolution.

In the following simple example

(*Initial-boundary conditions and PDE system*)
IC = {v[0, z] == 0, p[0, z] == 1};
BC = {v[t, 0] == 0, p[t, 1] == 1};
PDEs = {Derivative[1, 0][p][t,
z] == -v[t, z]*Derivative[0, 1][p][t, z] -
p[t, z]*Derivative[0, 1][v][t, z],
Derivative[1, 0][v][t, z] == -Derivative[0, 1][p][t, z]/(p[t, z]) -
v[t, z]*Derivative[0, 1][v][t, z]};

(*Numerical integration*)
evolution = NDSolve[{PDEs, IC, BC}, {v, p}, {t, 0, 1}, {z, 0, 1}];
vv[t_, z_] := First[v[t, z] /. evolution];

(*Initial v as it should be*)
Plot[0, {z, 0, 1}, PlotRange -> All]
(*Initial v as it is*)
Plot[vv[0, z], {z, 0, 1}, PlotRange -> All]

the initial profile of function v looks like this  It seems that, in principle, Mathematica is able to understand initial v as exactly zero, but I have not found yet how to do this.

So in general I will not be able to take full advantage of Mathematica's ability to eliminate initial numerical error.

Can anyone help?

P.S. PDEs are the classical fluid mechanics Euler and Continuity equations for an ideal fluid EoS $$ρ=P$$.

• You could change AccuracyGoal. – b.gates.you.know.what Sep 4 at 7:53
• In version 12.0 I get two flat lines, but besides that the scale is 10^-33. This is a very small number. – user21 Sep 4 at 7:53
• This is just an illustrative example. My main concern is that there is numerical error before any evolution has heppened. This may be crucial in general (e.g. this is the case with constraint violation in GR free evolution). – jheidk51 Sep 4 at 7:58

Can't reproduce the issue in v11.3, and you should check the values on grid inside InterpolatingFunction rather than using Plot:

evolutionfunclst = NDSolveValue[{PDEs, IC, BC}, {v, p}, {t, 0, 1}, {z, 0, 1}];

value = #["ValuesOnGrid"] & /@ evolutionfunclst;

First /@ value
(*
{{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0.}, {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1.}}
*)

BTW, I'm a bit doubt about whether you're in the correct direction or not. According to my limited personal experience, unlike BVP of nonlinear ODE, small numeric error almost never influences PDE solving. (Actually I can't recall any example at the moment. )