8.1
general documentation
cs_param_sles.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <bft_error.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_fp_exception.h"
#include "cs_log.h"
#include "cs_math.h"
#include "cs_multigrid.h"
#include "cs_sles.h"
#include "cs_param_sles.h"
+ Include dependency graph for cs_param_sles.c:

Functions

static bool _system_should_be_sym (cs_param_itsol_type_t solver)
 Return true if the prescribed solver implies a symmetric linear system. More...
 
static void _check_settings (cs_param_sles_t *slesp)
 Check if the settings are consistent. Can apply minor modifications. More...
 
static int _get_poly_degree (const cs_param_sles_t *slesp)
 Retrieve the value of the polynomial degree to consider according to the settings. Only for in-house solvers. More...
 
static void _set_saturne_sles (bool use_field_id, cs_param_sles_t *slesp)
 Set parameters for initializing SLES structures used for the resolution of the linear system. Case of saturne's own solvers. More...
 
static void _set_mumps_sles (bool use_field_id, cs_param_sles_t *slesp)
 Set parameters for initializing SLES structures used for the resolution of the linear system. Case of MUMPS's own solvers. More...
 
static void _set_petsc_hypre_sles (bool use_field_id, cs_param_sles_t *slesp)
 Set parameters for initializing SLES structures used for the resolution of the linear system. Case of PETSc and Hypre families of solvers. More...
 
static cs_param_sles_mumps_t_create_mumps_param (bool is_single, cs_param_sles_facto_type_t facto_type)
 Create a new structure storing a set of parameters used when calling MUMPS. Set a default value for the advanced parameters. More...
 
static cs_param_sles_mumps_t_copy_mumps_param (const cs_param_sles_mumps_t *mumpsp)
 Copy into a new structure the given set of parameters used when calling MUMPS. More...
 
static void _log_mumps_param (const char *name, const cs_param_sles_mumps_t *mumpsp)
 Log a set of parameters used when calling MUMPS. More...
 
cs_param_sles_saddle_tcs_param_sles_saddle_create (void)
 Create a cs_param_sles_saddle_t structure and assign a minimalist default settings. More...
 
void cs_param_sles_saddle_init_schur (const char *basename, cs_param_sles_saddle_t *saddlep)
 Initialize a cs_param_sles_t structure for the Schur approximation nested inside a ref cs_param_sles_saddle_t structure. By default, this member is not allocated. Do nothing if the related structure is already allocated. More...
 
void cs_param_sles_saddle_copy (const cs_param_sles_saddle_t *ref, cs_param_sles_saddle_t *dest)
 Copy a cs_param_sles_saddle_t structure from ref to dest. More...
 
void cs_param_sles_saddle_free (cs_param_sles_saddle_t **p_saddlep)
 Free the structure storing the parameter settings for a saddle-point system. More...
 
cs_param_sles_tcs_param_sles_create (int field_id, const char *system_name)
 Create a cs_param_sles_t structure and assign a default settings. More...
 
void cs_param_sles_free (cs_param_sles_t **p_slesp)
 Free a cs_param_sles_t structure. More...
 
void cs_param_sles_log (cs_param_sles_t *slesp)
 Log information related to the linear settings stored in the structure. More...
 
void cs_param_sles_copy_from (cs_param_sles_t *src, cs_param_sles_t *dst)
 Copy a cs_param_sles_t structure from src to dst. More...
 
int cs_param_sles_set (bool use_field_id, cs_param_sles_t *slesp)
 Define cs_sles_t structure in accordance with the settings of a cs_param_sles_t structure (SLES = Sparse Linear Equation Solver) More...
 
void cs_param_sles_mumps (cs_param_sles_t *slesp, bool is_single, cs_param_sles_facto_type_t facto_type)
 Set the main memebers of a cs_param_sles_mumps_t structure. This structure is allocated if needed. Other members are kept to their values. More...
 
void cs_param_sles_mumps_advanced (cs_param_sles_t *slesp, cs_param_sles_analysis_algo_t analysis_algo, int block_analysis, double mem_coef, double blr_threshold, int ir_steps, bool advanced_optim)
 Set the main memebers of a cs_param_sles_mumps_t structure. This structure is allocated if needed. Other members are kept to their values. Please refer to the MUMPS user guide for more details about the following advanced options. More...
 
void cs_param_sles_update_cvg_settings (bool use_field_id, const cs_param_sles_t *slesp)
 Update the settings associated to a cs_sles_t structure and apply those defined in the given cs_param_sles_t structure. This function is used only when a first setup has been performed. More...
 
cs_param_sles_class_t cs_param_sles_get_class_from_amg (cs_param_amg_type_t amg_type)
 Retrieve the related solver class from the amg type. More...
 
cs_param_sles_class_t cs_param_sles_check_class (cs_param_sles_class_t wanted_class)
 Check the availability of a solver library and return the requested one if this is possible or an alternative or CS_PARAM_SLES_N_CLASSES if no alternative is available. More...
 
void cs_param_sles_check_amg (cs_param_sles_t *slesp)
 Check if the setting related to the AMG is consistent with the solver class. More...
 

Function Documentation

◆ _check_settings()

static void _check_settings ( cs_param_sles_t slesp)
static

Check if the settings are consistent. Can apply minor modifications.

Parameters
[in,out]slesppointer to a cs_param_sles_t structure

◆ _copy_mumps_param()

static cs_param_sles_mumps_t* _copy_mumps_param ( const cs_param_sles_mumps_t mumpsp)
static

Copy into a new structure the given set of parameters used when calling MUMPS.

Parameters
[in]mumpspset of mumps parameters

◆ _create_mumps_param()

static cs_param_sles_mumps_t* _create_mumps_param ( bool  is_single,
cs_param_sles_facto_type_t  facto_type 
)
static

Create a new structure storing a set of parameters used when calling MUMPS. Set a default value for the advanced parameters.

Parameters
[in]is_singlesingle-precision or double-precision
[in]facto_typetype of factorization to consider

◆ _get_poly_degree()

static int _get_poly_degree ( const cs_param_sles_t slesp)
static

Retrieve the value of the polynomial degree to consider according to the settings. Only for in-house solvers.

Parameters
[in]slesppointer to a cs_param_sles_t structure
Returns
the value of the polynomial degree to consider

◆ _log_mumps_param()

static void _log_mumps_param ( const char *  name,
const cs_param_sles_mumps_t mumpsp 
)
static

Log a set of parameters used when calling MUMPS.

Parameters
[in]namename related to the current SLES
[in]mumpspset of mumps parameters

◆ _set_mumps_sles()

static void _set_mumps_sles ( bool  use_field_id,
cs_param_sles_t slesp 
)
static

Set parameters for initializing SLES structures used for the resolution of the linear system. Case of MUMPS's own solvers.

Parameters
[in]use_field_idif false use system name
[in,out]slesppointer to a cs_param_sles_t structure

◆ _set_petsc_hypre_sles()

static void _set_petsc_hypre_sles ( bool  use_field_id,
cs_param_sles_t slesp 
)
static

Set parameters for initializing SLES structures used for the resolution of the linear system. Case of PETSc and Hypre families of solvers.

Parameters
[in]use_field_idif false use system name
[in,out]slesppointer to a cs_param_sles_t structure

◆ _set_saturne_sles()

static void _set_saturne_sles ( bool  use_field_id,
cs_param_sles_t slesp 
)
static

Set parameters for initializing SLES structures used for the resolution of the linear system. Case of saturne's own solvers.

Parameters
[in]use_field_idif false use system name
[in,out]slesppointer to a cs_param_sles_t structure

◆ _system_should_be_sym()

static bool _system_should_be_sym ( cs_param_itsol_type_t  solver)
inlinestatic

Return true if the prescribed solver implies a symmetric linear system.

◆ cs_param_sles_check_amg()

void cs_param_sles_check_amg ( cs_param_sles_t slesp)

Check if the setting related to the AMG is consistent with the solver class.

Parameters
[in,out]slesppointer to a cs_pparam_sles_t structure

◆ cs_param_sles_check_class()

cs_param_sles_class_t cs_param_sles_check_class ( cs_param_sles_class_t  wanted_class)

Check the availability of a solver library and return the requested one if this is possible or an alternative or CS_PARAM_SLES_N_CLASSES if no alternative is available.

Parameters
[in]wanted_classrequested class of solvers
Returns
the available solver class related to the requested class

◆ cs_param_sles_copy_from()

void cs_param_sles_copy_from ( cs_param_sles_t src,
cs_param_sles_t dst 
)

Copy a cs_param_sles_t structure from src to dst.

Parameters
[in]srcreference cs_param_sles_t structure to copy
[in,out]dstcopy of the reference at exit

◆ cs_param_sles_create()

cs_param_sles_t* cs_param_sles_create ( int  field_id,
const char *  system_name 
)

Create a cs_param_sles_t structure and assign a default settings.

Parameters
[in]field_idid related to to the variable field or -1
[in]system_namename of the system to solve or NULL
Returns
a pointer to a cs_param_sles_t stucture

◆ cs_param_sles_free()

void cs_param_sles_free ( cs_param_sles_t **  p_slesp)

Free a cs_param_sles_t structure.

Parameters
[in,out]slesppointer to a \cs_param_sles_t structure to free

◆ cs_param_sles_get_class_from_amg()

cs_param_sles_class_t cs_param_sles_get_class_from_amg ( cs_param_amg_type_t  amg_type)

Retrieve the related solver class from the amg type.

Parameters
[in]amg_typetype of AMG to consider
Returns
the related solver class or CS_PARAM_SLES_CLASS_CS

◆ cs_param_sles_log()

void cs_param_sles_log ( cs_param_sles_t slesp)

Log information related to the linear settings stored in the structure.

Parameters
[in]slesppointer to a cs_param_sles_log

◆ cs_param_sles_mumps()

void cs_param_sles_mumps ( cs_param_sles_t slesp,
bool  is_single,
cs_param_sles_facto_type_t  facto_type 
)

Set the main memebers of a cs_param_sles_mumps_t structure. This structure is allocated if needed. Other members are kept to their values.

Parameters
[in,out]slesppointer to a cs_param_sles_t structure
[in]is_singlesingle-precision or double-precision
[in]facto_typetype of factorization to consider

◆ cs_param_sles_mumps_advanced()

void cs_param_sles_mumps_advanced ( cs_param_sles_t slesp,
cs_param_sles_analysis_algo_t  analysis_algo,
int  block_analysis,
double  mem_coef,
double  blr_threshold,
int  ir_steps,
bool  advanced_optim 
)

Set the main memebers of a cs_param_sles_mumps_t structure. This structure is allocated if needed. Other members are kept to their values. Please refer to the MUMPS user guide for more details about the following advanced options.

Parameters
[in,out]slesppointer to a cs_param_sles_t structure
[in]analysis_algoalgorithm used for the analysis step
[in]block_analysis< 0: fixed block size; 0: nothing
[in]mem_coefpercentage increase in the memory workspace
[in]blr_thresholdAccuracy in BLR compression (< 0: not used)
[in]ir_steps0: No, otherwise number of iterations
[in]advanced_optimactivate advanced optimization (MPI/openMP)

◆ cs_param_sles_saddle_copy()

void cs_param_sles_saddle_copy ( const cs_param_sles_saddle_t ref,
cs_param_sles_saddle_t dest 
)

Copy a cs_param_sles_saddle_t structure from ref to dest.

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

◆ cs_param_sles_saddle_create()

cs_param_sles_saddle_t* cs_param_sles_saddle_create ( void  )

Create a cs_param_sles_saddle_t structure and assign a minimalist default settings.

Returns
a pointer to the new cs_param_sles_saddle_t structure

◆ cs_param_sles_saddle_free()

void cs_param_sles_saddle_free ( cs_param_sles_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_sles_saddle_init_schur()

void cs_param_sles_saddle_init_schur ( const char *  basename,
cs_param_sles_saddle_t saddlep 
)

Initialize a cs_param_sles_t structure for the Schur approximation nested inside a ref cs_param_sles_saddle_t structure. By default, this member is not allocated. Do nothing if the related structure is already allocated.

Parameters
[in]basenameprefix for the naming of the Schur system
[in,out]saddleppointer to the structure to update

◆ cs_param_sles_set()

int cs_param_sles_set ( bool  use_field_id,
cs_param_sles_t slesp 
)

Define cs_sles_t structure in accordance with the settings of a cs_param_sles_t structure (SLES = Sparse Linear Equation Solver)

Parameters
[in]use_field_idif false use system name to define a SLES
[in,out]slesppointer to a cs_param_sles_t structure
Returns
an error code (-1 if a problem is encountered, 0 otherwise)

◆ cs_param_sles_update_cvg_settings()

void cs_param_sles_update_cvg_settings ( bool  use_field_id,
const cs_param_sles_t slesp 
)

Update the settings associated to a cs_sles_t structure and apply those defined in the given cs_param_sles_t structure. This function is used only when a first setup has been performed.

One modifies only some specific options like the max. number of iterations or the relative tolerance

Parameters
[in]use_field_idif false use a name to retrieve the cs_sles_t struc.
[in]slesppointer to a cs_param_sles_t structure