9.2
general documentation
cs_convection_diffusion.cpp File Reference

Convection-diffusion operators. More...

#include "base/cs_defs.h"
#include <cmath>
#include <chrono>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <mpi.h>
#include "bft/bft_error.h"
#include "bft/bft_printf.h"
#include "base/cs_algorithm.h"
#include "base/cs_array.h"
#include "base/cs_boundary_conditions.h"
#include "base/cs_boundary_conditions_set_coeffs.h"
#include "base/cs_dispatch.h"
#include "cdo/cs_equation_param.h"
#include "base/cs_halo.h"
#include "base/cs_log.h"
#include "base/cs_internal_coupling.h"
#include "base/cs_math.h"
#include "base/cs_mem.h"
#include "mesh/cs_mesh.h"
#include "base/cs_field.h"
#include "base/cs_field_default.h"
#include "base/cs_field_operator.h"
#include "base/cs_field_pointer.h"
#include "base/cs_parall.h"
#include "base/cs_parameters.h"
#include "base/cs_porous_model.h"
#include "base/cs_profiling.h"
#include "base/cs_reducers.h"
#include "base/cs_timer.h"
#include "base/cs_velocity_pressure.h"
#include "alge/cs_blas.h"
#include "alge/cs_bad_cells_regularisation.h"
#include "alge/cs_gradient.h"
#include "alge/cs_gradient_boundary.h"
#include "mesh/cs_mesh_quantities.h"
#include "alge/cs_convection_diffusion.h"
#include "alge/cs_convection_diffusion_priv.h"
+ Include dependency graph for cs_convection_diffusion.cpp:

Functions

template<typename T >
void cs_convection_diffusion_adjust_and_check_bounds_scalar (cs_dispatch_context &ctx, const char *var_name, const cs_equation_param_t &eqp, bool face_gradient, int ircflb, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, const cs_real_t *restrict pvar, const T(*restrict grad)[3], const cs_real_t *df_limiter, cs_real_t(*restrict bounds)[2])
 Adust bounds if rc_clip_factor < or > 1, and check bounds if required by verbosity level or postprocessing. More...
 
template<cs_lnum_t stride, typename T >
void cs_convection_diffusion_adjust_and_check_bounds_strided (cs_dispatch_context &ctx, const char *var_name, const cs_equation_param_t &eqp, bool face_gradient, int ircflb, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, const T(*restrict grad)[stride][3], const cs_real_t *df_limiter, cs_real_t *restrict bounds)
 Adust bounds if rc_clip_factor < or > 1, and check bounds if required by verbosity level or postprocessing. More...
 
template void cs_convection_diffusion_adjust_and_check_bounds_strided (cs_dispatch_context &ctx, const char *var_name, const cs_equation_param_t &eqp, bool face_gradient, int ircflb, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, const double(*restrict grad)[6][3], const cs_real_t *df_limiter, cs_real_t *restrict bounds)
 
template void cs_convection_diffusion_adjust_and_check_bounds_strided (cs_dispatch_context &ctx, const char *var_name, const cs_equation_param_t &eqp, bool face_gradient, int ircflb, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, const double(*restrict grad)[3][3], const cs_real_t *df_limiter, cs_real_t *restrict bounds)
 
template void cs_convection_diffusion_adjust_and_check_bounds_strided (cs_dispatch_context &ctx, const char *var_name, const cs_equation_param_t &eqp, bool face_gradient, int ircflb, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, const float(*restrict grad)[6][3], const cs_real_t *df_limiter, cs_real_t *restrict bounds)
 
template void cs_convection_diffusion_adjust_and_check_bounds_strided (cs_dispatch_context &ctx, const char *var_name, const cs_equation_param_t &eqp, bool face_gradient, int ircflb, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, const float(*restrict grad)[3][3], const cs_real_t *df_limiter, cs_real_t *restrict bounds)
 
cs_real_tcs_get_v_slope_test (int f_id, const cs_equation_param_t eqp)
 
void cs_beta_limiter_building (int f_id, int inc, const cs_real_t rovsdt[])
 Compute the beta blending coefficient of the beta limiter (ensuring preservation of a given min/max pair of values). More...
 
void cs_convection_diffusion_scalar (const cs_field_t *f, const cs_equation_param_t eqp, int icvflb, int inc, int imasac, const cs_real_t *restrict pvar, const int icvfli[], cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t *c_weight, cs_real_t *rhs, cs_real_2_t i_flux[], cs_real_t b_flux[])
 Add the explicit part of the convection/diffusion terms of a standard transport equation of a scalar field $ \varia $. More...
 
void cs_convection_diffusion_thermal (const cs_field_t *f, const cs_equation_param_t eqp, int inc, int imasac, const cs_real_t *pvar, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t *c_weight, const cs_real_t xcpp[], cs_real_t *restrict rhs)
 Add the explicit part of the convection/diffusion terms of a transport equation of a scalar field $ \varia $ such as the temperature. More...
 
void cs_face_convection_scalar (int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const int icvfli[], cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], cs_real_t i_conv_flux[][2], cs_real_t b_conv_flux[])
 Update face flux with convection contribution of a standard transport equation of a scalar field $ \varia $. More...
 
void cs_convection_diffusion_secvis (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *mq, cs_real_t thetap, const cs_real_t i_visc[], const cs_real_t i_secvis[], const cs_real_t b_secvis[], const cs_rreal_t gradv[][3][3], cs_real_3_t *restrict rhs)
 Compute balance contribution of the transpose grad(vel) term and grad(-2/3 div(vel)) More...
 
void cs_convection_anisotropic_leff_diffusion_secvis (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *mq, const cs_real_33_t i_visc[], const cs_real_t i_secvis[], const cs_rreal_t gradv[][3][3], cs_real_3_t *restrict rhs)
 Compute balance contribution of the transpose grad(vel) term and grad(-2/3 div(vel)) with anisotropic. More...
 
void cs_convection_diffusion_vector (int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int ivisep, int imasac, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const int icvfli[], cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], const cs_real_t b_secvis[], cs_real_3_t *restrict i_pvar, cs_real_3_t *restrict b_pvar, cs_real_3_t *restrict rhs)
 Add the explicit part of the convection/diffusion terms of a transport equation of a vector field $ \vect{\varia} $. More...
 
void cs_convection_diffusion_tensor (int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int imasac, cs_real_6_t *restrict pvar, const cs_real_6_t *restrict pvara, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict rhs)
 Add the explicit part of the convection/diffusion terms of a transport equation of a tensor field $ \tens{\varia} $. More...
 
void cs_anisotropic_diffusion_scalar (int idtvar, int f_id, const cs_equation_param_t eqp, int inc, const cs_real_t *restrict pvar, const cs_real_t *restrict pvara, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict c_weight, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict rhs)
 Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equation of a scalar field $ \varia $. More...
 
void cs_anisotropic_left_diffusion_vector (int idtvar, int f_id, const cs_equation_param_t eqp, int inc, int ivisep, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_33_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], cs_real_3_t *restrict rhs)
 Add explicit part of the terms of diffusion by a left-multiplying symmetric tensorial diffusivity for a transport equation of a vector field $ \vect{\varia} $. More...
 
void cs_anisotropic_right_diffusion_vector (int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_3_t *restrict rhs)
 Add explicit part of the terms of diffusion by a right-multiplying symmetric tensorial diffusivity for a transport equation of a vector field $ \vect{\varia} $. More...
 
void cs_anisotropic_diffusion_tensor (int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_6_t *restrict pvar, const cs_real_6_t *restrict pvara, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_6_t *restrict rhs)
 Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equation of a scalar field $ \varia $. More...
 
void cs_face_diffusion_potential (const cs_field_t *f, const cs_equation_param_t *eqp, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int iphydp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict visel, cs_real_t *restrict i_massflux, cs_real_t *restrict b_massflux)
 Update the face mass flux with the face pressure (or pressure increment, or pressure double increment) gradient. More...
 
void cs_face_anisotropic_diffusion_potential (const cs_field_t *f, const cs_equation_param_t *eqp, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int iphydp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict i_massflux, cs_real_t *restrict b_massflux)
 Add the explicit part of the pressure gradient term to the mass flux in case of anisotropic diffusion of the pressure field $ P $. More...
 
void cs_diffusion_potential (const cs_field_t *f, const cs_equation_param_t *eqp, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int iphydp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t *restrict diverg)
 Update the cell mass flux divergence with the face pressure (or pressure increment, or pressure double increment) gradient. More...
 
void cs_anisotropic_diffusion_potential (const cs_field_t *f, const cs_equation_param_t *eqp, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int iphydp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict diverg)
 Add the explicit part of the divergence of the mass flux due to the pressure gradient (analog to cs_anisotropic_diffusion_scalar). More...
 
void cs_cell_courant_number (const cs_field_t *f, cs_dispatch_context &ctx, cs_real_t *courant)
 
template<typename T >
void cs_slope_test_gradient (int f_id, cs_dispatch_context &ctx, const T(*grad)[3], T(*grdpa)[3], const cs_real_t *pvar, const cs_real_t val_f[], const cs_real_t *i_massflux)
 Compute the upwind gradient used in the slope tests. More...
 
template void cs_slope_test_gradient (int f_id, cs_dispatch_context &ctx, const cs_real_t(*grad)[3], cs_real_t(*grdpa)[3], const cs_real_t *pvar, const cs_real_t val_f[], const cs_real_t *i_massflux)
 
template void cs_slope_test_gradient (int f_id, cs_dispatch_context &ctx, const float(*grad)[3], float(*grdpa)[3], const cs_real_t *pvar, const cs_real_t val_f[], const cs_real_t *i_massflux)
 
template<cs_lnum_t stride, typename T >
void cs_slope_test_gradient_strided (cs_dispatch_context &ctx, const T grad[][stride][3], T(*restrict grdpa)[stride][3], const cs_real_t pvar[][stride], const cs_real_t val_f[][stride], const cs_real_t *i_massflux)
 Compute the upwind gradient used in the slope tests. More...
 
template void cs_slope_test_gradient_strided (cs_dispatch_context &ctx, const float grad[][3][3], float(*restrict grdpa)[3][3], const cs_real_t pvar[][3], const cs_real_t val_f[][3], const cs_real_t *i_massflux)
 
template void cs_slope_test_gradient_strided (cs_dispatch_context &ctx, const float grad[][6][3], float(*restrict grdpa)[6][3], const cs_real_t pvar[][6], const cs_real_t val_f[][6], const cs_real_t *i_massflux)
 
template void cs_slope_test_gradient_strided (cs_dispatch_context &ctx, const double grad[][3][3], double(*restrict grdpa)[3][3], const cs_real_t pvar[][3], const cs_real_t val_f[][3], const cs_real_t *i_massflux)
 
template void cs_slope_test_gradient_strided (cs_dispatch_context &ctx, const double grad[][6][3], double(*restrict grdpa)[6][3], const cs_real_t pvar[][6], const cs_real_t val_f[][6], const cs_real_t *i_massflux)
 
template<typename T >
void cs_upwind_gradient (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t *restrict pvar, T(*restrict grdpa)[3])
 Compute the upwind gradient used in the pure SOLU schemes (observed in the litterature). More...
 
template void cs_upwind_gradient (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t *restrict pvar, double(*restrict grdpa)[3])
 
template void cs_upwind_gradient (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t *restrict pvar, float(*restrict grdpa)[3])
 
template<cs_lnum_t stride, typename T >
void cs_upwind_gradient_strided (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t pvar[][stride], T grdpa[][stride][3])
 Compute the upwind gradient used in the pure SOLU schemes (observed in the litterature) for a vector. More...
 
template void cs_upwind_gradient_strided (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t pvar[][3], double(*restrict grdpa)[3][3])
 
template void cs_upwind_gradient_strided (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t pvar[][3], float(*restrict grdpa)[3][3])
 
template void cs_upwind_gradient_strided (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t pvar[][6], double(*restrict grdpa)[6][3])
 
template void cs_upwind_gradient_strided (cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t pvar[][6], float(*restrict grdpa)[6][3])
 
int cs_convection_diffusion_get_scheme_version (void)
 Query convection-diffusion scheme variants. More...
 
void cs_convection_diffusion_set_scheme_version (int version)
 Allow reverting to older convection-diffusion scheme variants. More...
 

Detailed Description

Convection-diffusion operators.

Convection-diffusion operators, v9 scheme.

Please refer to the convection-diffusion section of the theory guide for more information.

Bounds for diffusion scheme value reconstruction.

For non-orthogonal meshes, the diffusion scheme involves reconstruction of cell variables at points orthogonal to the associated face centers. Deactivating this reconstruction improves robustness, at the cost of the loss of the scheme's second order spatial accuracy and even consistency.

Since the reconstruction (based on 1st order Taylor expansion using the cell gradients or face gradients (mean or adjacent cell gradients) can lead to reconstructed values outside the range of values in neighboring cells, diffusion from a cell I with a given field value to a cell J with a higher value is possible if the reconstructed value at the I' location associated to face IJ is higher than the value in J, leading to loss of monotonicity.

To avoid this, using gradient limiters can reduce the reconstructed values range where computed gradients are detected as being too strong. It is now also possible to use bounded reconstruction, where the gradient value is not modified, but values outside the range of adjacent cell (and boundary face) values are clipped to values within this range.

For scalars, bounds are naturally based on the minimum and maximum values at adjacent cells and boundary faces. the actual upper bound applied in cell I is equal to $ \varia_clip = \varia_\celli + rc{\_}clip{\_}factor . (\varia_{max} - \varia_\celli) $ so using a reconstruction clipping factor of 0 is equivalent to disabling reconstruction, and using a clipping factor of 1 limits the reconstructed value to the exact bounds of adjacent cells (using face adjacency only or additional cell neighbors based on the cell neighborhood used for the matching reconstruction gradient. The lower bound is defined in a similar manner.

For vectors and tensors, bounds are not so straightforward, as component-based bounds are not invariant by rotation. So we choose a simpled dispersion bound for vectors, for which the Euclidean norm of the difference between the reconstructed vector and the non-reconstructed vector in cell I does not exceed that of if the norm of this difference with all adjacent cell and boundary face values. If this bound is exceeded, the reconstruction gradient is scaled so that the reconstructed value lies withing this bound (here again a reconstruction clipping factor multiplier may be used, so a factor of 0 disables reconstruction entirely, while a factor of 1 limits the reconstruction so as to exactly fit the bound).

This is illustrated in the following figures:

Vector values in cell _I_ and adjacent cells.

Placing vectors at the same origin, we can compute their dispersion:

Vector values in cell _I_ and adjacent cells.

Finally, the value reconstructed at I' should fir inside both circles:

Vector value bounds at _I'_.

Please refer to the convection-diffusion section of the theory guide for more information.

Function Documentation

◆ cs_anisotropic_diffusion_potential()

void cs_anisotropic_diffusion_potential ( const cs_field_t f,
const cs_equation_param_t eqp,
const cs_mesh_t m,
cs_mesh_quantities_t fvq,
int  init,
int  inc,
int  iphydp,
cs_real_3_t *restrict  frcxt,
cs_real_t *restrict  pvar,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_6_t *restrict  viscel,
const cs_real_2_t  weighf[],
const cs_real_t  weighb[],
cs_real_t *restrict  diverg 
)

Add the explicit part of the divergence of the mass flux due to the pressure gradient (analog to cs_anisotropic_diffusion_scalar).

More precisely, the divergence of the mass flux side $ \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij $ is updated as follows:

\[
\sum_{\fij \in \Facei{\celli}} \dot{m}_\fij
 = \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij
 - \sum_{\fij \in \Facei{\celli}}
   \left( \tens{\mu}_\fij \gradv_\fij P \cdot \vect{S}_\ij  \right)
\]

Parameters
[in]fpointer to field or nullptr
[in]eqpequation parameters
[in]mpointer to mesh
[in]fvqpointer to finite volume quantities
[in]initindicator
  • 1 initialize the mass flux to 0
  • 0 otherwise
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]iphydpindicator
  • 1 hydrostatic pressure taken into account
  • 0 otherwise
[in]frcxtbody force creating the hydrostatic pressure
[in]pvarsolved variable (pressure)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]viscelsymmetric cell tensor $ \tens{\mu}_\celli $
[in]weighfinternal face weight between cells i j in case of tensor diffusion
[in]weighbboundary face weight for cells i in case of tensor diffusion
[in,out]divergdivergence of the mass flux

◆ cs_anisotropic_diffusion_scalar()

void cs_anisotropic_diffusion_scalar ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  inc,
const cs_real_t *restrict  pvar,
const cs_real_t *restrict  pvara,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_6_t *restrict  c_weight,
const cs_real_2_t  weighf[],
const cs_real_t  weighb[],
cs_real_t *restrict  rhs 
)

Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equation of a scalar field $ \varia $.

More precisely, the right hand side $ Rhs $ is updated as follows:

\[
Rhs = Rhs - \sum_{\fij \in \Facei{\celli}}      \left(
     - \tens{\mu}_\fij \gradv_\fij \varia \cdot \vect{S}_\ij  \right)
\]

Warning:

  • $ Rhs $ has already been initialized before calling cs_anisotropic_diffusion_scalar!
  • mind the sign minus
  • the ghost cell values of pvar must already be synchronized
Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idindex of the current variable
[in]eqpequation parameters
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]pvarsolved variable (current time step)
[in]pvarasolved variable (previous time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]c_weightsymmetric cell tensor $ \tens{\mu}_\celli $
[in]weighfinternal face weight between cells i j in case of tensor diffusion
[in]weighbboundary face weight for cells i in case of tensor diffusion
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_anisotropic_diffusion_tensor()

void cs_anisotropic_diffusion_tensor ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  inc,
cs_real_6_t *restrict  pvar,
const cs_real_6_t *restrict  pvara,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_6_t *restrict  viscel,
const cs_real_2_t  weighf[],
const cs_real_t  weighb[],
cs_real_6_t *restrict  rhs 
)

Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equation of a scalar field $ \varia $.

More precisely, the right hand side $ Rhs $ is updated as follows:

\[
Rhs = Rhs - \sum_{\fij \in \Facei{\celli}}      \left(
     - \tens{\mu}_\fij \gradv_\fij \varia \cdot \vect{S}_\ij  \right)
\]

Warning:

  • $ Rhs $ has already been initialized before calling cs_anisotropic_diffusion_scalar!
  • mind the sign minus
Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idindex of the current variable
[in]eqpequation parameters
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]pvarsolved variable (current time step)
[in]pvarasolved variable (previous time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]viscelsymmetric cell tensor $ \tens{\mu}_\celli $
[in]weighfinternal face weight between cells i j in case of tensor diffusion
[in]weighbboundary face weight for cells i in case of tensor diffusion
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_anisotropic_left_diffusion_vector()

void cs_anisotropic_left_diffusion_vector ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  inc,
int  ivisep,
cs_real_3_t *restrict  pvar,
const cs_real_3_t *restrict  pvara,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_33_t  i_visc[],
const cs_real_t  b_visc[],
const cs_real_t  i_secvis[],
cs_real_3_t *restrict  rhs 
)

Add explicit part of the terms of diffusion by a left-multiplying symmetric tensorial diffusivity for a transport equation of a vector field $ \vect{\varia} $.

More precisely, the right hand side $ \vect{Rhs} $ is updated as follows:

\[
\vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}}      \left(
     - \gradt_\fij \vect{\varia} \tens{\mu}_\fij  \cdot \vect{S}_\ij  \right)
\]

Remark: if ivisep = 1, then we also take $ \mu \transpose{\gradt\vect{\varia}}
+ \lambda \trace{\gradt\vect{\varia}} $, where $ \lambda $ is the secondary viscosity, i.e. usually $ -\frac{2}{3} \mu $.

Warning:

  • $ \vect{Rhs} $ has already been initialized before calling the present function
  • mind the sign minus
Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idindex of the current variable
[in]eqpequation parameters
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]ivisepindicator to take $ \divv
                              \left(\mu \gradt \transpose{\vect{a}} \right)
                              -2/3 \grad\left( \mu \dive \vect{a} \right)$
  • 1 take into account,
[in]pvarsolved variable (current time step)
[in]pvarasolved variable (previous time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \tens{\mu}_\fij \dfrac{S_\fij}{\ipf\jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]i_secvissecondary viscosity at interior faces
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_anisotropic_right_diffusion_vector()

void cs_anisotropic_right_diffusion_vector ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  inc,
cs_real_3_t *restrict  pvar,
const cs_real_3_t *restrict  pvara,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_6_t *restrict  viscel,
const cs_real_2_t  weighf[],
const cs_real_t  weighb[],
cs_real_3_t *restrict  rhs 
)

Add explicit part of the terms of diffusion by a right-multiplying symmetric tensorial diffusivity for a transport equation of a vector field $ \vect{\varia} $.

More precisely, the right hand side $ \vect{Rhs} $ is updated as follows:

\[
\vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}}      \left(
     - \gradt_\fij \vect{\varia} \tens{\mu}_\fij  \cdot \vect{S}_\ij  \right)
\]

Warning:

  • $ \vect{Rhs} $ has already been initialized before calling the present function
  • mind the sign minus
Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idindex of the current variable
[in]eqpequation parameters
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]pvarsolved variable (current time step)
[in]pvarasolved variable (previous time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \tens{\mu}_\fij \dfrac{S_\fij}{\ipf\jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]viscelsymmetric cell tensor $ \tens{\mu}_\celli $
[in]weighfinternal face weight between cells i j in case of tensor diffusion
[in]weighbboundary face weight for cells i in case of tensor diffusion
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_beta_limiter_building()

void cs_beta_limiter_building ( int  f_id,
int  inc,
const cs_real_t  rovsdt[] 
)

Compute the beta blending coefficient of the beta limiter (ensuring preservation of a given min/max pair of values).

Parameters
[in]f_idfield id
[in]inc"not an increment" flag
[in]rovsdtrho * volume / dt

◆ cs_cell_courant_number()

void cs_cell_courant_number ( const cs_field_t f,
cs_dispatch_context ctx,
cs_real_t courant 
)

◆ cs_convection_anisotropic_leff_diffusion_secvis()

void cs_convection_anisotropic_leff_diffusion_secvis ( cs_dispatch_context ctx,
const cs_mesh_t m,
const cs_mesh_quantities_t mq,
const cs_real_33_t  i_visc[],
const cs_real_t  i_secvis[],
const cs_rreal_t  gradv[][3][3],
cs_real_3_t *restrict  rhs 
)

Compute balance contribution of the transpose grad(vel) term and grad(-2/3 div(vel)) with anisotropic.

Compute $ \mu \transpose{\gradt\vect{\varia}}
+ \lambda \trace{\gradt\vect{\varia}} $, where $ \lambda $ is the secondary viscosity, i.e. usually $ -\frac{2}{3} \mu $.

Warning
  • $ \vect{Rhs} $ must already have been initialized.
  • mind the minus sign
Parameters
[in,out]ctxreference to dispatch context
[in]mpointer to mesh structure
[in]mqpointer to mesh quantities
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]i_secvissecondary viscosity at interior faces
[in]b_secvissecondary viscosity at boundary faces
[in]gradvelocity gradient
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_convection_diffusion_adjust_and_check_bounds_scalar()

void cs_convection_diffusion_adjust_and_check_bounds_scalar ( cs_dispatch_context ctx,
const char *  var_name,
const cs_equation_param_t eqp,
bool  face_gradient,
int  ircflb,
const cs_mesh_t m,
const cs_mesh_quantities_t fvq,
const cs_real_t *restrict  pvar,
const T(*)  grad[3],
const cs_real_t df_limiter,
cs_real_t(*)  bounds[2] 
)

Adust bounds if rc_clip_factor < or > 1, and check bounds if required by verbosity level or postprocessing.

parameters: ctx <-> dispatch context var_name <– associated variable name eqp <– equation parameters face_gradient <– use face averaged gradient (instead of cell gradient) for reconstruction ircflb <– if > 0, reconstruction at boundary faces m <– pointer to associated mesh structure fvq <– pointer to associated finite volume quantities ircflu <– 1 if reconstruction should be done at boundaries pvar <– variable grad <– gradient of pvar (du/dx_j : grad[][j]) df_limiter <– optional reconstruction limiter factor, or null bounds <-> variable bounds (min, max)

◆ cs_convection_diffusion_adjust_and_check_bounds_strided() [1/5]

template void cs_convection_diffusion_adjust_and_check_bounds_strided ( cs_dispatch_context ctx,
const char *  var_name,
const cs_equation_param_t eqp,
bool  face_gradient,
int  ircflb,
const cs_mesh_t m,
const cs_mesh_quantities_t fvq,
const double(*)  grad[3][3],
const cs_real_t df_limiter,
cs_real_t *restrict  bounds 
)

◆ cs_convection_diffusion_adjust_and_check_bounds_strided() [2/5]

template void cs_convection_diffusion_adjust_and_check_bounds_strided ( cs_dispatch_context ctx,
const char *  var_name,
const cs_equation_param_t eqp,
bool  face_gradient,
int  ircflb,
const cs_mesh_t m,
const cs_mesh_quantities_t fvq,
const double(*)  grad[6][3],
const cs_real_t df_limiter,
cs_real_t *restrict  bounds 
)

◆ cs_convection_diffusion_adjust_and_check_bounds_strided() [3/5]

template void cs_convection_diffusion_adjust_and_check_bounds_strided ( cs_dispatch_context ctx,
const char *  var_name,
const cs_equation_param_t eqp,
bool  face_gradient,
int  ircflb,
const cs_mesh_t m,
const cs_mesh_quantities_t fvq,
const float(*)  grad[3][3],
const cs_real_t df_limiter,
cs_real_t *restrict  bounds 
)

◆ cs_convection_diffusion_adjust_and_check_bounds_strided() [4/5]

template void cs_convection_diffusion_adjust_and_check_bounds_strided ( cs_dispatch_context ctx,
const char *  var_name,
const cs_equation_param_t eqp,
bool  face_gradient,
int  ircflb,
const cs_mesh_t m,
const cs_mesh_quantities_t fvq,
const float(*)  grad[6][3],
const cs_real_t df_limiter,
cs_real_t *restrict  bounds 
)

◆ cs_convection_diffusion_adjust_and_check_bounds_strided() [5/5]

void cs_convection_diffusion_adjust_and_check_bounds_strided ( cs_dispatch_context ctx,
const char *  var_name,
const cs_equation_param_t eqp,
bool  face_gradient,
int  ircflb,
const cs_mesh_t m,
const cs_mesh_quantities_t fvq,
const T(*)  grad[stride][3],
const cs_real_t df_limiter,
cs_real_t *restrict  bounds 
)

Adust bounds if rc_clip_factor < or > 1, and check bounds if required by verbosity level or postprocessing.

template parameters: stride 3 for vectors, 6 for symmetric tensors

parameters: ctx <-> dispatch context var_name <– associated variable name eqp <– equation parameters face_gradient <– use face averaged gradient (instead of cell gradient) for reconstruction ircflb <– if > 0, reconstruction at boundary faces m <– pointer to associated mesh structure fvq <– pointer to associated finite volume quantities ircflu <– 1 if reconstruction should be done at boundaries grad <-> gradient of pvar (du/dx_j : grad[][j]) df_limiter <– optional reconstruction limiter factor, or null bounds <– bounds of pvar in neighboring cells

  • square distance to ref, square norm for vector
  • square distance to ref for tensor

◆ cs_convection_diffusion_get_scheme_version()

int cs_convection_diffusion_get_scheme_version ( void  )

Query convection-diffusion scheme variants.

Returns
specific scheme (i.e. 90 for v9.0) or -1 for current.

◆ cs_convection_diffusion_scalar()

void cs_convection_diffusion_scalar ( const cs_field_t f,
const cs_equation_param_t  eqp,
int  icvflb,
int  inc,
int  imasac,
const cs_real_t *restrict  pvar,
const int  icvfli[],
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
const cs_real_t c_weight,
cs_real_t rhs,
cs_real_2_t  i_flux[],
cs_real_t  b_flux[] 
)

Add the explicit part of the convection/diffusion terms of a standard transport equation of a scalar field $ \varia $.

More precisely, the right hand side $ Rhs $ is updated as follows:

\[
Rhs = Rhs - \sum_{\fij \in \Facei{\celli}}      \left(
       \dot{m}_\ij \left( \varia_\fij - \varia_\celli \right)
     - \mu_\fij \gradv_\fij \varia \cdot \vect{S}_\ij  \right)
\]

Warning:

  • $ Rhs $ has already been initialized before calling bilsc2!
  • mind the sign minus

Please refer to the bilsc2 section of the theory guide for more information.

Parameters
[in]fpointer to field, or null
[in]eqpequation parameters
[in]icvflbglobal indicator of boundary convection flux
  • 0 upwind scheme at all boundary faces
  • 1 imposed flux at some boundary faces
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]imasactake mass accumulation into account?
[in]pvarsolved variable
[in]icvfliboundary face indicator array of convection flux
  • 0 upwind scheme
  • 1 imposed flux
[in]bc_coeffsboundary condition structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]c_weightdiffusion gradient weighting
[in,out]rhsright hand side $ \vect{Rhs} $
[in,out]i_fluxinterior flux (or nullptr)
[in,out]b_fluxboundary flux (or nullptr)

◆ cs_convection_diffusion_secvis()

void cs_convection_diffusion_secvis ( cs_dispatch_context ctx,
const cs_mesh_t m,
const cs_mesh_quantities_t mq,
cs_real_t  thetap,
const cs_real_t  i_visc[],
const cs_real_t  i_secvis[],
const cs_real_t  b_secvis[],
const cs_rreal_t  gradv[][3][3],
cs_real_3_t *restrict  rhs 
)

Compute balance contribution of the transpose grad(vel) term and grad(-2/3 div(vel))

Compute $ \mu \transpose{\gradt\vect{\varia}}
+ \lambda \trace{\gradt\vect{\varia}} $, where $ \lambda $ is the secondary viscosity, i.e. usually $ -\frac{2}{3} \mu $.

Warning
  • $ \vect{Rhs} $ must already have been initialized.
  • mind the minus sign
Parameters
[in,out]ctxreference to dispatch context
[in]mpointer to mesh structure
[in]mqpointer to mesh quantities
[in]thetaptheta-scheme value
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]i_secvissecondary viscosity at interior faces
[in]b_secvissecondary viscosity at boundary faces
[in]gradvvelocity gradient
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_convection_diffusion_set_scheme_version()

void cs_convection_diffusion_set_scheme_version ( int  version)

Allow reverting to older convection-diffusion scheme variants.

Parameters
[in]versionScheme version (90 for v9.0) -1 for current)

◆ cs_convection_diffusion_tensor()

void cs_convection_diffusion_tensor ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  icvflb,
int  inc,
int  imasac,
cs_real_6_t *restrict  pvar,
const cs_real_6_t *restrict  pvara,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_6_t *restrict  rhs 
)

Add the explicit part of the convection/diffusion terms of a transport equation of a tensor field $ \tens{\varia} $.

More precisely, the right hand side $ \tens{Rhs} $ is updated as follows:

\[
 \tens{Rhs} = \tens{Rhs} - \sum_{\fij \in \Facei{\celli}}      \left(
        \dot{m}_\ij \left( \tens{\varia}_\fij - \tens{\varia}_\celli \right)
      - \mu_\fij \gradt_\fij \tens{\varia} \cdot \tens{S}_\ij  \right)
\]

Warning:

  • $ \tens{Rhs} $ has already been initialized before calling bilsc!
  • mind the sign minus
Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idindex of the current variable
[in]eqpequation parameters
[in]icvflbglobal indicator of boundary convection flux
  • 0 upwind scheme at all boundary faces
  • 1 imposed flux at some boundary faces
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]imasactake mass accumulation into account?
[in]pvarsolved velocity (current time step)
[in]pvarasolved velocity (previous time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in,out]rhsright hand side $ \tens{Rhs} $

◆ cs_convection_diffusion_thermal()

void cs_convection_diffusion_thermal ( const cs_field_t f,
const cs_equation_param_t  eqp,
int  inc,
int  imasac,
const cs_real_t pvar,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
const cs_real_t c_weight,
const cs_real_t  xcpp[],
cs_real_t *restrict  rhs 
)

Add the explicit part of the convection/diffusion terms of a transport equation of a scalar field $ \varia $ such as the temperature.

More precisely, the right hand side $ Rhs $ is updated as follows:

\[
Rhs = Rhs + \sum_{\fij \in \Facei{\celli}}      \left(
       C_p\dot{m}_\ij \varia_\fij
     - \lambda_\fij \gradv_\fij \varia \cdot \vect{S}_\ij  \right)
\]

Warning
$ Rhs $ must have been initialized before calling this function!
The ghost cell values of pvar must already have been synchronized.
Parameters
[in]fpointer to field, or null
[in]eqpequation parameters)
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]imasactake mass accumulation into account?
[in]pvarsolved variable
[in]bc_coeffsboundary condition structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]w_stridestride for weighting coefficient
[in]c_weightdiffusion gradient weighting
[in]xcpparray of specific heat ( $ C_p $)
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_convection_diffusion_vector()

void cs_convection_diffusion_vector ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  icvflb,
int  inc,
int  ivisep,
int  imasac,
cs_real_3_t *restrict  pvar,
const cs_real_3_t *restrict  pvara,
const int  icvfli[],
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
const cs_real_t  i_secvis[],
const cs_real_t  b_secvis[],
cs_real_3_t *restrict  i_pvar,
cs_real_3_t *restrict  b_pvar,
cs_real_3_t *restrict  rhs 
)

Add the explicit part of the convection/diffusion terms of a transport equation of a vector field $ \vect{\varia} $.

More precisely, the right hand side $ \vect{Rhs} $ is updated as follows:

\[
 \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}}      \left(
        \dot{m}_\ij \left( \vect{\varia}_\fij - \vect{\varia}_\celli \right)
      - \mu_\fij \gradt_\fij \vect{\varia} \cdot \vect{S}_\ij  \right)
\]

Remark: if ivisep = 1, then we also take $ \mu \transpose{\gradt\vect{\varia}}
+ \lambda \trace{\gradt\vect{\varia}} $, where $ \lambda $ is the secondary viscosity, i.e. usually $ -\frac{2}{3} \mu $.

Warning:

  • $ \vect{Rhs} $ has already been initialized before calling bilsc!
  • mind the sign minus
Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idindex of the current variable
[in]eqpequation parameters
[in]icvflbglobal indicator of boundary convection flux
  • 0 upwind scheme at all boundary faces
  • 1 imposed flux at some boundary faces
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]ivisepindicator to take $ \divv
                              \left(\mu \gradt \transpose{\vect{a}} \right)
                              -2/3 \grad\left( \mu \dive \vect{a} \right)$
  • 1 take into account,
  • 0 otherwise
[in]imasactake mass accumulation into account?
[in]pvarsolved velocity (current time step)
[in]pvarasolved velocity (previous time step)
[in]icvfliboundary face indicator array of convection flux
  • 0 upwind scheme
  • 1 imposed flux
[in]bc_coeffsboundary conditions structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]i_secvissecondary viscosity at interior faces
[in]b_secvissecondary viscosity at boundary faces
[in]i_pvarvelocity at interior faces
[in]b_pvarvelocity at boundary faces
[in,out]rhsright hand side $ \vect{Rhs} $

◆ cs_diffusion_potential()

void cs_diffusion_potential ( const cs_field_t f,
const cs_equation_param_t eqp,
const cs_mesh_t m,
cs_mesh_quantities_t fvq,
int  init,
int  inc,
int  iphydp,
cs_real_3_t *restrict  frcxt,
cs_real_t *restrict  pvar,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_t  visel[],
cs_real_t *restrict  diverg 
)

Update the cell mass flux divergence with the face pressure (or pressure increment, or pressure double increment) gradient.

\[
\dot{m}_\ij = \dot{m}_\ij
            - \sum_j \Delta t \grad_\fij p \cdot \vect{S}_\ij
\]

Parameters
[in]fpointer to field or nullptr
[in]eqpequation parameters
[in]mpointer to mesh
[in]fvqpointer to finite volume quantities
[in]initindicator
  • 1 initialize the mass flux to 0
  • 0 otherwise
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]iphydphydrostatic pressure indicator
[in]frcxtbody force creating the hydrostatic pressure
[in]pvarsolved variable (current time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]viselviscosity by cell
[in,out]divergmass flux divergence

◆ cs_face_anisotropic_diffusion_potential()

void cs_face_anisotropic_diffusion_potential ( const cs_field_t f,
const cs_equation_param_t eqp,
const cs_mesh_t m,
cs_mesh_quantities_t fvq,
int  init,
int  inc,
int  iphydp,
cs_real_3_t *restrict  frcxt,
cs_real_t *restrict  pvar,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_6_t *restrict  viscel,
const cs_real_2_t  weighf[],
const cs_real_t  weighb[],
cs_real_t *restrict  i_massflux,
cs_real_t *restrict  b_massflux 
)

Add the explicit part of the pressure gradient term to the mass flux in case of anisotropic diffusion of the pressure field $ P $.

More precisely, the mass flux side $ \dot{m}_\fij $ is updated as follows:

\[
\dot{m}_\fij = \dot{m}_\fij -
             \left( \tens{\mu}_\fij \gradv_\fij P \cdot \vect{S}_\ij  \right)
\]

Parameters
[in]fpointer to field or nullptr
[in]eqpequation parameters
[in]mpointer to mesh
[in]fvqpointer to finite volume quantities
[in]initindicator
  • 1 initialize the mass flux to 0
  • 0 otherwise
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]iphydpindicator
  • 1 hydrostatic pressure taken into account
  • 0 otherwise
[in]frcxtbody force creating the hydrostatic pressure
[in]pvarsolved variable (pressure)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]viscelsymmetric cell tensor $ \tens{\mu}_\celli $
[in]weighfinternal face weight between cells i j in case of tensor diffusion
[in]weighbboundary face weight for cells i in case of tensor diffusion
[in,out]i_massfluxmass flux at interior faces
[in,out]b_massfluxmass flux at boundary faces

◆ cs_face_convection_scalar()

void cs_face_convection_scalar ( int  idtvar,
int  f_id,
const cs_equation_param_t  eqp,
int  icvflb,
int  inc,
int  imasac,
cs_real_t *restrict  pvar,
const cs_real_t *restrict  pvara,
const int  icvfli[],
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
cs_real_t  i_conv_flux[][2],
cs_real_t  b_conv_flux[] 
)

Update face flux with convection contribution of a standard transport equation of a scalar field $ \varia $.

\[
C_\ij = \dot{m}_\ij \left( \varia_\fij - \varia_\celli \right)
\]

Parameters
[in]idtvarindicator of the temporal scheme
[in]f_idfield id (or -1)
[in]eqpequation parameters
[in]icvflbglobal indicator of boundary convection flux
  • 0 upwind scheme at all boundary faces
  • 1 imposed flux at some boundary faces
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]imasactake mass accumulation into account?
[in]pvarsolved variable (current time step)
[in]pvarasolved variable (previous time step)
[in]icvfliboundary face indicator array of convection flux
  • 0 upwind scheme
  • 1 imposed flux
[in]bc_coeffsboundary condition structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in,out]i_conv_fluxscalar convection flux at interior faces
[in,out]b_conv_fluxscalar convection flux at boundary faces

◆ cs_face_diffusion_potential()

void cs_face_diffusion_potential ( const cs_field_t f,
const cs_equation_param_t eqp,
const cs_mesh_t m,
cs_mesh_quantities_t fvq,
int  init,
int  inc,
int  iphydp,
cs_real_3_t *restrict  frcxt,
cs_real_t *restrict  pvar,
cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_visc[],
const cs_real_t  b_visc[],
cs_real_t *restrict  visel,
cs_real_t *restrict  i_massflux,
cs_real_t *restrict  b_massflux 
)

Update the face mass flux with the face pressure (or pressure increment, or pressure double increment) gradient.

\[
\dot{m}_\ij = \dot{m}_\ij
            - \Delta t \grad_\fij \delta p \cdot \vect{S}_\ij
\]

Please refer to the cs_face_diffusion_potential/cs_diffusion_potential section of the theory guide for more information.

Parameters
[in]fpointer to field or nullptr
[in]eqpequation parameters
[in]mpointer to mesh
[in]fvqpointer to finite volume quantities
[in]initindicator
  • 1 initialize the mass flux to 0
  • 0 otherwise
[in]incindicator
  • 0 when solving an increment
  • 1 otherwise
[in]iphydphydrostatic pressure indicator
[in]frcxtbody force creating the hydrostatic pressure
[in]pvarsolved variable (current time step)
[in]bc_coeffsboundary condition structure for the variable
[in]i_visc$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} $ at interior faces for the r.h.s.
[in]b_visc$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} $ at border faces for the r.h.s.
[in]viselviscosity by cell
[in,out]i_massfluxmass flux at interior faces
[in,out]b_massfluxmass flux at boundary faces

◆ cs_get_v_slope_test()

cs_real_t * cs_get_v_slope_test ( int  f_id,
const cs_equation_param_t  eqp 
)

◆ cs_slope_test_gradient() [1/3]

template void cs_slope_test_gradient ( int  f_id,
cs_dispatch_context ctx,
const cs_real_t(*)  grad[3],
cs_real_t(*)  grdpa[3],
const cs_real_t pvar,
const cs_real_t  val_f[],
const cs_real_t i_massflux 
)

◆ cs_slope_test_gradient() [2/3]

template void cs_slope_test_gradient ( int  f_id,
cs_dispatch_context ctx,
const float(*)  grad[3],
float(*)  grdpa[3],
const cs_real_t pvar,
const cs_real_t  val_f[],
const cs_real_t i_massflux 
)

◆ cs_slope_test_gradient() [3/3]

void cs_slope_test_gradient ( int  f_id,
cs_dispatch_context ctx,
const T(*)  grad[3],
T(*)  grdpa[3],
const cs_real_t pvar,
const cs_real_t  val_f[],
const cs_real_t i_massflux 
)

Compute the upwind gradient used in the slope tests.

This function assumes the input gradient and pvar values have already been synchronized.

Parameters
[in]f_idfield id
[in]ctxReference to dispatch context
[in]gradstandard gradient
[out]grdpaupwind gradient
[in]pvarvalues
[in]val_fface values for gradient
[in]i_massfluxmass flux at interior faces

◆ cs_slope_test_gradient_strided() [1/5]

template void cs_slope_test_gradient_strided ( cs_dispatch_context ctx,
const double  grad[][3][3],
double(*)  grdpa[3][3],
const cs_real_t  pvar[][3],
const cs_real_t  val_f[][3],
const cs_real_t i_massflux 
)

◆ cs_slope_test_gradient_strided() [2/5]

template void cs_slope_test_gradient_strided ( cs_dispatch_context ctx,
const double  grad[][6][3],
double(*)  grdpa[6][3],
const cs_real_t  pvar[][6],
const cs_real_t  val_f[][6],
const cs_real_t i_massflux 
)

◆ cs_slope_test_gradient_strided() [3/5]

template void cs_slope_test_gradient_strided ( cs_dispatch_context ctx,
const float  grad[][3][3],
float(*)  grdpa[3][3],
const cs_real_t  pvar[][3],
const cs_real_t  val_f[][3],
const cs_real_t i_massflux 
)

◆ cs_slope_test_gradient_strided() [4/5]

template void cs_slope_test_gradient_strided ( cs_dispatch_context ctx,
const float  grad[][6][3],
float(*)  grdpa[6][3],
const cs_real_t  pvar[][6],
const cs_real_t  val_f[][6],
const cs_real_t i_massflux 
)

◆ cs_slope_test_gradient_strided() [5/5]

void cs_slope_test_gradient_strided ( cs_dispatch_context ctx,
const T  grad[][stride][3],
T(*)  grdpa[stride][3],
const cs_real_t  pvar[][stride],
const cs_real_t  val_f[][stride],
const cs_real_t i_massflux 
)

Compute the upwind gradient used in the slope tests.

template parameters: stride 1 for scalars, 3 for vectors, 6 for symmetric tensors

This function assumes the input gradient and pvar values have already been synchronized.

Parameters
[in]ctxReference to dispatch context
[in]gradstandard gradient
[out]grdpaupwind gradient
[in]pvarvalues
[in]val_fface values for gradient
[in]i_massfluxmass flux at interior faces

◆ cs_upwind_gradient() [1/3]

template void cs_upwind_gradient ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t *restrict  pvar,
double(*)  grdpa[3] 
)

◆ cs_upwind_gradient() [2/3]

template void cs_upwind_gradient ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t *restrict  pvar,
float(*)  grdpa[3] 
)

◆ cs_upwind_gradient() [3/3]

void cs_upwind_gradient ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t *restrict  pvar,
T(*)  grdpa[3] 
)

Compute the upwind gradient used in the pure SOLU schemes (observed in the litterature).

Parameters
[in]ctxReference to dispatch context
[in]incNot an increment flag
[in]halo_typehalo type
[in]bc_coeffsboundary condition structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in]pvarvalues
[out]grdpaupwind gradient

◆ cs_upwind_gradient_strided() [1/5]

template void cs_upwind_gradient_strided ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  pvar[][3],
double(*)  grdpa[3][3] 
)

◆ cs_upwind_gradient_strided() [2/5]

template void cs_upwind_gradient_strided ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  pvar[][3],
float(*)  grdpa[3][3] 
)

◆ cs_upwind_gradient_strided() [3/5]

template void cs_upwind_gradient_strided ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  pvar[][6],
double(*)  grdpa[6][3] 
)

◆ cs_upwind_gradient_strided() [4/5]

template void cs_upwind_gradient_strided ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  pvar[][6],
float(*)  grdpa[6][3] 
)

◆ cs_upwind_gradient_strided() [5/5]

void cs_upwind_gradient_strided ( cs_dispatch_context ctx,
const int  inc,
const cs_halo_type_t  halo_type,
const cs_field_bc_coeffs_t bc_coeffs,
const cs_real_t  i_massflux[],
const cs_real_t  b_massflux[],
const cs_real_t  pvar[][stride],
grdpa[][stride][3] 
)

Compute the upwind gradient used in the pure SOLU schemes (observed in the litterature) for a vector.

Parameters
[in]ctxReference to dispatch context
[in]incNot an increment flag
[in]halo_typehalo type
[in]bc_coeffsboundary condition structure for the variable
[in]i_massfluxmass flux at interior faces
[in]b_massfluxmass flux at boundary faces
[in]pvarvalues
[out]grdpaupwind gradient