Specifiesafunctionthatacceleratestheinflowvelocity:
In[]:=
ramp=Function[t,Exp[5*t]/(Exp[20]+Exp[5*t])];
Specifytheinflowprofile:
In[]:=
radius=2;flowProfile[y_,z_]:=-(y^2/radius^2+z^2/radius^2)+1​​Plot3D[flowProfile[y,z],{y,z}∈Disk[{0,0},radius]]
Out[]=
​
Specifytheinflowboundaryconditionatthetop:
In[]:=
velocity=3/4;​​inflowBC=DirichletCondition[{u[t,x,y,z]-ramp[t]*velocity*flowProfile[y,z],v[t,x,y,z]0,w[t,x,y,z]0},x8];
Specifytheoutflowboundaryconditionontheright:
In[]:=
outflowBC=DirichletCondition[p[t,x,y,z]0,x-8.6];
Specifyno-slipboundaryconditionsontheremainingfaces:
In[]:=
wallBC=DirichletCondition[{u[t,x,y,z]0,v[t,x,y,z]0,w[t,x,y,z]0},x≠-8.6&&x≠8];
Combineboundaryconditionstogether:
In[]:=
bcs={inflowBC,outflowBC,wallBC};
​​Setinitialconditionssothatthesystemisatrest:
In[]:=
ic={u[0,x,y,z]0,v[0,x,y,z]0,w[0,x,y,z]0,p[0,x,y,z]0};
Setupthepartialdifferentialequation:
In[]:=
pde=FluidFlowPDEComponent[{{u[t,x,y,z],v[t,x,y,z],w[t,x,y,z],p[t,x,y,z]},t,{x,y,z}},<|"ReynoldsNumber"->2002|>]{0,0,0,0};
​​Monitorthesolutionprocessandmeasurethetimerequiredtosolvethepartialdifferentialequation:
In[]:=
Monitor[AbsoluteTiming[{xVel,yVel,zVel,pressure}=NDSolveValue[{pde,bcs,ic},{u,v,w,p},{x,y,z}∈mesh,{t,0,3.65},Method{"TimeIntegration"{"IDA","MaxDifferenceOrder"2},"PDEDiscretization"{"MethodOfLines","SpatialDiscretization"{"FiniteElement","InterpolationOrder"{u2,v2,w2,p1}}}},EvaluationMonitor(currentTime=Row[{"t = ",CForm[t]}])];],currentTime]
Out[]=
{588.277,Null}
ViewtheamountofmemoryusedinGB:
In[]:=
MaxMemoryUsed[]/1024.^2
Out[]=
6109.51
Calculatetherangeofvelocitydistribution:
In[]:=
minmaxVel=MinMax[Flatten[{MinMax[xVel["ValuesOnGrid"]],MinMax[yVel["ValuesOnGrid"]],MinMax[zVel["ValuesOnGrid"]]}]]
Out[]=
{-1.52831,1.66502}