6.3
general documentation
cs_cdofb_monolithic_sles.h
Go to the documentation of this file.
1 #ifndef __CS_CDOFB_MONOLITHIC_SLES_H__
2 #define __CS_CDOFB_MONOLITHIC_SLES_H__
3 
4 /*============================================================================
5  * Functions dedicated to the linear algebra settings and operations in case
6  * of CDO face-based schemes with a monolithic velocity-pressure coupling
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2020 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------*/
30 
31 #include "cs_defs.h"
32 
33 /*----------------------------------------------------------------------------
34  * Standard C library headers
35  *----------------------------------------------------------------------------*/
36 
37 /*----------------------------------------------------------------------------
38  * Local headers
39  *----------------------------------------------------------------------------*/
40 
41 #include "cs_navsto_param.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 /* Context related to the resolution of a saddle point problem */
56 typedef struct {
57 
58  /* Block matrices: The gradient operator is the -transpose of div_op */
59 
60  /*
61  * If n_row_blocks = 1 and div_op == NULL then all the velocity-pressure
62  * components are gathered in one block. In this case, the full matrix is a
63  * 1x1 matrix
64  *
65  * If n_row_blocks = 1 and div_op != NULL then all the velocity components are
66  * gathered in one block. In this case, the full matrix is a 2x2 matrix
67 
68  * If n_row_blocks = 3 and div_op == NULL then there is one block dedicated to
69  * each velocity component. In this case, the full matrix is a 4x4 matrix
70  *
71  * Please notice that div_op if not NULL is stored in a non-assembled way.
72  */
73 
75 
76  /* Blocks related to the velocity momentum */
78 
79  cs_real_t *div_op; /* Block related to the -divergence (block A_{10} */
80 
81  /* Arrays split according to the block shape. U is interlaced or not
82  * according to the SLES strategy */
83 
84  cs_lnum_t n_faces; /* local number of DoFs for each component
85  * of the velocity */
86  cs_lnum_t n_cells; /* local number of DoFs for the pressure */
87 
88  cs_real_t *u_f; /* velocity values at faces */
89  cs_real_t *p_c; /* pressure values at cells */
90 
91  cs_real_t *b_f; /* RHS for the momentum (size = 3*n_faces) */
92  cs_real_t *b_c; /* RHS for the mass equation (size = n_cells) */
93 
94  cs_sles_t *sles; /* main SLES structure */
95 
96  cs_real_t graddiv_coef; /* value of the grad-div coefficient in case
97  * of augmented system */
98 
100 
101 /*============================================================================
102  * Public function prototypes
103  *============================================================================*/
104 
105 /*----------------------------------------------------------------------------*/
111 /*----------------------------------------------------------------------------*/
112 
115 
116 /*----------------------------------------------------------------------------*/
124 /*----------------------------------------------------------------------------*/
125 
126 void
128  cs_lnum_t n_faces,
130 
131 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
139 void
141 
142 /*----------------------------------------------------------------------------*/
148 /*----------------------------------------------------------------------------*/
149 
150 void
152 
153 /*----------------------------------------------------------------------------*/
159 /*----------------------------------------------------------------------------*/
160 
161 void
163 
164 /*----------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------*/
173 
174 void
176  const cs_cdo_quantities_t *quant,
177  const cs_range_set_t *rset);
178 
179 /*----------------------------------------------------------------------------*/
190 /*----------------------------------------------------------------------------*/
191 
192 void
194  void *context);
195 
196 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
210 int
212  const cs_equation_param_t *eqp,
214 
215 /*----------------------------------------------------------------------------*/
228 /*----------------------------------------------------------------------------*/
229 
230 int
232  const cs_equation_param_t *eqp,
234 
235 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 
249 int
251  const cs_equation_param_t *eqp,
253 
254 /*----------------------------------------------------------------------------*/
266 /*----------------------------------------------------------------------------*/
267 
268 int
270  const cs_equation_param_t *eqp,
272 
273 /*----------------------------------------------------------------------------*/
286 /*----------------------------------------------------------------------------*/
287 
288 int
290  const cs_equation_param_t *eqp,
292 
293 /*----------------------------------------------------------------------------*/
294 
296 
297 #endif /* __CS_CDOFB_MONOLITHIC_SLES_H__ */
cs_cdofb_monolithic_solve
int cs_cdofb_monolithic_solve(const cs_navsto_param_t *nsp, const cs_equation_param_t *eqp, cs_cdofb_monolithic_sles_t *msles)
Solve a linear system arising from the discretization of the Navier-Stokes equation with a CDO face-b...
Definition: cs_cdofb_monolithic_sles.c:2330
cs_cdofb_monolithic_sles_t::block_matrices
cs_matrix_t ** block_matrices
Definition: cs_cdofb_monolithic_sles.h:77
cs_defs.h
cs_cdofb_monolithic_sles_t::div_op
cs_real_t * div_op
Definition: cs_cdofb_monolithic_sles.h:79
cs_cdofb_monolithic_by_blocks_solve
int cs_cdofb_monolithic_by_blocks_solve(const cs_navsto_param_t *nsp, const cs_equation_param_t *eqp, cs_cdofb_monolithic_sles_t *msles)
Solve a linear system arising from the discretization of the Navier-Stokes equation with a CDO face-b...
Definition: cs_cdofb_monolithic_sles.c:2462
cs_cdofb_monolithic_sles_t::p_c
cs_real_t * p_c
Definition: cs_cdofb_monolithic_sles.h:89
cs_navsto_param_t
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:487
cs_cdofb_monolithic_gkb_solve
int cs_cdofb_monolithic_gkb_solve(const cs_navsto_param_t *nsp, const cs_equation_param_t *eqp, cs_cdofb_monolithic_sles_t *msles)
Use the GKB algorithm to solve the saddle-point problem arising from CDO-Fb schemes for Stokes and Na...
Definition: cs_cdofb_monolithic_sles.c:2492
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:493
cs_cdofb_monolithic_sles_clean
void cs_cdofb_monolithic_sles_clean(cs_cdofb_monolithic_sles_t *msles)
Free a part of the structure.
Definition: cs_cdofb_monolithic_sles.c:2063
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:304
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:492
cs_matrix_t
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:94
cs_navsto_param.h
cs_cdofb_monolithic_sles_reset
void cs_cdofb_monolithic_sles_reset(cs_cdofb_monolithic_sles_t *msles)
Reset to zero rhs and clean the cs_sles_t structure.
Definition: cs_cdofb_monolithic_sles.c:2032
cs_equation_param_t
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:201
cs_cdofb_monolithic_uzawa_al_solve
int cs_cdofb_monolithic_uzawa_al_solve(const cs_navsto_param_t *nsp, const cs_equation_param_t *eqp, cs_cdofb_monolithic_sles_t *msles)
Use the Uzawa algorithm with an Augmented Lagrangian technique to solve the saddle-point problem aris...
Definition: cs_cdofb_monolithic_sles.c:2643
cs_cdofb_monolithic_sles_t::n_row_blocks
int n_row_blocks
Definition: cs_cdofb_monolithic_sles.h:74
cs_cdofb_monolithic_set_sles
void cs_cdofb_monolithic_set_sles(cs_navsto_param_t *nsp, void *context)
Start setting-up the Navier-Stokes equations when a monolithic algorithm is used to couple the system...
Definition: cs_cdofb_monolithic_sles.c:2138
cs_cdofb_monolithic_sles_t::n_faces
cs_lnum_t n_faces
Definition: cs_cdofb_monolithic_sles.h:84
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:124
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_cdo_connect_t
Definition: cs_cdo_connect.h:76
cs_range_set_t
Definition: cs_range_set.h:57
cs_cdofb_monolithic_sles_set_shared
void cs_cdofb_monolithic_sles_set_shared(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_range_set_t *rset)
Set pointers to shared structures.
Definition: cs_cdofb_monolithic_sles.c:2112
cs_cdofb_monolithic_sles_t::n_cells
cs_lnum_t n_cells
Definition: cs_cdofb_monolithic_sles.h:86
cs_sles_t
struct _cs_sles_t cs_sles_t
Definition: cs_sles.h:68
cs_cdofb_monolithic_sles_create
cs_cdofb_monolithic_sles_t * cs_cdofb_monolithic_sles_create(void)
Create an empty cs_cdofb_monolithic_sles_t structure.
Definition: cs_cdofb_monolithic_sles.c:1964
cs_cdofb_monolithic_sles_init
void cs_cdofb_monolithic_sles_init(cs_lnum_t n_cells, cs_lnum_t n_faces, cs_cdofb_monolithic_sles_t *msles)
Allocate and initialize the rhs.
Definition: cs_cdofb_monolithic_sles.c:1999
cs_cdofb_monolithic_sles_t
Definition: cs_cdofb_monolithic_sles.h:56
cs_cdofb_monolithic_uzawa_al_incr_solve
int cs_cdofb_monolithic_uzawa_al_incr_solve(const cs_navsto_param_t *nsp, const cs_equation_param_t *eqp, cs_cdofb_monolithic_sles_t *msles)
Use the Uzawa algorithm with an Augmented Lagrangian technique in an incremental way to solve the sad...
Definition: cs_cdofb_monolithic_sles.c:2782
cs_cdofb_monolithic_sles_t::graddiv_coef
cs_real_t graddiv_coef
Definition: cs_cdofb_monolithic_sles.h:96
cs_cdofb_monolithic_sles_t::u_f
cs_real_t * u_f
Definition: cs_cdofb_monolithic_sles.h:88
cs_cdofb_monolithic_sles_t::sles
cs_sles_t * sles
Definition: cs_cdofb_monolithic_sles.h:94
cs_cdofb_monolithic_sles_free
void cs_cdofb_monolithic_sles_free(cs_cdofb_monolithic_sles_t **p_msles)
Free memory related to cs_cdofb_monolithic_sles_t structure.
Definition: cs_cdofb_monolithic_sles.c:2086
cs_cdofb_monolithic_sles_t::b_c
cs_real_t * b_c
Definition: cs_cdofb_monolithic_sles.h:92
cs_cdofb_monolithic_sles_t::b_f
cs_real_t * b_f
Definition: cs_cdofb_monolithic_sles.h:91