8.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-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 
100 typedef enum {
101 
108 
110 
112 
183 typedef enum {
184 
186 
195 
197 
199 
243 typedef enum {
244 
246 
253 
255 
257 
272 typedef struct {
273 
280 
287  char *name;
288 
303 
312 
319 
328 
337 
354 
361 
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 
377 typedef struct {
378 
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 
400 
402 
403 
404 /* Block preconditioner algorithm with a Krylov solver */
405 /* --------------------------------------------------- */
406 
407 typedef struct {
408 
415 
427 
429 
430 
431 /* GKB algorithm */
432 /* ------------- */
433 
434 typedef struct {
435 
443 
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 
465 
467 
468 
469 /* Notay's algebraic transformation */
470 /* -------------------------------- */
471 
472 typedef 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 
479  double scaling_coef;
480 
482 
483 /* Uzawa-CG algorithm */
484 /* ------------------ */
485 
486 typedef 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 
500 
512 
514 
515 
516 /*============================================================================
517  * Global variables
518  *============================================================================*/
519 
520 /*============================================================================
521  * Public function prototypes
522  *============================================================================*/
523 
524 /*----------------------------------------------------------------------------*/
531 /*----------------------------------------------------------------------------*/
532 
533 void
535  int restart_range);
536 
537 /*----------------------------------------------------------------------------*/
548 /*----------------------------------------------------------------------------*/
549 
550 void
552  double scaling_coef);
553 
554 /*----------------------------------------------------------------------------*/
562 /*----------------------------------------------------------------------------*/
563 
564 void
566  double coef);
567 
568 /*----------------------------------------------------------------------------*/
577 /*----------------------------------------------------------------------------*/
578 
579 double
581 
582 /*----------------------------------------------------------------------------*/
590 /*----------------------------------------------------------------------------*/
591 
592 const char *
594 
595 /*----------------------------------------------------------------------------*/
602 /*----------------------------------------------------------------------------*/
603 
606 
607 /*----------------------------------------------------------------------------*/
614 /*----------------------------------------------------------------------------*/
615 
616 void
618 
619 /*----------------------------------------------------------------------------*/
627 /*----------------------------------------------------------------------------*/
628 
629 const char *
631 
632 /*----------------------------------------------------------------------------*/
639 /*----------------------------------------------------------------------------*/
640 
641 void
642 cs_param_saddle_set_name(const char *name,
643  cs_param_saddle_t *saddlep);
644 
645 /*----------------------------------------------------------------------------*/
654 /*----------------------------------------------------------------------------*/
655 
656 void
658  const cs_param_sles_t *block11_slesp);
659 
660 /*----------------------------------------------------------------------------*/
669 /*----------------------------------------------------------------------------*/
670 
671 int
672 cs_param_saddle_set_precond(const char *keyval,
673  cs_param_saddle_t *saddlep);
674 
675 /*----------------------------------------------------------------------------*/
685 /*----------------------------------------------------------------------------*/
686 
687 int
688 cs_param_saddle_set_schur_approx(const char *keyval,
689  cs_param_saddle_t *saddlep);
690 
691 /*----------------------------------------------------------------------------*/
700 /*----------------------------------------------------------------------------*/
701 
702 int
703 cs_param_saddle_set_solver_class(const char *keyval,
704  cs_param_saddle_t *saddlep);
705 
706 /*----------------------------------------------------------------------------*/
715 /*----------------------------------------------------------------------------*/
716 
717 int
718 cs_param_saddle_set_solver(const char *keyval,
719  cs_param_saddle_t *saddlep);
720 
721 /*----------------------------------------------------------------------------*/
730 /*----------------------------------------------------------------------------*/
731 
732 void
734 
735 /*----------------------------------------------------------------------------*/
746 /*----------------------------------------------------------------------------*/
747 
750 
751 /*----------------------------------------------------------------------------*/
762 /*----------------------------------------------------------------------------*/
763 
766 
767 /*----------------------------------------------------------------------------*/
777 /*----------------------------------------------------------------------------*/
778 
781 
782 /*----------------------------------------------------------------------------*/
789 /*----------------------------------------------------------------------------*/
790 
791 void
793  cs_param_saddle_t *dest);
794 
795 /*----------------------------------------------------------------------------*/
801 /*----------------------------------------------------------------------------*/
802 
803 void
804 cs_param_saddle_log(const cs_param_saddle_t *saddlep);
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
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_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
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
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
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:196
@ CS_PARAM_SADDLE_SOLVER_MUMPS
Definition: cs_param_saddle.h:192
@ CS_PARAM_SADDLE_SOLVER_UZAWA_CG
Definition: cs_param_saddle.h:194
@ CS_PARAM_SADDLE_SOLVER_GKB
Definition: cs_param_saddle.h:190
@ 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.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_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
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:243
@ CS_PARAM_SADDLE_SCHUR_NONE
Definition: cs_param_saddle.h:245
@ CS_PARAM_SADDLE_SCHUR_DIAG_INVERSE
Definition: cs_param_saddle.h:247
@ CS_PARAM_SADDLE_SCHUR_LUMPED_INVERSE
Definition: cs_param_saddle.h:249
@ CS_PARAM_SADDLE_N_SCHUR_APPROX
Definition: cs_param_saddle.h:254
@ 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_SADDLE_SCHUR_IDENTITY
Definition: cs_param_saddle.h:248
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED
Definition: cs_param_saddle.h:250
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
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
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
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
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
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
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
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:399
bool dedicated_init_sles
Definition: cs_param_saddle.h:391
double augmentation_scaling
Definition: cs_param_saddle.h:384
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
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:464
bool dedicated_init_sles
Definition: cs_param_saddle.h:456
double augmentation_scaling
Definition: cs_param_saddle.h:442
int truncation_threshold
Definition: cs_param_saddle.h:449
Definition: cs_param_saddle.h:472
double scaling_coef
Definition: cs_param_saddle.h:479
Definition: cs_param_saddle.h:486
cs_param_sles_t * init_sles_param
Definition: cs_param_saddle.h:499
bool dedicated_init_sles
Definition: cs_param_saddle.h:492
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
cs_param_convergence_t cvg_param
Definition: cs_param_saddle.h:327
cs_param_saddle_precond_t precond
Definition: cs_param_saddle.h:318
cs_param_sles_t * schur_sles_param
Definition: cs_param_saddle.h:360
cs_param_saddle_solver_t solver
Definition: cs_param_saddle.h:311
const cs_param_sles_t * block11_sles_param
Definition: cs_param_saddle.h:336
int verbosity
Definition: cs_param_saddle.h:279
cs_param_solver_class_t solver_class
Definition: cs_param_saddle.h:302
cs_param_saddle_schur_approx_t schur_approx
Definition: cs_param_saddle.h:353
char * name
Definition: cs_param_saddle.h:287
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