8.1
general documentation
cs_pressure_correction.h
Go to the documentation of this file.
1 #ifndef __CS_PRESSURE_CORRECTION_H__
2 #define __CS_PRESSURE_CORRECTION_H__
3 
4 /*============================================================================
5  * Pressure correction.
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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 "cs_defs.h"
35 
36 #include "cs_equation.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Type definitions
44  *============================================================================*/
45 
46 typedef struct {
47 
52 
58 
63 
69 
74 
79 
85 
87 
89 
90 /*============================================================================
91  * Public function definitions
92  *============================================================================*/
93 
94 /*----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------*/
99 
100 void
102 
103 /*----------------------------------------------------------------------------*/
107 /*----------------------------------------------------------------------------*/
108 
109 void
111 
112 
113 /*----------------------------------------------------------------------------*/
114 /*
115  * \brief Activate the pressure increment solving with CDO
116  */
117 /*----------------------------------------------------------------------------*/
118 
119 void
121 
122 /*----------------------------------------------------------------------------*/
123 /*
124  * \brief Activate the pressure increment, either FV or CDO
125  */
126 /*----------------------------------------------------------------------------*/
127 
128 void
130 
131 /*----------------------------------------------------------------------------*/
132 /*
133  * \brief Test if pressure solving with CDO is activated
134  *
135  * \return true if solving with CDO is requested, false otherwise
136  */
137 /*----------------------------------------------------------------------------*/
138 
139 bool
141 
142 /*----------------------------------------------------------------------------*/
143 /*
144  * \brief Start setting-up the pressure increment equation
145  * At this stage, numerical settings should be completely determined
146  * but connectivity and geometrical information is not yet available.
147  */
148 /*----------------------------------------------------------------------------*/
149 
150 void
152 
153 /*----------------------------------------------------------------------------*/
154 /*
155  * \brief Finalize setting-up the pressure increment equation
156  * At this stage, numerical settings should be completely determined
157  *
158  * \param[in] domain pointer to a cs_domaint_t structure
159  */
160 /*----------------------------------------------------------------------------*/
161 
162 void
164 
165 /*----------------------------------------------------------------------------*/
166 /*
167  * \brief Perform the pressure correction step of the Navier-Stokes equations
168  * for incompressible or slightly compressible flows.
169  *
170  * This function solves the following Poisson equation on the pressure:
171  * \f[
172  * D \left( \Delta t, \delta p \right) =
173  * \divs \left( \rho \vect{\widetilde{u}}\right)
174  * - \Gamma^n
175  * + \dfrac{\rho^n - \rho^{n-1}}{\Delta t}
176  * \f]
177  *
178  * Either the legacy FV method or a CDO face-based scheme is used.
179  *
180  * For the legacy case, the mass flux is updated as follows:
181  * \f[
182  * \dot{m}^{n+1}_\ij = \dot{m}^{n}_\ij
183  * - \Delta t \grad_\fij \delta p \cdot \vect{S}_\ij
184  * \f]
185  *
186  * \Remark:
187  * - an iterative process is used to solve the Poisson equation.
188  * - if the arak coefficient is set to 1, the the Rhie & Chow filter is
189  * activated.
190  *
191  * Please refer to the
192  * <a href="../../theory.pdf#resopv"><b>resopv</b></a>
193  * section of the theory guide for more information.
194  *
195  * \param[in] iterns Navier-Stokes iteration number
196  * \param[in] nfbpcd number of faces with condensation source term
197  * \param[in] ncmast number of cells with condensation source terms
198  * \param[in] ifbpcd index of faces with condensation source term
199  * \param[in] ltmast list of cells with condensation source terms
200  * (1 to n numbering)
201  * \param[in] isostd indicator of standard outlet and index
202  * of the reference outlet face
203  * \param[in] vel velocity
204  * \param[in, out] da_uu velocity matrix
205  * \param[in] coefav boundary condition array for the variable
206  * (explicit part)
207  * \param[in] coefbv boundary condition array for the variable
208  * (implicit part)
209  * \param[in] coefa_dp boundary conditions for the pressure increment
210  * \param[in] coefb_dp boundary conditions for the pressure increment
211  * \param[in] spcond variable value associated to the condensation
212  * source term (for ivar=ipr, spcond is the
213  * flow rate
214  * \f$ \Gamma_{s,cond}^n \f$)
215  * \param[in] svcond variable value associated to the condensation
216  * source term (for ivar=ipr, svcond is the flow rate
217  * \f$ \Gamma_{v, cond}^n \f$)
218  * \param[in] frcxt external forces making hydrostatic pressure
219  * \param[in] dfrcxt variation of the external forces
220  * composing the hydrostatic pressure
221  * \param[in] i_visc visc*surface/dist aux faces internes
222  * \param[in] b_visc visc*surface/dist aux faces de bord
223  */
224 /*----------------------------------------------------------------------------*/
225 
226 void
227 cs_pressure_correction(int iterns,
230  cs_lnum_t ifbpcd[],
231  cs_lnum_t ltmast[],
232  const int isostd[],
233  cs_real_t vel[restrict][3],
234  cs_real_t da_uu[restrict][6],
235  cs_real_t coefav[restrict][3],
236  cs_real_t coefbv[restrict][3][3],
237  cs_real_t coefa_dp[restrict],
238  cs_real_t coefb_dp[restrict],
241  cs_real_t frcxt[restrict][3],
242  cs_real_t dfrcxt[restrict][3],
243  cs_real_t i_visc[restrict],
244  cs_real_t b_visc[restrict]);
245 
246 /*----------------------------------------------------------------------------*/
247 
249 
250 #endif /* __CS_PRESSURE_CORRECTION_H__ */
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
unsigned short int cs_flag_t
Definition: cs_defs.h:321
@ vel
Definition: cs_field_pointer.h:68
void cs_pressure_correction_cdo_activate(void)
Activate the pressure increment solving with CDO.
Definition: cs_pressure_correction.c:3397
void cs_pressure_correction_cdo_destroy_all(void)
Free the main structure related to the pressure correction.
Definition: cs_pressure_correction.c:3631
bool cs_pressure_correction_cdo_is_activated(void)
Test if pressure solving with CDO is activated.
Definition: cs_pressure_correction.c:3476
void cs_pressure_correction(int iterns, cs_lnum_t nfbpcd, cs_lnum_t ncmast, cs_lnum_t ifbpcd[], cs_lnum_t ltmast[], const int isostd[], cs_real_t vel[restrict][3], cs_real_t da_uu[restrict][6], cs_real_t coefav[restrict][3], cs_real_t coefbv[restrict][3][3], cs_real_t coefa_dp[restrict], cs_real_t coefb_dp[restrict], cs_real_t spcond[restrict], cs_real_t svcond[restrict], cs_real_t frcxt[restrict][3], cs_real_t dfrcxt[restrict][3], cs_real_t i_visc[restrict], cs_real_t b_visc[restrict])
Perform the pressure correction step of the Navier-Stokes equations for incompressible or slightly co...
Definition: cs_pressure_correction.c:3709
void cs_pressure_correction_fv_activate(void)
Activate the pressure increment solving with Legacy FV.
Definition: cs_pressure_correction.c:3371
void cs_pressure_correction_cdo_init_setup(void)
Start setting-up the pressure increment equation At this stage, numerical settings should be complete...
Definition: cs_pressure_correction.c:3493
void cs_pressure_correction_cdo_finalize_setup(const cs_domain_t *domain)
Finalize setting-up the pressure increment equation At this stage, numerical settings should be compl...
Definition: cs_pressure_correction.c:3559
void cs_pressure_correction_model_activate(void)
Activate the pressure increment, either FV or CDO.
Definition: cs_pressure_correction.c:3456
integer(c_int), pointer, save ncmast
number of the cells in which a condensation source terms is imposed. See lstmast list and the subrout...
Definition: cs_nz_condensation.f90:167
double precision, dimension(:, :), pointer, save svcond
value of the condensation source terms for pressure associated to the metal structures modelling....
Definition: cs_nz_condensation.f90:195
integer, dimension(:), pointer, save ltmast
list on the ncmast cells in which a condensation source terms is imposed. See the user subroutine cs_...
Definition: cs_nz_condensation.f90:179
integer(c_int), pointer, save nfbpcd
number of faces in which a condensation source terms is imposed. See ifbpcd and the user subroutine c...
Definition: cs_nz_condensation.f90:55
double precision, dimension(:,:), pointer, save spcond
value of the condensation source terms for pressure. For the other variables, eventual imposed specif...
Definition: cs_nz_condensation.f90:83
integer, dimension(:), pointer, save ifbpcd
list on the nfbpcd faces in which a condensation source terms is imposed. See ifbpcd and the user sub...
Definition: cs_nz_condensation.f90:96
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition: cs_domain.h:138
Main structure to handle the discretization and the resolution of an equation.
Field descriptor.
Definition: cs_field.h:131
Definition: cs_pressure_correction.h:46
cs_flag_t post_flag
Definition: cs_pressure_correction.h:86
cs_equation_t * pressure_incr
Definition: cs_pressure_correction.h:51
cs_field_t * pressure_incr_gradient
Definition: cs_pressure_correction.h:57
cs_real_t * bdy_pressure_incr
Definition: cs_pressure_correction.h:84
cs_field_t * pressure_gradient
Definition: cs_pressure_correction.h:62
cs_real_t * div_st
Definition: cs_pressure_correction.h:68
cs_real_t * inner_potential_flux
Definition: cs_pressure_correction.h:73
cs_real_t * bdy_potential_flux
Definition: cs_pressure_correction.h:78