8.2
general documentation
Loading...
Searching...
No Matches
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
47
48/*============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52/*============================================================================
53 * Type definitions
54 *============================================================================*/
55
99
112
182
199
242
257
271
272typedef struct {
273
278
280
286
287 char *name;
288
294
296
301
303
310
312
317
319
326
328
330
335
337
345
352
354
359
361
363
364 /* Additional parameters which are advanced/developper settings */
365
366 void *context;
367
369
370
371/* Set of advanced settings according to the type of saddle-point solver */
372/* ===================================================================== */
373
374/* Augmented Lagrangian Uzawa algorithm */
375/* ------------------------------------ */
376
377typedef struct {
378
383
385
386 /* \var dedicated_init_sles
387 * Define an additional SLES to perform the resolution associated to the
388 * transformation of the right-hand side. By default, this is false in order
389 * to not compute two setup steps in one call. */
390
392
398
400
402
403
404/* Block preconditioner algorithm with a Krylov solver */
405/* --------------------------------------------------- */
406
429
430
431/* GKB algorithm */
432/* ------------- */
433
434typedef struct {
435
441
443
448
450
451 /* \var dedicated_init_sles
452 * Define an additional SLES to perform the resolution associated to the
453 * transformation of the right-hand side. By default, this is false in order
454 * to not compute two setup steps in one call. */
455
457
463
465
467
468
469/* Notay's algebraic transformation */
470/* -------------------------------- */
471
472typedef struct {
473
474 /* \var scaling_coef
475 * This coefficient is used in Notay's transformation devised in "Algebraic
476 * multigrid for Stokes equations" SIAM J. Sci. Comput. Vol. 39 (5), 2017
477 */
478
480
482
483/* Uzawa-CG algorithm */
484/* ------------------ */
485
486typedef struct {
487
488 /* \var dedicated_init_sles
489 * Define an additional SLES to perform the initial resolution. By default,
490 * this is false in order to not compute two setup steps in one call. */
491
493
498
500
510
512
514
515
516/*============================================================================
517 * Global variables
518 *============================================================================*/
519
520/*============================================================================
521 * Public function prototypes
522 *============================================================================*/
523
524/*----------------------------------------------------------------------------*/
531/*----------------------------------------------------------------------------*/
532
533void
535 int restart_range);
536
537/*----------------------------------------------------------------------------*/
548/*----------------------------------------------------------------------------*/
549
550void
552 double scaling_coef);
553
554/*----------------------------------------------------------------------------*/
562/*----------------------------------------------------------------------------*/
563
564void
566 double coef);
567
568/*----------------------------------------------------------------------------*/
577/*----------------------------------------------------------------------------*/
578
579double
581
582/*----------------------------------------------------------------------------*/
590/*----------------------------------------------------------------------------*/
591
592const char *
594
595/*----------------------------------------------------------------------------*/
602/*----------------------------------------------------------------------------*/
603
606
607/*----------------------------------------------------------------------------*/
614/*----------------------------------------------------------------------------*/
615
616void
618
619/*----------------------------------------------------------------------------*/
627/*----------------------------------------------------------------------------*/
628
629const char *
631
632/*----------------------------------------------------------------------------*/
639/*----------------------------------------------------------------------------*/
640
641void
642cs_param_saddle_set_name(const char *name,
643 cs_param_saddle_t *saddlep);
644
645/*----------------------------------------------------------------------------*/
654/*----------------------------------------------------------------------------*/
655
656void
658 const cs_param_sles_t *block11_slesp);
659
660/*----------------------------------------------------------------------------*/
669/*----------------------------------------------------------------------------*/
670
671int
672cs_param_saddle_set_precond(const char *keyval,
673 cs_param_saddle_t *saddlep);
674
675/*----------------------------------------------------------------------------*/
685/*----------------------------------------------------------------------------*/
686
687int
688cs_param_saddle_set_schur_approx(const char *keyval,
689 cs_param_saddle_t *saddlep);
690
691/*----------------------------------------------------------------------------*/
700/*----------------------------------------------------------------------------*/
701
702int
703cs_param_saddle_set_solver_class(const char *keyval,
704 cs_param_saddle_t *saddlep);
705
706/*----------------------------------------------------------------------------*/
715/*----------------------------------------------------------------------------*/
716
717int
718cs_param_saddle_set_solver(const char *keyval,
719 cs_param_saddle_t *saddlep);
720
721/*----------------------------------------------------------------------------*/
730/*----------------------------------------------------------------------------*/
731
732void
734
735/*----------------------------------------------------------------------------*/
746/*----------------------------------------------------------------------------*/
747
750
751/*----------------------------------------------------------------------------*/
762/*----------------------------------------------------------------------------*/
763
766
767/*----------------------------------------------------------------------------*/
777/*----------------------------------------------------------------------------*/
778
781
782/*----------------------------------------------------------------------------*/
789/*----------------------------------------------------------------------------*/
790
791void
793 cs_param_saddle_t *dest);
794
795/*----------------------------------------------------------------------------*/
801/*----------------------------------------------------------------------------*/
802
803void
805
806/*----------------------------------------------------------------------------*/
807
809
810#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.c:858
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 or a GKB algorithm is considered.
Definition cs_param_saddle.c:470
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.c:549
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.c:674
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 or a GKB algorithm is consi...
Definition cs_param_saddle.c:515
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.c:1237
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.c:786
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_NOTAY_TRANSFORM
Definition cs_param_saddle.h:193
@ CS_PARAM_SADDLE_N_SOLVERS
Definition cs_param_saddle.h:196
@ 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_NONE
Definition cs_param_saddle.h:185
@ CS_PARAM_SADDLE_SOLVER_GKB
Definition cs_param_saddle.h:190
@ CS_PARAM_SADDLE_SOLVER_GCR
Definition cs_param_saddle.h:189
@ CS_PARAM_SADDLE_SOLVER_MUMPS
Definition cs_param_saddle.h:192
@ CS_PARAM_SADDLE_SOLVER_ALU
Definition cs_param_saddle.h:187
@ CS_PARAM_SADDLE_SOLVER_UZAWA_CG
Definition cs_param_saddle.h:194
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.c:814
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.c:1020
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.c:445
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.c:1216
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.c:596
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_LOWER
Definition cs_param_saddle.h:104
@ CS_PARAM_SADDLE_PRECOND_DIAG
Definition cs_param_saddle.h:103
@ CS_PARAM_SADDLE_PRECOND_SGS
Definition cs_param_saddle.h:105
@ CS_PARAM_SADDLE_N_PRECOND
Definition cs_param_saddle.h:109
@ 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_NONE
Definition cs_param_saddle.h:102
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:243
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED
Definition cs_param_saddle.h:250
@ CS_PARAM_SADDLE_SCHUR_DIAG_INVERSE
Definition cs_param_saddle.h:247
@ CS_PARAM_SADDLE_N_SCHUR_APPROX
Definition cs_param_saddle.h:254
@ CS_PARAM_SADDLE_SCHUR_NONE
Definition cs_param_saddle.h:245
@ CS_PARAM_SADDLE_SCHUR_LUMPED_INVERSE
Definition cs_param_saddle.h:249
@ CS_PARAM_SADDLE_SCHUR_IDENTITY
Definition cs_param_saddle.h:248
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED_DIAG_INVERSE
Definition cs_param_saddle.h:251
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED_LUMPED_INVERSE
Definition cs_param_saddle.h:252
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.c:738
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.c:638
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.c:696
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.c:906
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.c:968
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.c:837
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.c:1350
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.c:405
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:617
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition cs_param_types.h:537
Definition cs_param_saddle.h:377
double augmentation_scaling
Definition cs_param_saddle.h:384
bool dedicated_init_sles
Definition cs_param_saddle.h:391
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:399
Definition cs_param_saddle.h:407
int n_stored_directions
Definition cs_param_saddle.h:414
cs_param_sles_t * xtra_sles_param
Definition cs_param_saddle.h:426
Definition cs_param_saddle.h:434
int truncation_threshold
Definition cs_param_saddle.h:449
double augmentation_scaling
Definition cs_param_saddle.h:442
bool dedicated_init_sles
Definition cs_param_saddle.h:456
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:464
Definition cs_param_saddle.h:472
double scaling_coef
Definition cs_param_saddle.h:479
Definition cs_param_saddle.h:486
bool dedicated_init_sles
Definition cs_param_saddle.h:492
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:499
cs_param_sles_t * xtra_sles_param
Definition cs_param_saddle.h:511
Structure storing all metadata related to the resolution of a saddle-point linear system....
Definition cs_param_saddle.h:272
int verbosity
Definition cs_param_saddle.h:279
cs_param_sles_t * schur_sles_param
Definition cs_param_saddle.h:360
char * name
Definition cs_param_saddle.h:287
cs_param_convergence_t cvg_param
Definition cs_param_saddle.h:327
cs_param_saddle_schur_approx_t schur_approx
Definition cs_param_saddle.h:353
cs_param_saddle_solver_t solver
Definition cs_param_saddle.h:311
cs_param_solver_class_t solver_class
Definition cs_param_saddle.h:302
const cs_param_sles_t * block11_sles_param
Definition cs_param_saddle.h:336
cs_param_saddle_precond_t precond
Definition cs_param_saddle.h:318
void * context
Definition cs_param_saddle.h:366
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition cs_param_sles.h:64