8.1
general documentation
cs_cdofb_monolithic_priv.h
Go to the documentation of this file.
1 #ifndef __CS_CDOFB_MONOLITHIC_PRIV_H__
2 #define __CS_CDOFB_MONOLITHIC_PRIV_H__
3 
4 /*============================================================================
5  * Build an algebraic CDO face-based system for the Navier-Stokes equations
6  * and solved it as one block (monolithic approach of the velocity-pressure
7  * coupling)
8  *============================================================================*/
9 
10 /*
11  This file is part of code_saturne, a general-purpose CFD tool.
12 
13  Copyright (C) 1998-2023 EDF S.A.
14 
15  This program is free software; you can redistribute it and/or modify it under
16  the terms of the GNU General Public License as published by the Free Software
17  Foundation; either version 2 of the License, or (at your option) any later
18  version.
19 
20  This program is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23  details.
24 
25  You should have received a copy of the GNU General Public License along with
26  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
27  Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 */
29 
30 /*----------------------------------------------------------------------------*/
31 
32 #include "cs_defs.h"
33 
34 /*----------------------------------------------------------------------------
35  * Standard C library headers
36  *----------------------------------------------------------------------------*/
37 
38 /*----------------------------------------------------------------------------
39  * Local headers
40  *----------------------------------------------------------------------------*/
41 
42 #include "cs_cdo_assembly.h"
43 #include "cs_cdo_bc.h"
44 #include "cs_cdo_system.h"
45 #include "cs_cdofb_priv.h"
46 #include "cs_cdofb_scaleq.h"
47 #include "cs_cdofb_vecteq.h"
49 #include "cs_cdofb_navsto.h"
50 #include "cs_equation_bc.h"
51 #include "cs_equation_priv.h"
52 #include "cs_iter_algo.h"
53 #include "cs_navsto_coupling.h"
54 #include "cs_navsto_param.h"
55 #include "cs_sles.h"
56 #include "cs_static_condensation.h"
57 #include "cs_timer.h"
58 
59 /*----------------------------------------------------------------------------*/
60 
62 
63 /*=============================================================================
64  * Additional doxygen documentation
65  *============================================================================*/
66 
75 /* Context related to the resolution of a saddle point problem */
76 
77 typedef struct {
78 
79  cs_real_t *div_op; /* Block related to the -divergence (block
80  A_{10}) */
81 
82  /* Arrays split according to the block shape. U is interlaced or not
83  * according to the SLES strategy */
84 
85  cs_lnum_t n_faces; /* local number of DoFs for each component
86  * of the velocity */
87  cs_lnum_t n_cells; /* local number of DoFs for the pressure */
88 
89  cs_real_t *u_f; /* velocity values at faces */
90  cs_real_t *p_c; /* pressure values at cells */
91 
92  cs_sles_t *sles; /* main SLES structure */
93  cs_sles_t *schur_sles; /* auxiliary SLES for the Schur complement
94  * May be NULL */
95 
96  cs_real_t graddiv_coef; /* value of the grad-div coefficient in case
97  * of augmented system */
98 
100 
101 
102 typedef struct _cdofb_monolithic_t cs_cdofb_monolithic_t;
103 
106 /*=============================================================================
107  * Definitions of function pointers
108  *============================================================================*/
109 
110 /*----------------------------------------------------------------------------*/
122 /*----------------------------------------------------------------------------*/
123 
124 typedef void
125 (cs_cdofb_monolithic_assemble_t)(const cs_cell_sys_t *csys,
126  const cs_cell_mesh_t *cm,
127  const cs_cdofb_navsto_builder_t *nsb,
129  cs_cdofb_vecteq_t *eqc,
130  cs_cdo_assembly_t *asb);
131 
132 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 typedef void
150 (cs_cdofb_monolithic_build_t)(const cs_navsto_param_t *nsp,
151  const cs_real_t vel_f_n[],
152  const cs_real_t vel_c_n[],
153  const cs_real_t vel_f_nm1[],
154  const cs_real_t vel_c_nm1[],
156 
157 /*----------------------------------------------------------------------------*/
171 /*----------------------------------------------------------------------------*/
172 
173 typedef int
174 (cs_cdofb_monolithic_solve_t)(const cs_navsto_param_t *nsp,
175  const cs_equation_param_t *eqp,
176  const cs_cdo_system_helper_t *sh,
177  cs_param_sles_t *slesp,
179 
180 /*=============================================================================
181  * Structure definitions
182  *============================================================================*/
183 
190 struct _cdofb_monolithic_t {
191 
198  cs_navsto_monolithic_t *coupling_context;
199 
210  cs_field_t *velocity;
211 
218 
224  cs_field_t *divergence;
225 
235  cs_adv_field_t *adv_field;
236 
240  cs_real_t *mass_flux_array;
241 
245  cs_real_t *mass_flux_array_pre;
246 
257  const cs_boundary_type_t *bf_type;
258 
265  cs_cdo_bc_face_t *pressure_bc;
266  int pressure_rescaling;
267 
285  cs_cdo_apply_boundary_t *apply_fixed_wall;
286  cs_cdo_apply_boundary_t *apply_sliding_wall;
287  cs_cdo_apply_boundary_t *apply_velocity_inlet;
288  cs_cdo_apply_boundary_t *apply_symmetry;
289 
297  cs_cdofb_monolithic_build_t *steady_build;
298  cs_cdofb_monolithic_build_t *build;
299 
306  cs_cdofb_navsto_source_t *add_gravity_term;
307 
315  /* \var assemble
316  * Function pointer to manage the assembly process for the Navier-Stokes
317  * system of equation
318  */
319 
320  cs_cdofb_monolithic_assemble_t *assemble;
321 
322  /* \var system_helper
323  * Set of structure to handle the saddle-point matrix and its rhs
324  */
325 
326  cs_cdo_system_helper_t *system_helper;
327 
338  cs_cdofb_monolithic_solve_t *solve;
339 
340  /* \var msles
341  * Set of pointers to enable the resolution of saddle-point system
342  * with various algorithms. This structure allows us to unify the prototype
343  * of "solve" functions
344  * Some members of this structure are allocated only if a specific algorithm
345  * is requested.
346  */
347 
349 
355  cs_iter_algo_t *nl_algo;
356 
368  cs_timer_counter_t timer;
369 
371 };
372 
375 /*============================================================================
376  * Public function prototypes
377  *============================================================================*/
378 
379 /*----------------------------------------------------------------------------*/
380 
382 
383 #endif /* __CS_CDOFB_MONOLITHIC_PRIV_H__ */
int cs_boundary_type_t
Definition: cs_boundary.h:69
struct _cdofb_monolithic_t cs_cdofb_monolithic_t
Definition: cs_cdofb_monolithic_priv.h:102
void() cs_cdofb_navsto_source_t(const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_cdofb_navsto_builder_t *nsb, cs_cell_sys_t *csys)
Compute and add a source term to the local RHS. This is a special treatment to enable source involvin...
Definition: cs_cdofb_navsto.h:184
#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
void() cs_cdo_apply_boundary_t(short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Apply a boundary condition for a given face (inlet, outlet, wall, sliding wall, symmetry....
Definition: cs_equation_bc.h:68
struct _cs_sles_t cs_sles_t
Definition: cs_sles.h:68
double precision, dimension(:,:,:), allocatable pressure
Definition: atimbr.f90:122
Definition: cs_advection_field.h:150
Definition: cs_cdo_bc.h:109
Definition: cs_cdo_system.h:377
Definition: cs_cdofb_monolithic_priv.h:77
cs_real_t graddiv_coef
Definition: cs_cdofb_monolithic_priv.h:96
cs_real_t * u_f
Definition: cs_cdofb_monolithic_priv.h:89
cs_lnum_t n_faces
Definition: cs_cdofb_monolithic_priv.h:85
cs_lnum_t n_cells
Definition: cs_cdofb_monolithic_priv.h:87
cs_sles_t * schur_sles
Definition: cs_cdofb_monolithic_priv.h:93
cs_real_t * p_c
Definition: cs_cdofb_monolithic_priv.h:90
cs_real_t * div_op
Definition: cs_cdofb_monolithic_priv.h:79
cs_sles_t * sles
Definition: cs_cdofb_monolithic_priv.h:92
Structure storing additional arrays related to the building of the Navier-Stokes system.
Definition: cs_cdofb_navsto.h:107
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:203
Set of arrays and local (small) dense matrices related to a mesh cell This is a key structure for bui...
Definition: cs_cdo_local.h:147
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:192
Field descriptor.
Definition: cs_field.h:131
Structure to handle the convergence of an iterative algorithm.
Definition: cs_iter_algo.h:289
Set of parameters specific for solving the Navier-Stokes system with a fully coupled monolithic algor...
Definition: cs_navsto_coupling.h:77
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:611
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:213
Definition: cs_timer.h:55