8.0
general documentation
cs_iter_algo.c File Reference

Set of functions to handle the management of high-level iterative algorithms such as Uzawa, Golub-Kahan Bi-orthogonalization, block preconditioner or Picard algorithms which incorporates inner iterative solvers. More...

#include "cs_defs.h"
#include <float.h>
#include <assert.h>
#include <string.h>
#include <bft_error.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_array.h"
#include "cs_parall.h"
#include "cs_sdm.h"
#include "cs_iter_algo.h"
+ Include dependency graph for cs_iter_algo.c:

Functions

cs_iter_algo_tcs_iter_algo_create (int verbosity, cs_param_sles_cvg_t cvg_param)
 Create and initialize a new cs_iter_algo_t structure. More...
 
void cs_iter_algo_post_check (const char *func_name, const char *eq_name, const char *algo_name, cs_iter_algo_t *algo)
 Check if something wrong happens during the iterative process after one new iteration. More...
 
void cs_iter_algo_update_cvg (cs_iter_algo_t *algo)
 Update the convergence status and the number of iterations. The tolerance threshold has to be computed outside the function and before calling this function. More...
 
void cs_iter_algo_update_cvg_default (cs_iter_algo_t *algo)
 Update the convergence status and the number of iterations. The tolerance threshold is computed by a default formula relying on the relative tolerance scaled by the normalization factor and the absolute tolerance. More...
 
void cs_iter_algo_reset_nl (cs_param_nl_algo_t nl_algo_type, cs_iter_algo_t *algo)
 Reset a cs_iter_algo_t structure in case of a non-linear algorothm. More...
 
cs_iter_algo_aa_tcs_iter_algo_aa_create (cs_iter_algo_param_aa_t aap, cs_lnum_t n_elts)
 Create a new cs_iter_algo_aa_t structure for Anderson acceleration. More...
 
cs_iter_algo_param_aa_t cs_iter_algo_get_anderson_param (cs_iter_algo_t *algo)
 Retrieve the set of parameters for an Anderson algorithm. More...
 
void cs_iter_algo_aa_allocate_arrays (cs_iter_algo_aa_t *aa)
 Allocate arrays needed by the "Anderson acceleration" algorithm. More...
 
void cs_iter_algo_aa_free_arrays (cs_iter_algo_aa_t *aa)
 Free arrays used during the Anderson acceleration. More...
 
void cs_iter_algo_aa_free (cs_iter_algo_t *algo)
 Free a cs_iter_algo_aa_t structure inside a cs_iter_algo_t structure This structure is used to manage the Anderson acceleration. More...
 
void cs_iter_algo_aa_update (cs_iter_algo_t *algo, cs_real_t *cur_iterate, const cs_real_t *pre_iterate, cs_cdo_blas_dotprod_t *dotprod, cs_cdo_blas_square_norm_t *sqnorm)
 Apply one more iteration of the Anderson acceleration. More...
 

Detailed Description

Set of functions to handle the management of high-level iterative algorithms such as Uzawa, Golub-Kahan Bi-orthogonalization, block preconditioner or Picard algorithms which incorporates inner iterative solvers.

Function Documentation

◆ cs_iter_algo_aa_allocate_arrays()

void cs_iter_algo_aa_allocate_arrays ( cs_iter_algo_aa_t aa)

Allocate arrays needed by the "Anderson acceleration" algorithm.

Parameters
[in,out]aapointer to the structure managing the Anderson algo.

◆ cs_iter_algo_aa_create()

cs_iter_algo_aa_t* cs_iter_algo_aa_create ( cs_iter_algo_param_aa_t  aap,
cs_lnum_t  n_elts 
)

Create a new cs_iter_algo_aa_t structure for Anderson acceleration.

Parameters
[in]aapset of parameters for the Anderson acceleration
[in]n_eltsnumber of elements by direction
Returns
a pointer to the new allocated structure

◆ cs_iter_algo_aa_free()

void cs_iter_algo_aa_free ( cs_iter_algo_t algo)

Free a cs_iter_algo_aa_t structure inside a cs_iter_algo_t structure This structure is used to manage the Anderson acceleration.

Parameters
[in,out]algopointer the main structure. Free the context part.

◆ cs_iter_algo_aa_free_arrays()

void cs_iter_algo_aa_free_arrays ( cs_iter_algo_aa_t aa)

Free arrays used during the Anderson acceleration.

Parameters
[in,out]aapointer to the structure managing the Anderson algo.

◆ cs_iter_algo_aa_update()

void cs_iter_algo_aa_update ( cs_iter_algo_t algo,
cs_real_t cur_iterate,
const cs_real_t pre_iterate,
cs_cdo_blas_dotprod_t dotprod,
cs_cdo_blas_square_norm_t sqnorm 
)

Apply one more iteration of the Anderson acceleration.

Parameters
[in,out]algopointer to a cs_iter_algo_t structure
[in,out]cur_iteratecurrent iterate
[in]pre_iterateprevious iterate
[in]dotprodfunction to compute a dot product
[in]sqnormfunction to compute a square norm

◆ cs_iter_algo_create()

cs_iter_algo_t* cs_iter_algo_create ( int  verbosity,
cs_param_sles_cvg_t  cvg_param 
)

Create and initialize a new cs_iter_algo_t structure.

Parameters
[in]verbositylevel of information to print
[in]paramset of parameters driving the convergence of the iterative algorithm
Returns
a pointer to the new allocated structure

◆ cs_iter_algo_get_anderson_param()

cs_iter_algo_param_aa_t cs_iter_algo_get_anderson_param ( cs_iter_algo_t algo)

Retrieve the set of parameters for an Anderson algorithm.

Parameters
[in,out]algopointer to a cs_iter_algo_t structure
Returns
a cs_iter_algo_param_aa_t structure

◆ cs_iter_algo_post_check()

void cs_iter_algo_post_check ( const char *  func_name,
const char *  eq_name,
const char *  algo_name,
cs_iter_algo_t algo 
)

Check if something wrong happens during the iterative process after one new iteration.

Parameters
[in]func_namename of the calling function
[in]eq_namename of the equation being solved
[in]algo_namename of the iterative algo. used
[in]algopointer to the iterative algorithm structure

◆ cs_iter_algo_reset_nl()

void cs_iter_algo_reset_nl ( cs_param_nl_algo_t  nl_algo_type,
cs_iter_algo_t algo 
)

Reset a cs_iter_algo_t structure in case of a non-linear algorothm.

Parameters
[in]nl_algo_typetype of non-linear algorithm
[in,out]algopointer to a cs_iter_algo_t

◆ cs_iter_algo_update_cvg()

void cs_iter_algo_update_cvg ( cs_iter_algo_t algo)

Update the convergence status and the number of iterations. The tolerance threshold has to be computed outside the function and before calling this function.

Parameters
[in,out]algopointer to a cs_iter_algo_t structure

◆ cs_iter_algo_update_cvg_default()

void cs_iter_algo_update_cvg_default ( cs_iter_algo_t algo)

Update the convergence status and the number of iterations. The tolerance threshold is computed by a default formula relying on the relative tolerance scaled by the normalization factor and the absolute tolerance.

Parameters
[in,out]algopointer to a cs_iter_algo_t structure