8.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 settings
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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  * Macro definitions
50  *============================================================================*/
51 
52 /*============================================================================
53  * Type definitions
54  *============================================================================*/
55 
61 typedef struct {
62 
78  double atol;
79  double rtol;
80  double dtol;
82 
84 
103 typedef enum {
104 
108 
110 
112 
150 typedef enum {
151 
159 
161 
163 
165 
166 
173 typedef struct {
174 
175  /* \var analysis_algo
176  * Choice of the algorithm used to perform the analysis step
177  *
178  * \var facto_type
179  * Type of factorization to consider. This choice depends on the type of
180  * matrix to handle
181  */
182 
185 
186  bool is_single;
191  double blr_threshold;
195  double mem_coef;
202  int ir_steps;
205 
206 
213 typedef struct {
214 
215  char *name;
216  int field_id;
218  int verbosity;
219  bool setup_done;
224  bool flexible;
225  int restart;
233 
239 
246 
253 
255 
262 typedef struct {
263 
270 
286 
293 
302 
321 
328 
332 
333 /*============================================================================
334  * Global variables
335  *============================================================================*/
336 
337 /*============================================================================
338  * Static inline public function prototypes
339  *============================================================================*/
340 
341 /*----------------------------------------------------------------------------*/
349 /*----------------------------------------------------------------------------*/
350 
351 static inline bool
353 {
354  if (solver == CS_PARAM_ITSOL_MUMPS)
355  return true;
356  else
357  return false;
358 }
359 
360 /*============================================================================
361  * Public function prototypes
362  *============================================================================*/
363 
364 /*----------------------------------------------------------------------------*/
371 /*----------------------------------------------------------------------------*/
372 
375 
376 /*----------------------------------------------------------------------------*/
386 /*----------------------------------------------------------------------------*/
387 
388 void
389 cs_param_sles_saddle_init_schur(const char *basename,
390  cs_param_sles_saddle_t *saddlep);
391 
392 /*----------------------------------------------------------------------------*/
399 /*----------------------------------------------------------------------------*/
400 
401 void
403  cs_param_sles_saddle_t *dest);
404 
405 /*----------------------------------------------------------------------------*/
412 /*----------------------------------------------------------------------------*/
413 
414 void
416 
417 /*----------------------------------------------------------------------------*/
427 /*----------------------------------------------------------------------------*/
428 
430 cs_param_sles_create(int field_id,
431  const char *system_name);
432 
433 /*----------------------------------------------------------------------------*/
439 /*----------------------------------------------------------------------------*/
440 
441 void
443 
444 /*----------------------------------------------------------------------------*/
451 /*----------------------------------------------------------------------------*/
452 
453 void
455 
456 /*----------------------------------------------------------------------------*/
466 /*----------------------------------------------------------------------------*/
467 
468 void
470  bool is_single,
471  cs_param_sles_facto_type_t facto_type);
472 
473 /*----------------------------------------------------------------------------*/
488 /*----------------------------------------------------------------------------*/
489 
490 void
492  cs_param_sles_analysis_algo_t analysis_algo,
493  int block_analysis,
494  double mem_coef,
495  double blr_threshold,
496  int ir_steps,
497  bool advanced_optim);
498 
499 /*----------------------------------------------------------------------------*/
506 /*----------------------------------------------------------------------------*/
507 
508 void
510  cs_param_sles_t *dst);
511 
512 /*----------------------------------------------------------------------------*/
522 /*----------------------------------------------------------------------------*/
523 
524 int
525 cs_param_sles_set(bool use_field_id,
526  cs_param_sles_t *slesp);
527 
528 /*----------------------------------------------------------------------------*/
540 /*----------------------------------------------------------------------------*/
541 
542 void
543 cs_param_sles_update_cvg_settings(bool use_field_id,
544  const cs_param_sles_t *slesp);
545 
546 /*----------------------------------------------------------------------------*/
554 /*----------------------------------------------------------------------------*/
555 
558 
559 /*----------------------------------------------------------------------------*/
569 /*----------------------------------------------------------------------------*/
570 
573 
574 /*----------------------------------------------------------------------------*/
581 /*----------------------------------------------------------------------------*/
582 
583 void
585 
586 #if defined(HAVE_PETSC)
587 /*----------------------------------------------------------------------------*/
596 /*----------------------------------------------------------------------------*/
597 
598 void
599 cs_param_sles_petsc_cmd(bool use_prefix,
600  const char *prefix,
601  const char *keyword,
602  const char *keyval);
603 #endif
604 
605 /*----------------------------------------------------------------------------*/
606 
608 
609 #endif /* __CS_PARAM_SLES_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
#define END_C_DECLS
Definition: cs_defs.h:515
cs_param_sles_class_t cs_param_sles_get_class_from_amg(cs_param_amg_type_t amg_type)
Retrieve the related solver class from the amg type.
Definition: cs_param_sles.c:3175
void cs_param_sles_mumps(cs_param_sles_t *slesp, bool is_single, cs_param_sles_facto_type_t facto_type)
Set the main memebers of a cs_param_sles_mumps_t structure. This structure is allocated if needed....
Definition: cs_param_sles.c:2995
cs_param_sles_analysis_algo_t
Type of algorithm to consider when using the MUMPS solver to perform the analysis step (renumbering a...
Definition: cs_param_sles.h:150
@ CS_PARAM_SLES_ANALYSIS_AMD
Definition: cs_param_sles.h:152
@ CS_PARAM_SLES_ANALYSIS_QAMD
Definition: cs_param_sles.h:153
@ CS_PARAM_SLES_N_ANALYSIS_ALGOS
Definition: cs_param_sles.h:162
@ CS_PARAM_SLES_ANALYSIS_PORD
Definition: cs_param_sles.h:154
@ CS_PARAM_SLES_ANALYSIS_SCOTCH
Definition: cs_param_sles.h:155
@ CS_PARAM_SLES_ANALYSIS_PTSCOTCH
Definition: cs_param_sles.h:156
@ CS_PARAM_SLES_ANALYSIS_AUTO
Definition: cs_param_sles.h:160
@ CS_PARAM_SLES_ANALYSIS_PARMETIS
Definition: cs_param_sles.h:158
@ CS_PARAM_SLES_ANALYSIS_METIS
Definition: cs_param_sles.h:157
cs_param_sles_facto_type_t
type of factorization to consider when using the MUMPS solver to solve a linear system
Definition: cs_param_sles.h:103
@ CS_PARAM_SLES_FACTO_LU
LU factorization is the most generic factorization available with MUMPS. It can handle general matric...
Definition: cs_param_sles.h:105
@ CS_PARAM_SLES_FACTO_LDLT_SPD
This factorization is devoted to SPD matrices and corresponds to a Cholesky factorization....
Definition: cs_param_sles.h:107
@ CS_PARAM_SLES_FACTO_LDLT_SYM
This factorization is a Cholesky factorization (L.D.Lt) for general symmetric matrices.
Definition: cs_param_sles.h:106
@ CS_PARAM_SLES_N_FACTO_TYPES
Definition: cs_param_sles.h:109
static bool cs_param_sles_is_mumps_set(cs_param_itsol_type_t solver)
Find if a MUMPS-related solver is set or not.
Definition: cs_param_sles.h:352
void cs_param_sles_check_amg(cs_param_sles_t *slesp)
Check if the setting related to the AMG is consistent with the solver class.
Definition: cs_param_sles.c:3274
cs_param_sles_saddle_t * cs_param_sles_saddle_create(void)
Create a cs_param_sles_saddle_t structure and assign a minimalist default settings.
Definition: cs_param_sles.c:2567
cs_param_sles_class_t cs_param_sles_check_class(cs_param_sles_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.c:3206
void cs_param_sles_update_cvg_settings(bool use_field_id, const cs_param_sles_t *slesp)
Update the settings associated to a cs_sles_t structure and apply those defined in the given cs_param...
Definition: cs_param_sles.c:3076
void cs_param_sles_free(cs_param_sles_t **p_slesp)
Free a cs_param_sles_t structure.
Definition: cs_param_sles.c:2747
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.c:2699
int cs_param_sles_set(bool use_field_id, cs_param_sles_t *slesp)
Define cs_sles_t structure in accordance with the settings of a cs_param_sles_t structure (SLES = Spa...
Definition: cs_param_sles.c:2920
void cs_param_sles_mumps_advanced(cs_param_sles_t *slesp, cs_param_sles_analysis_algo_t analysis_algo, int block_analysis, double mem_coef, double blr_threshold, int ir_steps, bool advanced_optim)
Set the main memebers of a cs_param_sles_mumps_t structure. This structure is allocated if needed....
Definition: cs_param_sles.c:3035
void cs_param_sles_saddle_copy(const cs_param_sles_saddle_t *ref, cs_param_sles_saddle_t *dest)
Copy a cs_param_sles_saddle_t structure from ref to dest.
Definition: cs_param_sles.c:2638
void cs_param_sles_saddle_init_schur(const char *basename, cs_param_sles_saddle_t *saddlep)
Initialize a cs_param_sles_t structure for the Schur approximation nested inside a ref cs_param_sles_...
Definition: cs_param_sles.c:2602
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.c:2778
void cs_param_sles_copy_from(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.c:2872
void cs_param_sles_saddle_free(cs_param_sles_saddle_t **p_saddlep)
Free the structure storing the parameter settings for a saddle-point system.
Definition: cs_param_sles.c:2673
cs_param_resnorm_type_t
Definition: cs_param_types.h:1021
cs_param_saddle_solver_t
Type of solver used to solve a saddle-point system. Up to now, this happens only with CDO cell-based ...
Definition: cs_param_types.h:698
cs_param_precond_type_t
Definition: cs_param_types.h:898
cs_param_sles_class_t
Class of iterative solvers to consider for solver the linear system.
Definition: cs_param_types.h:586
cs_param_precond_block_t
Definition: cs_param_types.h:819
cs_param_itsol_type_t
Definition: cs_param_types.h:989
@ CS_PARAM_ITSOL_MUMPS
Definition: cs_param_types.h:1007
cs_param_saddle_precond_t
Type of preconditioner used to solve a saddle-point system. Up to now, this happens only with CDO cel...
Definition: cs_param_types.h:656
cs_param_schur_approx_t
Strategy to build the Schur complement approximation. This appears in block preconditioning or Uzawa ...
Definition: cs_param_types.h:753
cs_param_amg_type_t
Definition: cs_param_types.h:604
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition: cs_param_sles.h:61
double atol
Definition: cs_param_sles.h:78
double dtol
Definition: cs_param_sles.h:80
int n_max_iter
Definition: cs_param_sles.h:81
double rtol
Definition: cs_param_sles.h:79
Set of parameters to specify additional options to MUMPS For more advanced settings,...
Definition: cs_param_sles.h:173
double blr_threshold
Definition: cs_param_sles.h:191
double mem_coef
Definition: cs_param_sles.h:195
int ir_steps
Definition: cs_param_sles.h:202
int block_analysis
Definition: cs_param_sles.h:199
bool is_single
Definition: cs_param_sles.h:186
cs_param_sles_facto_type_t facto_type
Definition: cs_param_sles.h:184
bool advanced_optim
Definition: cs_param_sles.h:188
cs_param_sles_analysis_algo_t analysis_algo
Definition: cs_param_sles.h:183
Structure storing all metadata related to the resolution of a saddle-point linear system.
Definition: cs_param_sles.h:262
cs_param_sles_cvg_t cvg_param
Definition: cs_param_sles.h:301
cs_param_saddle_precond_t precond
Definition: cs_param_sles.h:292
cs_param_sles_t * schur_sles_param
Definition: cs_param_sles.h:327
cs_param_saddle_solver_t solver
Definition: cs_param_sles.h:285
cs_param_schur_approx_t schur_approximation
Definition: cs_param_sles.h:320
int verbosity
Definition: cs_param_sles.h:269
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:213
cs_param_sles_cvg_t cvg_param
Definition: cs_param_sles.h:245
int field_id
Definition: cs_param_sles.h:216
int verbosity
Definition: cs_param_sles.h:218
void * context_param
Definition: cs_param_sles.h:252
char * name
Definition: cs_param_sles.h:215
cs_param_resnorm_type_t resnorm_type
Definition: cs_param_sles.h:238
cs_param_itsol_type_t solver
Definition: cs_param_sles.h:223
cs_param_precond_type_t precond
Definition: cs_param_sles.h:222
int restart
Definition: cs_param_sles.h:225
cs_param_sles_class_t solver_class
Definition: cs_param_sles.h:221
bool setup_done
Definition: cs_param_sles.h:219
cs_param_amg_type_t amg_type
Definition: cs_param_sles.h:226
bool flexible
Definition: cs_param_sles.h:224
cs_param_precond_block_t pcd_block_type
Definition: cs_param_sles.h:232