1
$\begingroup$

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. enter image description here

I don't know how to solve this problem,please help me.

$\endgroup$
4
  • $\begingroup$ Are you solving the thermal conductivity problem for a sandwich made of 4 different materials? Condition like 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 at x=x11, x=x22, x=x33. Using FEM, we can solve this problem without boundary conditions at x=x11, x=x22, x=x33. $\endgroup$ Commented Sep 3, 2023 at 12:30
  • $\begingroup$ Part of the problem may be that the "When" in 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 is WhenEvent processed. If the x space only is discretize with FEM and time-stepping integration in t is used, I don't know how WhenEvent is processed, whether it is like the Method of Lines or not. (Maybe @user21 is working on an idea.) $\endgroup$
    – Michael E2
    Commented Sep 3, 2023 at 12:41
  • $\begingroup$ @AlexTrounev I see the problem, thank you $\endgroup$
    – Wd Wd
    Commented Sep 3, 2023 at 13:43
  • 1
    $\begingroup$ Have a look here for many examples $\endgroup$
    – user21
    Commented Sep 3, 2023 at 19:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.