8.0
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 
91 typedef struct {
92 
93  char *name;
94  int field_id;
96  int verbosity;
97  bool setup_done;
102  bool flexible;
103  int restart;
111 
117 
124 
126 
133 typedef struct {
140 
153 
160 
169 
181 
188 
192 
193 /*============================================================================
194  * Global variables
195  *============================================================================*/
196 
197 /*============================================================================
198  * Static inline public function prototypes
199  *============================================================================*/
200 
201 /*----------------------------------------------------------------------------*/
209 /*----------------------------------------------------------------------------*/
210 
211 static inline bool
213 {
214  switch (solver) {
215 
222  return true;
223 
224  default:
225  return false;
226 
227  }
228 }
229 
230 /*============================================================================
231  * Public function prototypes
232  *============================================================================*/
233 
234 /*----------------------------------------------------------------------------*/
241 /*----------------------------------------------------------------------------*/
242 
245 
246 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
258 void
259 cs_param_sles_saddle_init_schur(const char *basename,
260  cs_param_sles_saddle_t *saddlep);
261 
262 /*----------------------------------------------------------------------------*/
269 /*----------------------------------------------------------------------------*/
270 
271 void
273  cs_param_sles_saddle_t *dest);
274 
275 /*----------------------------------------------------------------------------*/
282 /*----------------------------------------------------------------------------*/
283 
284 void
286 
287 /*----------------------------------------------------------------------------*/
297 /*----------------------------------------------------------------------------*/
298 
300 cs_param_sles_create(int field_id,
301  const char *system_name);
302 
303 /*----------------------------------------------------------------------------*/
309 /*----------------------------------------------------------------------------*/
310 
311 void
313 
314 /*----------------------------------------------------------------------------*/
321 /*----------------------------------------------------------------------------*/
322 
323 void
325 
326 /*----------------------------------------------------------------------------*/
333 /*----------------------------------------------------------------------------*/
334 
335 void
337  cs_param_sles_t *dst);
338 
339 /*----------------------------------------------------------------------------*/
349 /*----------------------------------------------------------------------------*/
350 
351 int
352 cs_param_sles_set(bool use_field_id,
353  cs_param_sles_t *slesp);
354 
355 /*----------------------------------------------------------------------------*/
367 /*----------------------------------------------------------------------------*/
368 
369 void
370 cs_param_sles_update_cvg_settings(bool use_field_id,
371  const cs_param_sles_t *slesp);
372 
373 /*----------------------------------------------------------------------------*/
381 /*----------------------------------------------------------------------------*/
382 
385 
386 /*----------------------------------------------------------------------------*/
396 /*----------------------------------------------------------------------------*/
397 
400 
401 /*----------------------------------------------------------------------------*/
408 /*----------------------------------------------------------------------------*/
409 
410 void
412 
413 #if defined(HAVE_PETSC)
414 /*----------------------------------------------------------------------------*/
423 /*----------------------------------------------------------------------------*/
424 
425 void
426 cs_param_sles_petsc_cmd(bool use_prefix,
427  const char *prefix,
428  const char *keyword,
429  const char *keyval);
430 #endif
431 
432 /*----------------------------------------------------------------------------*/
433 
435 
436 #endif /* __CS_PARAM_SLES_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
#define END_C_DECLS
Definition: cs_defs.h:510
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:2918
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:212
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:3017
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:2423
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:2949
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:2819
void cs_param_sles_free(cs_param_sles_t **p_slesp)
Free a cs_param_sles_t structure.
Definition: cs_param_sles.c:2601
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:2555
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:2742
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:2494
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:2458
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:2626
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:2704
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:2529
cs_param_resnorm_type_t
Definition: cs_param_types.h:1074
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:697
cs_param_precond_type_t
Definition: cs_param_types.h:919
cs_param_sles_class_t
Class of iterative solvers to consider for solver the linear system.
Definition: cs_param_types.h:585
cs_param_precond_block_t
Definition: cs_param_types.h:818
cs_param_itsol_type_t
Definition: cs_param_types.h:1037
@ CS_PARAM_ITSOL_MUMPS_FLOAT_LDLT
Definition: cs_param_types.h:1057
@ CS_PARAM_ITSOL_MUMPS_FLOAT
Definition: cs_param_types.h:1056
@ CS_PARAM_ITSOL_MUMPS_SYM
Definition: cs_param_types.h:1060
@ CS_PARAM_ITSOL_MUMPS
Definition: cs_param_types.h:1055
@ CS_PARAM_ITSOL_MUMPS_LDLT
Definition: cs_param_types.h:1059
@ CS_PARAM_ITSOL_MUMPS_FLOAT_SYM
Definition: cs_param_types.h:1058
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:655
cs_param_schur_approx_t
Strategy to build the Schur complement approximation. This appears in block preconditioning or Uzawa ...
Definition: cs_param_types.h:752
cs_param_amg_type_t
Definition: cs_param_types.h:603
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
Structure storing all metadata related to the resolution of a saddle-point linear system.
Definition: cs_param_sles.h:133
cs_param_sles_cvg_t cvg_param
Definition: cs_param_sles.h:168
cs_param_saddle_precond_t precond
Definition: cs_param_sles.h:159
cs_param_sles_t * schur_sles_param
Definition: cs_param_sles.h:187
cs_param_saddle_solver_t solver
Definition: cs_param_sles.h:152
cs_param_schur_approx_t schur_approximation
Definition: cs_param_sles.h:180
int verbosity
Definition: cs_param_sles.h:139
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:91
cs_param_sles_cvg_t cvg_param
Definition: cs_param_sles.h:123
int field_id
Definition: cs_param_sles.h:94
int verbosity
Definition: cs_param_sles.h:96
char * name
Definition: cs_param_sles.h:93
cs_param_resnorm_type_t resnorm_type
Definition: cs_param_sles.h:116
cs_param_itsol_type_t solver
Definition: cs_param_sles.h:101
cs_param_precond_type_t precond
Definition: cs_param_sles.h:100
int restart
Definition: cs_param_sles.h:103
cs_param_sles_class_t solver_class
Definition: cs_param_sles.h:99
bool setup_done
Definition: cs_param_sles.h:97
cs_param_amg_type_t amg_type
Definition: cs_param_sles.h:104
bool flexible
Definition: cs_param_sles.h:102
cs_param_precond_block_t pcd_block_type
Definition: cs_param_sles.h:110