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"
Functions | |
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. 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_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. 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... | |
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.
void cs_iter_algo_aa_allocate_arrays | ( | cs_iter_algo_aa_t * | aa | ) |
Allocate arrays needed by the "Anderson acceleration" algorithm.
[in,out] | aa | pointer to the structure managing the Anderson algo. |
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.
[in] | aap | set of parameters for the Anderson acceleration |
[in] | n_elts | number of elements by direction |
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.
[in,out] | algo | pointer the main structure. Free the context part. |
void cs_iter_algo_aa_free_arrays | ( | cs_iter_algo_aa_t * | aa | ) |
Free arrays used during the Anderson acceleration.
[in,out] | aa | pointer to the structure managing the Anderson algo. |
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.
[in,out] | algo | pointer to a cs_iter_algo_t structure |
[in,out] | cur_iterate | current iterate |
[in] | pre_iterate | previous iterate |
[in] | dotprod | function to compute a dot product |
[in] | sqnorm | function to compute a square norm |
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.
[in] | verbosity | level of information to print |
[in] | param | set of parameters driving the convergence of the iterative algorithm |
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.
[in,out] | algo | pointer to a cs_iter_algo_t structure |
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.
[in] | func_name | name of the calling function |
[in] | eq_name | name of the equation being solved |
[in] | algo_name | name of the iterative algo. used |
[in] | algo | pointer to the iterative algorithm structure |
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.
[in] | nl_algo_type | type of non-linear algorithm |
[in,out] | algo | pointer to a cs_iter_algo_t |
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.
[in,out] | algo | pointer to a cs_iter_algo_t structure |
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.
[in,out] | algo | pointer to a cs_iter_algo_t structure |