8.2
general documentation
Loading...
Searching...
No Matches
cs_param_amg.h
Go to the documentation of this file.
1#ifndef __CS_PARAM_AMG_H__
2#define __CS_PARAM_AMG_H__
3
4/*============================================================================
5 * Routines to handle the set of parameters for algebraic multigrids (AMG)
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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_param_types.h"
35
36/*----------------------------------------------------------------------------*/
37
39
48
49/*============================================================================
50 * Macro definitions
51 *============================================================================*/
52
53/*============================================================================
54 * Type definitions
55 *============================================================================*/
56
63
78
79
84
96
101
115
120
139
147
168
169/* In-house AMG algorithms */
170/* ----------------------- */
171
180
198
204
220
228
229typedef struct {
230
231 /* Coarsening algorithm */
232
233 int max_levels; /* advanced settings */
234 cs_gnum_t min_n_g_rows; /* advanced settings */
235 double p0p1_relax; /* advanced settings */
236
239
240 /* Down smoother */
241
245
246 /* Up smoother */
247
251
252 /* Coarse solver */
253
254 double coarse_rtol_mult; /* advanced settings */
255 int coarse_max_iter; /* advanced settings */
258
260
261/*============================================================================
262 * Global variables
263 *============================================================================*/
264
265/*----------------------------------------------------------------------------*/
275/*----------------------------------------------------------------------------*/
276
277static inline bool
281{
282 if (precond == CS_PARAM_PRECOND_AMG || solver == CS_PARAM_SOLVER_AMG)
283 if (amg == CS_PARAM_AMG_HYPRE_BOOMER_V ||
285 return true;
286
287 return false;
288}
289
290/*----------------------------------------------------------------------------*/
301/*----------------------------------------------------------------------------*/
302
303static inline bool
307{
308 if (precond == CS_PARAM_PRECOND_AMG || solver == CS_PARAM_SOLVER_AMG)
310 return true;
311
312 return false;
313}
314
315/*============================================================================
316 * Public function prototypes
317 *============================================================================*/
318
319/*----------------------------------------------------------------------------*/
327/*----------------------------------------------------------------------------*/
328
329const char *
331
332/*----------------------------------------------------------------------------*/
340/*----------------------------------------------------------------------------*/
341
344
345/*----------------------------------------------------------------------------*/
352/*----------------------------------------------------------------------------*/
353
356
357/*----------------------------------------------------------------------------*/
366/*----------------------------------------------------------------------------*/
367
370
371/*----------------------------------------------------------------------------*/
379/*----------------------------------------------------------------------------*/
380
381const char *
383
384/*----------------------------------------------------------------------------*/
391/*----------------------------------------------------------------------------*/
392
393void
394cs_param_amg_boomer_log(const char *name,
395 const cs_param_amg_boomer_t *bamgp);
396
397/*----------------------------------------------------------------------------*/
407/*----------------------------------------------------------------------------*/
408
410cs_param_amg_inhouse_create(bool used_as_solver,
411 bool used_as_k_cycle);
412
413/*----------------------------------------------------------------------------*/
422/*----------------------------------------------------------------------------*/
423
426
427/*----------------------------------------------------------------------------*/
435/*----------------------------------------------------------------------------*/
436
437const char *
439
440/*----------------------------------------------------------------------------*/
447/*----------------------------------------------------------------------------*/
448
449void
450cs_param_amg_inhouse_log(const char *name,
451 const cs_param_amg_inhouse_t *amgp);
452
453/*----------------------------------------------------------------------------*/
454
456
457#endif /* __CS_PARAM_AMG_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:528
#define END_C_DECLS
Definition cs_defs.h:529
cs_param_solver_class_t cs_param_amg_get_class(cs_param_amg_type_t amg_type)
Retrieve the related solver class from the amg type.
Definition cs_param_amg.c:135
cs_param_amg_boomer_interp_algo_t
Type of algorithm used in boomerAMG to coarsen a level. Only a selection of algorithms is available h...
Definition cs_param_amg.h:102
@ CS_PARAM_AMG_BOOMER_INTERP_FF1
Definition cs_param_amg.h:107
@ CS_PARAM_AMG_BOOMER_INTERP_HYPERBOLIC
Definition cs_param_amg.h:104
@ CS_PARAM_AMG_BOOMER_INTERP_EXTENDED
Definition cs_param_amg.h:108
@ CS_PARAM_AMG_BOOMER_INTERP_EXT_PLUS_I_MATRIX
Definition cs_param_amg.h:109
@ CS_PARAM_AMG_BOOMER_N_INTERP_ALGOS
Definition cs_param_amg.h:112
@ CS_PARAM_AMG_BOOMER_INTERP_EXT_PLUS_E_MATRIX
Definition cs_param_amg.h:110
@ CS_PARAM_AMG_BOOMER_INTERP_EXT_PLUS_I
Definition cs_param_amg.h:106
@ CS_PARAM_AMG_BOOMER_INTERP_EXT_PLUS_I_CC
Definition cs_param_amg.h:105
void cs_param_amg_inhouse_log(const char *name, const cs_param_amg_inhouse_t *amgp)
Log the set of parameters used for setting in-house AMG algorithms.
Definition cs_param_amg.c:602
cs_param_amg_boomer_coarsen_algo_t
Type of algorithm used in boomerAMG to coarsen a level. Only a selection of algorithms is available h...
Definition cs_param_amg.h:85
@ CS_PARAM_AMG_BOOMER_COARSEN_CGC_E
Definition cs_param_amg.h:91
@ CS_PARAM_AMG_BOOMER_COARSEN_CGC
Definition cs_param_amg.h:90
@ CS_PARAM_AMG_BOOMER_COARSEN_HMIS
Definition cs_param_amg.h:89
@ CS_PARAM_AMG_BOOMER_COARSEN_PMIS
Definition cs_param_amg.h:88
@ CS_PARAM_AMG_BOOMER_N_COARSEN_ALGOS
Definition cs_param_amg.h:93
@ CS_PARAM_AMG_BOOMER_COARSEN_FALGOUT
Definition cs_param_amg.h:87
const char * cs_param_amg_get_type_name(cs_param_amg_type_t type)
Get the name of the type of algebraic multigrid (AMG)
Definition cs_param_amg.c:88
cs_param_amg_boomer_t * cs_param_amg_boomer_create(void)
Create a new structure storing a set of parameters used when calling boomerAMG. Set default values fo...
Definition cs_param_amg.c:163
cs_param_amg_inhouse_solver_t
Type of algorithm used in the in-house algorithm for smoothing each level or solving the coarse level...
Definition cs_param_amg.h:181
@ CS_PARAM_AMG_INHOUSE_GCR
Definition cs_param_amg.h:192
@ CS_PARAM_AMG_INHOUSE_PROCESS_GS
Definition cs_param_amg.h:187
@ CS_PARAM_AMG_INHOUSE_CR3
Definition cs_param_amg.h:191
@ CS_PARAM_AMG_INHOUSE_GMRES
Definition cs_param_amg.h:193
@ CS_PARAM_AMG_INHOUSE_JACOBI
Definition cs_param_amg.h:186
@ CS_PARAM_AMG_INHOUSE_FORWARD_GS
Definition cs_param_amg.h:183
@ CS_PARAM_AMG_INHOUSE_N_SOLVERS
Definition cs_param_amg.h:195
@ CS_PARAM_AMG_INHOUSE_BACKWARD_GS
Definition cs_param_amg.h:184
@ CS_PARAM_AMG_INHOUSE_CG
Definition cs_param_amg.h:190
@ CS_PARAM_AMG_INHOUSE_PROCESS_SGS
Definition cs_param_amg.h:188
static bool cs_param_amg_inhouse_is_needed(cs_param_solver_type_t solver, cs_param_precond_type_t precond, cs_param_amg_type_t amg)
Return true if the settings rely on the in-house implementation, otherwise false.
Definition cs_param_amg.h:304
cs_param_amg_inhouse_t * cs_param_amg_inhouse_create(bool used_as_solver, bool used_as_k_cycle)
Create a new structure storing a set of parameters used when calling the in-house AMG algo....
Definition cs_param_amg.c:428
cs_param_amg_inhouse_t * cs_param_amg_inhouse_copy(const cs_param_amg_inhouse_t *amgp)
Copy the given set of parameters used when calling in-house AMG algo. into a new structure.
Definition cs_param_amg.c:525
static bool cs_param_amg_boomer_is_needed(cs_param_solver_type_t solver, cs_param_precond_type_t precond, cs_param_amg_type_t amg)
Return true if the settings rely on boomeramg, otherwise false.
Definition cs_param_amg.h:278
const char * cs_param_amg_get_inhouse_solver_name(cs_param_amg_inhouse_solver_t solver)
Get the name of the solver used with in-house AMG algo.
Definition cs_param_amg.c:563
cs_param_amg_boomer_t * cs_param_amg_boomer_copy(const cs_param_amg_boomer_t *bamgp)
Copy the given set of parameters used when calling boomerAMG into a new structure.
Definition cs_param_amg.c:224
void cs_param_amg_boomer_log(const char *name, const cs_param_amg_boomer_t *bamgp)
Log the set of parameters used for setting BoomerAMG.
Definition cs_param_amg.c:301
const char * cs_param_amg_get_boomer_smoother_name(cs_param_amg_boomer_smoother_t smoother)
Get the name of the smoother used with BoomerAMG (HYPRE library)
Definition cs_param_amg.c:257
cs_param_amg_type_t
Definition cs_param_amg.h:64
@ CS_PARAM_AMG_INHOUSE_K
Definition cs_param_amg.h:73
@ CS_PARAM_AMG_HYPRE_BOOMER_W
Definition cs_param_amg.h:68
@ CS_PARAM_N_AMG_TYPES
Definition cs_param_amg.h:75
@ CS_PARAM_AMG_PETSC_GAMG_V
Definition cs_param_amg.h:69
@ CS_PARAM_AMG_PETSC_PCMG
Definition cs_param_amg.h:71
@ CS_PARAM_AMG_PETSC_GAMG_W
Definition cs_param_amg.h:70
@ CS_PARAM_AMG_HYPRE_BOOMER_V
Definition cs_param_amg.h:67
@ CS_PARAM_AMG_INHOUSE_V
Definition cs_param_amg.h:72
@ CS_PARAM_AMG_NONE
Definition cs_param_amg.h:66
cs_param_amg_boomer_smoother_t
Type of algorithm used in boomerAMG to smooth a level. Only a selection of algorithms is available he...
Definition cs_param_amg.h:121
@ CS_PARAM_AMG_BOOMER_N_SMOOTHERS
Definition cs_param_amg.h:136
@ CS_PARAM_AMG_BOOMER_GAUSS_ELIM
Definition cs_param_amg.h:128
@ CS_PARAM_AMG_BOOMER_FORWARD_L1_GS
Definition cs_param_amg.h:130
@ CS_PARAM_AMG_BOOMER_FCF_JACOBI
Definition cs_param_amg.h:133
@ CS_PARAM_AMG_BOOMER_BACKWARD_GS
Definition cs_param_amg.h:125
@ CS_PARAM_AMG_BOOMER_HYBRID_SSOR
Definition cs_param_amg.h:126
@ CS_PARAM_AMG_BOOMER_L1_SGS
Definition cs_param_amg.h:127
@ CS_PARAM_AMG_BOOMER_CG
Definition cs_param_amg.h:131
@ CS_PARAM_AMG_BOOMER_FORWARD_GS
Definition cs_param_amg.h:124
@ CS_PARAM_AMG_BOOMER_BACKWARD_L1_GS
Definition cs_param_amg.h:129
@ CS_PARAM_AMG_BOOMER_JACOBI
Definition cs_param_amg.h:123
@ CS_PARAM_AMG_BOOMER_CHEBYSHEV
Definition cs_param_amg.h:132
@ CS_PARAM_AMG_BOOMER_L1_JACOBI
Definition cs_param_amg.h:134
cs_param_amg_inhouse_coarsen_t
Type of algorithm used in the in-house algorithm to coarsen each level. This enum avoids using the as...
Definition cs_param_amg.h:205
@ CS_PARAM_AMG_INHOUSE_COARSEN_SPD_DX
Definition cs_param_amg.h:209
@ CS_PARAM_AMG_INHOUSE_COARSEN_SPD_MX
Definition cs_param_amg.h:211
@ CS_PARAM_AMG_INHOUSE_COARSEN_SPD_PW
Definition cs_param_amg.h:213
@ CS_PARAM_AMG_INHOUSE_N_COARSENINGS
Definition cs_param_amg.h:217
@ CS_PARAM_AMG_INHOUSE_COARSEN_CONV_DIFF_DX
Definition cs_param_amg.h:215
cs_param_solver_class_t
Class of iterative solvers to consider for solver the linear system.
Definition cs_param_types.h:617
cs_param_precond_type_t
Definition cs_param_types.h:726
@ CS_PARAM_PRECOND_AMG
Definition cs_param_types.h:730
cs_param_solver_type_t
Definition cs_param_types.h:806
@ CS_PARAM_SOLVER_AMG
Definition cs_param_types.h:810
Set of the main parameters to setup the algebraic multigrid BoomerAMG belonging to the HYPRE library....
Definition cs_param_amg.h:148
cs_param_amg_boomer_interp_algo_t interp_algo
Definition cs_param_amg.h:155
cs_param_amg_boomer_smoother_t up_smoother
Definition cs_param_amg.h:161
cs_param_amg_boomer_coarsen_algo_t coarsen_algo
Definition cs_param_amg.h:154
int n_up_iter
Definition cs_param_amg.h:165
int p_max
Definition cs_param_amg.h:156
cs_param_amg_boomer_smoother_t down_smoother
Definition cs_param_amg.h:160
double strong_threshold
Definition cs_param_amg.h:153
cs_param_amg_boomer_smoother_t coarse_solver
Definition cs_param_amg.h:162
int n_down_iter
Definition cs_param_amg.h:164
int n_agg_paths
Definition cs_param_amg.h:158
int n_agg_levels
Definition cs_param_amg.h:157
Set of the main parameters used to setup the algebraic multigrid available natively in code_saturne (...
Definition cs_param_amg.h:229
double p0p1_relax
Definition cs_param_amg.h:235
int aggreg_limit
Definition cs_param_amg.h:237
cs_param_amg_inhouse_solver_t coarse_solver
Definition cs_param_amg.h:256
cs_param_amg_inhouse_solver_t up_smoother
Definition cs_param_amg.h:249
double coarse_rtol_mult
Definition cs_param_amg.h:254
int down_poly_degree
Definition cs_param_amg.h:244
cs_param_amg_inhouse_solver_t down_smoother
Definition cs_param_amg.h:243
int coarse_max_iter
Definition cs_param_amg.h:255
cs_param_amg_inhouse_coarsen_t coarsen_algo
Definition cs_param_amg.h:238
int n_up_iter
Definition cs_param_amg.h:248
int max_levels
Definition cs_param_amg.h:233
int up_poly_degree
Definition cs_param_amg.h:250
int n_down_iter
Definition cs_param_amg.h:242
int coarse_poly_degree
Definition cs_param_amg.h:257
cs_gnum_t min_n_g_rows
Definition cs_param_amg.h:234