9.0
general documentation
Loading...
Searching...
No Matches
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-2025 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
44
45/*=============================================================================
46 * Local Macro definitions
47 *============================================================================*/
48
49/*============================================================================
50 * Type definition
51 *============================================================================*/
52
53/*============================================================================
54 * Global variables
55 *============================================================================*/
56
57/*=============================================================================
58 * Public function prototypes
59 *============================================================================*/
60
61/*----------------------------------------------------------------------------*/
62/*
63 * \brief Add \f$ \rho \vect{u} \cdot \vect{s}_\ij\f$ to
64 * the mass flux \f$ \dot{m}_\ij \f$.
65 *
66 * For the reconstruction, \f$ \gradt \left(\rho \vect{u} \right) \f$ is
67 * computed with the following approximated boundary conditions:
68 * - \f$ \vect{a}_{\rho u} = \rho_\fib \vect{a}_u \f$
69 * - \f$ \tens{b}_{\rho u} = \tens{b}_u \f$
70 *
71 * For the mass flux at the boundary we have:
72 * \f[
73 * \dot{m}_\ib = \left[ \rho_\fib \vect{a}_u + \rho_\fib \tens{b}_u \vect{u}
74 * + \tens{b}_u \left(\gradt \vect{u} \cdot \vect{\centi \centip}\right)\right]
75 * \cdot \vect{s}_\ij
76 * \f]
77 * The last equation uses some approximations detailed in the theory guide.
78 *
79 * \param[in] m pointer to mesh
80 * \param[in] fvq pointer to finite volume quantities
81 * \param[in] f_id field id (or -1)
82 * \param[in] itypfl indicator (take rho into account or not)
83 * - 1 compute \f$ \rho\vect{u}\cdot\vect{s} \f$
84 * - 0 compute \f$ \vect{u}\cdot\vect{s} \f$
85 * \param[in] iflmb0 the mass flux is set to 0 on walls and
86 * symmetries if = 1
87 * \param[in] init the mass flux is initialized to 0 if > 0
88 * \param[in] inc indicator
89 * - 0 solve an increment
90 * - 1 otherwise
91 * \param[in] imrgra indicator
92 * - 0 iterative gradient
93 * - 1 least square gradient
94 * \param[in] nswrgu number of sweeps for the reconstruction
95 * of the gradients
96 * \param[in] imligu clipping gradient method
97 * - < 0 no clipping
98 * - = 0 thanks to neighbooring gradients
99 * - = 1 thanks to the mean gradient
100 * \param[in] iwarnu verbosity
101 * \param[in] epsrgu relative precision for the gradient
102 * reconstruction
103 * \param[in] climgu clipping coefficient for the computation of
104 * the gradient
105 * \param[in] rom cell density
106 * \param[in] romb density at boundary faces
107 * \param[in] vel vector variable
108 * \param[in] bc_coeffs_v BC structure for the vector variable
109 * \param[in,out] i_massflux mass flux at interior faces \f$ \dot{m}_\fij \f$
110 * \param[in,out] b_massflux mass flux at boundary faces \f$ \dot{m}_\fib \f$
111 */
112/*----------------------------------------------------------------------------*/
113
114void
116 const cs_mesh_quantities_t *fvq,
117 int f_id,
118 int itypfl,
119 int iflmb0,
120 int init,
121 int inc,
122 int imrgra,
123 int nswrgu,
124 cs_gradient_limit_t imligu,
125 int iwarnu,
126 double epsrgu,
127 double climgu,
128 const cs_real_t rom[],
129 const cs_real_t romb[],
130 const cs_real_3_t vel[],
131 cs_field_bc_coeffs_t *bc_coeffs_v,
132 cs_real_t *i_massflux,
133 cs_real_t *b_massflux);
134
135/*----------------------------------------------------------------------------*/
151/*----------------------------------------------------------------------------*/
152
153void
155 int init,
156 const cs_real_t i_massflux[],
157 const cs_real_t b_massflux[],
158 cs_real_t *diverg);
159
160/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
178void
180 int init,
181 const cs_real_3_t i_massflux[],
182 const cs_real_3_t b_massflux[],
183 cs_real_3_t *diverg);
184
185/*----------------------------------------------------------------------------*/
211/*----------------------------------------------------------------------------*/
212
213void
216 int init,
217 int nswrgu,
218 const cs_real_3_t frcxt[],
219 const cs_real_t cofbfp[],
220 cs_real_t *i_massflux,
221 cs_real_t *b_massflux,
222 const cs_real_t i_visc[],
223 const cs_real_t b_visc[],
224 const cs_real_t viselx[],
225 const cs_real_t visely[],
226 const cs_real_t viselz[]);
227
228/*----------------------------------------------------------------------------*/
257/*----------------------------------------------------------------------------*/
258
259void
262 int init,
263 int nswrgp,
264 int ircflp,
265 const cs_real_3_t frcxt[],
266 const cs_real_t cofbfp[],
267 const cs_real_t i_visc[],
268 const cs_real_t b_visc[],
269 cs_real_6_t viscel[],
270 const cs_real_2_t weighf[],
271 cs_real_t *i_massflux,
272 cs_real_t *b_massflux);
273
274/*----------------------------------------------------------------------------*/
311/*----------------------------------------------------------------------------*/
312
313void
315 const cs_mesh_quantities_t *fvq,
316 int f_id,
317 int itypfl,
318 int iflmb0,
319 int init,
320 int inc,
321 int imrgra,
322 int nswrgu,
323 cs_gradient_limit_t imligu,
324 int iwarnu,
325 double epsrgu,
326 double climgu,
327 const cs_real_t c_rho[],
328 const cs_real_t b_rho[],
329 const cs_real_6_t c_var[],
330 const cs_field_bc_coeffs_t *bc_coeffs_ts,
331 cs_real_3_t *i_massflux,
332 cs_real_3_t *b_massflux);
333
334/*----------------------------------------------------------------------------*/
335
337
338#endif /* __CS_DIVERGENCE_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:542
double cs_real_t
Floating-point value.
Definition cs_defs.h:342
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition cs_defs.h:358
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition cs_defs.h:361
#define END_C_DECLS
Definition cs_defs.h:543
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition cs_defs.h:359
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, int imrgra, int nswrgu, cs_gradient_limit_t imligu, int iwarnu, double epsrgu, double climgu, 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:70
cs_gradient_limit_t
Definition cs_gradient.h:72
Field boundary condition descriptor (for variables)
Definition cs_field.h:121
Definition cs_mesh_quantities.h:92
Definition cs_mesh.h:85