9.1
general documentation
cs_param_sles.h
Go to the documentation of this file.
1#ifndef __CS_PARAM_SLES_H__
2#define __CS_PARAM_SLES_H__
3
4/*============================================================================
5 * Routines to handle the SLES (Sparse Linear Equation Solver) settings
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2025 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 "alge/cs_param_amg.h"
35#include "alge/cs_param_hpddm.h"
36#include "alge/cs_param_mumps.h"
37#include "base/cs_param_types.h"
38
39/*----------------------------------------------------------------------------*/
40
42
51/*============================================================================
52 * Macro definitions
53 *============================================================================*/
54
55/*============================================================================
56 * Type definitions
57 *============================================================================*/
58
65typedef struct {
66
67 char *name;
76 int restart;
84
90
97
105
112
119
121
122/*============================================================================
123 * Global variables
124 *============================================================================*/
125
126/*============================================================================
127 * Public function prototypes
128 *============================================================================*/
129
130/*----------------------------------------------------------------------------*/
140/*----------------------------------------------------------------------------*/
141
143cs_param_sles_create(int field_id,
144 const char *system_name);
145
146/*----------------------------------------------------------------------------*/
152/*----------------------------------------------------------------------------*/
153
154void
156
157/*----------------------------------------------------------------------------*/
164/*----------------------------------------------------------------------------*/
165
166void
168
169/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
178void
180 cs_param_sles_t *dst);
181
182/*----------------------------------------------------------------------------*/
191/*----------------------------------------------------------------------------*/
192
193int
194cs_param_sles_set_solver(const char *keyval,
195 cs_param_sles_t *slesp);
196
197/*----------------------------------------------------------------------------*/
206/*----------------------------------------------------------------------------*/
207
208int
209cs_param_sles_set_precond(const char *keyval,
210 cs_param_sles_t *slesp);
211
212/*----------------------------------------------------------------------------*/
222/*----------------------------------------------------------------------------*/
223
224int
225cs_param_sles_set_solver_class(const char *keyval,
226 cs_param_sles_t *slesp);
227
228/*----------------------------------------------------------------------------*/
238/*----------------------------------------------------------------------------*/
239
240int
241cs_param_sles_set_amg_type(const char *keyval,
242 cs_param_sles_t *slesp);
243
244/*----------------------------------------------------------------------------*/
254/*----------------------------------------------------------------------------*/
255
256int
257cs_param_sles_set_precond_block_type(const char *keyval,
258 cs_param_sles_t *slesp);
259
260/*----------------------------------------------------------------------------*/
272/*----------------------------------------------------------------------------*/
273
274void
276 double rtol,
277 double atol,
278 double dtol,
279 int max_iter);
280
281/*----------------------------------------------------------------------------*/
290/*----------------------------------------------------------------------------*/
291
292void
294 bool used_as_solver,
295 bool used_as_k_cycle);
296
297/*----------------------------------------------------------------------------*/
315/*----------------------------------------------------------------------------*/
316
317void
319 int n_down_iter,
320 cs_param_amg_inhouse_solver_t down_smoother,
321 int down_poly_deg,
322 int n_up_iter,
324 int up_poly_deg,
325 cs_param_amg_inhouse_solver_t coarse_solver,
326 int coarse_poly_deg,
328 int aggreg_limit);
329
330/*----------------------------------------------------------------------------*/
343/*----------------------------------------------------------------------------*/
344
345void
347 int max_levels,
348 cs_gnum_t min_n_g_rows,
349 double p0p1_relax,
350 int coarse_max_iter,
351 double coarse_rtol_mult);
352
353/*----------------------------------------------------------------------------*/
360/*----------------------------------------------------------------------------*/
361
362void
364
365/*----------------------------------------------------------------------------*/
380/*----------------------------------------------------------------------------*/
381
382void
384 int n_down_iter,
385 cs_param_amg_boomer_smoother_t down_smoother,
386 int n_up_iter,
388 cs_param_amg_boomer_smoother_t coarse_solver,
390
391/*----------------------------------------------------------------------------*/
405/*----------------------------------------------------------------------------*/
406
407void
409 double strong_thr,
411 int p_max,
412 int n_agg_lv,
413 int n_agg_paths);
414
415/*----------------------------------------------------------------------------*/
422/*----------------------------------------------------------------------------*/
423
424void
426
427/*----------------------------------------------------------------------------*/
441/*----------------------------------------------------------------------------*/
442
443void
445 int n_down_iter,
446 cs_param_amg_gamg_smoother_t down_smoother,
447 int n_up_iter,
450
451/*----------------------------------------------------------------------------*/
464/*----------------------------------------------------------------------------*/
465
466void
468 double threshold,
469 int n_agg_lv,
470 bool use_sq_grph,
471 int n_smooth_agg);
472
473/*----------------------------------------------------------------------------*/
480/*----------------------------------------------------------------------------*/
481
482void
484
485/*----------------------------------------------------------------------------*/
499/*----------------------------------------------------------------------------*/
500
501void
503 int n_down_iter,
504 cs_param_amg_gamg_smoother_t down_smoother,
505 int n_up_iter,
508
509/*----------------------------------------------------------------------------*/
521/*----------------------------------------------------------------------------*/
522
523void
525 bool use_boomer_coarsening,
526 bool reuse_interpolation,
527 bool subspace_coarsening);
528
529/*----------------------------------------------------------------------------*/
536/*----------------------------------------------------------------------------*/
537
538void
540
541/*----------------------------------------------------------------------------*/
552/*----------------------------------------------------------------------------*/
553
554void
556 bool is_single,
557 cs_param_mumps_facto_type_t facto_type);
558
559/*----------------------------------------------------------------------------*/
576/*----------------------------------------------------------------------------*/
577
578void
580 cs_param_mumps_analysis_algo_t analysis_algo,
581 int block_analysis,
582 bool keep_ordering,
583 double mem_coef,
584 double blr_threshold,
585 int ir_steps,
587 bool advanced_optim);
588
589/*----------------------------------------------------------------------------*/
596/*----------------------------------------------------------------------------*/
597
598void
600
601/*----------------------------------------------------------------------------*/
619/*----------------------------------------------------------------------------*/
620
621#ifdef __cplusplus
622
623void
625 const bool use_neumann,
626 const int nb_eigenvector,
627 const int harmonic_overlap,
628 const double relative_threshold,
629 const int p = -1);
630
631#endif
632
633/*----------------------------------------------------------------------------*/
648/*----------------------------------------------------------------------------*/
649
650void
652 const int min_iter,
653 const int max_iter,
654 const int min_harmonic_overlap,
655 const int max_harmonic_overlap,
656 const int min_nb_eigenvector,
657 const int max_nb_eigenvector);
658
659/*----------------------------------------------------------------------------*/
665/*----------------------------------------------------------------------------*/
666
667bool
669
670/*----------------------------------------------------------------------------*/
680/*----------------------------------------------------------------------------*/
681
684
685/*----------------------------------------------------------------------------*/
686
688
689#endif /* __CS_PARAM_SLES_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
unsigned cs_gnum_t
global mesh entity number
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:555
@ p
Definition: cs_field_pointer.h:67
Routines to handle the set of parameters for algebraic multigrids (AMG) like boomerAMG of the HYPRE l...
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:103
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:86
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:274
cs_param_amg_gamg_coarse_solver_t
Definition: cs_param_amg.h:191
cs_param_amg_type_t
Definition: cs_param_amg.h:64
cs_param_amg_gamg_smoother_t
Definition: cs_param_amg.h:175
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:122
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:298
Routines and structure to handle the HPDDM setup. The structure is used as a context structure of a c...
Routines and structure to handle the MUMPS setup. The structure is used as a context structure of a c...
cs_param_mumps_facto_type_t
type of factorization to consider when using the MUMPS solver to solve a linear system
Definition: cs_param_mumps.h:71
cs_param_mumps_memory_usage_t
Strategy for the memory usage inside MUMPS.
Definition: cs_param_mumps.h:149
cs_param_mumps_analysis_algo_t
Type of algorithm to consider when using the MUMPS solver to perform the analysis step (renumbering a...
Definition: cs_param_mumps.h:119
void cs_param_sles_amg_inhouse(cs_param_sles_t *slesp, int n_down_iter, cs_param_amg_inhouse_solver_t down_smoother, int down_poly_deg, int n_up_iter, cs_param_amg_inhouse_solver_t up_smoother, int up_poly_deg, cs_param_amg_inhouse_solver_t coarse_solver, int coarse_poly_deg, cs_param_amg_inhouse_coarsen_t coarsen_algo, int aggreg_limit)
Set the main members of a cs_param_amg_inhouse_t structure. This structure is not reset before applyi...
Definition: cs_param_sles.cpp:1460
void cs_param_sles_mumps(cs_param_sles_t *slesp, bool is_single, cs_param_mumps_facto_type_t facto_type)
Set the main members of a cs_param_mumps_t structure. This structure is allocated and initialized wit...
Definition: cs_param_sles.cpp:1916
bool cs_param_sles_hypre_from_petsc(void)
Check the availability of Hypre solvers from the PETSc library.
Definition: cs_param_sles.cpp:2121
void cs_param_sles_hpddm_reset(cs_param_sles_t *slesp)
Allocate and initialize a new context structure for the HPDDM settings.
Definition: cs_param_sles.cpp:1993
void cs_param_sles_gamg(cs_param_sles_t *slesp, int n_down_iter, cs_param_amg_gamg_smoother_t down_smoother, int n_up_iter, cs_param_amg_gamg_smoother_t up_smoother, cs_param_amg_gamg_coarse_solver_t coarse_solver)
Set the main members of a cs_param_amg_gamg_t structure. This structure is allocated,...
Definition: cs_param_sles.cpp:1712
void cs_param_sles_copy_from(const cs_param_sles_t *src, cs_param_sles_t *dst)
Copy a cs_param_sles_t structure from src to dst.
Definition: cs_param_sles.cpp:542
void cs_param_sles_boomeramg_advanced(cs_param_sles_t *slesp, double strong_thr, cs_param_amg_boomer_interp_algo_t interp_algo, int p_max, int n_agg_lv, int n_agg_paths)
Set the members of a cs_param_amg_boomer_t structure used in advanced settings. This structure is all...
Definition: cs_param_sles.cpp:1642
void cs_param_sles_amg_inhouse_advanced(cs_param_sles_t *slesp, int max_levels, cs_gnum_t min_n_g_rows, double p0p1_relax, int coarse_max_iter, double coarse_rtol_mult)
Set the members of a cs_param_amg_inhouse_t structure used in advanced settings. CS_CDO_KEEP_DEFAULT ...
Definition: cs_param_sles.cpp:1520
void cs_param_sles_amg_inhouse_reset(cs_param_sles_t *slesp, bool used_as_solver, bool used_as_k_cycle)
Allocate and initialize a new context structure for the in-house AMG settings.
Definition: cs_param_sles.cpp:1411
int cs_param_sles_set_solver_class(const char *keyval, cs_param_sles_t *slesp)
Set the class of solvers associated to this SLES from its keyval Common choices are "petsc",...
Definition: cs_param_sles.cpp:1033
int cs_param_sles_set_solver(const char *keyval, cs_param_sles_t *slesp)
Set the solver associated to this SLES from its keyval.
Definition: cs_param_sles.cpp:602
int cs_param_sles_set_precond(const char *keyval, cs_param_sles_t *slesp)
Set the preconditioner associated to this SLES from its keyval.
Definition: cs_param_sles.cpp:770
void cs_param_sles_gamg_reset(cs_param_sles_t *slesp)
Allocate and initialize a new context structure for the GAMG settings in PETSc.
Definition: cs_param_sles.cpp:1677
void cs_param_sles_mumps_reset(cs_param_sles_t *slesp)
Allocate and initialize a new context structure for the MUMPS settings.
Definition: cs_param_sles.cpp:1888
void cs_param_sles_gamg_advanced(cs_param_sles_t *slesp, double threshold, int n_agg_lv, bool use_sq_grph, int n_smooth_agg)
Set the members of a cs_param_amg_gamg_t structure used in advanced settings. This structure is alloc...
Definition: cs_param_sles.cpp:1752
void cs_param_sles_free(cs_param_sles_t **p_slesp)
Free a cs_param_sles_t structure.
Definition: cs_param_sles.cpp:346
cs_param_solver_class_t cs_param_sles_check_class(cs_param_solver_class_t wanted_class)
Check the availability of a solver library and return the requested one if this is possible or an alt...
Definition: cs_param_sles.cpp:2147
void cs_param_sles_set_cvg_param(cs_param_sles_t *slesp, double rtol, double atol, double dtol, int max_iter)
Set the convergence criteria for the given SLES parameters. One can use the parameter value CS_CDO_KE...
Definition: cs_param_sles.cpp:1369
void cs_param_sles_boomeramg_reset(cs_param_sles_t *slesp)
Allocate and initialize a new context structure for the boomerAMG settings.
Definition: cs_param_sles.cpp:1560
void cs_param_sles_hmg(cs_param_sles_t *slesp, int n_down_iter, cs_param_amg_gamg_smoother_t down_smoother, int n_up_iter, cs_param_amg_gamg_smoother_t up_smoother, cs_param_amg_gamg_coarse_solver_t coarse_solver)
Set the main members of a cs_param_amg_hmg_t structure. This structure is allocated,...
Definition: cs_param_sles.cpp:1820
void cs_param_sles_hpddm_advanced(cs_param_sles_t *slesp, const int min_iter, const int max_iter, const int min_harmonic_overlap, const int max_harmonic_overlap, const int min_nb_eigenvector, const int max_nb_eigenvector)
Set the members related to an advanced settings of a cs_param_hpddm_t structure. This structure is al...
Definition: cs_param_sles.cpp:2079
int cs_param_sles_set_precond_block_type(const char *keyval, cs_param_sles_t *slesp)
Set the type of block preconditioner associated to this SLES from its keyval.
Definition: cs_param_sles.cpp:1304
void cs_param_sles_hpddm(cs_param_sles_t *slesp, const bool use_neumann, const int nb_eigenvector, const int harmonic_overlap, const double relative_threshold, const int p=-1)
Set the members related to an settings of a cs_param_hpddm_t structure. This structure is allocated a...
Definition: cs_param_sles.cpp:2031
cs_param_sles_t * cs_param_sles_create(int field_id, const char *system_name)
Create a cs_param_sles_t structure and assign a default settings.
Definition: cs_param_sles.cpp:295
void cs_param_sles_hmg_advanced(cs_param_sles_t *slesp, bool use_boomer_coarsening, bool reuse_interpolation, bool subspace_coarsening)
Set the members of a cs_param_amg_gamg_t structure used in advanced settings. This structure is alloc...
Definition: cs_param_sles.cpp:1857
int cs_param_sles_set_amg_type(const char *keyval, cs_param_sles_t *slesp)
Set the type of algebraic multigrid (AMG) associated to this SLES from its keyval.
Definition: cs_param_sles.cpp:1135
void cs_param_sles_boomeramg(cs_param_sles_t *slesp, int n_down_iter, cs_param_amg_boomer_smoother_t down_smoother, int n_up_iter, cs_param_amg_boomer_smoother_t up_smoother, cs_param_amg_boomer_smoother_t coarse_solver, cs_param_amg_boomer_coarsen_algo_t coarsen_algo)
Set the main members of a cs_param_amg_boomer_t structure. This structure is allocated and initialize...
Definition: cs_param_sles.cpp:1599
void cs_param_sles_log(cs_param_sles_t *slesp)
Log information related to the linear settings stored in the structure.
Definition: cs_param_sles.cpp:377
void cs_param_sles_hmg_reset(cs_param_sles_t *slesp)
Allocate and initialize a new context structure for the HMG settings in PETSc.
Definition: cs_param_sles.cpp:1785
void cs_param_sles_mumps_advanced(cs_param_sles_t *slesp, cs_param_mumps_analysis_algo_t analysis_algo, int block_analysis, bool keep_ordering, double mem_coef, double blr_threshold, int ir_steps, cs_param_mumps_memory_usage_t mem_usage, bool advanced_optim)
Set the members related to an advanced settings of a cs_param_mumps_t structure. This structure is al...
Definition: cs_param_sles.cpp:1952
cs_param_resnorm_type_t
Definition: cs_param_types.h:902
cs_param_solver_class_t
Class of iterative solvers to consider for solver the linear system.
Definition: cs_param_types.h:680
cs_param_precond_type_t
Definition: cs_param_types.h:792
cs_param_precond_block_t
Definition: cs_param_types.h:715
cs_param_solver_type_t
Definition: cs_param_types.h:873
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition: cs_param_types.h:595
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:65
cs_param_convergence_t cvg_param
Definition: cs_param_sles.h:111
cs_param_precond_block_t precond_block_type
Definition: cs_param_sles.h:83
bool allow_no_op
Definition: cs_param_sles.h:96
int field_id
Definition: cs_param_sles.h:68
bool mat_is_sym
Definition: cs_param_sles.h:104
int verbosity
Definition: cs_param_sles.h:70
void * context_param
Definition: cs_param_sles.h:118
char * name
Definition: cs_param_sles.h:67
cs_param_resnorm_type_t resnorm_type
Definition: cs_param_sles.h:89
bool need_flexible
Definition: cs_param_sles.h:75
cs_param_precond_type_t precond
Definition: cs_param_sles.h:73
cs_param_solver_class_t solver_class
Definition: cs_param_sles.h:72
int restart
Definition: cs_param_sles.h:76
cs_param_amg_type_t amg_type
Definition: cs_param_sles.h:77
cs_param_solver_type_t solver
Definition: cs_param_sles.h:74