DL_MG
Data Types | Functions/Subroutines | Variables
dl_mg_errors Module Reference

data types and subroutines for error handling More...

Data Types

type  errm
 

Functions/Subroutines

subroutine handle_error (err_code, ierror, msg)
 
subroutine, private error_abort (error_code, msg)
 
subroutine get_errmsg (err_code, msg)
 
logical function check_assertion (assertion, err_code)
 can be used to trigger assertion failure. useful for testing error handling More...
 

Variables

integer, parameter, private nerror = 34
 Warning : If a new error code is added nerror must be increased by one and a corressponding error message must be added in error_list array. This is awkward but I cannot think of a better solution. error codes are defined in dl_mg_common_params.inc. More...
 
type(errm), dimension(nerror), parameter, private error_list = (/ errm("Unspecified error:"), errm("dl_mg_init called before dl_mg_free"), errm("Neumann boundary condition is not implemented"), errm("dl_mg_init: wrong boundary condition specification in input. It must be one of: DL_MG_BC_PERIODIC, DL_MG_BC_DIRICHLET"), errm("input communicator does not have a cartesian topology"), errm("duplicate communicator does not have a cartesian topology"), errm("boundary conditions inconsistent with MPI topology"), errm("empty inner grid in set_mg_grids"), errm("build_prolong_map: inactive site left behind"), errm("dl_mg_init_nonlin: Debye length squared is negative"), errm("dl_mg_solver_poisson is called before dl_mg_init"), errm("dl_mg_solver_pbe called before initialisation subroutines"), errm("dl_mg_solver_pbe: not an error, functionality added"), errm("Dirichlet boundary values were modified by the solver"), errm("Consecutive residuals ratio is too large. It is possible that the round-off limit was reached. Check the residual ratio distribution histogram (enabled with DL_MG_RES_HIST)."), errm("Computation failed to converge after the prescribed number of iterations"), errm("wrong eq_type in Newton's MG"), errm("compute_damping_parameter: failed to find a damping parameter for Newton method"), errm("compute_damping_parameter: functional derivative is non-negative"), errm("assertion error"), errm("error in memory allocation"), errm("error in memory deallocation"), errm("error in file I/O"), errm("error in setting up grid geometry"), errm("MPI routine returned a non-zero error code"), errm("Wrong equation type"), errm("requested FD order not supported"), errm("convergence was not achieved within the maximum number of defect correction iterations"), errm("unphysical solution obtained in defect correction"), errm("error damping for defect correction failed"), errm("der_pot should not be passed to the solver when the defect correction is used, since the potential at which the derivative is evaluated is generated internally (within the defect correction loop)"), errm("Using serial build code in MPI run?"), errm("Ion concentration is zero in PBE solver. Use Poisson or linearised PBE"), errm("Shifted ion concentration is negative.") /)
 
logical, save abort_on_failure = .true.
 control wether to abort or return control to the calling up when error conditions are detected. Control is return to the calling routine only if handle_error is called with ierror argument More...
 
integer, save first_error = -1
 keeps the first error code reported by handle_error() this useful because the ierror code could be changed as dlmg is quitting and the control is returned to the higher level subroutines NB the error code are positive integers More...
 

Detailed Description

data types and subroutines for error handling

Function/Subroutine Documentation

◆ check_assertion()

logical function dl_mg_errors::check_assertion ( logical, intent(in)  assertion,
integer, intent(in), optional  err_code 
)

can be used to trigger assertion failure. useful for testing error handling

Parameters
[in]assertionlogical expression whose value is is returned
[in]err_codeused for testing the error reporting of that error code; if missing nothing happens

◆ error_abort()

subroutine, private dl_mg_errors::error_abort ( integer, intent(in)  error_code,
character(len=*), intent(in), optional  msg 
)
private

◆ get_errmsg()

subroutine dl_mg_errors::get_errmsg ( integer, intent(in)  err_code,
character(len=dl_mg_max_error_string), intent(out)  msg 
)

◆ handle_error()

subroutine dl_mg_errors::handle_error ( integer, intent(in)  err_code,
integer, intent(out), optional  ierror,
character(len=*), intent(in), optional  msg 
)
Parameters
[in]err_codeerror code
[out]ierrorvalue to be return to the caller
[in]msgsupplementary message used only if the execution aborts on error

Variable Documentation

◆ abort_on_failure

logical, save dl_mg_errors::abort_on_failure = .true.

control wether to abort or return control to the calling up when error conditions are detected. Control is return to the calling routine only if handle_error is called with ierror argument

◆ error_list

type(errm), dimension(nerror), parameter, private dl_mg_errors::error_list = (/ errm("Unspecified error:"), errm("dl_mg_init called before dl_mg_free"), errm("Neumann boundary condition is not implemented"), errm("dl_mg_init: wrong boundary condition specification in input. It must be one of: DL_MG_BC_PERIODIC, DL_MG_BC_DIRICHLET"), errm("input communicator does not have a cartesian topology"), errm("duplicate communicator does not have a cartesian topology"), errm("boundary conditions inconsistent with MPI topology"), errm("empty inner grid in set_mg_grids"), errm("build_prolong_map: inactive site left behind"), errm("dl_mg_init_nonlin: Debye length squared is negative"), errm("dl_mg_solver_poisson is called before dl_mg_init"), errm("dl_mg_solver_pbe called before initialisation subroutines"), errm("dl_mg_solver_pbe: not an error, functionality added"), errm("Dirichlet boundary values were modified by the solver"), errm("Consecutive residuals ratio is too large. It is possible that the round-off limit was reached. Check the residual ratio distribution histogram (enabled with DL_MG_RES_HIST)."), errm("Computation failed to converge after the prescribed number of iterations"), errm("wrong eq_type in Newton's MG"), errm("compute_damping_parameter: failed to find a damping parameter for Newton method"), errm("compute_damping_parameter: functional derivative is non-negative"), errm("assertion error"), errm("error in memory allocation"), errm("error in memory deallocation"), errm("error in file I/O"), errm("error in setting up grid geometry"), errm("MPI routine returned a non-zero error code"), errm("Wrong equation type"), errm("requested FD order not supported"), errm("convergence was not achieved within the maximum number of defect correction iterations"), errm("unphysical solution obtained in defect correction"), errm("error damping for defect correction failed"), errm("der_pot should not be passed to the solver when the defect correction is used, since the potential at which the derivative is evaluated is generated internally (within the defect correction loop)"), errm("Using serial build code in MPI run?"), errm("Ion concentration is zero in PBE solver. Use Poisson or linearised PBE"), errm("Shifted ion concentration is negative.") /)
private

◆ first_error

integer, save dl_mg_errors::first_error = -1

keeps the first error code reported by handle_error() this useful because the ierror code could be changed as dlmg is quitting and the control is returned to the higher level subroutines NB the error code are positive integers

◆ nerror

integer, parameter, private dl_mg_errors::nerror = 34
private

Warning : If a new error code is added nerror must be increased by one and a corressponding error message must be added in error_list array. This is awkward but I cannot think of a better solution. error codes are defined in dl_mg_common_params.inc.