I try to solve this PDE
testmodel001 =
NDSolve[{D[CO2P[h, t], t] == 10^4 (h-100)^4 - 3*10^(-10) CO2P[h, t]*Exp[30 - 0.05 h],
CO2P[h, 0] == 0
}, {CO2P}, {h, 100, 250}, {t, 0, 200},
Method -> {"MethodOfLines", "TemporalVariable" -> t}]
It's easy to see that CO2P[h, t] should always be positive(or zero), if it starts with non-negative value.
However, when I get the solution I found CO2P[h, t] get negative values for certain altitude (h) range. For example:
{#, (CO2P/.testmodel001[[1]])[#, 10]}&/@Range[100, 110, 0.1] //
ListPlot[#, AxesLabel -> {"h", "CO2P[t=10]"}] &
gives:
It seems CO2P[h=101, t] run to negative value very fast:
{#, ((CO2P/.testmodel001[[1]])[101, #])}&/@Range[0, 3, 0.05] //
ListPlot[#, AxesLabel -> {"t", "CO2P[h=101]"}, PlotRange -> All] &
gives:
What should I do to force my CO2P[h, t] to take positive value?
Notes: the PDE above is only an oversimplified toy model. The reallife PDEs I have to deal with is much more complicate (and contain D[X[h,t],h] terms). Is there a general way to make sure my function always take positive value?




CO2P[h, t]gets a negative value somehow,D[CO2P[h, t], t] ==10^4 (h-100)^4 - 3*10^(-10) CO2P[h, t]*Exp[30 - 0.05 h]is positive and should boostCO2P[h, t]back to positive...CO2P[h=101, t] gets larger and larger negative value, this is real hard to understand.... – Harry Oct 28 '20 at 14:29