I'm having trouble using WhenEvent
function in two-dimensional functions:
My goal is to change the value of a diffusion coefficient $\alpha[x, t]$ as a function of the pressure field $P[x,t]$ acording the conditions: $\alpha = 0.3$ if $P[x,t]<0.5$ and $\alpha = 0.7$ if $P[x,t]>0.5$ only at the location where the presure surpasses the citical value of $P[x,t]=0.5$.
Based on the discussion made in this question, the code I'm using is:
ifun = NDSolve[{D[P[x, t], t] - α[x, t] D[P[x, t], {x, 2}] == 0,
P[x, 0] == 0, P[0, t] == UnitStep[t - t0],
P[L, t] == 0, α[x, 0] == 0.3,
WhenEvent[P[x, t] > 0.5,α[x, t] -> 0.7]},
{P[x, t], α[x, t]}, {t, 0, Tend}, {x, 0, L},
DiscreteVariables -> α]
where:
Tend = 10; L = 10; t0=1;
and the error message I get is:
NDSolve::disto: -- Message text not found -- (α[x,t])
Thanks a lot and a Happy new year:) Ofek.
t0,L,Tend
$\endgroup$