I tried to solve a partial differential equation with parameters, the critical condition of which I used WhenEvent to express, but the solution after bringing in the parameters shows that the WhenEvent statement is not executed, here is my code.
x11 = 0.6 ;
x22 = x11 + 6;
x33 = x22 + 3.6;
x44 = x33 + 5;
a1 = (0.082 10^6)/(300 1377);
a2 = (0.37 10^6)/(862 2100);
a3 = (0.045 10^6)/(74.2 1726);
a4 = (0.028 10^6)/(1.18 1005);
k1 = 0.37/0.082;
k2 = 0.045/0.37;
k3 = 0.028/0.045;
aa[x_] := Piecewise[{{a1, 0 <= x < x11}, {a2, x11 <= x < x22}, {a3,
x22 <= x < x33}, {a4, x33 <= x <= x44}}];
soll3 = ParametricNDSolveValue[{
D[u[t, x], t] - aa[x] D[u[t, x], x, x] ==
NeumannValue[h3/0.028 (37 - u[t, x]), x == x44] +
NeumannValue[h4/0.082 (-75 + u[t, x]), x == 0],
DirichletCondition[u[t, x] == 37, t == 0],
WhenEvent[x == x11,
Derivative[0, 1][u][t, x] -> 1/k1 Derivative[0, 1][u][t, x]],
WhenEvent[x == x22,
Derivative[0, 1][u][t, x] -> 1/k2 Derivative[0, 1][u][t, x]],
WhenEvent[x == x33,
Derivative[0, 1][u][t, x] -> 1/k3 Derivative[0, 1][u][t, x]]
}, u, {t, 0, 5400}, {x, 0, x44}, {h3, h4}]
Set h3=8.23* 10^-3,h4=113* 10^-3,
Below is a function image of the solution obtained by bringing in a specified t=4000 as a function of the x value, and it is obvious that the turning point does not match the critical point given by the critical condition.
I don't know how to solve this problem,please help me.
x == x33
it is not event for PDE of this type. Practically you try to set boundary condition in internal region. Here you have to solve 4 problems and stitch their solution atx=x11, x=x22, x=x33
. Using FEM, we can solve this problem without boundary conditions atx=x11, x=x22, x=x33
. $\endgroup$WhenEvent
refers to a time step. See mathematica.stackexchange.com/questions/86504/… -- I'm not competely sure how it operates in FEM. Specifically if the (t,x) space is discretized with FEM, I don't how isWhenEvent
processed. If the x space only is discretize with FEM and time-stepping integration int
is used, I don't know howWhenEvent
is processed, whether it is like the Method of Lines or not. (Maybe @user21 is working on an idea.) $\endgroup$