Message Boards Message Boards

GROUPS:

PDE solution using NDSolve not smooth

Posted 7 months ago
1142 Views
|
4 Replies
|
0 Total Likes
|

I am trying to solve 2 simultaneous PDE using NDSolve and the solution is not smooth. I think this has to do with setting of the computational grid, but I am not sure how to change it.

PDEin:=-2.4669065517374813*Derivative[0, 1][Tfin][\[Tau], z] + Derivative[1, 0][Tfin][\[Tau], z] == 0.0001770831817216026*(-Tfin[\[Tau], z] + Tfo[\[Tau], z])
PDEo:=0.9327310058932085*Derivative[0, 1][Tfo][\[Tau], z] + Derivative[1, 0][Tfo][\[Tau], z] == 0.07577538961255041*(10 + 0.026*z - Tfo[\[Tau], z]) + 0.00006695469437122687*(Tfin[\[Tau], z] - Tfo[\[Tau], z])
IC:={Tfin[0, z] == 10 + 0.026*z, Tfo[0, z] == 10 + 0.026*z}
tA=NDSolve[{PDEin,PDEo,IC,Tfo[\[Tau],0]==10,Tfin[\[Tau],L]==Tfo[\[Tau],L]},{Tfin,Tfo},{\[Tau],0,3600},{z,0,L}]
t:=3000
Plot[Evaluate[{Tfin[t,z],Tfo[t,z]}/.tA],{z,0,L}]
4 Replies

You are not giving a value for L.

You have a precision issue because your equations have some rapid transients.

L = 1000; PDEin := -2.4669065517374813*
    Derivative[0, 1][Tfin][\[Tau], z] + 
   Derivative[1, 0][Tfin][\[Tau], z] == 
  0.0001770831817216026*(-Tfin[\[Tau], z] + Tfo[\[Tau], z])
PDEo := 0.9327310058932085*Derivative[0, 1][Tfo][\[Tau], z] + 
   Derivative[1, 0][Tfo][\[Tau], z] == 
  0.07577538961255041*(10 + 0.026*z - Tfo[\[Tau], z]) + 
   0.00006695469437122687*(Tfin[\[Tau], z] - Tfo[\[Tau], z])
IC := {Tfin[0, z] == 10 + 0.026*z, Tfo[0, z] == 10 + 0.026*z}
tA = NDSolve[
   SetPrecision[{PDEin, PDEo, IC, Tfo[\[Tau], 0] == 10, 
     Tfin[\[Tau], L] == Tfo[\[Tau], L]}, 20], {Tfin, Tfo}, {\[Tau], 0,
     3600}, {z, 0, L}, WorkingPrecision -> 20];

gives

Plot3D[Evaluate[{Tfin[t, z]} /. tA], {t, 0, 3000}, {z, 0, L}, 
 PlotRange -> All]

To get

enter image description here

but you still get some "waviness" in the solution. I suggest you look at diving into the various settings for PDE solving using Method. Look at the settings in the documentation in Advanced Numerical Differential Equation Solving in the Wolfram Language if you need a better solution. You can also set the grid spacing, etc. there.

Regards,

Neil

Posted 7 months ago

Thanks for the suggestion Neil. I will take a look at the suggested link. The differential equations are for a heat balance between coaxial tubes with heat loss/gain from surroundings. This is why the wavy solution seems strange.

Posted 7 months ago

Using StiffnessSwitching seems to have smoothened out the solution. Thank you for the suggestions.

tA = NDSolve[{Subscript[PDE, in], Subscript[PDE, out], IC, 
   Subscript[T, f, o][\[Tau], 0] == 10, 
   Subscript[T, f, in][\[Tau], L] == 
    Subscript[T, f, o][\[Tau], L]}, {Subscript[T, f, in], Subscript[T,
    f, o]}, {\[Tau], 0, 3600}, {z, 0, L}, 
  Method -> "StiffnessSwitching"]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract