10

The following is a coupled heat transfer and fluid flow problem.

A thick plane channel is being heated with a constant flux from the bottom (at $y=-e$) with a constant heat flux $q$ as shown in the attached figure. The heated channel is subjected to a reciprocating flow with velocity $U(t)=u_{max}\sin(2\pi ft)$. I must state here that the flow velocity has a mean of $0$ which means for the first half of the cycle it reaches $u_{max}$ and in the second half reaches $-u_{max}$. In the expression for velocity the term $f$ stands for freqency of the oscillating flow. Thus, the time period of the flow is $\tau=1/f$. This indicates that for $0<t<\tau/2$, the boundary at ${x=0, 0<y<d}$ acts as the inlet, while for the second half, i.e., $\tau>t>\tau/2$ the boundary at ${x=L, d>y>0}$ is the inlet. The top plane ($y=d, 0<x<L$), the left solid face ($x=0, 0>y>-e$) and the right solid face ($x=L, -e<y<0$) are all insulated. The solid and fluid domains are coupled through the temperature and flux continuity at the interface ($y=0$).

modelling domain

In this scenario, after a certain time the entire system is supposed to reach a cyclic steady state. I will now mention the governing equations and boundary conditions:

Fluid

Hydrodynamic

$$\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} = 0 \tag1$$ $$\frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} + v \frac{\partial u}{\partial y} = \frac{-1}{\rho} \frac{\partial p}{\partial x} + \mu (\nabla^2 u) \tag2$$ $$\frac{\partial v}{\partial t} + u \frac{\partial v}{\partial x} + v \frac{\partial v}{\partial y} = \frac{-1}{\rho} \frac{\partial p}{\partial y} + \mu (\nabla^2 v) \tag3$$

No slip and No penetration condition on $y=0$ and $y=d$.

Thermal

$$\rho c_p \frac{\partial T}{\partial t} + \rho c_p u \frac{\partial T}{\partial x} + \rho c_p v \frac{\partial T}{\partial y}= k_f (\nabla^2 T) \tag4$$

The fluid has an inlet temperature $T=T_i$. So the boundary condition will be $T(x=0)=T_i, \frac{\partial T}{\partial x} \vert_{x=L} = 0$ for $\tau/2>t>0$ and $T(x=L)=T_i, \frac{\partial T}{\partial x} \vert_{x=0} = 0$ for $\tau/2<0<\tau$

Solid

Thermal

$$\rho_s c_{p,s} \frac{\partial T_s}{\partial t} = k_s \nabla^2 T_s \tag 5$$

The boundary conditions are: $\frac{\partial T_s}{\partial t}\vert_{x=0}=\frac{\partial T_s}{\partial t}\vert_{x=L} = 0$ and $-k_s\frac{\partial T_s}{\partial t} = q$.Here, $k_s$ is the solid thermal conductivity.

Coupling

At the interface between the solid and the fluid, the following holds which couples the problem:

Continuity of Temperature $$T(x,0)= T_s(x,0), 0<x<L \tag6$$ Continuity of Flux $$-k_s \frac{\partial T_s}{\partial y}\vert_{y=0,x} = -k_f \frac{\partial T}{\partial y}\vert_{y=0,x} \tag7$$

The objective is to solve for the velocity and the temperature fields in the solid and fluid. Also, the flux transfer from the solid to the fluid at the interface is of interst. I have found a Mathematica fluid solver here, but it only simulates isothermal flows:

(1) Are there non-isothermal flow mathematica solvers ?

(2) How should I model the coupling between the solid and fluid using (6) and (7) ? In a time-step what should be calculated first, the solid temperature or the fluid? I do understand that both the fields have to be calculated simultaneously.

(3) Finally, since the flow is reversing, how should I model the switching of boundary conditions during each half cycle ?

Some parameter values L=0.025, d=0.002, e=0.002, k_f=0.614, k_s=390, q=5000, rho=997, rhos=8960, mu=8.90*10^-4, cp =4178, cps =385. These parameters represent flow of water over copper. A typical flow velocity profile can be U=0.3*sin(2*pi*1*t), which is a 1Hz flow giving tau=1.

A typical CFD result obtained from COMSOL

For the same material combinations but with a e=4, f=0.5, umax=0.22875, Ti=288 and a heat input of $1W$ which translates to q=40000, I attach the average interface ($y=0$) temperature (line integrated along the length from $x=0$ to $x=L$) variation with time.enter image description here

user21
  • 39,710
  • 8
  • 110
  • 167
Avrana
  • 297
  • 1
  • 4
  • 14
  • 1
    Could you provide $c_p,c_{ps}$ as well? – Alex Trounev Feb 02 '22 at 12:20
  • 2
    Have you seen the examples from the documentation? For example the Heat Exchanger or the Buoyancy-Driven Flow – user21 Feb 02 '22 at 14:02
  • @AlexTrounev I have added the values – Avrana Feb 02 '22 at 14:27
  • @user21 thanks for the links, I will have a look. – Avrana Feb 02 '22 at 14:28
  • @Avrana Fluid flow not depends on temperature, therefore it can be solved separately. Also in my post on Wolfram Community there is section with convection flow solution. – Alex Trounev Feb 03 '22 at 07:24
  • @AlexTrounev I have found that notebook. If I am correct, it describes two-dimensional airflow around a heated cylinder (constant temperature of cylinder wall) using linear FEM in ver.11. Its a pretty neat implementation. My problem is mainly to couple both the solid and fluid energy equations using the continuity of flux and temperature at the interface and switching of the boundary conditions to simulate the oscillations. – Avrana Feb 03 '22 at 12:00
  • 1
    @Avrana I'am confused a little about BC for eq.(4) on $x=0$ and $x=L$. Such a conditions should lead to sharp temperature drop (growth) on these boundaries. How to imagine it it physically? – Oleksii Semenov Feb 03 '22 at 14:13
  • 1
    @Avrana See my answer. Please note, that we don't need any boundary condition for temperature on interface since we solve problem with FEM in the region $0\le x\le L, -e\le y\le d$. – Alex Trounev Feb 03 '22 at 15:23
  • @OleksiiSemenov Those are supposed to be outflow conditions, depicting zero conductive heat flux out of the domain. In a model with convective heat transfer, this condition states that the only heat transfer occurring across the boundary is by convection. – Avrana Feb 03 '22 at 16:55
  • @Avrana When outflow BC are changed by inflow BC the temperature on the boundary drops rapidly. Right? – Oleksii Semenov Feb 03 '22 at 17:09
  • @OleksiiSemenov Yes, you are right. In a practical scenario there are two heat exchangers connected to the piping going out of the $x=0$ and $x=L$ boundaries which cools down the exiting fluid back to the inlet temperature $T_i$. You can have a look at this paper which has a figure of the experimental setup. – Avrana Feb 03 '22 at 17:22
  • @Avrana Thanks for the paper. It clarifies significantly problem statement – Oleksii Semenov Feb 04 '22 at 09:06
  • @Avrana Is it principal in your problem to set constant (independent of $z$) velocity on inlet or Poiseuille (parabolic) profile can be used there? – Oleksii Semenov Feb 04 '22 at 09:11
  • Do you mean independent of $y$ ? One can obviously use the poiseuille profile at the inlet, however, that would imply assuming a fully developed hydrodynamic flow, right? Although, for a reduced order model it is acceptable. – Avrana Feb 04 '22 at 10:26
  • Yes, independent of $y$. It seems that under given $Re$ numbers ($v=0.3 m/s$) the flow is fully developed at $y>d$. At least my calculations showed such a result. May be Poiseuille profile for simplicity can be used. – Oleksii Semenov Feb 04 '22 at 11:23
  • In your post mu is a dynamic viscosity. Right? – Oleksii Semenov Feb 04 '22 at 11:25
  • @OleksiiSemenov Yes dynamic viscosity of water with units as $Pa.s$. – Avrana Feb 04 '22 at 11:30
  • @Avrana, why don't you share your code? – user21 Feb 08 '22 at 07:03
  • @Avrana I wrote the code with dimensionless parameters as in paper [zhao1996] mentioned by you. Let me know if it is still interesting for you and I will post it. – Oleksii Semenov Feb 09 '22 at 15:41
  • @OleksiiSemenov Please surely do. I was not aware that you have a solution. The dimensionless form mentioned in the paper is easier to compare in experiments, so it obviously is helpful. Thank you. – Avrana Feb 09 '22 at 17:16
  • @Avrana OK I'll post it tomorrow. It seems that quasi-stationary solution is reached after $\approx$ 5 periods – Oleksii Semenov Feb 09 '22 at 17:38
  • @Avrana By the way. In paper [zhao1996] the measured temperature are used in BC – Oleksii Semenov Feb 09 '22 at 17:40
  • @OleksiiSemenov yes $\theta_{ml}$ and $\theta_{mr}$ are measured at the left and right mixing chambers. In a practical scenario they might be different, however, in an idealized case which I was considering here the fluids shall be entering at a fixed inlet temperature in each half cycle. Have you considered them to be different ? That would be a much more generalized model I guess.nice. – Avrana Feb 09 '22 at 18:00
  • @Avrana I set BC in code from your problem statement i.e. constant but it can be changed by time dependent function $T_{in}(t)$ – Oleksii Semenov Feb 09 '22 at 18:05
  • @Avrana Thank you for COMSOL example added. Can you show parameters d, e, L for this example since e=4 looks like a typo. – Alex Trounev Feb 11 '22 at 09:32
  • @AlexTrounev no it is not a typo. It is quite a thick channel in the COMSOL example. The other parameters are same d=1,e=4,L=25. – Avrana Feb 11 '22 at 11:50
  • @Avrana Do you mean d=.001,e=.004,L=0.025 in SI units? – Alex Trounev Feb 11 '22 at 12:54
  • @AlexTrounev Yes $L=25 mm, d = 1 mm, e = 4 mm, q = 40000 W/m^2, T_i = 288 K, f = 0.5 Hz, u = 0.22875 m/s$. In the COMSOL example, the initial temperature of the entire model is at 293.15 K. – Avrana Feb 11 '22 at 14:56

2 Answers2

13

We can solve this problem with method proposed on my page.

Solution1. We use nondimensional form of equations with scale d and $t_s = d^2/(k_f/(c_p \rho))$. We define two regions reg1, reg2 to describe fluid flow and temperature consequently. This is code in a case of divergent form of temperature equation. We use scaled form of heat flux qn = q ts/(cp rho)/d, but temperature is unscaled

{f = 1; L = 0.025, d = 0.002, e = 0.002, kf = 0.614, ks = 390, 
 q = 5000, rho = 997, rhos = 8960, mu = 8.90*10^-4, 
 cp = 4.178*10^3 (*J/kg/\[Degree]K*), cps = 385}; Pr = 
 mu/rho/(kf/(cp rho));
Pr0 = Pr;   a = ks/kf; ts = d^2/(kf/(cp rho)); as = 
 ts ks/(cp rho)/d^2; rs = cps rhos/(cp rho); u0 = .25 ts/d; om = 
 2 Pi f ts; t0 = 1/om/10; nn = Round[4 Pi/(t0 om)]; qn = 
 q ts/(cp rho)/d;
Needs["NDSolve`FEM`"]

reg1 = ImplicitRegion[0 <= x <= L/d && 0 <= y <= 1, {x, y}]; reg2 = ImplicitRegion[0 <= x <= L/d && -e/d <= y <= 1, {x, y}]; UX[0][x_, y_] := 0; VY[0][x_, y_] := 0; P[0][x_, y_] := 0; Tfs[0][x_, y_] := 0; appro = With[{k = 2. 10^4}, ArcTan[k #]/Pi + 1/2 &]; ade[y_] := (as + (1 - as) UnitStep[y] /. UnitStep -> appro); rde[y_] := (rs + (1 - rs) UnitStep[y] /. UnitStep -> appro);

Do[ {UX[i], VY[i], P[i]} = NDSolveValue[{{Inactive[

       Div][({{-\[Mu], 0}, {0, -\[Mu]}} . Inactive[Grad][
                      u[x, y], {x, y}]), {x, y}] + D[p[x, y], x] + 
              UX[i - 1][x, y]*D[u[x, y], x] + 

     VY[i - 1][x, y]*D[u[x, y], y] + (u[x, y] - UX[i - 1][x, y])/
                t0 , 
            Inactive[

       Div][({{-\[Mu], 0}, {0, -\[Mu]}} . Inactive[Grad][
                      v[x, y], {x, y}]), {x, y}] + D[p[x, y], y] + 
              UX[i - 1][x, y]*D[v[x, y], x] + 

     VY[i - 1][x, y]*D[v[x, y], y] + (v[x, y] - VY[i - 1][x, y])/
      t0, 
            D[u[x, y], x] + D[v[x, y], y]} == {0, 0, 0} /. \[Mu] -&gt; 
   Pr0, {

  DirichletCondition[{u[x, y] == u0*Sin[om*i*t0]*y*(1 - y), 
    v[x, y] == 0}, x == 0], 
        DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, 
          y == 0 || y == 1]}, 
 DirichletCondition[p[x, y] == 0, x == L/d]}, {u, v, 
 p}, {x, y} \[Element] reg1, 
    Method -&gt; {&quot;FiniteElement&quot;, 
        &quot;InterpolationOrder&quot; -&gt; {u -&gt; 2, v -&gt; 2, p -&gt; 1}, 
        &quot;MeshOptions&quot; -&gt; {&quot;MaxCellMeasure&quot; -&gt; 0.01}}];

ux = If[y <= 0, 0, UX[i ][x, y]]; vy = If[y <= 0, 0, VY[i ][x, y]]; Tfs[i] = NDSolveValue[{rde[y] ((uxD[T[x, y], x] + vyD[T[x, y], y]) + (T[x, y] - Tfs[i - 1][x, y])/ t0 ) - Inactive[Div][ ade[y]*Inactive[Grad][T[x, y], {x, y}], {x, y}] == NeumannValue[qn, y == -e/d ], DirichletCondition[{T[x, y] == 0},

   x == 0 + L/d (1 - Sign[Sin[om*i*t0]])/2 &amp;&amp; 0 &lt;= y &lt;= 1]}, 
 T, {x, y} \[Element] reg2, 
     Method -&gt; {&quot;FiniteElement&quot;, 
         &quot;InterpolationOrder&quot; -&gt; { T -&gt; 2}, 
         &quot;MeshOptions&quot; -&gt; {&quot;MaxCellMeasure&quot; -&gt; 0.01}}] // 
Quiet;, {i, 1, nn}] // AbsoluteTiming

Visualization of temperature

Table[DensityPlot[Tfs[i][x, y], {x, y} \[Element] mesh1, 
  ColorFunction -> "Rainbow", PlotLegends -> Automatic, 
  AspectRatio -> 1/2, PlotLabel -> i ts t0, PlotRange -> All, 
  PlotPoints -> 50], {i, 5, nn, 10}]

Figure 4

Solution 2. We use unscaled version of code with given input parameters and boundary conditions as in a paper Oscillatory Heat Transfer in a Pipe Subjected to a Laminar Reciprocating Flow by T. S. Zhao & P. Cheng

{f = 1; L = 0.025, d = 0.002, e = 0.002, kf = 0.614, ks = 390, 
 q = 5000, rho = 997, rhos = 8960, mu = 8.90*10^-4, 
 cp = 4.178*10^3 (*J/kg/\[Degree]K*), cps = 385}; u0 = .3; nu = 
 mu/rho; om = 2 Pi f ; t0 = .1; nn = Round[10 Pi/(om t0)];

Needs["NDSolveFEM"]

reg1 = ImplicitRegion[0 <= x <= L && 0 <= y <= d, {x, y}]; reg2 = ImplicitRegion[0 <= x <= L && -e <= y <= d, {x, y}]; UX[0][x_, y_] := 0; VY[0][x_, y_] := 0; P[0][x_, y_] := 0; Tfs[0][x_, y_] := 0; appro = With[{k = 2. 10^6}, ArcTan[k #]/Pi + 1/2 &]; ade[y_] := (ks + (kf - ks) UnitStep[y] /. UnitStep -> appro); rde[y_] := (cps rhos + (cp rho - cps rhos) UnitStep[y] /. UnitStep -> appro);

Do[ {UX[i], VY[i], P[i]} = NDSolveValue[{{Inactive[

       Div][({{-\[Mu], 0}, {0, -\[Mu]}} . Inactive[Grad][
                      u[x, y], {x, y}]), {x, y}] + D[p[x, y], x] + 
              UX[i - 1][x, y]*D[u[x, y], x] + 

     VY[i - 1][x, y]*D[u[x, y], y] + (u[x, y] - UX[i - 1][x, y])/
                t0 , 
            Inactive[

       Div][({{-\[Mu], 0}, {0, -\[Mu]}} . Inactive[Grad][
                      v[x, y], {x, y}]), {x, y}] + D[p[x, y], y] + 
              UX[i - 1][x, y]*D[v[x, y], x] + 

     VY[i - 1][x, y]*D[v[x, y], y] + (v[x, y] - VY[i - 1][x, y])/
      t0, 
            D[u[x, y], x] + D[v[x, y], y]} == {0, 0, 0} /. \[Mu] -&gt; 
   nu, {

  DirichletCondition[{u[x, y] == u0*Sin[om*i*t0], v[x, y] == 0}, 
   x == L (1 - Sign[Sin[om*i*t0]])/2 &amp;&amp; 0 &lt; y &lt; d], 
        DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, 
          y == 0 || y == d]}, 
 DirichletCondition[p[x, y] == 0, 
  x == L (1 + Sign[Sin[om*i*t0]])/2 &amp;&amp; 0 &lt; y &lt; d]}, {u, v, 
 p}, {x, y} \[Element] reg1, 
    Method -&gt; {&quot;FiniteElement&quot;, 
        &quot;InterpolationOrder&quot; -&gt; {u -&gt; 2, v -&gt; 2, p -&gt; 1}, 
        &quot;MeshOptions&quot; -&gt; {&quot;MaxCellMeasure&quot; -&gt; 0.00000005}}];

ux = If[y <= 0, 0, UX[i ][x, y]]; vy = If[y <= 0, 0, VY[i ][x, y]]; Tfs[i] = NDSolveValue[{rde[y] ((uxD[T[x, y], x] + vyD[T[x, y], y]) + (T[x, y] - Tfs[i - 1][x, y])/ t0 ) - Inactive[Div][ ade[y]Inactive[Grad][T[x, y], {x, y}], {x, y}] == NeumannValue[q, y == -e ], DirichletCondition[{T[x, y] == 0}, x == L (1 - Sign[Sin[omi*t0]])/2 && 0 <= y <= d]}, T, {x, y} [Element] reg2, Method -> {"FiniteElement", "InterpolationOrder" -> { T -> 2}, "MeshOptions" -> {"MaxCellMeasure" -> 0.0000001}}] // Quiet;, {i, 1, nn}] // AbsoluteTiming

Visualization of temperature vs time at x=L/2, y=0 and x=L/2 for different t=1,2,3,4,5 s

ListLinePlot[Table[{i t0, Tfs[i][L/2, 0]}, {i, 0, nn}], 
 AxesLabel -> {"t, s", "T"}]

Plot[Evaluate[Table[Tfs[i][L/2, y], {i, 10, nn, 10}]], {y, -e, d}, PlotLegends -> Table[i t0, {i, 10, nn, 10}]]

Figure 5 Temperature and velocity distributions for different time shown above Figure 6 Figure 7

Note, that temperature distribution is same for scaled and unscaled form of equation. Let consider test example posted by Avrana and solved with COMSOL. To get same average temperature we need to increase q up to q=120000, then we have

Needs["NDSolve`FEM`"]

{f = .5, L = 0.025, d = 0.001, e = 0.004, kf = 0.614, ks = 390, rho = 997, rhos = 8960, mu = 8.9010^-4, cp = 4.17810^3 (J/kg/[Degree]K), cps = 385}; u0 = 0.22875; nu = mu/rho; om = 2 Pi f ; t0 = .1; nn = Round[40 Pi/(om t0)]; Ti = 288; q = 120000/Ti;

reg1 = ImplicitRegion[0 <= x <= L && 0 <= y <= d, {x, y}]; reg2 = ImplicitRegion[0 <= x <= L && -e <= y <= d, {x, y}]; UX[0][x_, y_] := 0; VY[0][x_, y_] := 0; P[0][x_, y_] := 0; Tfs[0][x_, y_] := 293/Ti; appro = With[{k = 2. 10^6}, ArcTan[k #]/Pi + 1/2 &]; ade[y_] := (ks + (kf - ks) UnitStep[y] /. UnitStep -> appro); rde[y_] := (cps rhos + (cp rho - cps rhos) UnitStep[y] /. UnitStep -> appro);

Do[ {UX[i], VY[i], P[i]} = NDSolveValue[{{Inactive[

       Div][({{-\[Mu], 0}, {0, -\[Mu]}} . Inactive[Grad][
                      u[x, y], {x, y}]), {x, y}] + D[p[x, y], x] + 
              UX[i - 1][x, y]*D[u[x, y], x] + 

     VY[i - 1][x, y]*D[u[x, y], y] + (u[x, y] - UX[i - 1][x, y])/
                t0 , 
            Inactive[

       Div][({{-\[Mu], 0}, {0, -\[Mu]}} . Inactive[Grad][
                      v[x, y], {x, y}]), {x, y}] + D[p[x, y], y] + 
              UX[i - 1][x, y]*D[v[x, y], x] + 

     VY[i - 1][x, y]*D[v[x, y], y] + (v[x, y] - VY[i - 1][x, y])/
      t0, 
            D[u[x, y], x] + D[v[x, y], y]} == {0, 0, 0} /. \[Mu] -&gt; 
   nu, {

  DirichletCondition[{u[x, y] == u0*Sin[om*i*t0], v[x, y] == 0}, 
   x == L (1 - Sign[Sin[om*i*t0]])/2 &amp;&amp; 0 &lt; y &lt; d], 
        DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, 
          y == 0 || y == d]}, 
 DirichletCondition[p[x, y] == 0, 
  x == L (1 + Sign[Sin[om*i*t0]])/2 &amp;&amp; 0 &lt; y &lt; d]}, {u, v, 
 p}, {x, y} \[Element] reg1, 
    Method -&gt; {&quot;FiniteElement&quot;, 
        &quot;InterpolationOrder&quot; -&gt; {u -&gt; 2, v -&gt; 2, p -&gt; 1}, 
        &quot;MeshOptions&quot; -&gt; {&quot;MaxCellMeasure&quot; -&gt; 0.00000005}}];

ux = If[y <= 0, 0, UX[i ][x, y]]; vy = If[y <= 0, 0, VY[i ][x, y]]; Tfs[i] = NDSolveValue[{rde[y] ((uxD[T[x, y], x] + vyD[T[x, y], y]) + (T[x, y] - Tfs[i - 1][x, y])/ t0 ) - Inactive[Div][ ade[y]Inactive[Grad][T[x, y], {x, y}], {x, y}] == NeumannValue[q, y == -e ], DirichletCondition[{T[x, y] == 1}, x == L (1 - Sign[Sin[omi*t0]])/2 && 0 <= y <= d]}, T, {x, y} [Element] reg2, Method -> {"FiniteElement", "InterpolationOrder" -> { T -> 2}, "MeshOptions" -> {"MaxCellMeasure" -> 0.0000001}}] // Quiet;, {i, 1, nn}];

Average temperature

ff = Interpolation[
  Table[{i t0, 
    Ti/L NIntegrate[Tfs[i][x, 0], {x, 0, L}, AccuracyGoal -> 4, 
      PrecisionGoal -> 4]}, {i, 0, nn}], InterpolationOrder -> 2]

Plot[ff[t], {t, 0, 40}, AxesLabel -> {"t, s", "T"}, PlotRange -> All]

Figure 5

Alex Trounev
  • 44,369
  • 3
  • 48
  • 106
  • 1
    Appreciate the very detailed answer. I will now go through it and come back with any questions. Thanks again. – Avrana Feb 03 '22 at 16:47
  • 1
    @Avrana Please, check that we can use DirichletCondition[{u[x, y] == u0*Sin[om*i*t0], v[x, y] == 0}, x == 0] as well with same result for temperature. – Alex Trounev Feb 04 '22 at 06:02
  • I am going through the solution till this time. Actually, i had non dimensionalized using a different scheme as described in a paper I had linked to in one of my comments to the question. So I am rewriting the equations now using your approach to non-dimensionalization. I will surely run with the condition you just mentioned and get back. – Avrana Feb 04 '22 at 06:13
  • @Avrana It looks like we should use u0 = .3 ts/d (it is not as in my code). Then flow became unstable but temperature drops to 80. – Alex Trounev Feb 04 '22 at 06:38
  • Yes ts/d will make u0 non-dimensional, as d/ts results in unit of $m^2/s^2$. If it helps should I post my non-dimensional governing equations as an edit to the question ? – Avrana Feb 04 '22 at 06:42
  • @Avrana I have updated code with new data for stably solution with u0=0.1 ts/d. Note, solution stable up to u0=0.25 ts/d. – Alex Trounev Feb 04 '22 at 08:03
  • The modifications you made now produce temperature plots much more reasonable. One can see the thermally developing flow on both sides. As far as I can comprehend, the momentum equation has been non-dimensionalised but the energy equation is used in the native form? I say this becasue in its boundary condition NeumannValue[q, y == -e/d ] has been used where q is actually dimensional. Moreover nn = Round[4 Pi/(t0 om)] decides the number of timesteps and t0 is the timestep right ? – Avrana Feb 04 '22 at 11:02
  • Also, what does the function ade[y_] signify alongwith as. I think some clarity regarding the variables, especially the non-dimensionalisation procedure as an addition to this answer, and how they are being used will be helpful in appreciating and using this excellent response . Please excuse if I sound ignorant in some of my inquiries. – Avrana Feb 04 '22 at 11:15
  • @Avrana Yes, t0 is timestep in this method while ts is the time scale. Since equation describing temperature is linear, we can use arbitrary scale for temperature including T0=1. Function ade[y] describes different properties of fluid and solid. We normalize equation for T in fluid on cp rho, while in a solid on cps rhos . May be we need some divergent form of it. – Alex Trounev Feb 06 '22 at 10:33
  • @Avrana See Update 1 with divergent form of temperature equation and scaled heat flux. – Alex Trounev Feb 07 '22 at 14:58
  • Sorry for the late response. I have been away from the system. I will go through this update now. – Avrana Feb 08 '22 at 06:35
  • The Update1 form of the solution works nicely. I have already checked with certain combination of parameters and will check for air (which would take a long time to reach cyclic steady state becuase of its low cp and density). Thankyou for all the effort you put. I will also modify this code such that one can input the flow time as an input to the problem. If I face any other problem, I will report here. – Avrana Feb 09 '22 at 12:32
  • 1
    @Avrana See Update 2 with unscaled version of code and with bc from Zhao paper. – Alex Trounev Feb 11 '22 at 08:59
  • thankyou for the addition. I will be running it now and get back. – Avrana Feb 11 '22 at 11:53
  • Thankyou again for the continued effort. I have rerun your new addition, i.e., the test again the COMSOL results. It is really puzzling why the heat input has to be ramped up 3 times to get the same results. I have rechecked my COMSOL calculations and they seem to be OK (an excel sheet can be found here It also contains the average temperature of the solid region along with the interface. I will keep using your code to validate some calculations, as it helps in getting insight. – Avrana Feb 12 '22 at 13:30
  • Sorry to post this so late. In the first code posted in this answer \[Mu] -> Pr0. Instead, should not it be \[Mu] -> 1/Re ? – Avrana Jan 04 '23 at 10:23
  • 1
    @Avrana We use scales $d$ and $t_s = d^2/(k_f/(c_p \rho))$. With this scaling we have \[Mu] -> Pr0. This scaling used in convection problem - see, for instance, Vahl Davis, G.de (1983) : Natural convection of air in a square cavity : A bench mark numerical solution. Int. J. Numer. Methods Fluids 3, 249-264. – Alex Trounev Jan 04 '23 at 14:32
  • Thankyou for the clarification and the reference. It makes sense now. – Avrana Jan 06 '23 at 04:26
10

It seems that the main challenge in this problem is Dirichlet BC which should be switched periodically on $x=0$ and $x=L$. I don't know whether it possible to switch BC inside NDSolveValue but we can run NDSolveValue every half period with new BC and take use solution obtained at last half period as a initial conditions. Velocity field is not influenced by temperature so that partitioned coupling scheme can be used i.e. at first stage velocity is calculated than temperature is obtained. But in this case interpolation functions for velocity are involved into calculations inside the solver that significantly decelerates calculation. I propose to use here monolithic approach which implies calculation both temperature and velocity in single code. We will solve NS equations in computational domain which includes solid and fluid. By introducing the momentum sink term $-C\cdot \vec{V}$ into the momentum conservation equations one can set to zero the velocity in solid phase. Here $C$ is a large number. In current simulation the value $C=10^6$ was used. Lets write the governing equations in dimensionless form as in the paper [Zhao1996] which is mentioned by @Avrana in comments. Velocity and pressure are measured in units $u_0$ and $u_0^2\rho$, spatial coordinates and time are dimentionelized by $d$, $\omega^{-1}$ respectively. Here $\omega$, $u_0$ are circular frequency and inflow velocity accordingly. Temperature is measured in units $qd/k_f$, where $q$ is a heat flux density supplied from bottom wall.

Navier-Stokes equations

\begin{equation} \frac{\partial \vec{V}}{\partial t}+\frac{A_0}{2}\left[ (\vec{V}\cdot\nabla)\vec{V} +\nabla P\right ]=\frac{1}{Re_{\omega}}\Delta \vec{V} \end{equation}

\begin{equation} \nabla\cdot \vec{V}=0 \end{equation}

Energy conservation in fluid \begin{equation} \frac{\partial T}{\partial t}+\frac{A_0}{2}(\vec{V}\cdot\nabla)T=\frac{1}{Re_{\omega}Pr}\Delta T \end{equation}

Energy conservation in solid \begin{equation} \frac{\partial T}{\partial t}=\frac{1}{\Gamma Pr Re_{\omega}}\Delta T \end{equation}

where $Re_{\omega}=\omega d^2/\nu$, $A_0=2u_0/(d\omega)$, $Pr=\nu/\alpha_f$, $\Gamma=\alpha_f/\alpha_s$ are dimensionless parameters.

Input parameters

Needs["NDSolve`FEM`"]
Needs["MeshTools`"]

L = 0.025;(length of the channel) d = 0.002;(depth of the fluid) e = d;(depth of the solid) l = L/d; (dimensionless length) rhof = 997;(fluid density) rhos = 8960;(density of solid) mu = 8.910^-4;(dynamic viscosity) nu = mu/rhof;(kinematic viscosity) ks = 390;(conductivity of solid) kf = 0.614;(conductivity of liquid) cf = 4178;(heat capacity of fluid) cs = 385;(heat capacity of solid) AlphaF =kf/(cfrhof); (thermal diffusivity of fluid) AlphaS = ks/(csrhos); (thermal diffusivity of solid) period = 1.;(period) omega = 2Pi/period;(circular frequency) u0 = 0.3;(inflow velocity) q = 5000;(heat flux density)

(dimensionless model input parameters ) A0 = 2u0/(domega); re = omegad^2/(nu); Pr = nu/AlphaF;(Pandtl number*) gamma=If[ElementMarker == 0, AlphaF/AlphaS, 1]; sigma = kf/ks;

FE mesh generation

It is convenient to use structured FE mesh for this particular case. All the manipulations with meshes were done here by means of utilities from MeshTools package.

Nx = 100;(*number of elements in x-direction *)
NyF = 20;(*number of elements in y-direction in fluid*)
NyS = 5;(*number of elements in y-direction in solid*)
hy = 1./NyF;(*linear dimension of element in fluid*)

raster = { {{0, 0}, {l, 0}}, {{0, 1}, {l, 1}} }; MeshFluid = StructuredMesh[raster, {Nx, NyF}];(FE mesh in fluid)

raster = { {{0, -e/d}, {l, -e/d}}, {{0, 0}, {l, 0}} }; MeshSolid = StructuredMesh[raster, {Nx, NyS}];(FE mesh in solid) mesh = MergeMesh[MeshSolid, MeshFluid]; nodes = mesh["Coordinates"]; quads = mesh["MeshElements"][[1]][[1]]; (ElementMarker=0 in soilid and 1 in fluid)

mark = Table[z = Mean[nodes[[quads[[i]]]]][[2]]; If[z < 0, 0, 1], {i, 1, Length[quads]}]; (1d order mesh in total domain)

MeshTotal1 = ToElementMesh["Coordinates" -> nodes, "MeshElements" -> {QuadElement[quads, mark]}]; (2d order mesh in total domain)

MeshTotal2 = MeshOrderAlteration[MeshTotal1, 2]; pic1 = Show[MeshTotal1["Wireframe"], ImageSize -> 600] Export["pic1.jpeg", pic1, ImageResolution -> 300]

FE_msh

Solution procedure

NS solver used little differ from those in documentation. Function rampFunction introduced there helps to increase inflow velocity smoothly in time. Velocity inflow profile UinfProfile[y] used here has a trapezoidal shape.

enter image description here

Clear[TopWall, BottomWall, reference, HeatInpBC, op, c, rampFunction, 
  sf, UinfProfile, Profile];

rampFunction[min_, max_, c_, r_] := Function[t, (minExp[cr] + maxExp[rt])/(Exp[c*r] + Exp[r*t])] sf = rampFunction[0, 1, 0.25, 100];

Profile = Interpolation[{{0, 0}, {hy, 1}, {1 - hy, 1}, {1, 0}}, InterpolationOrder -> 1] Uc = 1/NIntegrate[Profile[y], {y, 0, 1}];(calibration coefficient) UinfProfile[y_] := UcProfile[y];(inflow velocity profile*)

Define a PDE operator with boundary conditions

c = If[ElementMarker == 0, 10^6, 
  0];(*define the constant in momentum sink term*)
op = {
  D[u[t, x, y], t] + 
   Inactive[
     Div][({{-1/re, 0}, {0, -1/re}} . 
      Inactive[Grad][u[t, x, y], {x, y}]), {x, y}] + 
   0.5 A0*{{u[t, x, y], v[t, x, y]}} . 
     Inactive[Grad][u[t, x, y], {x, y}] + 0.5 A0*D[p[t, x, y], x] + 
   c*u[t, x, y], 
  D[v[t, x, y], t] + 
   Inactive[
     Div][({{-1/re, 0}, {0, -1/re}} . 
      Inactive[Grad][v[t, x, y], {x, y}]), {x, y}] + 
   0.5 A0*{{u[t, x, y], v[t, x, y]}} . 
     Inactive[Grad][v[t, x, y], {x, y}] + 0.5 A0*D[p[t, x, y], y] + 
   c*v[t, x, y], 
  D[u[t, x, y], x] + D[v[t, x, y], y],
  D[T[t, x, y], t] + 
   Inactive[
     Div][(-(1/(Pr*re*gamma))* 
      Inactive[Grad][T[t, x, y], {x, y}]), {x, y}] + 
   0.5*A0*{u[t, x, y], v[t, x, y]} . Inactive[Grad][T[t, x, y], {x, y}]
          };

TopWall = DirichletCondition[{u[t, x, y] == 0, v[t, x, y] == 0}, y == 1]; BottomWall = DirichletCondition[{u[t, x, y] == 0, v[t, x, y] == 0}, y <= 0]; (setting pressure value in single node)

reference = DirichletCondition[p[t, x, y] == 0., x == 0 && y == 0]; HeatInpBC = NeumannValue[sigmaAlphaS/(AlphaFPr*re), y == -1];

Finally, the next code realizes the solution procedure for first twenty half-periods

Clear[UxLast, UyLast, TLast, PLast];
UxLast[x_, y_] := 0;
UyLast[x_, y_] := 0;
TLast[x_, y_] := 0.;
PLast[x_, y_] := 0;

SolutData = {}; K = 20;(number of half-periods considered) Do[ Clear[u, v, p, t, HeatDBC]; ti = (k - 1)*Pi; tf = ti + Pi;

Clear[HeatDBC, Inflow, Outflow, bcs, ic, UxFun, UyFun, pressure, TFun]; If[k == 1, Inflow = DirichletCondition[{u[t, x, y] == sf[t]Sin[t]UinfProfile[y], v[t, x, y] == 0}, x == 0 && y > 0 && y < 1]; Outflow = DirichletCondition[{u[t, x, y] == sf[t]Sin[t]UinfProfile[y], v[t, x, y] == 0}, x == l && y > 0 && y < 1],

 Inflow = 

DirichletCondition[{u[t, x, y] == Sin[t]UinfProfile[y], v[t, x, y] == 0}, x == 0 && y > 0 && y < 1]; Outflow = DirichletCondition[{u[t, x, y] == Sin[t]UinfProfile[y], v[t, x, y] == 0}, x == l && y > 0 && y < 1] ];

If[OddQ[k] == True, HeatDBC = DirichletCondition[T[t, x, y] == 0, x == 0 && y >= 0 && y <= 1], HeatDBC = DirichletCondition[T[t, x, y] == 0, x == l && y >= 0 && y <= 1] ];

ic = {u[ti, x, y] == UxLast[x, y], v[ti, x, y] == UyLast[x, y], 

p[ti, x, y] == PLast[x, y], T[ti, x, y] == TLast[x, y]}; bcs = {TopWall, BottomWall, Inflow, Outflow, reference, HeatDBC};

Monitor[ {UxFun, UyFun, pressure, TFun} = NDSolveValue[{op == {0, 0, 0, HeatInpBC}, bcs, ic}, {u, v, p, T}, {x, y} [Element] MeshTotal2, {t, ti, tf},

MaxStepSize -&gt; Pi*10^-3,


Method -&gt; {

  &quot;TimeIntegration&quot; -&gt; {&quot;IDA&quot;, &quot;MaxDifferenceOrder&quot; -&gt; 2},

  &quot;PDEDiscretization&quot; -&gt; {&quot;MethodOfLines&quot;,
    &quot;SpatialDiscretization&quot; -&gt; {&quot;FiniteElement&quot;, 
      &quot;PDESolveOptions&quot; -&gt; {&quot;LinearSolver&quot; -&gt; &quot;Pardiso&quot;}, 
      &quot;InterpolationOrder&quot; -&gt; {u -&gt; 2, v -&gt; 2, p -&gt; 1, T -&gt; 2}}}}
, EvaluationMonitor :&gt; (currentTime = Row[{&quot;t = &quot;, CForm[t]}])]

, currentTime];

UxLast = ElementMeshInterpolation[{MeshTotal2}, Last[UxFun["ValuesOnGrid"]] ]; UyLast = ElementMeshInterpolation[{MeshTotal2}, Last[UyFun["ValuesOnGrid"]]]; TLast = ElementMeshInterpolation[{MeshTotal2}, Last[TFun["ValuesOnGrid"]] ]; PLast = ElementMeshInterpolation[{MeshTotal1}, Last[pressure["ValuesOnGrid"]] ];

n = Length[TFun["ValuesOnGrid"]]; m = If[k < K, n - 1, n];

AppendTo[SolutData,

Take[Transpose[{TFun[[3]][[1]], TFun["ValuesOnGrid"]}], {1, m, 10}]

     ]

 , {k, 1, K} 
 ]

Postprocessing

Construction of interpolation function for temperature solution

Clear[TsolVec, TFun]
TsolVec = 
  Interpolation[Flatten[SolutData, 1], InterpolationOrder -> 1];
TFun[t_?NumericQ] := 
 ElementMeshInterpolation[{MeshTotal2}, TsolVec[t]]

Visualization of thermal history in point $\{0.5L,0\}$

Plot[TFun[t][0.5 l, 0], {t, 0, K*Pi}, 
 PlotStyle -> {Thickness[0.005], RGBColor[0, 0, 0]}, 
 PlotRange -> {0, 0.02}, Frame -> True, 
 FrameLabel -> {"time", "Temperature"}, 
 FrameTicks -> {Table[(k - 1) 2 \[Pi], {k, 1, 6}], Automatic}, 
 FrameStyle -> RGBColor[0, 0, 0], BaseStyle -> 14, ImageSize -> 500, 
 LabelStyle -> RGBColor[0, 0, 0], 
 PlotLabel -> "Thermal history in point {0.5l,0}"]

thermal history

It is necessary to calculate at least 5 periods to reach quasi-stationary regime under the given input parameters (properties, geometry, inflow velocity) as we can see from the last pic. Distributions of temperature in cross section $x=0.5L$ at different times looks as follows

t1 = 2 Pi; t2 = 4 Pi;
t3 = 6 Pi; t4 = 8 Pi;
t5 = 10 Pi; t6 = 18 Pi;

Plot[{TFun[t1][0.5 l, y], TFun[t2][0.5 l, y], TFun[t3][0.5 l, y], TFun[t4][0.5 l, y], TFun[t5][0.5 l, y], TFun[t6][0.5 l, y]}, {y, -1, 1}, PlotStyle -> Thickness[0.005], PlotRange -> All, Frame -> True, FrameLabel -> {"y", "Temperature"}, FrameStyle -> RGBColor[0, 0, 0], BaseStyle -> 14, ImageSize -> 500, PlotLegends -> {2 [Pi], 4 [Pi], 6 [Pi], 8 [Pi], 10 [Pi], 18 [Pi]}, PlotLabel -> "Temperature distribution along the line x=0.5L at different
times", LabelStyle -> RGBColor[0, 0, 0]]

temperature in middle cross section

Multiplication $T\cdot qd/k_f$ with $q=5\cdot 10^3 W/m^2$ gives overheating (in Kelvins) above initial temperature of supplied water $T_0$.

Plot[{(q*d)/kf*TFun[t1][0.5 l, y/d], (q*d)/kf*TFun[t2][0.5 l, y/d], (
   q*d)/kf*TFun[t3][0.5 l, y/d], (q*d)/kf*TFun[t4][0.5 l, y/d], (q*d)/
   kf*TFun[t5][0.5 l, y/d], (q*d)/kf*TFun[t6][0.5 l, y/d]}, {y, -e, 
  d}, PlotStyle -> Thickness[0.004], PlotRange -> All, Frame -> True, 
 FrameLabel -> {"y, m", "T-\!\(\*SubscriptBox[\(T\), \(0\)]\), K"}, 
 FrameStyle -> RGBColor[0, 0, 0], BaseStyle -> 14, ImageSize -> 500, 
 PlotLegends -> {"t=1s", "t=2s", "t=3s", "t=4s", "t=5s", "t=9s"}, 
 PlotLabel -> 
  "Temperature distribution along line x=0.5L ar different times", 
 LabelStyle -> RGBColor[0, 0, 0]]

temperature_crosssection_SI

It's interesting to analyze velocity profiles in different cross sections

VelocProfArr = Table[
   ParametricPlot[
     {
     {UxFun[t, 0, y], y},
     {UxFun[t, l/2, y], y},
     {Sin[t]*6 (y - y^2), y}
     },
    {y, 0, 1}, AspectRatio -> 0.25, Frame -> True, 
    FrameStyle -> RGBColor[0, 0, 0], FrameLabel -> {"Velocity", "y"}, 
    BaseStyle -> 14, PlotRange -> {{-1.8, 1.8}, {0, 1}}, 
    LabelStyle -> Black, PlotLabel -> "time=" <> ToString[t], 
    PlotLegends -> {"x=0", "x=0.5L", "Poiseuille profile"}, 
    ImageSize -> 500]
   , {t, ti, tf, 0.01*(tf - ti)}];

ListAnimate@VelocProfArr

velocity_cross_section

$V_x$ distribution in longitudinal direction at $y=d/2$ is as follows

VelocLongArr = Table[
   Plot[
     {UxFun[t, x, 0.5],
     Sin[t]*6*(0.5 - 0.5^2)
     },
    {x, 0, l}, AspectRatio -> 0.25, Frame -> True, 
    FrameStyle -> RGBColor[0, 0, 0], FrameLabel -> {"x", "Velocity"}, 
    BaseStyle -> 14, PlotRange -> {{0, l}, {-1.8, 1.8}}, 
    LabelStyle -> Black, PlotLabel -> "time=" <> ToString[t], 
    PlotLegends -> {"y=0", "Poiseuille flow"}, ImageSize -> 500]
   , {t, ti, tf, 0.01*(tf - ti)}];

ListAnimate@VelocLongArr

longitudinal_velocity

As we can see, the velocity field differ from Poiseuille profile. Thereby the flow in channel can not be considered to be fully developed.

Oleksii Semenov
  • 1,187
  • 6
  • 11
  • This is a beautifully written and well-explained answer. I will go through it one module at a time and get back. – Avrana Feb 10 '22 at 12:30
  • While doing the mesh operations I enountered an error while running MeshFluid = StructuredMesh[raster, {Nx, NyF}] which I sorted out by using MeshFluid = StructuredMesh[raster, {{Nx, NyF}}] and similarly for MeshSolid. Another error was there in quads = mesh["MeshElements"][[1]][[1]] saying Part::partd: Part specification MeshElements[[1]] is longer than depth of object.. This I removed by using quads = mesh["MeshElements"][1][1]. – Avrana Feb 10 '22 at 16:19
  • However, finally while using MeshTotal1 = ToElementMesh I got an error ToElementMesh::femtemnm: A mesh could not be generated. which I have not been able to sort out. I am using 12.0.0 for Microsoft Windows (64-bit) – Avrana Feb 10 '22 at 16:19
  • 1
    @Avrana Did you install MeshTools package prior to simulation? – Oleksii Semenov Feb 10 '22 at 16:28
  • 1
    Do not forget to install it. I gave the link on this package in answer – Oleksii Semenov Feb 10 '22 at 16:42
  • Thankyou for the suggestions. I had MeshTools installed on my system already, just restarting the Kernel worked. I have now been able to run the code and will try to run for other fluids, materials and oscillation frequencies. I will post any more questions, If I have here. – Avrana Feb 10 '22 at 17:40
  • Meanwhile, I will start a bounty to reward your answer. Thank you. – Avrana Feb 10 '22 at 18:25
  • @OleksiiSemenov Could you plot unscaled temperature at x=0.5 L? It looks like you suppose same boundary condition for velocity at x==0 and at x==l as well. Also, note, that with ramp[t] function flow is different from that without ramp as we discussed on https://mathematica.stackexchange.com/questions/180959/solver-for-unsteady-flow-with-the-use-of-the-navier-stokes-and-mathematica-fem – Alex Trounev Feb 11 '22 at 02:58
  • @AlexTrounev For each half-period when the flow reversal happens, should not the hydrodynamic boundary conditions at the left and right ends be similar ? I mean if one considers a reciprocating pump driving the oscillation, the velocity being produced at each end might be almost same. – Avrana Feb 11 '22 at 03:36
  • @AlexTrounev However, your question regarding the temperature intrigues me. As per the Zhao paper, temperature is non-dimensionalised as $T=k_f T'/(q d)$, where $q$ is the heat input and $T'$ is the temperature with dimensions. So, in the present scheme, it is questionable how would one study the effect of different heat inputs to the system. – Avrana Feb 11 '22 at 03:37
  • @AlexTrounev I now understand your comment, so you mean to ask, where is the $p=0$, i.e., the outflow boundary condition (for a half-cycle) is being applied in the present implementation, right ? Since both the Inflow and Outflow have similar expressions. – Avrana Feb 11 '22 at 03:57
  • @Avrana Thank you for Zhao paper. I will try to reproduce solution in a tube. But your problem looks different in bc and in geometry as well. Did you try to reproduce solution from Zhao paper? I have solution for unscaled problem with all parameters as it is. The maximal unscaled temperature is about 0.7 for q=5000. – Alex Trounev Feb 11 '22 at 04:15
  • @AlexTrounev Thankyou for the comment. Yes, my geometry is different. Also, direct comparison with the Zhao paper might not yield identical results becuase although the Zhao paper mentions the solid energy equation, it does not solve for it. It is mentioned in the paper that they have neglected solid conduction. I linked the Zhao paper because the phenomena I am studying is similar. Additionally, my dimensions are in the microchannel regime which makes it important to incorporate the effects of conduction in the solid. – Avrana Feb 11 '22 at 05:01
  • @AlexTrounev I have shown $T(t,0.5L,y)$ in my answer. Please look at it. Yes I used the same BC for velocity at $x=0$ and $x=L$ as stated in OP. – Oleksii Semenov Feb 11 '22 at 09:38
  • @AlexTrounev Function ramp[t] is used only during first half period in my code so that it have no influence on flow at $t=5\tau$ – Oleksii Semenov Feb 11 '22 at 09:41
  • @OleksiiSemenov In the picture shown T is scaled. How much is unscaled value? – Alex Trounev Feb 11 '22 at 09:43
  • @AlexTrounev Temperature is measured in units $qd/k_f$ like in paper [zhao1996] – Oleksii Semenov Feb 11 '22 at 09:47
  • @OleksiiSemenov In your post there is scale $qd/k_s$ for temperature. Is it a typo? Also you use HeatInpBC = NeumannValue[sigma, y == -1]; with sigma = kf/ks;. Is it typo as well? – Alex Trounev Feb 11 '22 at 09:57
  • 1
    @AlexTrounev No it is not a type. As I already said I use dimensionless temperature $\tilde{T}=k_fT/(qd)$ in calculations – Oleksii Semenov Feb 11 '22 at 10:02
  • 1
    @AlexTrounev When such dimensionless variables are used the BC on the bottom wall reads as follows $-\frac{\partial \tilde{T}}{\partial y}\Big |_{y=-1}=k_f/k_s$ – Oleksii Semenov Feb 11 '22 at 10:06
  • @AlexTrounev About $qd/k_s$. Yes, it is a typo in my text. It should be $qd/k_f$. But in code it is OK – Oleksii Semenov Feb 11 '22 at 10:18
  • @OleksiiSemenov Please pay attention for sigma as well since it is not looks well in your equation for T. – Alex Trounev Feb 11 '22 at 10:34
  • @AlexTrounev A checked the equations . It seems that everything is right – Oleksii Semenov Feb 11 '22 at 10:45
  • @AlexTrounev I added temperature distribution in SI units in cross section $x=0.5L$ . – Oleksii Semenov Feb 11 '22 at 17:31
  • @Avrana As regards to BC for pressure. When Dirichlet BC for velocity are used (as we have in this problem ) along all the boundary, the pressure is defined up to the constant. And one should define the pressure in one point. I set $P(t,0,0)=0$ – Oleksii Semenov Feb 11 '22 at 17:48
  • @OleksiiSemenov That is then the pressure point constraint. Also, thank you for the additional plot in dimensional values. – Avrana Feb 11 '22 at 17:57
  • @Avrana On the other hand when BC for pressure are $P\Big|{x=L}=0$ we should expect $\frac{\partial V_x}{\partial x}\Big|{x=L}=0$ as a result. – Oleksii Semenov Feb 11 '22 at 18:16
  • What BC i.e. (1).constant velocity on both inlet and outlet or (2). constant velocity on inlet +zero pressure on outlet reflect physics better? It is a good question. Since we do't know what is going on at $x<0$ and $x>L$ :) – Oleksii Semenov Feb 11 '22 at 18:22
  • 1
    @Avrana By the way. My first estimates whether the flow can be considered to be fully developed were wrong. Analysis of velocity field (animations in my post) suggest otherwise. Velocity profile differ from Poiseuille profile appreciably. – Oleksii Semenov Feb 11 '22 at 18:37
  • @OleksiiSemenov A nice point. When I model this problem in COMSOL, for the hydraulic boundary conditions, I use a velocity inlet condition at $x=0$ and a pressure outlet at $x=L$. The sinusoidally varying profile at $x=0$ automatically keeps the flow direction from left to right for half-period and reverses it in the next half. For the thermal conditions, I use a COMSOL feature called open boundary on both $x=0$ and $x=L$. – Avrana Feb 11 '22 at 18:38
  • This boundary feature has a special property that it checks the flow direction at a particular face. If it sees that the flow is out of the domain, it acts like an Outflow condition that is zero conductive flux and if it sees that the flow is into the domain, it takes the form of a Dirichlet condition. – Avrana Feb 11 '22 at 18:38
  • @OleksiiSemenov Yes I have already noticed that animation and was myself surprised. Mainly, for such oscillating flow, it is the non-dimensional Womerseley number $Wo$ which decides the flow profile. – Avrana Feb 11 '22 at 18:40
  • @OleksiiSemenov Hi ! It has been long. I wanted to ask, if the option MaxStepSize -> Pi*10^-3 is to dictate the time-stepping size for the equations ? The documentation says this option is for NDSolve to decide the step-size. I wanted to know its applicability in the present context. I need to change the time-stepping to attain a CFL number <1. Also can you suggest some changes to make the code faster ? – Avrana Jan 03 '23 at 10:38
  • @Avrana Hi! Yes, I used option MaxStepSize in code from the stability considerations. In much of the numerical methods used in discretization of convection-dominated problems the time step is restricted by CFL condition. At least this take place in Eulerian methods. – Oleksii Semenov Jan 04 '23 at 16:03
  • I don't know exactly how discretization in time and stabilization is implemented inside NDSolveValue when such a problem is considered. May be it is described in documentation. In any case it would be better to maintain Courant <1 during calculations. – Oleksii Semenov Jan 04 '23 at 16:13
  • Popular joke among the people working in CFD reads :"In CFD there are no non-solvable problems, there is only the lack of computing time to solve them" :) – Oleksii Semenov Jan 04 '23 at 16:23
  • @OleksiiSemenov Thankyou for the clarifications Oleksii. Yes, now I have been trying to keep time-step such that CFL<1. For sure, calculation times are huge lol! Recently, I have been trying to do a grid-independence test on Alex's code and found that up until certain refinement, the fields converge to a particular solution, but further refinement in mesh leads to a different solution which is very perplexing to me. – Avrana Jan 05 '23 at 04:20
  • This is happening even when I am adjusting the time-step and grid-size such that CFL<1. You can find this problem here, where an excel sheet is attached. Also, currently I have been running a grid-and time independence study on your solution (by keeping a constant CFL=0.5), and it has been working fine till now. – Avrana Jan 05 '23 at 04:52
  • @Avrana Interesting to look on grid-independence test of my code. Pay attention that I supposed $d=e$ in dimensionless form. So, the setting of BC should be correcting to take into account different values of $e$. – Oleksii Semenov Jan 05 '23 at 06:47
  • Yes, I changed code to y=-e/d in relevant places. I also conducted a grid and time-independence study based on a fixed CFL=0.5, by varying Nx. As I increased Nx, I had to also reduce the MaxStpeSize to maintain CFL=0.5. Fortunately, it passed the tests with no issues. You can find the results attached here. Sheet 2 tabulates the various grid and time-step used. Please note that I used an air-steel combination with u0=0.05, q=50000 for these studies. – Avrana Jan 05 '23 at 18:52
  • @OleksiiSemenov I have some additional doubts. The present non-dimensional scheme used in Zhao paper (based on which you proposed this solution), leads to some results which are a little perplexing, especially the amount of overheat being predicted is too low. I wanted to solve the dimensional flow and energy equations using the algorithm you have proposed. Will that be possible ? – Avrana Jan 06 '23 at 05:05
  • I have started modifying the code, but got stuck at Profile = Interpolation[{{0, 0}, {hy, 1}, {1 - hy, 1}, {1, 0}}, InterpolationOrder -> 1] Uc = 1/NIntegrate[Profile[y], {y, 0, 1}]; UinfProfile[y_] := Uc*Profile[y];. How should this be changed ? I tried Profile = Interpolation[{{0, 0}, {hy, 1}, {d - hy, 1}, {d, 0}}, InterpolationOrder -> 1] Uc = 1/NIntegrate[Profile[y], {y, 0, d}]; UinfProfile[y_] := Uc*Profile[y]; However, this leads to a profile not within 1 – Avrana Jan 06 '23 at 05:09
  • 1
    @Avrana Grid-independence test of the code went out perfectly according your data. Sounds encouraging. – Oleksii Semenov Jan 06 '23 at 08:56
  • 1
    As to me It would be better to carry out FEM simulation based on non-dimensional equations and then to recalculate dimensional temperature. This will help to avoid errors dealing with small values of geometrical characteristics $d,e$ in SI units. – Oleksii Semenov Jan 06 '23 at 09:20
  • As to the low overheating that you observe. It would be excellent to check integral heat balance to be sure either we have problems with energy conservation or not. – Oleksii Semenov Jan 06 '23 at 09:28
  • Also I would like to pay attention on the next. Let you check the calculated temperature on the inflow boundary. It should be equal to 0 according BC we set. But I faced earlier with the fact that Dirichlet BC can not be applied rapidly in NDSolveValue when transient PDE are solved. However it is not correctly (from the mathematical point of view) to set Dirichlet BC on inflow which is not consistent with initial condition what we do after every half-period. – Oleksii Semenov Jan 06 '23 at 09:39
  • As to inflow and outflow velocity profiles which I set. First of all they should satisfy integral mass balance. I set such a profiles shape with calibration coefficient because I wanted to provide condition $u_y=0$ at $y=0, y=d$ as I remember. However, may be it is possible to set directly $u_y=1$ as inflow and outflow BC. Let you experiment with this – Oleksii Semenov Jan 06 '23 at 10:00