9.2
general documentation
cs_convection_diffusion_v9.cpp File Reference
#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_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_v9.cpp:

Functions

bool cs_convection_diffusion_scalar_v9 (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...
 
bool cs_convection_diffusion_thermal_v9 (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...
 
bool cs_convection_diffusion_vector_v9 (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...
 
bool cs_convection_diffusion_tensor_v9 (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...
 

Function Documentation

◆ cs_convection_diffusion_scalar_v9()

bool cs_convection_diffusion_scalar_v9 ( 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)
Returns
true if v9 algorithm called, false if nothing done

◆ cs_convection_diffusion_tensor_v9()

bool cs_convection_diffusion_tensor_v9 ( 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} $
Returns
true if v9 algorithm called, false if nothing done

◆ cs_convection_diffusion_thermal_v9()

bool cs_convection_diffusion_thermal_v9 ( 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} $
Returns
true if v9 algorithm called, false if nothing done

◆ cs_convection_diffusion_vector_v9()

bool cs_convection_diffusion_vector_v9 ( 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} $
Returns
true if v9 algorithm called, false if nothing done