Starting from this question: Couple a PDE and ODE in NDSolve

I would like to modify the fluid from static to a flowing one in the y direction.

that's the original code that I modified a little bit:


len = 1(*length of domain*)
wid = 1(*width of domain*)
end = 3(*end time*)
h = 2(*convection coefficient*)
cpmR = 9(*heat capacity/mass ratio*)
Tinit = 1(*initial temperature of the bar*)
T0init = 1;(*initial temperature of the fluid*)

(*Note:Constants,such as thermal conductivity,heat \
capacity,mass,cross-section,etc are all omitted for simplicity \
(assumed to be 1)*)

{Tsol2D, T0sol2D} =

NDSolveValue[{D[T[t, x, y],t] - (D[T[t, x, y], x, x] + D[T[t, x, y],y,y]) ==
                              NeumannValue[-h (T[t, x, y] - T0[t, x, y]), x == 0] +

                              NeumannValue[0, x == len] +

                              NeumannValue[0, y == wid],

                              DirichletCondition[T[t, x, y] == Tinit + 2*Sin[4 t], y == 0],


 cpmR D[T0[t, x, y], t] == -h (T0[t, x, y] - T[t, x, y]),


 T[0, x, y] == Tinit,
 T0[0, x, y] == T0init},

 {T, T0}, {t, 0, end}, {x, 0, len}, {y, 0, wid}, 
 Method -> {"MethodOfLines", 
 "SpatialDiscretization" -> {"FiniteElement"}}];

The problem is that I have no idea how to "let the fluid flow".

My first idea was to re iteratively compute the solutions with some time interval dt, than couple the PDEs solution Tsol2D at time "t" and couple it with the ODEs solution T0sold2D translated by some amount "y+v dt" where "v" is the speed of the fluid. The problem is that this method seems to me extremely time expensive so I was wondering if anybody have a better idea or know some Mathematica functionality that could help me.

EDIT 23/08/2016 I think that i solved the problem using the advection equation. So

      cpmR D[T0[t, x, y], t] == -h (T0[t, x, y] - T[t, x, y]),


      cpmR D[T0[t, x, y], t] == -vD[T0[t, x, y], y] -h (T0[t, x, y] - T[t, x, y]),
  • 1
    $\begingroup$ You could use a Stokes flow model to let the fluid flow and model this as a system of several fully coupled PDEs. $\endgroup$
    – user21
    Aug 19, 2016 at 14:26
  • $\begingroup$ So your suggestion is to express the problem in therms of PDE and than solve them all usinG NDSolve, right? I will try to implement something like that but I would not like to spend to much energy on the fluid motion since it is not my primary concern. Thank you for the suggestion! $\endgroup$
    – Django
    Aug 19, 2016 at 15:32
  • $\begingroup$ If you want to model fluid motion, then there's no way around "spending energy" on modeling fluid motion, and doing so correctly. There's no shortcuts on this, and the system of equations you need to solve will become significantly more complex. $\endgroup$
    – Pirx
    Aug 19, 2016 at 17:52
  • $\begingroup$ Hi! the point is that I'm not really interested on the fluid motion since, but on heat propagation, so for me some constant velocity transport would be enough, the problem is that I don't know how to couple it with the other equations. $\endgroup$
    – Django
    Aug 22, 2016 at 8:54
  • $\begingroup$ I solved the problem using the advection equation! $\endgroup$
    – Django
    Aug 23, 2016 at 7:34


Your Answer

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