8.3
general documentation
cs_param_saddle.cpp File Reference

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"
+ Include dependency graph for cs_param_saddle.cpp:

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_tcs_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_tcs_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_tcs_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_tcs_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...
 

Detailed Description

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.

Function Documentation

◆ _copy_init_slesp()

static cs_param_sles_t * _copy_init_slesp ( const cs_param_sles_t slesp_ref,
const cs_param_saddle_t saddlep_dest 
)
static

Copy a cs_param_sles_t structure from an existing one. Case of the set of parameters associated to the initial system.

Parameters
[in]slesp_refset of parameters managing a SLES (the ref. one)
[in]saddlep_destset of parameters managing a saddle-point problem
Returns
the pointer to the newly defined set of parameters

◆ _copy_xtra_slesp()

static cs_param_sles_t * _copy_xtra_slesp ( const cs_param_sles_t slesp_ref,
const cs_param_saddle_t saddlep_dest 
)
static

Copy a cs_param_sles_t structure from an existing one. Case of the set of parameters associated to the additional SLES system.

Parameters
[in]slesp_refset of parameters managing a SLES (the ref. one)
[in]saddlep_destset of parameters managing a saddle-point problem
Returns
the pointer to the newly defined set of parameters

◆ _free_context()

static void _free_context ( cs_param_saddle_t saddlep)
static

Release structure associated to a context.

Parameters
[in,out]saddlepset of parameters for solving a saddle-point

◆ _init_init_slesp()

static cs_param_sles_t * _init_init_slesp ( const cs_param_saddle_t saddlep)
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.

Parameters
[in]saddlepset of parameters managing a saddle-point problem
Returns
the pointer to the newly defined set of parameters

◆ _init_schur_slesp()

static void _init_schur_slesp ( cs_param_saddle_t saddlep)
static

Define a cs_param_sles_t structure for the Schur complement system.

Parameters
[in]saddlepset of parameters managing a saddle-point problem

◆ _init_xtra_slesp()

static cs_param_sles_t * _init_xtra_slesp ( const cs_param_saddle_t saddlep)
static

Define a cs_param_sles_t structure for an extra system used in the construction of the approximation of the Schur complement.

Parameters
[in]saddlepset of parameters managing a saddle-point problem
Returns
the pointer to the newly defined set of parameters

◆ cs_param_saddle_copy()

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.

Parameters
[in]refreference structure to be copied
[in,out]destdestination structure

◆ cs_param_saddle_create()

cs_param_saddle_t * cs_param_saddle_create ( void  )

Create a cs_param_saddle_t structure No solver is set by default.

Returns
a pointer to the new cs_param_saddle_t structure

◆ cs_param_saddle_free()

void cs_param_saddle_free ( cs_param_saddle_t **  p_saddlep)

Free the structure storing the parameter settings for a saddle-point system.

Parameters
[in,out]p_saddlepdouble pointer to the structure to free

◆ cs_param_saddle_get_augmentation_coef()

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.

Parameters
[in]saddlepset of parameters for solving a saddle-point
Returns
0 if not relevant or the value of the augmentation coefficient

◆ cs_param_saddle_get_init_sles_param()

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.

Parameters
[in]saddleppointer to a cs_param_saddle_t structure
Returns
a pointer to a cs_param_sles_t structure

◆ cs_param_saddle_get_name()

const char * cs_param_saddle_get_name ( const cs_param_saddle_t saddlep)

Retrieve the name of the saddle-point solver.

Parameters
[in]saddleppointer to a set of saddle-point parameters
Returns
a string

◆ cs_param_saddle_get_schur_sles_param()

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.

Parameters
[in]saddleppointer to a cs_param_saddle_t structure
Returns
a pointer to a cs_param_sles_t structure

◆ cs_param_saddle_get_type_name()

const char * cs_param_saddle_get_type_name ( cs_param_saddle_solver_t  type)

Retrieve the name of the type of saddle-point solver.

Parameters
[in]typetype of saddle-point solver
Returns
a string

◆ cs_param_saddle_get_xtra_sles_param()

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.

Parameters
[in]saddleppointer to a cs_param_saddle_t structure
Returns
a pointer to a cs_param_sles_t structure

◆ cs_param_saddle_log()

void cs_param_saddle_log ( const cs_param_saddle_t saddlep)

Log the setup information for the given cs_param_saddle_t structure.

Parameters
[in]saddleppointer to the structure

◆ cs_param_saddle_set_augmentation_coef()

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.

Parameters
[in,out]saddlepset of parameters for solving a saddle-point
[in]coefvalue of the scaling coefficient

◆ cs_param_saddle_set_block11_sles_param()

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.

Parameters
[in,out]saddleppointer to the structure to update
[in]block11_slespset of parameters for the (1,1) block

◆ cs_param_saddle_set_name()

void cs_param_saddle_set_name ( const char *  name,
cs_param_saddle_t saddlep 
)

Set the name of the saddle-point system.

Parameters
[in]namename associated to this saddle-point system
[in,out]saddleppointer to the structure to update

◆ cs_param_saddle_set_notay_scaling()

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.

Parameters
[in,out]saddlepset of parameters for solving a saddle-point
[in]scaling_coefvalue of the scaling coefficient

◆ cs_param_saddle_set_precond()

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.

Parameters
[in]keyvalvalue of the key for the preconditioner
[in,out]saddleppointer to the structure to update
Returns
0 if no error detected, > 0 otherwise

◆ cs_param_saddle_set_restart_range()

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.

Parameters
[in,out]saddlepset of parameters for solving a saddle-point
[in]restart_rangenumber of directions

◆ cs_param_saddle_set_schur_approx()

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.

Parameters
[in]keyvalvalue of the key for the schur approx.
[in,out]saddleppointer to the structure to update
Returns
0 if no error detected, > 0 otherwise

◆ cs_param_saddle_set_solver()

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.

Parameters
[in]keyvalvalue of the key for the preconditioner
[in,out]saddleppointer to the structure to update
Returns
0 if no error detected, > 0 otherwise

◆ cs_param_saddle_set_solver_class()

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.

Parameters
[in]keyvalvalue of the key for the preconditioner
[in,out]saddleppointer to the structure to update
Returns
0 if no error detected, > 0 otherwise

◆ cs_param_saddle_try_init_schur_sles_param()

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.

Parameters
[in,out]saddleppointer to the structure to update