Specify the transient viscous Navier–Stokes equation with viscosity
μ
and density
ρ
:
In[3]:=
op=ρ
(1,0,0)
u
[t,x,y]+ρ{u[t,x,y],v[t,x,y]}.
∇
{x,y}
u[t,x,y]+
∇
{x,y}
·
-μ
∇
{x,y}
u[t,x,y]+
(0,1,0)
p
[t,x,y],ρ
(1,0,0)
v
[t,x,y]+ρ{u[t,x,y],v[t,x,y]}.
∇
{x,y}
v[t,x,y]+
∇
{x,y}
·
-μ
∇
{x,y}
v[t,x,y]+
(0,0,1)
p
[t,x,y],
(0,1,0)
u
[t,x,y]+
(0,0,1)
v
[t,x,y]/.{μ10^-3,ρ1};
Specify a function that ramps up the inflow velocity:
In[4]:=
ramp=Function[t,Exp[5*t]/(Exp[20]+Exp[5*t])];
Specify the boundary conditions for inflow on the left and right, the no-slip boundary conditions on the remaining walls: inflow boundary condition on the left:
Obtain a list of all boundary conditions and replace the parameters with the chosen values:
In[6]:=
bcs={inflowBC,outflowBC,wallBC}/.rules;
Set up initial conditions such that the system is at rest:
In[7]:=
ic={u[0,x,y]0,v[0,x,y]0,p[0,x,y]0};
Time-integrate the Navier–Stokes equation on a mesh with specified spacing while interpolating the velocities with second order and the pressure with first order. This calculation can take a few minutes, but the progress is reported with a