8.3
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-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_sles.h"
35
36/*----------------------------------------------------------------------------*/
37
39
48/*============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52/*============================================================================
53 * Type definitions
54 *============================================================================*/
55
100typedef enum {
101
108
110
112
183typedef enum {
184
186
196
198
200
244typedef enum {
245
247
254
256
258
273typedef struct {
274
281
288 char *name;
289
304
313
320
329
338
355
362
365 /* Additional parameters which are advanced/developper settings */
366
367 void *context;
368
370
371
372/* Set of advanced settings according to the type of saddle-point solver */
373/* ===================================================================== */
374
375/* Augmented Lagrangian Uzawa algorithm */
376/* ------------------------------------ */
377
378typedef struct {
379
386
387 /* \var dedicated_init_sles
388 * Define an additional SLES to perform the resolution associated to the
389 * transformation of the right-hand side. By default, this is false in order
390 * to not compute two setup steps in one call. */
391
393
401
403
404
405/* Block preconditioner algorithm with a Krylov solver */
406/* --------------------------------------------------- */
407
408typedef struct {
409
417
424
436
438
439
440/* GKB algorithm */
441/* ------------- */
442
443typedef struct {
444
452
459
460 /* \var dedicated_init_sles
461 * Define an additional SLES to perform the resolution associated to the
462 * transformation of the right-hand side. By default, this is false in order
463 * to not compute two setup steps in one call. */
464
466
474
476
477
478/* Notay's algebraic transformation */
479/* -------------------------------- */
480
481typedef struct {
482
483 /* \var scaling_coef
484 * This coefficient is used in Notay's transformation devised in "Algebraic
485 * multigrid for Stokes equations" SIAM J. Sci. Comput. Vol. 39 (5), 2017
486 */
487
489
491
492/* Uzawa-CG algorithm */
493/* ------------------ */
494
495typedef struct {
496
497 /* \var dedicated_init_sles
498 * Define an additional SLES to perform the initial resolution. By default,
499 * this is false in order to not compute two setup steps in one call. */
500
502
509
521
523
524/* SIMPLE-like algorithm */
525/* --------------------- */
526
527typedef struct {
528
529 /* \var dedicated_init_sles
530 * Define an additional SLES to perform the initial resolution. By default,
531 * this is false in order to not compute two setup steps in one call. */
532
534
541
553
555
556/*============================================================================
557 * Global variables
558 *============================================================================*/
559
560/*============================================================================
561 * Public function prototypes
562 *============================================================================*/
563
564/*----------------------------------------------------------------------------*/
571/*----------------------------------------------------------------------------*/
572
573void
575 int restart_range);
576
577/*----------------------------------------------------------------------------*/
588/*----------------------------------------------------------------------------*/
589
590void
592 double scaling_coef);
593
594/*----------------------------------------------------------------------------*/
602/*----------------------------------------------------------------------------*/
603
604void
606 double coef);
607
608/*----------------------------------------------------------------------------*/
617/*----------------------------------------------------------------------------*/
618
619double
621
622/*----------------------------------------------------------------------------*/
630/*----------------------------------------------------------------------------*/
631
632const char *
634
635/*----------------------------------------------------------------------------*/
642/*----------------------------------------------------------------------------*/
643
646
647/*----------------------------------------------------------------------------*/
654/*----------------------------------------------------------------------------*/
655
656void
658
659/*----------------------------------------------------------------------------*/
667/*----------------------------------------------------------------------------*/
668
669const char *
671
672/*----------------------------------------------------------------------------*/
679/*----------------------------------------------------------------------------*/
680
681void
682cs_param_saddle_set_name(const char *name,
683 cs_param_saddle_t *saddlep);
684
685/*----------------------------------------------------------------------------*/
694/*----------------------------------------------------------------------------*/
695
696void
698 const cs_param_sles_t *block11_slesp);
699
700/*----------------------------------------------------------------------------*/
709/*----------------------------------------------------------------------------*/
710
711int
712cs_param_saddle_set_precond(const char *keyval,
713 cs_param_saddle_t *saddlep);
714
715/*----------------------------------------------------------------------------*/
725/*----------------------------------------------------------------------------*/
726
727int
728cs_param_saddle_set_schur_approx(const char *keyval,
729 cs_param_saddle_t *saddlep);
730
731/*----------------------------------------------------------------------------*/
740/*----------------------------------------------------------------------------*/
741
742int
743cs_param_saddle_set_solver_class(const char *keyval,
744 cs_param_saddle_t *saddlep);
745
746/*----------------------------------------------------------------------------*/
755/*----------------------------------------------------------------------------*/
756
757int
758cs_param_saddle_set_solver(const char *keyval,
759 cs_param_saddle_t *saddlep);
760
761/*----------------------------------------------------------------------------*/
770/*----------------------------------------------------------------------------*/
771
772void
774
775/*----------------------------------------------------------------------------*/
786/*----------------------------------------------------------------------------*/
787
790
791/*----------------------------------------------------------------------------*/
802/*----------------------------------------------------------------------------*/
803
806
807/*----------------------------------------------------------------------------*/
817/*----------------------------------------------------------------------------*/
818
821
822/*----------------------------------------------------------------------------*/
829/*----------------------------------------------------------------------------*/
830
831void
833 cs_param_saddle_t *dest);
834
835/*----------------------------------------------------------------------------*/
841/*----------------------------------------------------------------------------*/
842
843void
845
846/*----------------------------------------------------------------------------*/
847
849
850#endif /* __CS_PARAM_SADDLE_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
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:923
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:490
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:597
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:725
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:547
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:1334
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:851
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:183
@ CS_PARAM_SADDLE_SOLVER_NONE
Definition: cs_param_saddle.h:185
@ CS_PARAM_SADDLE_N_SOLVERS
Definition: cs_param_saddle.h:197
@ CS_PARAM_SADDLE_SOLVER_MUMPS
Definition: cs_param_saddle.h:192
@ CS_PARAM_SADDLE_SOLVER_UZAWA_CG
Definition: cs_param_saddle.h:195
@ CS_PARAM_SADDLE_SOLVER_GKB
Definition: cs_param_saddle.h:190
@ CS_PARAM_SADDLE_SOLVER_SIMPLE
Definition: cs_param_saddle.h:194
@ CS_PARAM_SADDLE_SOLVER_ALU
Definition: cs_param_saddle.h:187
@ CS_PARAM_SADDLE_SOLVER_FGMRES
Definition: cs_param_saddle.h:188
@ CS_PARAM_SADDLE_SOLVER_MINRES
Definition: cs_param_saddle.h:191
@ CS_PARAM_SADDLE_SOLVER_NOTAY_TRANSFORM
Definition: cs_param_saddle.h:193
@ CS_PARAM_SADDLE_SOLVER_GCR
Definition: cs_param_saddle.h:189
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:879
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:1085
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:464
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:1313
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:647
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_NONE
Definition: cs_param_saddle.h:102
@ CS_PARAM_SADDLE_PRECOND_DIAG
Definition: cs_param_saddle.h:103
@ CS_PARAM_SADDLE_N_PRECOND
Definition: cs_param_saddle.h:109
@ CS_PARAM_SADDLE_PRECOND_LOWER
Definition: cs_param_saddle.h:104
@ CS_PARAM_SADDLE_PRECOND_UPPER
Definition: cs_param_saddle.h:106
@ CS_PARAM_SADDLE_PRECOND_UZAWA
Definition: cs_param_saddle.h:107
@ CS_PARAM_SADDLE_PRECOND_SGS
Definition: cs_param_saddle.h:105
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:244
@ CS_PARAM_SADDLE_SCHUR_NONE
Definition: cs_param_saddle.h:246
@ CS_PARAM_SADDLE_SCHUR_DIAG_INVERSE
Definition: cs_param_saddle.h:248
@ CS_PARAM_SADDLE_SCHUR_LUMPED_INVERSE
Definition: cs_param_saddle.h:250
@ CS_PARAM_SADDLE_N_SCHUR_APPROX
Definition: cs_param_saddle.h:255
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED_DIAG_INVERSE
Definition: cs_param_saddle.h:252
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED_LUMPED_INVERSE
Definition: cs_param_saddle.h:253
@ CS_PARAM_SADDLE_SCHUR_IDENTITY
Definition: cs_param_saddle.h:249
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED
Definition: cs_param_saddle.h:251
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:800
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:689
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:747
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:971
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:1033
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:902
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:1452
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:423
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:643
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition: cs_param_types.h:558
Definition: cs_param_saddle.h:378
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:400
bool dedicated_init_sles
Definition: cs_param_saddle.h:392
double augmentation_scaling
Definition: cs_param_saddle.h:385
Definition: cs_param_saddle.h:408
int n_stored_directions
Definition: cs_param_saddle.h:423
double augmentation_scaling
Definition: cs_param_saddle.h:416
cs_param_sles_t * xtra_sles_param
Definition: cs_param_saddle.h:435
Definition: cs_param_saddle.h:443
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:473
bool dedicated_init_sles
Definition: cs_param_saddle.h:465
double augmentation_scaling
Definition: cs_param_saddle.h:451
int truncation_threshold
Definition: cs_param_saddle.h:458
Definition: cs_param_saddle.h:481
double scaling_coef
Definition: cs_param_saddle.h:488
Definition: cs_param_saddle.h:527
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:540
bool dedicated_init_sles
Definition: cs_param_saddle.h:533
cs_param_sles_t * xtra_sles_param
Definition: cs_param_saddle.h:552
Definition: cs_param_saddle.h:495
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:508
bool dedicated_init_sles
Definition: cs_param_saddle.h:501
cs_param_sles_t * xtra_sles_param
Definition: cs_param_saddle.h:520
Structure storing all metadata related to the resolution of a saddle-point linear system....
Definition: cs_param_saddle.h:273
cs_param_convergence_t cvg_param
Definition: cs_param_saddle.h:328
cs_param_saddle_precond_t precond
Definition: cs_param_saddle.h:319
cs_param_sles_t * schur_sles_param
Definition: cs_param_saddle.h:361
cs_param_saddle_solver_t solver
Definition: cs_param_saddle.h:312
const cs_param_sles_t * block11_sles_param
Definition: cs_param_saddle.h:337
int verbosity
Definition: cs_param_saddle.h:280
cs_param_solver_class_t solver_class
Definition: cs_param_saddle.h:303
cs_param_saddle_schur_approx_t schur_approx
Definition: cs_param_saddle.h:354
char * name
Definition: cs_param_saddle.h:288
void * context
Definition: cs_param_saddle.h:367
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:64