9.0
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-2025 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
47
48/*============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52/*============================================================================
53 * Type definitions
54 *============================================================================*/
55
99
112
182
200
243
258
272
273typedef struct {
274
279
281
287
288 char *name;
289
295
297
302
304
311
313
318
320
327
329
331
336
338
346
353
355
360
362
364
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
384
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
399
401
403
404
405/* Block preconditioner algorithm with a Krylov solver */
406/* --------------------------------------------------- */
407
438
439
440/* GKB algorithm */
441/* ------------- */
442
443typedef struct {
444
450
452
457
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
472
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
507
509
519
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
539
541
551
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:929
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:495
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:603
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:731
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:553
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:1340
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:857
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:197
@ 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_SIMPLE
Definition cs_param_saddle.h:194
@ 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:195
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:885
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:1091
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:469
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:1319
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:653
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:244
@ CS_PARAM_SADDLE_SCHUR_MASS_SCALED
Definition cs_param_saddle.h:251
@ CS_PARAM_SADDLE_SCHUR_DIAG_INVERSE
Definition cs_param_saddle.h:248
@ CS_PARAM_SADDLE_N_SCHUR_APPROX
Definition cs_param_saddle.h:255
@ CS_PARAM_SADDLE_SCHUR_NONE
Definition cs_param_saddle.h:246
@ CS_PARAM_SADDLE_SCHUR_LUMPED_INVERSE
Definition cs_param_saddle.h:250
@ CS_PARAM_SADDLE_SCHUR_IDENTITY
Definition cs_param_saddle.h:249
@ 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_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:806
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:695
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:753
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:977
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:1039
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:908
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:1458
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:427
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:655
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition cs_param_types.h:570
Definition cs_param_saddle.h:378
double augmentation_scaling
Definition cs_param_saddle.h:385
bool dedicated_init_sles
Definition cs_param_saddle.h:392
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:400
Definition cs_param_saddle.h:408
double augmentation_scaling
Definition cs_param_saddle.h:416
int n_stored_directions
Definition cs_param_saddle.h:423
cs_param_sles_t * xtra_sles_param
Definition cs_param_saddle.h:435
Definition cs_param_saddle.h:443
int truncation_threshold
Definition cs_param_saddle.h:458
double augmentation_scaling
Definition cs_param_saddle.h:451
bool dedicated_init_sles
Definition cs_param_saddle.h:465
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:473
Definition cs_param_saddle.h:481
double scaling_coef
Definition cs_param_saddle.h:488
Definition cs_param_saddle.h:527
bool dedicated_init_sles
Definition cs_param_saddle.h:533
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:540
cs_param_sles_t * xtra_sles_param
Definition cs_param_saddle.h:552
Definition cs_param_saddle.h:495
bool dedicated_init_sles
Definition cs_param_saddle.h:501
cs_param_sles_t * init_sles_param
Definition cs_param_saddle.h:508
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
int verbosity
Definition cs_param_saddle.h:280
cs_param_sles_t * schur_sles_param
Definition cs_param_saddle.h:361
char * name
Definition cs_param_saddle.h:288
cs_param_convergence_t cvg_param
Definition cs_param_saddle.h:328
cs_param_saddle_schur_approx_t schur_approx
Definition cs_param_saddle.h:354
cs_param_saddle_solver_t solver
Definition cs_param_saddle.h:312
cs_param_solver_class_t solver_class
Definition cs_param_saddle.h:303
const cs_param_sles_t * block11_sles_param
Definition cs_param_saddle.h:337
cs_param_saddle_precond_t precond
Definition cs_param_saddle.h:319
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