9.2
general documentation
cs_divergence.h
Go to the documentation of this file.
1#ifndef CS_DIVERGENCE_H
2#define CS_DIVERGENCE_H
3
4/*============================================================================
5 * Divergence operators.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_base.h"
35#include "base/cs_field.h"
36#include "base/cs_halo.h"
37#include "alge/cs_gradient.h"
38#include "mesh/cs_mesh.h"
40
41/*=============================================================================
42 * Local Macro definitions
43 *============================================================================*/
44
45/*============================================================================
46 * Type definition
47 *============================================================================*/
48
49/*============================================================================
50 * Global variables
51 *============================================================================*/
52
53/*=============================================================================
54 * Public function prototypes
55 *============================================================================*/
56
57/*----------------------------------------------------------------------------*/
58/*
59 * \brief Add \f$ \rho \vect{u} \cdot \vect{s}_\ij\f$ to
60 * the mass flux \f$ \dot{m}_\ij \f$.
61 *
62 * For the reconstruction, \f$ \gradt \left(\rho \vect{u} \right) \f$ is
63 * computed with the following approximated boundary conditions:
64 * - \f$ \vect{a}_{\rho u} = \rho_\fib \vect{a}_u \f$
65 * - \f$ \tens{b}_{\rho u} = \tens{b}_u \f$
66 *
67 * For the mass flux at the boundary we have:
68 * \f[
69 * \dot{m}_\ib = \left[ \rho_\fib \vect{a}_u + \rho_\fib \tens{b}_u \vect{u}
70 * + \tens{b}_u \left(\gradt \vect{u} \cdot \vect{\centi \centip}\right)\right]
71 * \cdot \vect{s}_\ij
72 * \f]
73 * The last equation uses some approximations detailed in the theory guide.
74 *
75 * \param[in] m pointer to mesh
76 * \param[in] fvq pointer to finite volume quantities
77 * \param[in] f_id field id (or -1)
78 * \param[in] itypfl indicator (take rho into account or not)
79 * - 1 compute \f$ \rho\vect{u}\cdot\vect{s} \f$
80 * - 0 compute \f$ \vect{u}\cdot\vect{s} \f$
81 * \param[in] iflmb0 the mass flux is set to 0 on walls and
82 * symmetries if = 1
83 * \param[in] init the mass flux is initialized to 0 if > 0
84 * \param[in] inc indicator
85 * - 0 solve an increment
86 * - 1 otherwise
87 * \param[in] imrgra indicator
88 * - 0 iterative gradient
89 * - 1 least square gradient
90 * \param[in] nswrgu number of sweeps for the reconstruction
91 * of the gradients
92 * \param[in] imligu clipping gradient method
93 * - < 0 no clipping
94 * - = 0 thanks to neighbooring gradients
95 * - = 1 thanks to the mean gradient
96 * \param[in] iwarnu verbosity
97 * \param[in] epsrgu relative precision for the gradient
98 * reconstruction
99 * \param[in] climgu clipping coefficient for the computation of
100 * the gradient
101 * \param[in] rom cell density
102 * \param[in] romb density at boundary faces
103 * \param[in] vel vector variable
104 * \param[in] bc_coeffs_v BC structure for the vector variable
105 * \param[in,out] i_massflux mass flux at interior faces \f$ \dot{m}_\fij \f$
106 * \param[in,out] b_massflux mass flux at boundary faces \f$ \dot{m}_\fib \f$
107 */
108/*----------------------------------------------------------------------------*/
109
110void
112 const cs_mesh_quantities_t *fvq,
113 int f_id,
114 int itypfl,
115 int iflmb0,
116 int init,
117 int inc,
118 int imrgra,
119 int nswrgu,
120 cs_gradient_limit_t imligu,
121 int iwarnu,
122 double epsrgu,
123 double climgu,
124 const cs_real_t rom[],
125 const cs_real_t romb[],
126 const cs_real_3_t vel[],
127 cs_field_bc_coeffs_t *bc_coeffs_v,
128 cs_real_t *i_massflux,
129 cs_real_t *b_massflux);
130
131/*----------------------------------------------------------------------------*/
147/*----------------------------------------------------------------------------*/
148
149void
151 int init,
152 const cs_real_t i_massflux[],
153 const cs_real_t b_massflux[],
154 cs_real_t *diverg);
155
156/*----------------------------------------------------------------------------*/
172/*----------------------------------------------------------------------------*/
173
174void
176 int init,
177 const cs_real_3_t i_massflux[],
178 const cs_real_3_t b_massflux[],
179 cs_real_3_t *diverg);
180
181/*----------------------------------------------------------------------------*/
207/*----------------------------------------------------------------------------*/
208
209void
212 int init,
213 int nswrgu,
214 const cs_real_3_t frcxt[],
215 const cs_real_t cofbfp[],
216 cs_real_t *i_massflux,
217 cs_real_t *b_massflux,
218 const cs_real_t i_visc[],
219 const cs_real_t b_visc[],
220 const cs_real_t viselx[],
221 const cs_real_t visely[],
222 const cs_real_t viselz[]);
223
224/*----------------------------------------------------------------------------*/
253/*----------------------------------------------------------------------------*/
254
255void
258 int init,
259 int nswrgp,
260 int ircflp,
261 const cs_real_3_t frcxt[],
262 const cs_real_t cofbfp[],
263 const cs_real_t i_visc[],
264 const cs_real_t b_visc[],
265 cs_real_6_t viscel[],
266 const cs_real_2_t weighf[],
267 cs_real_t *i_massflux,
268 cs_real_t *b_massflux);
269
270/*----------------------------------------------------------------------------*/
307/*----------------------------------------------------------------------------*/
308
309void
311 const cs_mesh_quantities_t *fvq,
312 int f_id,
313 int itypfl,
314 int iflmb0,
315 int init,
316 int inc,
317 const cs_equation_param_t *eqp,
318 const cs_real_t c_rho[],
319 const cs_real_t b_rho[],
320 const cs_real_6_t c_var[],
321 const cs_field_bc_coeffs_t *bc_coeffs_ts,
322 cs_real_3_t *i_massflux,
323 cs_real_3_t *b_massflux);
324
325/*----------------------------------------------------------------------------*/
326
327#endif /* CS_DIVERGENCE_H */
Field boundary condition descriptor (for variables)
Definition: cs_field.h:107
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:349
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:348
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:351
void cs_ext_force_anisotropic_flux(const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int nswrgp, int ircflp, const cs_real_3_t frcxt[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t viscel[], const cs_real_2_t weighf[], cs_real_t *i_massflux, cs_real_t *b_massflux)
Project the external source terms to the faces in coherence with cs_face_anisotropic_diffusion_scalar...
void cs_tensor_divergence(const cs_mesh_t *m, int init, const cs_real_3_t i_massflux[], const cs_real_3_t b_massflux[], cs_real_3_t *diverg)
Add the integrated mass flux on the cells for a tensor variable.
void cs_divergence(const cs_mesh_t *m, int init, const cs_real_t i_massflux[], const cs_real_t b_massflux[], cs_real_t *diverg)
Add the integrated mass flux on the cells.
void cs_tensor_face_flux(const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, int f_id, int itypfl, int iflmb0, int init, int inc, const cs_equation_param_t *eqp, const cs_real_t c_rho[], const cs_real_t b_rho[], const cs_real_6_t c_var[], const cs_field_bc_coeffs_t *bc_coeffs_ts, cs_real_3_t *i_massflux, cs_real_3_t *b_massflux)
Add to a flux.
void cs_mass_flux(const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, int f_id, int itypfl, int iflmb0, int init, int inc, int imrgra, int nswrgu, cs_gradient_limit_t imligu, int iwarnu, double epsrgu, double climgu, const cs_real_t rom[], const cs_real_t romb[], const cs_real_3_t vel[], cs_field_bc_coeffs_t *bc_coeffs_v, cs_real_t *i_massflux, cs_real_t *b_massflux)
void cs_ext_force_flux(const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int nswrgu, const cs_real_3_t frcxt[], const cs_real_t cofbfp[], cs_real_t *i_massflux, cs_real_t *b_massflux, const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t viselx[], const cs_real_t visely[], const cs_real_t viselz[])
Project the external source terms to the faces in coherence with cs_face_diffusion_scalar for the imp...
@ vel
Definition: cs_field_pointer.h:66
cs_gradient_limit_t
Definition: cs_gradient.h:73
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:190
Definition: cs_mesh_quantities.h:88
Definition: cs_mesh.h:85