Start with an example shown in unstable results when solve PDE even with great artificial diffusion term added
Suppose we have this simple 1-D PDE groups
$\partial n/\partial t =-\partial (n W)/\partial z$
$\partial W/\partial t =-1/(n m)\partial (n k_B T)/\partial z$
If we set initial/boundary conditions as:
kB = 1.380649*10^(-23);
mp = 1.6726231*10^(-27);
NDSolve[{D[ni[t, z], t] == -D[W[t, z]*ni[t, z], z],
D[W[t, z], t] == -1/(16 mp*ni[t, z])*(D[ni[t, z]*kB*3000*1.5, z]),
{ni[0, z] == 100, ni[t, 200] == 100, ni[t, 1000] == 100, W[0, z] == 0,
W[t, 200] == 0, W[t, 1000] == 0}}, {ni, W}, {t, 0, 100}, {z, 200, 1000}]
The solution is fine. However, if I change the initial/boundary conditions to
kB = 1.380649*10^(-23);
mp = 1.6726231*10^(-27);
NDSolve[
{D[ni[t, z], t] == -D[W[t, z]*ni[t, z],z],
D[W[t, z], t] == -1/(16 mp*ni[t, z])*(D[ni[t, z]*kB*3000*1.5, z]),
{ni[0, z] == 100*Exp[-z/100], ni[t, 200] == 100*Exp[-200/100],
ni[t, 1000] == 100*Exp[-1000/100], W[0, z] == 0, W[t, 200] == 0,
W[t, 1000] == 0}}, {ni, W}, {t, 0, 100}, {z, 200, 1000}]
The solution is broken as discussed in unstable results when solve PDE even with great artificial diffusion term added. This is caused by inconsistent initial/boundary conditions. However, the initial/boundary conditions look fine since my ni[0, z]== 100*Exp[-z/100],ni[t, 200]== 100*Exp[-200/100] and ni[t, 1000] == 100*Exp[-1000/100] match each other at joined points ni[0, 200] and ni[0, 1000]. So how could we determine whether an initial/boundary conditions setting is good/consistent? And how to find good initial/boundary conditions?
z = 1000, the downstream boundary, improves stability but not by a lot. – bbgodfrey Nov 05 '20 at 01:04