# How to set good initial/boundary conditions for 1-D PDE groups

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?

• Neither solution looks stable to me, although the second is far more unstable. Also, I believe that there should be only two boundary conditions, not four. Commented Nov 4, 2020 at 19:29
• Eliminating the extraneous boundary conditions, preferably at z = 1000, the downstream boundary, improves stability but not by a lot. Commented Nov 5, 2020 at 1:04