9.2
general documentation
cs_param_saddle.h
Go to the documentation of this file.
1#ifndef CS_PARAM_SADDLE_H
2#define CS_PARAM_SADDLE_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-2026 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_sles.h"
35
36/*----------------------------------------------------------------------------*/
37
39
48/*============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52/*============================================================================
53 * Type definitions
54 *============================================================================*/
55
100typedef enum {
101
109
111
113
189typedef enum {
190
192
203
205
207
251typedef enum {
252
254
261
263
265
280typedef struct {
281
288
295 char *name;
296
311
320
327
336
345
362
369
372 /* Additional parameters which are advanced/developper settings */
373
374 void *context;
375
377
378
379/* Set of advanced settings according to the type of saddle-point solver */
380/* ===================================================================== */
381
388typedef struct {
389
396
397 /* \var dedicated_init_sles
398 * Define an additional SLES to perform the resolution associated to the
399 * transformation of the right-hand side. By default, this is false in order
400 * to not compute two setup steps in one call. */
401
403
411
413
414
421typedef struct {
422
429
436
448
450
451
458typedef struct {
459
466
473
474 /* \var dedicated_init_sles
475 * Define an additional SLES to perform the resolution associated to the
476 * transformation of the right-hand side. By default, this is false in order
477 * to not compute two setup steps in one call. */
478
480
488
490
491
498typedef struct {
499
500 /* \var scaling_coef
501 * This coefficient is used in Notay's transformation devised in "Algebraic
502 * multigrid for Stokes equations" SIAM J. Sci. Comput. Vol. 39 (5), 2017
503 */
504
506
508
509
517typedef struct {
518
519 /* \var dedicated_init_sles
520 * Define an additional SLES to perform the initial resolution. By default,
521 * this is false in order to not compute two setup steps in one call. */
522
524
531
543
545
546
554typedef struct {
555
556 /* \var dedicated_init_sles
557 * Define an additional SLES to perform the initial resolution. By default,
558 * this is false in order to not compute two setup steps in one call. */
559
561
568
580
588
590
591/*============================================================================
592 * Global variables
593 *============================================================================*/
594
595/*============================================================================
596 * Public function prototypes
597 *============================================================================*/
598
599/*----------------------------------------------------------------------------*/
606/*----------------------------------------------------------------------------*/
607
608void
610 int restart_range);
611
612/*----------------------------------------------------------------------------*/
623/*----------------------------------------------------------------------------*/
624
625void
627 double scaling_coef);
628
629/*----------------------------------------------------------------------------*/
639/*----------------------------------------------------------------------------*/
640
641void
643 const double scaling_coef);
644
645/*----------------------------------------------------------------------------*/
653/*----------------------------------------------------------------------------*/
654
655void
657 double coef);
658
659/*----------------------------------------------------------------------------*/
668/*----------------------------------------------------------------------------*/
669
670double
672
673/*----------------------------------------------------------------------------*/
681/*----------------------------------------------------------------------------*/
682
683const char *
685
686/*----------------------------------------------------------------------------*/
693/*----------------------------------------------------------------------------*/
694
697
698/*----------------------------------------------------------------------------*/
705/*----------------------------------------------------------------------------*/
706
707void
709
710/*----------------------------------------------------------------------------*/
718/*----------------------------------------------------------------------------*/
719
720const char *
722
723/*----------------------------------------------------------------------------*/
730/*----------------------------------------------------------------------------*/
731
732void
733cs_param_saddle_set_name(const char *name,
734 cs_param_saddle_t *saddlep);
735
736/*----------------------------------------------------------------------------*/
745/*----------------------------------------------------------------------------*/
746
747void
749 const cs_param_sles_t *block11_slesp);
750
751/*----------------------------------------------------------------------------*/
760/*----------------------------------------------------------------------------*/
761
762int
763cs_param_saddle_set_precond(const char *keyval,
764 cs_param_saddle_t *saddlep);
765
766/*----------------------------------------------------------------------------*/
776/*----------------------------------------------------------------------------*/
777
778int
779cs_param_saddle_set_schur_approx(const char *keyval,
780 cs_param_saddle_t *saddlep);
781
782/*----------------------------------------------------------------------------*/
791/*----------------------------------------------------------------------------*/
792
793int
794cs_param_saddle_set_solver_class(const char *keyval,
795 cs_param_saddle_t *saddlep);
796
797/*----------------------------------------------------------------------------*/
806/*----------------------------------------------------------------------------*/
807
808int
809cs_param_saddle_set_solver(const char *keyval,
810 cs_param_saddle_t *saddlep);
811
812/*----------------------------------------------------------------------------*/
821/*----------------------------------------------------------------------------*/
822
823void
825
826/*----------------------------------------------------------------------------*/
837/*----------------------------------------------------------------------------*/
838
841
842/*----------------------------------------------------------------------------*/
853/*----------------------------------------------------------------------------*/
854
857
858/*----------------------------------------------------------------------------*/
868/*----------------------------------------------------------------------------*/
869
872
873/*----------------------------------------------------------------------------*/
880/*----------------------------------------------------------------------------*/
881
882void
884 cs_param_saddle_t *dest);
885
886/*----------------------------------------------------------------------------*/
892/*----------------------------------------------------------------------------*/
893
894void
896
897/*----------------------------------------------------------------------------*/
898
900
901#endif /* CS_PARAM_SADDLE_H */
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
#define END_C_DECLS
Definition: cs_defs.h:529
int cs_param_saddle_set_precond(const char *keyval, cs_param_saddle_t *saddlep)
Set the type of preconditioning to apply for this saddle-point system.
Definition: cs_param_saddle.cpp:990
void cs_param_saddle_set_augmentation_coef(cs_param_saddle_t *saddlep, double coef)
Set the scaling in front of the augmentation term when an ALU, a GKB or a block Krylov algorithm is c...
Definition: cs_param_saddle.cpp:552
const char * cs_param_saddle_get_type_name(cs_param_saddle_solver_t type)
Retrieve the name of the type of saddle-point solver.
Definition: cs_param_saddle.cpp:660
cs_param_sles_t * cs_param_saddle_get_schur_sles_param(const cs_param_saddle_t *saddlep)
Get the pointer to the set of parameters to handle a SLES. This SLES is associated to the approximati...
Definition: cs_param_saddle.cpp:791
double cs_param_saddle_get_augmentation_coef(const cs_param_saddle_t *saddlep)
Get the scaling coefficient in front of the augmentation term when an ALU, GKB or block Krylov algori...
Definition: cs_param_saddle.cpp:610
void cs_param_saddle_copy(const cs_param_saddle_t *ref, cs_param_saddle_t *dest)
Copy a cs_param_saddle_t structure from ref to dest.
Definition: cs_param_saddle.cpp:1458
const char * cs_param_saddle_get_name(const cs_param_saddle_t *saddlep)
Retrieve the name of the saddle-point solver.
Definition: cs_param_saddle.cpp:918
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_saddle.h:189
@ CS_PARAM_SADDLE_SOLVER_NONE
Definition: cs_param_saddle.h:191
@ CS_PARAM_SADDLE_N_SOLVERS
Definition: cs_param_saddle.h:204
@ CS_PARAM_SADDLE_SOLVER_MUMPS
Definition: cs_param_saddle.h:199
@ CS_PARAM_SADDLE_SOLVER_AFS
Definition: cs_param_saddle.h:194
@ CS_PARAM_SADDLE_SOLVER_UZAWA_CG
Definition: cs_param_saddle.h:202
@ CS_PARAM_SADDLE_SOLVER_GKB
Definition: cs_param_saddle.h:197
@ CS_PARAM_SADDLE_SOLVER_SIMPLE
Definition: cs_param_saddle.h:201
@ CS_PARAM_SADDLE_SOLVER_ALU
Definition: cs_param_saddle.h:193
@ CS_PARAM_SADDLE_SOLVER_FGMRES
Definition: cs_param_saddle.h:195
@ CS_PARAM_SADDLE_SOLVER_MINRES
Definition: cs_param_saddle.h:198
@ CS_PARAM_SADDLE_SOLVER_NOTAY_TRANSFORM
Definition: cs_param_saddle.h:200
@ CS_PARAM_SADDLE_SOLVER_GCR
Definition: cs_param_saddle.h:196
void cs_param_saddle_set_name(const char *name, cs_param_saddle_t *saddlep)
Set the name of the saddle-point system.
Definition: cs_param_saddle.cpp:946
int cs_param_saddle_set_solver(const char *keyval, cs_param_saddle_t *saddlep)
Set the type of solver to apply for this saddle-point system.
Definition: cs_param_saddle.cpp:1164
void cs_param_saddle_set_notay_scaling(cs_param_saddle_t *saddlep, double scaling_coef)
Set the scaling coefficient used in the Notay's transformation devised in "Algebraic multigrid for St...
Definition: cs_param_saddle.cpp:486
void cs_param_saddle_try_init_schur_sles_param(cs_param_saddle_t *saddlep)
Initialize a cs_param_sles_t structure for the Schur approximation nested inside a cs_param_saddle_t ...
Definition: cs_param_saddle.cpp:1437
cs_param_saddle_t * cs_param_saddle_create(void)
Create a cs_param_saddle_t structure No solver is set by default.
Definition: cs_param_saddle.cpp:713
cs_param_saddle_precond_t
Type of preconditioner used to solve a saddle-point system. Up to now, this happens only in two cases...
Definition: cs_param_saddle.h:100
@ CS_PARAM_SADDLE_PRECOND_AFS
Definition: cs_param_saddle.h:103
@ CS_PARAM_SADDLE_PRECOND_NONE
Definition: cs_param_saddle.h:102
@ CS_PARAM_SADDLE_PRECOND_DIAG
Definition: cs_param_saddle.h:104
@ CS_PARAM_SADDLE_N_PRECOND
Definition: cs_param_saddle.h:110
@ CS_PARAM_SADDLE_PRECOND_LOWER
Definition: cs_param_saddle.h:105
@ CS_PARAM_SADDLE_PRECOND_UPPER
Definition: cs_param_saddle.h:107
@ CS_PARAM_SADDLE_PRECOND_UZAWA
Definition: cs_param_saddle.h:108
@ CS_PARAM_SADDLE_PRECOND_SGS
Definition: cs_param_saddle.h:106
cs_param_saddle_schur_approx_t
Strategy to build the Schur complement approximation. This appears in block preconditioning or Uzawa ...
Definition: cs_param_saddle.h:251
@ CS_PARAM_SADDLE_SCHUR_NONE
Definition: cs_param_saddle.h:253
@ CS_PARAM_SADDLE_SCHUR_DIAG_INVERSE
Definition: cs_param_saddle.h:255
@ CS_PARAM_SADDLE_SCHUR_LUMPED_INVERSE
Definition: cs_param_saddle.h:257
@ CS_PARAM_SADDLE_N_SCHUR_APPROX
Definition: cs_param_saddle.h:262
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED_DIAG_INVERSE
Definition: cs_param_saddle.h:259
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED_LUMPED_INVERSE
Definition: cs_param_saddle.h:260
@ CS_PARAM_SADDLE_SCHUR_IDENTITY
Definition: cs_param_saddle.h:256
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED
Definition: cs_param_saddle.h:258
cs_param_sles_t * cs_param_saddle_get_init_sles_param(const cs_param_saddle_t *saddlep)
Get the pointer to the set of parameters to handle a SLES. This SLES is associated to the initial sad...
Definition: cs_param_saddle.cpp:867
void cs_param_saddle_free(cs_param_saddle_t **p_saddlep)
Free the structure storing the parameter settings for a saddle-point system.
Definition: cs_param_saddle.cpp:755
cs_param_sles_t * cs_param_saddle_get_xtra_sles_param(const cs_param_saddle_t *saddlep)
Get the pointer to the set of parameters to handle a SLES. This SLES is associated to an extra-operat...
Definition: cs_param_saddle.cpp:813
int cs_param_saddle_set_schur_approx(const char *keyval, cs_param_saddle_t *saddlep)
Set the type of Schur approximation to apply to this saddle-point system.
Definition: cs_param_saddle.cpp:1050
int cs_param_saddle_set_solver_class(const char *keyval, cs_param_saddle_t *saddlep)
Set the class of solver to apply for this saddle-point system.
Definition: cs_param_saddle.cpp:1112
void cs_param_saddle_set_block11_sles_param(cs_param_saddle_t *saddlep, const cs_param_sles_t *block11_slesp)
Assign the cs_param_sles_t structure (shared) related to the (1,1)-block to the structure managing th...
Definition: cs_param_saddle.cpp:969
void cs_param_saddle_log(const cs_param_saddle_t *saddlep)
Log the setup information for the given cs_param_saddle_t structure.
Definition: cs_param_saddle.cpp:1576
void cs_param_saddle_set_restart_range(cs_param_saddle_t *saddlep, int restart_range)
Set the number of iterations to store before starting a Krylov solver.
Definition: cs_param_saddle.cpp:444
void cs_param_saddle_set_simple_relaxation_scaling(cs_param_saddle_t *saddlep, const double scaling_coef)
Set the scaling coefficient used in the AFS/SIMPLE-like method devised in "SIMPLE-like preconditioner...
Definition: cs_param_saddle.cpp:514
Structure and routines handling the SLES ((Sparse Linear Equation Solver) settings stored inside a cs...
cs_param_solver_class_t
Class of iterative solvers to consider for solver the linear system.
Definition: cs_param_types.h:752
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition: cs_param_types.h:603
Structure storing additional elements associated with the usage of the Augmented Lagrangian Uzawa (AL...
Definition: cs_param_saddle.h:388
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:410
bool dedicated_init_sles
Definition: cs_param_saddle.h:402
double augmentation_scaling
Definition: cs_param_saddle.h:395
Structure storing additional elements associated with the usage of block preconditioners with a Krylo...
Definition: cs_param_saddle.h:421
int n_stored_directions
Definition: cs_param_saddle.h:435
double augmentation_scaling
Definition: cs_param_saddle.h:428
cs_param_sles_t * xtra_sles_param
Definition: cs_param_saddle.h:447
Structure storing additional elements associated with the usage of the Golub-Kahan Bidiagonalization ...
Definition: cs_param_saddle.h:458
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:487
bool dedicated_init_sles
Definition: cs_param_saddle.h:479
double augmentation_scaling
Definition: cs_param_saddle.h:465
int truncation_threshold
Definition: cs_param_saddle.h:472
Structure storing additional elements associated with the usage of the Notay's algebraic transformati...
Definition: cs_param_saddle.h:498
double scaling_coef
Definition: cs_param_saddle.h:505
Structure storing additional elements associated with the usage of the Algebraic Fractional Step meth...
Definition: cs_param_saddle.h:554
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:567
bool dedicated_init_sles
Definition: cs_param_saddle.h:560
cs_param_sles_t * xtra_sles_param
Definition: cs_param_saddle.h:579
double scaling_coef
Definition: cs_param_saddle.h:587
Structure storing additional elements associated with the usage of the Uzawa-CG algorithm (an Uzawa a...
Definition: cs_param_saddle.h:517
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:530
bool dedicated_init_sles
Definition: cs_param_saddle.h:523
cs_param_sles_t * xtra_sles_param
Definition: cs_param_saddle.h:542
Structure storing all metadata related to the resolution of a saddle-point linear system....
Definition: cs_param_saddle.h:280
cs_param_convergence_t cvg_param
Definition: cs_param_saddle.h:335
cs_param_saddle_precond_t precond
Definition: cs_param_saddle.h:326
cs_param_sles_t * schur_sles_param
Definition: cs_param_saddle.h:368
cs_param_saddle_solver_t solver
Definition: cs_param_saddle.h:319
const cs_param_sles_t * block11_sles_param
Definition: cs_param_saddle.h:344
int verbosity
Definition: cs_param_saddle.h:287
cs_param_solver_class_t solver_class
Definition: cs_param_saddle.h:310
cs_param_saddle_schur_approx_t schur_approx
Definition: cs_param_saddle.h:361
char * name
Definition: cs_param_saddle.h:295
void * context
Definition: cs_param_saddle.h:374
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:63