Introduction
The Navier–Stokes equations can be solved using CDO face-based discretizations. Other space discretizations are not available. Up to now, there is no turbulence modelling when using CDO schemes. This is a work in progress.
The rationale to set up the computation in the case of the Navier-Stokes equations is the very near of the one explained for user-defined equations here. One only focuses on the specifities arising from the Navier-Stokes case.
Settings done in cs_user_model()
The activation of the NavSto module is done thanks to the function cs_navsto_system_activate For instance, here are two examples to activate and set the main parameters for the NavSto module
{
0);
}
cs_domain_t * cs_glob_domain
Definition: cs_domain.c:89
@ CS_NAVSTO_COUPLING_MONOLITHIC
Definition: cs_navsto_param.h:231
@ CS_NAVSTO_MODEL_STOKES
Definition: cs_navsto_param.h:84
@ CS_NAVSTO_POST_VELOCITY_DIVERGENCE
Definition: cs_navsto_param.h:190
@ CS_NAVSTO_MODEL_STEADY
Definition: cs_navsto_param.h:133
cs_navsto_system_t * cs_navsto_system_activate(const cs_boundary_t *boundaries, cs_navsto_param_model_t model, cs_navsto_param_model_flag_t model_flag, cs_navsto_param_coupling_t algo_coupling, cs_navsto_param_post_flag_t post_flag)
Allocate and initialize the Navier-Stokes (NS) system.
Definition: cs_navsto_system.c:360
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition: cs_domain.h:138
cs_boundary_t * boundaries
Definition: cs_domain.h:161
or
{
0,
post_flag);
}
unsigned short int cs_flag_t
Definition: cs_defs.h:334
@ CS_NAVSTO_MODEL_INCOMPRESSIBLE_NAVIER_STOKES
Definition: cs_navsto_param.h:86
@ CS_NAVSTO_POST_MASS_DENSITY
Definition: cs_navsto_param.h:197
@ CS_NAVSTO_POST_VELOCITY_GRADIENT
Definition: cs_navsto_param.h:193
@ CS_NAVSTO_POST_PRESSURE_GRADIENT
Definition: cs_navsto_param.h:199
The first parameter is the structure managing the domain boundaries. An example of settings for the domain boundaries is described here.
The second parameter specifies the type of model to consider among the following choice:
The base model can be updated thanks to the third parameter which is a flag built from the following elemental bit (cs_navsto_param_model_bit_t):
The fourth parameter specifies which type of velocity-pressure algorithm will be used (cs_navsto_param_coupling_t). The choice is done among:
The last parameter specifies predefined post-processing operations. As the third parameter, this a flag built from the following elemental bit (cs_navsto_param_post_bit_t):
Predefined equations associated to the Navier–Stokes equations are
- the momentum equation is automatically added when activated with a monolithic or artificial compressibility velocity-pressure coupling
In all cases, a vector-valued field named velocity and a scalar-valued field named _"pressure"_ are created. Moreover, several properties are added:
- the property mass_density (a cs_property_t structure);
- the property laminar viscosity (a cs_property_t structure);
- the properties turbulent_viscosity and the total_viscosity are added if the model of turbulence is different from the laminar one (cf. cs_turb_model_t);
- the property graddiv_coef (a cs_property_t structure) when the artificial compressibility is set;
along with the advection field mass_flux (a cs_adv_field_t structure)
Settings done in cs_user_finalize_setup()
Boundary conditions
In the case of the NavSto module, this is done as follows (One does not access to the equation directly since it depends on the way the velocity/pressure coupling is done).
{
"boundary_faces",
_vel_def,
NULL);
}
cs_xdef_t * cs_navsto_set_velocity_inlet_by_analytic(cs_navsto_param_t *nsp, const char *z_name, cs_analytic_func_t *ana, void *input)
Define the velocity field for an inlet boundary using an analytical function.
Definition: cs_navsto_param.c:1567
cs_navsto_param_t * cs_navsto_system_get_param(void)
Retrieve the structure storing the parameters for the Navier–Stokes system.
Definition: cs_navsto_system.c:560
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:262
where the function _vel_def
is defined as follows
static inline void
{
const cs_real_t x = pxyz[0], y = pxyz[1], z = pxyz[2];
const cs_real_t sx = sin(_2pi*x), cx = cos(_2pi*x),
sy = sin(_2pi*y), cy = cos(_2pi*y),
sz = sin(_2pi*z), cz = cos(_2pi*z);
res[0] = .5 * sx * cy * cz;
res[1] = .5 * cx * sy * cz;
res[2] = - cx * cy * sz;
}
static void
bool dense_output,
void *input,
{
if (pt_ids != NULL && !dense_output) {
# pragma omp parallel for if(n_pts > CS_THR_MIN)
__vel(xyz + 3*id, res + 3*id);
}
}
else if (pt_ids != NULL && dense_output) {
# pragma omp parallel for if(n_pts > CS_THR_MIN)
__vel(xyz + 3*
id, res + 3*
p);
}
}
else {
# pragma omp parallel for if(n_pts > CS_THR_MIN)
__vel(xyz + 3*
p, res + 3*
p);
}
}
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:347
#define CS_UNUSED(x)
Definition: cs_defs.h:514
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
@ p
Definition: cs_field_pointer.h:67
Definition of source terms
Since the equation on which this source term applies, depends on the choice of the velocity-pressure algorithm, the way to proceed varies slightly of the way used on a user-defined equation.
{
}
cs_xdef_t * cs_navsto_add_source_term_by_analytic(cs_navsto_param_t *nsp, const char *z_name, cs_analytic_func_t *ana, void *input)
Define a new source term structure defined by an analytical function.
Definition: cs_navsto_param.c:1785
@ CS_QUADRATURE_BARY_SUBDIV
Definition: cs_quadrature.h:88
void cs_xdef_set_quadrature(cs_xdef_t *d, cs_quadrature_type_t qtype)
Set the type of quadrature to use for evaluating the given description.
Definition: cs_xdef.c:823
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:160
where the function _src_def
is defined as follows
static inline void
{
const cs_real_t x = pxyz[0], y = pxyz[1], z = pxyz[2];
const cs_real_t sx = sin(_2pi*x), cx = cos(_2pi*x),
sy = sin(_2pi*y), cy = cos(_2pi*y),
sz = sin(_2pi*z), cz = cos(_2pi*z);
res[0] = 6.*_pis * sx * cy * cz + _2pi * cx * sy * sz;
res[1] = 6.*_pis * cx * sy * cz + _2pi * sx * cy * sz;
res[2] = -12.*_pis * cx * cy * sz + _2pi * sx * sy * cz;
}
static void
bool dense_output,
void *input,
{
if (pt_ids != NULL && !dense_output) {
# pragma omp parallel for if(n_pts > CS_THR_MIN)
__st(xyz + 3*id, res + 3*id);
}
}
else if (pt_ids != NULL && dense_output) {
# pragma omp parallel for if(n_pts > CS_THR_MIN)
__st(xyz + 3*
id, res + 3*
p);
}
}
else {
# pragma omp parallel for if(n_pts > CS_THR_MIN)
__st(xyz + 3*
p, res + 3*
p);
}
}
Settings done in cs_user_parameters()
The rationale is similar to the one detailed in this section.
Here are listed some specificities related to the NavSto module.
Set the strategy to solve the Navier-Stokes system when a monolithic coupling is used
When a monolithic velocity-pressure is set, the linear system to solve is a saddle-point problem. This class of linear systems needs specific choices of preconditioner/solver. The default settings is not always the optimal choice in terms of efficiency. The settings of saddle-point problems is detailed here
To go further
The detailed description of CDO schemes, the mathmatical analysis and numerical results on benchmarks are available in the following PhD thesis:
Additional publications :