New Features for Fluid Dynamics

Martin Vejvoda
Wolfram Research

#WolframTechConf

The Story So Far

14.0

FluidFlowPDEComponent

Laminar Flow monograph

14.1

Blood Flow Modeling in Cerebral Aneurysm application example - stationary case

14.2

Blood Flow Modeling in Cerebral Aneurysm application example - pulsatile case + rupture site prediction

14.3

Axisymmetric and swirling flow

Fluid Dynamics Model Verification Tests monograph

Axisymmetric and Swirling Flow

Axisymmetric domain

Axisymmetric Navier-Stokes equations

FluidFlowPDEComponent[{{u[r,z],0,w[r,z],p[r,z]},{r,θ,z}},<|"DynamicViscosity"->μ,"MassDensity"->ρ,"RegionSymmetry"->"Axisymmetric"|>]

Swirling flow

FluidFlowPDEComponent[{{u[r,z],v[r,z],w[r,z],p[r,z]},{r,θ,z}},<|"DynamicViscosity"->μ,"MassDensity"->ρ,"CoordinateChart"->"Cylindrical"|>]

Axisymmetric Flow Example

Compute the fluid flow in a narrowing cylindrical pipe driven by a parabolic inflow

Set up the axisymmetric domain:

domain= RegionUnion[RegionDifference[RegionDifference[RegionUnion[Rectangle[{0,0},{2,7}], Rectangle[{0,4},{1,10}]],Disk[{3/2,7},1/2]],Disk[{2,13/2},1/2]],Disk[{3/2,6},1/2]]

Set up the equations:

pde=FluidFlowPDEComponent[{{u[r,z],0,w[r,z],p[r,z]},{r,θ,z}},<|"MassDensity"->1,"DynamicViscosity"->1,"RegionSymmetry"->"Axisymmetric"|>]=={0,0,0};

Set up the boundary conditions:

bcs={DirichletCondition[{u[r,z]==0,w[r,z]==0.25*(4-r^2)},z==0],
DirichletCondition[{u[r,z]==0,w[r,z]==0},r>0&&z!=0&&z!=10],
DirichletCondition[u[r,z]==0,z==10],
DirichletCondition[u[r,z]==0,r==0],
DirichletCondition[p[r,z]==0,r==0&&z==10]};

Solve the equations:

{rVel,zVel,pressure}=NDSolveValue[{pde,
bcs},{u[r,z],w[r,z],p[r,z]},{r,z}∈domain,
Method->{"FiniteElement","InterpolationOrder"->{u->2,w->2,p->1}}];

Visualize the velocity:

VectorPlot[{rVel,zVel},{r,z}∈domain]

Visualize the pressure in 3D:

rmf=RegionMember[domain];
Legended[RegionPlot3D[rmf[{Sqrt[x^2+y^2],z}]&&0<=PlanarAngle[{0,0}->{{0.02,0},{x,y}}]<=(4 π)/3,{x,-2,2},{y,-2,2},{z,0,10},],BarLegend[]]

Fluid Dynamics Model Verification Tests

New monograph for fluid dynamics in Version 14.3.

Features five benchmarking tests with references:

stationary 2D flow around cylinder

stationary lid-driven cavity (also features non-Newtonian flow)

stationary axisymmetric flow in cylinder (comparison with exact solution)

time-dependent axisymmetric flow in cylinder (comparison with exact solution)

time-dependent flow in cube (comparison with exact solution)

Post-processing

The solution of the fluid dynamics equations can be used to obtain additional information about the fluid flow

Quantities of interest

Viscosity

Stress

New functions

FluidViscosity

FluidViscousStress

Viscosity & Stress

Incompressible fluid dynamics equations

({{({{ρ(((∂v)/(∂t))+v·∇v), =, ∇·σ}, {σ, =, -pI+2μ(OverDot[ϵ])}, {(OverDot[ϵ]), =, (1/2)(∇v+(((∇v))^T))}, {∇·v, =, 0}})}})

Newtonian fluid

Viscosity μ is constant

Non-Newtonian fluid

Viscosity μ is a function of the shear rate (OverDot[γ])

({{({{(OverDot[γ]), =, (Sqrt[2(OverDot[ϵ]):(OverDot[ϵ])])}, {a:b, =, (∑_n)(∑_m)(Subscript[a, nm])(Subscript[b, nm])}})}})

FluidViscosity

New function computing fluid viscosity

FluidViscosity[vars,pars,velocity]

Viscosity of a Newtonian fluid

FluidViscosity[{{u[x,y],v[x,y],p[x,y]},{x,y}},<|"MassDensity"->ρ,"DynamicViscosity"->μ|>,{𝒰[x,y],𝒱[x,y]}]

Viscosity of a power-law fluid

FluidViscosity[{{u[x,y],v[x,y],p[x,y]},{x,y}},<|"MassDensity"->ρ,"FluidDynamicsMaterialModel"-><|"PowerLaw"-><|"Exponent"->n,"MinimalShearRate"->(Subscript[(OverDot[γ]), min]),"ReferenceShearRate"->(Subscript[(OverDot[γ]), ref]),"PowerLawViscosity"->m|>|>|>,{𝒰[x,y],𝒱[x,y]}]

FluidViscousStress

New function computing viscous part of the stress tensor

FluidViscousStress[vars,pars,velocity]

Viscous stress of a Newtonian fluid

FluidViscousStress[{{u[x,y],v[x,y],p[x,y]},{x,y}},<|"MassDensity"->ρ,"DynamicViscosity"->μ|>,{𝒰[x,y],𝒱[x,y]}]

//Normal//MatrixForm

Viscosity of a power-law fluid

FluidViscousStress[{{u[x,y],v[x,y],p[x,y]},{x,y}},<|"MassDensity"->ρ,"FluidDynamicsMaterialModel"-><|"PowerLaw"-><|"Exponent"->n,"MinimalShearRate"->(Subscript[(OverDot[γ]), min]),"ReferenceShearRate"->(Subscript[(OverDot[γ]), ref]),"PowerLawViscosity"->m|>|>|>,{𝒰[x,y],𝒱[x,y]}]

//Normal//MatrixForm

Example

Compute the viscosity and stress of the non-Newtonian fluid flow in an opening channel by using the power law fluid flow model.

Set up the domain:

Ω=RegionUnion[Rectangle[{0,-1/2},{5,1/2}],Rectangle[{5,-3/2},{30,3/2}]]

Set up the variables and parameters:

vars={{u[x,y],v[x,y],p[x,y]},{x,y}};
pars=<|"MassDensity"->1,"FluidDynamicsMaterialModel"-><|"PowerLaw"-><|"PowerLawExponent"->1/2,"PowerLawViscosity"->0.008838835|>|>
|>;

Solve the PDE with parabolic inflow and with the outflow pressure set to 0. The walls are set up as no-slip walls:

fluidFlowResult=NDSolveValue[{FluidFlowPDEComponent[vars,pars]=={0,0,0},DirichletCondition[
{u[x,y]==-(y-1/2)*(y+1/2),v[x,y]==0},x==0],DirichletCondition[{u[x,y]==0,v[x,y]==0},0<x<30],
DirichletCondition[p[x,y]==0,x==30]},vars[[1]],{x,y}∈Ω,];

Viscosity

Compute the viscosity:

viscosity=FluidViscosity[vars,pars,fluidFlowResult];

Visualize the viscosity:

ContourPlot[viscosity,{x,y}∈Ω,PlotLegends->Automatic,PlotRange->All]

Viscous stress

Compute the viscous stress:

viscousStress=FluidViscousStress[vars,pars,fluidFlowResult]

Visualize the norm of the viscous stress:

ContourPlot[Norm[viscousStress,"Frobenius"],{x,y}∈Ω,PlotRange->All,PlotLegends->Automatic]

Total stress

Compute the total stress:

totalStress=-fluidFlowResult[[-1]]*IdentityMatrix[2]+viscousStress;

Visualize the norm of the total stress:

ContourPlot[Norm[totalStress,"Frobenius"],{x,y}∈Ω,PlotRange->All,PlotLegends->Automatic]

Fluid Dynamics Equations

Navier-Stokes equations

({{({{ρ(((∂v)/(∂t))+v·∇v), =, -∇p+μΔv}, {∇·v, =, 0}})}})

Stokes equations

({{({{ρ((∂v)/(∂t)), =, -∇p+μΔv}, {∇·v, =, 0}})}})

Oseen equations

({{({{ρ(((∂v)/(∂t))+(Subscript[v, 0])·∇v), =, -∇p+μΔv}, {∇·v, =, 0}})}})

Summary

15.0

FluidViscosity - new function for computing fluid viscosity

FluidViscousStress - new function for computing viscous stresses

15.1

Stokes equations

Oseen equations