Handle the settings of saddle-point systems. These systems arise from the monolithic coupling of the Navier-Stokes equations or in mixed formulation of scalar-valued equations. More...
#include "cs_defs.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bft_error.h>
#include <bft_mem.h>
#include "cs_base.h"
#include "cs_log.h"
#include "cs_sles.h"
#include "cs_param_saddle.h"
Functions | |
static cs_param_sles_t * | _init_xtra_slesp (const cs_param_saddle_t *saddlep) |
Define a cs_param_sles_t structure for an extra system used in the construction of the approximation of the Schur complement. More... | |
static cs_param_sles_t * | _copy_xtra_slesp (const cs_param_sles_t *slesp_ref, const cs_param_saddle_t *saddlep_dest) |
Copy a cs_param_sles_t structure from an existing one. Case of the set of parameters associated to the additional SLES system. More... | |
static cs_param_sles_t * | _init_init_slesp (const cs_param_saddle_t *saddlep) |
Define a cs_param_sles_t structure for a system solved during the first step (transformation or initial resolution). The starting point is the settings for the (1,1) block. More... | |
static cs_param_sles_t * | _copy_init_slesp (const cs_param_sles_t *slesp_ref, const cs_param_saddle_t *saddlep_dest) |
Copy a cs_param_sles_t structure from an existing one. Case of the set of parameters associated to the initial system. More... | |
static void | _init_schur_slesp (cs_param_saddle_t *saddlep) |
Define a cs_param_sles_t structure for the Schur complement system. More... | |
static void | _free_context (cs_param_saddle_t *saddlep) |
Release structure associated to a context. More... | |
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. More... | |
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 Stokes equations" SIAM J. Sci. Comput. Vol. 39 (5), 2017 In this article, this scaling is denoted by alpha. More... | |
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. More... | |
double | cs_param_saddle_get_augmentation_coef (const cs_param_saddle_t *saddlep) |
Set the scaling in front of the augmentation term when an ALU, a GKB or a block Krylov algorithm is considered. More... | |
const char * | cs_param_saddle_get_type_name (cs_param_saddle_solver_t type) |
Retrieve the name of the type of saddle-point solver. More... | |
cs_param_saddle_t * | cs_param_saddle_create (void) |
Create a cs_param_saddle_t structure No solver is set by default. More... | |
void | cs_param_saddle_free (cs_param_saddle_t **p_saddlep) |
Free the structure storing the parameter settings for a saddle-point system. More... | |
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 approximation of the Schur complement. This is only useful for solving a saddle-point problem relying on an elaborated approximation of the Schur complement. More... | |
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-operation specific to a saddle-point solver It returns a non-null pointer only for some sadlle-point solver relying on a more elaborated Schur complement approximation. More... | |
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 saddle-point problem. It returns a non null pointer only for some sadlle-point solver. More... | |
const char * | cs_param_saddle_get_name (const cs_param_saddle_t *saddlep) |
Retrieve the name of the saddle-point solver. More... | |
void | cs_param_saddle_set_name (const char *name, cs_param_saddle_t *saddlep) |
Set the name of the saddle-point system. More... | |
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 the resolution of the saddle-point problems. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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 structure. By default, this member is not allocated. Do nothing if the related structure is already allocated. More... | |
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. More... | |
void | cs_param_saddle_log (const cs_param_saddle_t *saddlep) |
Log the setup information for the given cs_param_saddle_t structure. More... | |
Handle the settings of saddle-point systems. These systems arise from the monolithic coupling of the Navier-Stokes equations or in mixed formulation of scalar-valued equations.
|
static |
Copy a cs_param_sles_t structure from an existing one. Case of the set of parameters associated to the initial system.
[in] | slesp_ref | set of parameters managing a SLES (the ref. one) |
[in] | saddlep_dest | set of parameters managing a saddle-point problem |
|
static |
Copy a cs_param_sles_t structure from an existing one. Case of the set of parameters associated to the additional SLES system.
[in] | slesp_ref | set of parameters managing a SLES (the ref. one) |
[in] | saddlep_dest | set of parameters managing a saddle-point problem |
|
static |
Release structure associated to a context.
[in,out] | saddlep | set of parameters for solving a saddle-point |
|
static |
Define a cs_param_sles_t structure for a system solved during the first step (transformation or initial resolution). The starting point is the settings for the (1,1) block.
[in] | saddlep | set of parameters managing a saddle-point problem |
|
static |
Define a cs_param_sles_t structure for the Schur complement system.
[in] | saddlep | set of parameters managing a saddle-point problem |
|
static |
Define a cs_param_sles_t structure for an extra system used in the construction of the approximation of the Schur complement.
[in] | saddlep | set of parameters managing a saddle-point problem |
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.
[in] | ref | reference structure to be copied |
[in,out] | dest | destination structure |
cs_param_saddle_t * cs_param_saddle_create | ( | void | ) |
Create a cs_param_saddle_t structure No solver is set by default.
void cs_param_saddle_free | ( | cs_param_saddle_t ** | p_saddlep | ) |
Free the structure storing the parameter settings for a saddle-point system.
[in,out] | p_saddlep | double pointer to the structure to free |
double cs_param_saddle_get_augmentation_coef | ( | const cs_param_saddle_t * | saddlep | ) |
Set the scaling in front of the augmentation term when an ALU, a GKB or a block Krylov algorithm is considered.
Get the scaling coefficient in front of the augmentation term when an ALU, GKB or block Krylov algorithm is considered.
[in] | saddlep | set of parameters for solving a saddle-point |
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 saddle-point problem. It returns a non null pointer only for some sadlle-point solver.
[in] | saddlep | pointer to a cs_param_saddle_t structure |
const char * cs_param_saddle_get_name | ( | const cs_param_saddle_t * | saddlep | ) |
Retrieve the name of the saddle-point solver.
[in] | saddlep | pointer to a set of saddle-point parameters |
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 approximation of the Schur complement. This is only useful for solving a saddle-point problem relying on an elaborated approximation of the Schur complement.
[in] | saddlep | pointer to a cs_param_saddle_t structure |
const char * cs_param_saddle_get_type_name | ( | cs_param_saddle_solver_t | type | ) |
Retrieve the name of the type of saddle-point solver.
[in] | type | type of saddle-point solver |
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-operation specific to a saddle-point solver It returns a non-null pointer only for some sadlle-point solver relying on a more elaborated Schur complement approximation.
[in] | saddlep | pointer to a cs_param_saddle_t structure |
void cs_param_saddle_log | ( | const cs_param_saddle_t * | saddlep | ) |
Log the setup information for the given cs_param_saddle_t structure.
[in] | saddlep | pointer to the structure |
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.
Set the scaling in front of the augmentation term when an ALU, a GKB or a block Krylov algorithm is considered.
[in,out] | saddlep | set of parameters for solving a saddle-point |
[in] | coef | value of the scaling coefficient |
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 the resolution of the saddle-point problems.
[in,out] | saddlep | pointer to the structure to update |
[in] | block11_slesp | set of parameters for the (1,1) block |
void cs_param_saddle_set_name | ( | const char * | name, |
cs_param_saddle_t * | saddlep | ||
) |
Set the name of the saddle-point system.
[in] | name | name associated to this saddle-point system |
[in,out] | saddlep | pointer to the structure to update |
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 Stokes equations" SIAM J. Sci. Comput. Vol. 39 (5), 2017 In this article, this scaling is denoted by alpha.
[in,out] | saddlep | set of parameters for solving a saddle-point |
[in] | scaling_coef | value of the scaling coefficient |
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.
[in] | keyval | value of the key for the preconditioner |
[in,out] | saddlep | pointer to the structure to update |
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.
[in,out] | saddlep | set of parameters for solving a saddle-point |
[in] | restart_range | number of directions |
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.
[in] | keyval | value of the key for the schur approx. |
[in,out] | saddlep | pointer to the structure to update |
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.
[in] | keyval | value of the key for the preconditioner |
[in,out] | saddlep | pointer to the structure to update |
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.
[in] | keyval | value of the key for the preconditioner |
[in,out] | saddlep | pointer to the structure to update |
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 structure. By default, this member is not allocated. Do nothing if the related structure is already allocated.
[in,out] | saddlep | pointer to the structure to update |