programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cs_param.h
Go to the documentation of this file.
1 #ifndef __CS_PARAM_H__
2 #define __CS_PARAM_H__
3 
4 /*============================================================================
5  * Manage the definition/setting of a computation
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2017 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_mesh.h"
35 #include "cs_cdo.h"
36 #include "cs_quadrature.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
46 /*============================================================================
47  * Type definitions
48  *============================================================================*/
49 
50 /* DISCRETE HODGE OPERATORS */
51 /* ======================== */
52 
53 typedef enum {
54 
55  CS_PARAM_HODGE_TYPE_VPCD, // from primal vertices to dual cells
56  CS_PARAM_HODGE_TYPE_EPFD, // from primal edges to dual faces
57  CS_PARAM_HODGE_TYPE_FPED, // from primal faces to dual edges
58  CS_PARAM_HODGE_TYPE_EDFP, // from dual edges to primal faces
59  CS_PARAM_HODGE_TYPE_CPVD, // from primal cells to dual vertices
60  CS_PARAM_HODGE_TYPE_VC, // primal vertices + primal cells
62 
64 
65 typedef enum {
66 
67  CS_PARAM_HODGE_ALGO_VORONOI, // Under othogonality condition gives a diag. op.
68  CS_PARAM_HODGE_ALGO_WBS, // WBS: Whitney Barycentric Subdivision
69  CS_PARAM_HODGE_ALGO_COST, // COST: COnsistency & STabilization splitting
70  CS_PARAM_HODGE_ALGO_AUTO, /* Switch between the previous algo. according to
71  the type of cell and its property */
73 
75 
76 typedef struct {
77 
78  bool is_unity; /* No associated property. Property is equalt to the unity */
79  bool is_iso; /* Associated property is isotroopic ? */
80  bool inv_pty; /* Definition based on the property or its inverse */
81 
82  cs_param_hodge_type_t type; /* type of discrete Hodge operator */
83  cs_param_hodge_algo_t algo; /* type of algorithm used to build this op. */
84  double coef; /* Value of the stabilization parameter
85  if the COST algo. is used, otherwise 0. */
86 
88 
89 /* TIME SCHEME */
90 /* =========== */
91 
92 /* Type of numerical scheme for the discretization in time */
93 typedef enum {
94 
95  CS_TIME_SCHEME_IMPLICIT, // fully implicit (forward Euler/theta-scheme = 1)
96  CS_TIME_SCHEME_EXPLICIT, // fully explicit (backward Euler/theta-scheme = 0)
97  CS_TIME_SCHEME_CRANKNICO, // Crank-Nicolson (theta-scheme = 0.5)
98  CS_TIME_SCHEME_THETA, // theta-scheme
100 
102 
103 /* ADVECTION OPERATOR PARAMETRIZATION */
104 /* ================================== */
105 
106 typedef enum {
107 
111 
113 
114 /* Type of weight functions considered */
115 typedef enum {
116 
118  CS_PARAM_ADVECTION_SCHEME_CIP, // Only V+C CDO schemes
123 
125 
126 /* Choice on the type of algo. used to set the argument used in
127  the weight function */
128 typedef enum {
129 
133 
135 
136 /* Set of options for building a contraction operator (also called interior
137  product) which is closely related to the advection operator */
138 typedef struct {
139 
140  cs_param_advection_form_t formulation; // conservative or not
143 
145 
146 /* BOUNDARY CONDITIONS */
147 /* =================== */
148 
149 /* Physic-driven boundary */
150 typedef enum {
151 
157 
159 
160 /* Mathematical boundary conditions */
161 typedef enum {
162 
169 
171 
172 /* Choice between different method to enforce the BCs */
173 typedef enum {
174 
175  CS_PARAM_BC_ENFORCE_STRONG, /* Strong enforcement of the BCs */
176  CS_PARAM_BC_ENFORCE_WEAK_PENA, /* Weak enforcement with a strong
177  penalization coefficient */
178  CS_PARAM_BC_ENFORCE_WEAK_NITSCHE, /* Weak enforcement using Nitsche method */
179  CS_PARAM_BC_ENFORCE_WEAK_SYM, /* Weak enforcement using symmetric Nitsche
180  method */
182 
184 
185 /* ITERATIVE SOLVERS */
186 /* ================= */
187 
188 typedef enum {
189 
190  CS_PARAM_PRECOND_NONE, // No preconditioning
191  CS_PARAM_PRECOND_DIAG, // Diagonal preconditioning (also called Jacobi)
192  CS_PARAM_PRECOND_BJACOB, // Block Jacobi
193  CS_PARAM_PRECOND_POLY1, // Neumann polynomial preconditioning (Order 1)
194  CS_PARAM_PRECOND_SSOR, // Symmetric Successive OverRelaxations
195  CS_PARAM_PRECOND_ILU0, // Incomplete LU factorization
196  CS_PARAM_PRECOND_ICC0, // Incomplete Cholesky factorization
197  CS_PARAM_PRECOND_AMG, // Algebraic MultiGrid
198  CS_PARAM_PRECOND_AS, // Additive Schwarz method
200 
202 
203 /* Type of iterative solver to use to inverse the linear system */
204 typedef enum {
205 
207  CS_PARAM_ITSOL_CG, // Conjuguate Gradient
208  CS_PARAM_ITSOL_BICG, // Bi-Conjuguate gradient
209  CS_PARAM_ITSOL_BICGSTAB2, // Stabilized Bi-Conjuguate gradient
210  CS_PARAM_ITSOL_CR3, // 3-layer conjugate residual
211  CS_PARAM_ITSOL_GMRES, // Generalized Minimal RESidual
212  CS_PARAM_ITSOL_AMG, // Algebraic MultiGrid
214 
216 
217 /* Description of the algorithm used to solve an equation */
218 typedef struct {
219 
220  cs_param_precond_type_t precond; // type of preconditioner
221  cs_param_itsol_type_t solver; // type of solver
222 
223  int n_max_iter; // max. number of iterations
224  double eps; // stopping criterion on accuracy
225 
226  int output_freq; // frequencdy of output into listing
227  bool resid_normalized; /* normalized or not the norm of the
228  residual used for the stopping criterion
229  */
231 
232 /*============================================================================
233  * Global variables
234  *============================================================================*/
235 
236 /*============================================================================
237  * Public function prototypes
238  *============================================================================*/
239 
240 /*----------------------------------------------------------------------------*/
248 /*----------------------------------------------------------------------------*/
249 
250 const char *
252 
253 /*----------------------------------------------------------------------------*/
261 /*----------------------------------------------------------------------------*/
262 
263 const char *
265 
266 /*----------------------------------------------------------------------------*/
274 /*----------------------------------------------------------------------------*/
275 
276 const char *
278 
279 /*----------------------------------------------------------------------------*/
287 /*----------------------------------------------------------------------------*/
288 
289 const char *
291 
292 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 const char *
304 
305 /*----------------------------------------------------------------------------*/
314 /*----------------------------------------------------------------------------*/
315 
316 const char *
318 
319 /*----------------------------------------------------------------------------*/
327 /*----------------------------------------------------------------------------*/
328 
329 const char *
331 
332 /*----------------------------------------------------------------------------*/
333 
335 
336 #endif /* __CS_PARAM_H__ */
cs_time_scheme_t
Definition: cs_param.h:93
Definition: cs_param.h:96
const char * cs_param_get_boundary_domain_name(cs_param_boundary_type_t type)
Get the name of the domain boundary condition This name is also used as a name for zone definition...
Definition: cs_param.c:146
Definition: cs_param.h:59
cs_param_hodge_algo_t algo
Definition: cs_param.h:83
cs_param_precond_type_t precond
Definition: cs_param.h:220
Definition: cs_param.h:193
Definition: cs_param.h:195
cs_param_boundary_type_t
Definition: cs_param.h:150
Definition: cs_param.h:132
bool inv_pty
Definition: cs_param.h:80
Definition: cs_param.h:207
Definition: cs_param.h:179
Definition: cs_param.h:212
cs_param_advection_scheme_t scheme
Definition: cs_param.h:141
cs_param_itsol_type_t solver
Definition: cs_param.h:221
cs_param_advection_scheme_t
Definition: cs_param.h:115
Definition: cs_param.h:190
const char * cs_param_get_bc_enforcement_name(cs_param_bc_enforce_t type)
Get the name of the type of enforcement of the boundary condition.
Definition: cs_param.c:165
Definition: cs_param.h:166
#define BEGIN_C_DECLS
Definition: cs_defs.h:453
Definition: cs_param.h:167
Definition: cs_param.h:121
Definition: cs_param.h:191
Definition: cs_param.h:67
Definition: cs_param.h:130
Definition: cs_param.h:206
Definition: cs_param.h:154
const char * cs_param_get_precond_name(cs_param_precond_type_t precond)
Get the name of the preconditioner.
Definition: cs_param.c:260
bool is_unity
Definition: cs_param.h:78
cs_param_advection_weight_t
Definition: cs_param.h:128
Definition: cs_param.h:213
Definition: cs_param.h:175
Definition: cs_param.h:209
Definition: cs_param.h:196
Definition: cs_param.h:61
Definition: cs_param.h:55
Definition: cs_param.h:108
cs_param_advection_form_t
Definition: cs_param.h:106
Definition: cs_param.h:131
Definition: cs_param.h:208
Definition: cs_param.h:97
bool is_iso
Definition: cs_param.h:79
Definition: cs_param.h:58
Definition: cs_param.h:152
Definition: cs_param.h:60
Definition: cs_param.h:199
Definition: cs_param.h:72
Definition: cs_param.h:138
Definition: cs_param.h:163
const char * cs_param_hodge_get_type_name(const cs_param_hodge_t h_info)
Get the type of discrete Hodge operator.
Definition: cs_param.c:200
Definition: cs_param.h:109
int output_freq
Definition: cs_param.h:226
Definition: cs_param.h:70
int n_max_iter
Definition: cs_param.h:223
Definition: cs_param.h:181
const char * cs_param_get_bc_name(cs_param_bc_type_t bc)
Get the name of the type of boundary condition.
Definition: cs_param.c:126
const char * cs_param_hodge_get_algo_name(const cs_param_hodge_t h_info)
Get the name of algorithm related to a discrete Hdoge operator.
Definition: cs_param.c:184
cs_param_precond_type_t
Definition: cs_param.h:188
cs_param_hodge_type_t type
Definition: cs_param.h:82
Definition: cs_param.h:192
Definition: cs_param.h:120
Definition: cs_param.h:56
cs_param_itsol_type_t
Definition: cs_param.h:204
cs_param_advection_form_t formulation
Definition: cs_param.h:140
Definition: cs_param.h:155
cs_param_bc_type_t
Definition: cs_param.h:161
Definition: cs_param.h:153
Definition: cs_param.h:178
Definition: cs_param.h:168
Definition: cs_param.h:194
cs_param_advection_weight_t weight_criterion
Definition: cs_param.h:142
Definition: cs_param.h:95
cs_param_hodge_type_t
Definition: cs_param.h:53
Definition: cs_param.h:118
Definition: cs_param.h:98
Definition: cs_param.h:211
Definition: cs_param.h:210
const char * cs_param_get_solver_name(cs_param_itsol_type_t solver)
Get the name of the solver.
Definition: cs_param.c:216
Definition: cs_param.h:69
#define END_C_DECLS
Definition: cs_defs.h:454
Definition: cs_param.h:156
Definition: cs_param.h:122
Definition: cs_param.h:165
bool resid_normalized
Definition: cs_param.h:227
Definition: cs_param.h:57
Definition: cs_param.h:117
double coef
Definition: cs_param.h:84
Definition: cs_param.h:176
Definition: cs_param.h:164
Definition: cs_param.h:197
cs_param_hodge_algo_t
Definition: cs_param.h:65
Definition: cs_param.h:76
double eps
Definition: cs_param.h:224
cs_param_bc_enforce_t
Definition: cs_param.h:173
Definition: cs_param.h:198
Definition: cs_param.h:99
Definition: cs_param.h:110
Definition: cs_param.h:218
Definition: cs_param.h:68
Definition: cs_param.h:119