This is a steady-state conjugate heat transfer problem (the time-independent version of this problem). The problem is conjugate as the energy equation is being solved in thermally connected solid and fluid domain. It describes 2D-flow of fluid over a heated solid block. I presumed it would be straightforward with the NDSolve
fem
option, but alas I ran into errors:
Needs["NDSolve`FEM`"]
Needs["MeshTools`"]
L = 0.040 ;(*length of the channel*)
d = 0.003;(*depth of the fluid*)
e = 0.005;(*depth of the solid*)
l = L/d;(*dimensionless length*)
rhof = 1.1492;(*fluid density*)
rhos = 7860;(*density of solid*)
mu = 18.923*10^-6;(*dynamic viscosity*)
nu = mu/rhof;(*kinematic viscosity*)
ks = 16;(*conductivity of solid*)
kf = 0.026499;(*conductivity of liquid*)
cf = 1069;(*heat capacity of fluid*)
cs = 502.4;(*heat capacity of solid*)
AlphaF = kf/(cf*rhof);(*thermal diffusivity of fluid*)
AlphaS = ks/(cs*rhos);(*thermal diffusivity of solid*)
f = 1.0;(*flow oscillation frequency*)
period = 1/f;(*period*)
omega = 2*Pi/period;(*circular frequency*)
u0 = 0.05;(*inflow velocity*)
q = 5000;(*heat flux density*)
uavg = N[\!\(\*SubsuperscriptBox[\(∫\), \(0\), FractionBox[\(π\), \(omega\)]]\(u0\ Sin[omega\ t] \[DifferentialD]t\)\)/(π/omega)];
re = d uavg/(nu);
(*Meshing*)
Nx = 70;(*number of elements in x-direction*)
NyF = 50;(*number of elements in y-direction in fluid*)
NyS = 40;(*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]];
mark = Table[z = Mean[nodes[[quads[[i]]]]][[2]];
If[z < 0, 0, 1], {i, 1, Length[quads]}];
MeshTotal1 = ToElementMesh["Coordinates" -> nodes, "MeshElements" -> {QuadElement[quads, mark]}];
MeshTotal2 = MeshOrderAlteration[MeshTotal1, 2];
(*Fluid inflow profile*)
Clear[TopWall, BottomWall, reference, HeatInpBC, op, c, rampFunction,
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_] := Uc*Profile[y];(*inflow velocity profile*)
(*Material property switching function*)
appro = With[{k = 2. 10^6}, ArcTan[k #]/Pi + 1/2 &];
ade[y_] := (ks + (kf - ks) appro[y])
rde[y_] := (cs rhos + (cf rhof - cs rhos) appro[y]);
(*Stationary momentum, continuity and energy operator*)
c = If[ElementMarker == 0, 10^6,
0]; op = {{{u[x, y], v[x, y]}}.Inactive[Grad][u[x, y], {x, y}] +
Inactive[
Div][({{-(1/re), 0}, {0, -(1/re)}}.Inactive[Grad][
u[x, y], {x, y}]), {x, y}] + \!\(
\*SubscriptBox[\(∂\), \({x}\)]\(p[x, y]\)\) +
c u[x, y], {{u[x, y], v[x, y]}}.Inactive[Grad][v[x, y], {x, y}] +
Inactive[
Div][({{-(1/re), 0}, {0, -(1/re)}}.Inactive[Grad][
v[x, y], {x, y}]), {x, y}] + \!\(
\*SubscriptBox[\(∂\), \({y}\)]\(p[x, y]\)\) + c v[x, y], \!\(
\*SubscriptBox[\(∂\), \({x}\)]\(u[x, y]\)\) + \!\(
\*SubscriptBox[\(∂\), \({y}\)]\(v[x, y]\)\), {u[x, y],
v[x, y]}.Inactive[Grad][(u0 d) T[x, y], {x, y}] -
Inactive[Div][(ade[y] Inactive[Grad][T[x, y], {x, y}])/
rde[y], {x, y}]};
(*Boundary conditions*)
TopWall = DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, y == 1];
BottomWall = DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, y <= 0];
HeatInpBC = NeumannValue[(ks)/(cs rhos), y == -(e/d)];
reference = DirichletCondition[p[x, y] == 0., x == l && y == 0];Clear[u, v, p, t, HeatDBC];
Clear[HeatDBC, Inflow, Outflow, bcs, UxFun, UyFun, pressure, TFun];
Inflow = DirichletCondition[{u[x, y] == 1, v[x, y] == 0},
x == 0 && y > 0 && y < 1];
Outflow =
DirichletCondition[{p[x, y] == 0, v[x, y] == 0},
x == l && y > 0 && y < 1];
HeatDBC = DirichletCondition[T[x, y] == 0, x == 0 && y >= 0 && y <= 1];
bcs = {TopWall, BottomWall, Inflow, Outflow, reference, HeatDBC};
(*Solution*)
{UxFun, UyFun, pressure, TFun} =
NDSolveValue[{op == {0, 0, 0, HeatInpBC}, bcs}, {u, v, p,
T}, {x, y} \[Element] MeshTotal2,
Method -> {"FiniteElement",
"InterpolationOrder" -> {u -> 2, v -> 2, p -> 1}},
InitialSeeding -> {u[x, y] == 0, v[x, y] == 0, T[x,y]==0}];
On solving this leads to the following error:
It reads
FindRoot::nosol: Linear equation encountered that has no solution. FindRoot::sszero: The step size in the search has become less than the tolerance prescribed by the PrecisionGoal option, but the function value is still greater than the tolerance prescribed by the AccuracyGoal option.
As can be seen in code, I have also tried to provide an initial seed for the system InitialSeeding -> {u[x, y] == 1, v[x, y] == 0, T[x,y]==0}
, but to no avail. Also, I have kept the fluid velocity low u0=0.05
(uavg
is lower actually), which should be rendering the non-linearity to be low. What should be changed to find a stationary solution to this problem ?
Update
If the energy equation is non-dimensionalised as $T=\frac{T^*}{\frac{qd}{k_s}}, u =\frac{u^*}{u_{avg}}, v =\frac{v^*}{u_{avg}}$, it becomes:
$$u_{avg} d \rho c_p \bigg(u \frac{\partial T}{\partial x} + v \frac{\partial T}{\partial y}\bigg) -k \nabla^2 T=0$$ with the boundary condition $-\frac{\partial T}{\partial y}=1$ at $y=-e/d$.
Then for MMA FEM, the boundary conditon should become
NeumannValue[ks, y==-e/d]
After some recommendations in the comments, I have updated my approach. Please copy code till the definition of re
from the already posted code.
Ti = 307.;
reg1 = ImplicitRegion[0 <= x <= L/d && 0 <= y <= 1, {x, y}];
reg2 = ImplicitRegion[0 <= x <= L/d && -e <= y <= 1, {x, y}];
mesh = ToElementMesh[FullRegion[2], {{0, L/d}, {0, 1}},
MaxCellMeasure -> 5 10^-4];
mesh1 = ToElementMesh[FullRegion[2], {{0, L/d}, {-e/d, 1}},
MaxCellMeasure -> 5 10^-4];
op = {{{u[x, y], v[x, y]}}.Inactive[Grad][u[x, y], {x, y}] +
Inactive[
Div][({{-(1/re), 0}, {0, -(1/re)}}.Inactive[Grad][
u[x, y], {x, y}]), {x, y}] + \!\(
\*SubscriptBox[\(∂\), \({x}\)]\(p[x,
y]\)\), {{u[x, y], v[x, y]}}.Inactive[Grad][v[x, y], {x, y}] +
Inactive[
Div][({{-(1/re), 0}, {0, -(1/re)}}.Inactive[Grad][
v[x, y], {x, y}]), {x, y}] + \!\(
\*SubscriptBox[\(∂\), \({y}\)]\(p[x, y]\)\), \!\(
\*SubscriptBox[\(∂\), \({x}\)]\(u[x, y]\)\) + \!\(
\*SubscriptBox[\(∂\), \({y}\)]\(v[x, y]\)\)};
TopWall = DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, y == 1];
BottomWall = DirichletCondition[{u[x, y] == 0, v[x, y] == 0}, y <= 0];
reference = DirichletCondition[p[x, y] == 0., x == l && y == 0];
Clear[u, v, p, t];
Inflow = DirichletCondition[{u[x, y] == 1, v[x, y] == 0},
x == 0 && y > 0 && y < 1];
Outflow =
DirichletCondition[{p[x, y] == 0, v[x, y] == 0},
x == l && y > 0 && y < 1];
bcs = {TopWall, BottomWall, reference, Inflow, Outflow};
{UxFun, UyFun, pressure} =
NDSolveValue[{op == {0, 0, 0}, bcs}, {u, v, p}, {x, y} ∈
mesh, Method -> {"FiniteElement",
"InterpolationOrder" -> {u -> 2, v -> 2, p -> 1}}];
DensityPlot[UxFun[x, y], {x, 0, l}, {y, 0, 1},
ColorFunction -> "Rainbow", AspectRatio -> Automatic]
appro = With[{k = 2. 10^6}, ArcTan[#1 k]/\[Pi] + 1/2 &];
ade[y_] := (ks + (kf - ks) appro[y])
rde[y_] := (cs rhos + (cf rhof - cs rhos) appro[y]);
ux = If[y <= 0, 0, UxFun[x, y]];
vy = If[y <= 0, 0, UyFun[x, y]];
T = NDSolveValue[{ uavg d rde[y] (ux \!\(
\*SubscriptBox[\(\[PartialD]\), \({x}\)]\(T[x, y]\)\) + vy \!\(
\*SubscriptBox[\(\[PartialD]\), \({y}\)]\(T[x, y]\)\)) -
Inactive[Div][(ade[y] Inactive[Grad][T[x, y], {x, y}]), {x,
y}] == NeumannValue[ks , y == (-e/d)],
DirichletCondition[{T[x, y] == 0}, x == 0 && 0 <= y <= 1]},
T, {x, y} \[Element] mesh1,
Method -> {"FiniteElement", "InterpolationOrder" -> {T -> 2}}];
DensityPlot[T[x, y], {x, 0, l}, {y, -e/d, 1},
AspectRatio -> Automatic, ColorFunction -> "Rainbow"]
DensityPlot[T[x, y], {x, 0, l}, {y, -e/d, 1},
AspectRatio -> Automatic, ColorFunction -> "Rainbow"]
Plot[{Ti + T[x, -e/d/2]*(q d/ks), Ti + T[x, 1/4]*(q d/ks)}, {x, 0, l}]
The solid (at $y=\frac{-e/d}{2}$) and fluid (at $y=\frac{1}{4}$) temperature profiles are:
Some issues:
- While solving the energy equation, the following warnings are delivered:
Are these serious?
- If I want to calculate the average solid temperature (line-integrated along its height, i.e., $y-$ direction), what should be the way? Basically, I want to calculate:
$$T_{s,avg}(x) = \frac{1}{e/d}\int_{-e/d}^0 T(x,y)\mathrm{d}y$$
Currently I tried using:
T1[x_] = (1/(e/d)) NIntegrate[Ti + T[x, y]*(q d/ks), {y, -e/d, 0}]
- Let us assume from experiments, I know the length, width of a block to be $L,W$ (in m) to which some $Q$ (in W) heat is supplied. Now imagine, I am modelling this system in 2D (in Mathematica), where my model only has the length ($L$) feature and not the width ($W$). In this scenario, I have to emulate the heat input as a flux ($q′′$,
q
in this question) condition (Neumann value). How should I calculate this flux, to replicate the experiment ? Should it be $q = \frac{experimetal \space Q}{L∗1}$ or $q = \frac{experimental \space Q}{L∗W}$? Similar argument also follows for deciding theuavg
value for the simulation as volumetric flow rate is known from experiments. Should it be $\frac{experimental \space flowate}{d*1}$ or $\frac{experimental \space flowate}{d*W}$ for the simulation.
Bounty
Let us look at the energy balance scenario. Let us assume that the width of the block is 1 (in $z-$ direction). In that case, analytical considerations say that the fluid outlet temperature can be calculated using Solve[q L 1 == rhof uavg cf d 1 (x - Ti), x]
, i.e., $q*L*1 = \rho (d*1) u_{avg} c_p (T_{outlet} - T_i)$, which results in
{{x -> 363.828}}
However, using this MMA model (in the Update section), we get
T2[x]
is the average fluid temperature along the outlet boundary
T2[x_?NumericQ] := (1/1) NIntegrate[T[x, y], {y, 0, 1}, MaxRecursion -> 12];
Ti + Evaluate[T2[l]]*(q d/ks)
323.395
So there seems to be huge energy imbalance. Interstingly, I have seen that as the flow velocity, i.e., u0
is decreased, the amount of this discrepancy grows even further (hinting at diffusion being the main culprit). With increasing flow velcoity, this imbalance reduces.
T1[x_?NumericQ] := (1/(e/d)) NIntegrate[ Ti + T[x, y]*(q d/ks), {y, -e/d, 0}]; Plot[Evaluate[T1[x]], {x, 0, L/d}]
$\endgroup$