CFD Toolbox
1. Models
The CFD Toolbox supports both the incompressible Navier-Stokes and the Stokes equations.
The fluid mechanics model (Navier-Stokes
or Stokes
) can be selected in json file:
"Models": { "equations":"Navier-Stokes" }
2. Materials
Name | Symbol | Shape | Description |
---|---|---|---|
density |
rho |
scalar |
density |
dynamic-viscosity |
mu |
scalar |
dynamic viscosity |
turbulent-dynamic-viscosity |
mu_t |
scalar |
turbulent dynamic viscosity |
consistency-index |
mu_k |
scalar |
consistency index |
power-law-index |
mu_power_law_n |
scalar |
power law index |
viscosity-min |
mu_min |
scalar |
|
viscosity-max |
mu_max |
scalar |
|
viscosity-zero-shear |
mu_0 |
scalar |
|
viscosity-infinite-shear |
mu_inf |
scalar |
|
carreau-law-lambda |
mu_carreau_law_lambda |
scalar |
|
carreau-law-n |
mu_carreau_law_n |
scalar |
|
carreau-yasuda-law-lambda |
mu_carreau_yasuda_law_lambda |
scalar |
|
carreau-yasuda-law-n |
mu_carreau_yasuda_law_n |
scalar |
|
carreau-yasuda-law-a |
mu_carreau_yasuda_law_a |
scalar |
3. Fields and symbols expressions
Name | Description | Shape |
---|---|---|
velocity |
the velocity of fluid |
vectorial |
pressure |
the pressure |
scalar |
Symbol | Expression | Description |
---|---|---|
fluid_U_0 |
\(u_0\) |
evaluate the temperature |
fluid_U_1 |
\(u_1\) |
evaluate the temperature |
fluid_U_2 |
\(u_2\) |
evaluate the temperature |
fluid_U_magnitude |
\(\sqrt{u \cdot u}\) |
evaluate the temperature |
fluid_curl_U_magnitude |
stem:[\nabla \wedge u |
evaluate the first component of gradient of temperature |
The next step is to define the fluid material by setting its properties namely the density \(\rho_f\) and viscosity \(\mu_f\). In next table, we find the correspondance between the mathematical names and the json names.
Parameter | Symbol |
---|---|
\(\mu_f\) |
|
\(\rho_f\) |
|
A Materials
section is introduced in json file in order to configure the fluid properties. For each mesh marker, we can define the material properties associated.
"Materials":
{
"<name>"
{
"markers":"[marker1,marker2]",
"rho":"1.0e3",
"mu":"1.0"
}
}
3.1. Generalised Newtonian fluid
The non Newtonian properties are defined in cfg file in fluid section.
The viscosity law is activated by:
option | values |
---|---|
viscosity.law |
newtonian, power_law, walburn-schneck_law, carreau_law, carreau-yasuda_law |
Then, each model are configured with the options reported in the following table:
Viscosity law | options | unit |
---|---|---|
power_law |
power_law.k power_law.n |
dimensionless dimensionless |
walburn-schneck_law |
hematocrit TPMA walburn-schneck_law.C1 walburn-schneck_law.C2 walburn-schneck_law.C3 walburn-schneck_law.C4 |
Percentage g/l dimensionless dimensionless dimensionless l/g |
carreau_law |
viscosity.zero_shear viscosity.infinite_shear carreau_law.lambda carreau_law.n |
\(kg.m^{-1}.s^{-1}\) dimensionless dimensionless |
carreau-yasuda_law |
viscosity.zero_shear viscosity.infinite_shear carreau-yasuda_law.lambda carreau-yasuda_law.n carreau-yasuda_law.a |
\(kg/(m \times s)\) \(kg/(m \times s)\) dimensionless dimensionless dimensionless |
4. Boundary Conditions
We start by a listing of boundary conditions supported in fluid mechanics model.
4.1. Dirichlet on velocity
A Dirichlet condition on velocity field reads:
or only a component of vector \(\boldsymbol{u}_f =(u_f^1,u_f^2 ,u_f^3 )\)
Several methods are available to enforce the boundary condition:
-
elimination
-
Nitsche
-
Lagrange multiplier
4.2. Dirichlet on pressure
4.3. Neumann
Name | Expression |
---|---|
Neumann_scalar |
\(\boldsymbol{\sigma}_{f} \boldsymbol{n} = g \ \boldsymbol{n} \) |
Neumann_vectorial |
\(\boldsymbol{\sigma}_{f} \boldsymbol{n} = \boldsymbol{g} \) |
Neumann_tensor2 |
\(\boldsymbol{\sigma}_{f} \boldsymbol{n} = g \ \boldsymbol{n}\) |
4.5. Inlet
The boundary condition at inlets allow to define a velocity profile on a set of marked faces \(\Gamma_{\mathrm{inlet}}\) in fluid mesh:
The function \(g\) is computed from flow velocity profiles:
- Constant profile
- Parabolic profile
where \(\beta\) is a constant determined by adding a constraint to the inflow:
- velocity_max
-
\(\max( g ) = \alpha \)
- flow_rate
-
\(\int_\Gamma ( g \ \boldsymbol{n} ) \cdot \boldsymbol{n} = \alpha\)
Option | Value | Default value | Description |
---|---|---|---|
shape |
|
select a shape profile for inflow |
|
constraint |
|
give a constraint wich controle velocity |
|
expr |
string |
symbolic expression of constraint value |
4.6. Outlet flow
Option | Value | Default value | Description |
---|---|---|---|
model |
free,windkessel |
free |
select an outlet modeling |
4.6.2. Windkessel model
We use a 3-element Windkessel model for modeling an outflow boundary condition. We define \(P_l\) a pressure and \(Q_l\) the flow rate. The outflow model is discribed by the following system of differential equations:
Coefficients \(R_{p,l}\) and \(R_{d,l}\) represent respectively the proximal and distal resistance. The constant \(C_{d,l}\) is the capacitance of blood vessel. The unknowns \(P_l\) and \(\pi_l\) are called proximal pressure and distal pressure. Then we define the coupling between this outflow model and the fluid model by these two relationships:
Option | Value | Description |
---|---|---|
windkessel_coupling |
explicit, implicit |
coupling type with the Navier-Stokes equation |
windkessel_Rd |
real |
distal resistance |
windkessel_Rp |
real |
proximal resistance |
windkessel_Cd |
real |
capacitance |
4.7. Implementation of boundary conditions in json
Boundary conditions are set in the json files in the category BoundaryConditions
.
Then <field>
and <bc_type>
are chosen from type of boundary condition.
The parameter <marker>
corresponds to mesh marker where the boundary condition is applied.
Finally, we define some specific options inside a marker.
"BoundaryConditions":
{
"<field>":
{
"<bc_type>":
{
"<marker>":
{
"<option1>":"<value1>",
"<option2>":"<value2>",
// ...
}
}
}
}
4.8. Options summary
Field | Name | Option | Entity |
---|---|---|---|
velocity |
Dirichlet |
expr type number alemesh_bc |
faces, edges, points |
velocity_x velocity_y velocity_z |
Dirichlet |
expr type number alemesh_bc |
faces, edges, points |
velocity |
Neumann_scalar |
expr number alemesh_bc |
faces |
velocity |
Neumann_vectorial |
expr number alemesh_bc |
faces |
velocity |
Neumann_tensor2 |
expr number alemesh_bc |
faces |
velocity |
slip |
alemesh_bc |
faces |
pressure |
Dirichlet |
expr number alemesh_bc |
faces |
fluid |
outlet |
number alemesh_bc model windkessel_coupling windkessel_Rd windkessel_Rp windkessel_Cd |
faces |
fluid |
inlet |
expr shape constraint number alemesh_bc |
faces |
5. Body forces
Body forces are also defined in the fluid
section of BoundaryConditions
in the json file.
"BoundaryConditions":
{
"fluid":{
"VolumicForces":
{
"<marker>":
{
"expr":"{0,0,-gravityCst*7850}:gravityCst"
}
}
}
}
The marker corresponds to mesh elements marked with this tag. If the marker is an empty string, it corresponds to all elements of the mesh. |
6. Post Processing
"PostProcess":
{
"Exports":
{
"fields":["field1","field2",...]
},
"Measures":
{
"<measure type>":
{
"label":
{
"<range type>":"value",
"fields":["field1","field3"]
}
}
}
}
6.1. Exports for vizualisation
The fields allowed to be exported in the fields
section are:
-
velocity
-
pressure
-
displacement
-
vorticity
-
stress or normal-stress
-
wall-shear-stress
-
density
-
viscosity
-
pid
-
alemesh
6.2. Measures
-
Points
-
Force
-
FlowRate
-
Pressure
-
VelocityDivergence
The following fluid variables are available
Name |
Description |
|
magnitude of the velocity |
|
x component of the velocity |
|
y component of the velocity |
|
z component of the velocity |
|
pressure |
You can use these expressions in Statistics
6.2.1. Points
In order to evaluate velocity or pressure at specific points and save the results in .csv file, the user must define:
-
"<tag>" representing this data in the .csv file
-
the coordinate of point
-
the fields evaluated ("pressure" or "velocity")
"Points":
{
"<tag>":
{
"coord":"{0.6,0.2,0}",
"fields":"pressure"
},
"<tag>":
{
"coord":"{0.15,0.2,0}",
"fields":"velocity"
}
}
6.2.2. Flow rate
The flow rate can be evaluated and save on .csv file. The user must define:
-
"<tag>" representing this data in the .csv file
-
"<face_marker>" representing the name of marked face
-
the fluid direction ("interior_normal" or "exterior_normal") of the flow rate.
"FlowRate":
{
"<tag>":
{
"markers":"<face_marker>",
"direction":"interior_normal"
},
"<tag>":
{
"markers":"<face_marker>",
"direction":"exterior_normal"
}
}
6.3. Export user functions
A function defined by a symbolic expression can be represented as a finite element field thanks to nodal projection. This function can be exported.
"Functions":
{
"toto":{ "expr":"x*y:x:y"},
"toto2":{ "expr":"0.5*ubar*x*y:x:y:ubar"},
"totoV":{ "expr":"{2*x,y}:x:y"}
},
"PostProcess":
{
"Exports":
{
"fields":["velocity","pressure","pid","totoV","toto","toto2"]
}
}
7. Stabilization methods
7.1. GLS family
Galerkin leat-Square (GLS) stabilization methods can be activated from the cfg file by adding stabilization-gls=1
in the fluid
prefix.
Others options available are enumerated in the next table and must be given with the prefix fluid.stabilization-gls
.
Option | Value | Default value | Description |
---|---|---|---|
type |
|
|
type of stabilization |
parameter.method |
|
|
method used to compute the stabilization parameter |
parameter.hsize.method |
|
|
method used for evalute an element mesh size |
parameter.eigenvalue.penal-lambdaK |
real |
0. |
add a mass matrix scaled by this factor in the eigen value problem for the stabilization parameter |
convection-diffusion.location.expressions |
string |
if given, the stabilization is apply only on mesh location which verify |
8. Run simulation
The computational fluid dynamics applications available are
-
2D CFD toolbox :
feelpp_toolbox_fluid_2d
-
3D CFD toolbox :
feelpp_toolbox_fluid_3d
Here is an example of execution of the 2D CFD toolbox on 4 processors using the configuration script <myfile.cfg>
mpirun -np 4 feelpp_toolbox_fluid_2d --config-file=<myfile.cfg>