29 real(real64),
public :: tol_abs
30 real(real64),
public :: tol_rel
31 character(len=:),
allocatable,
public :: label
32 type(unit_t),
pointer,
public :: unit => null()
34 real(real64),
public :: val_abs
35 real(real64),
public :: val_rel
36 real(real64),
pointer :: value_diff
37 real(real64),
pointer :: norm
63 class(convergence_criterion_t),
intent(inout) :: this
64 integer,
intent(in) :: iunit
68 if (
associated(this%unit))
then
69 write(iunit,
'(6x,a,a,a,es15.8,a,es15.8,4a)')
'abs_', this%label,
' = ', &
74 write(iunit,
'(6x,a,a,a,es15.8,a,es15.8,a)')
'abs_', this%label,
' = ', this%val_abs,
' (', this%tol_abs,
')'
76 write(iunit,
'(6x,a,a,a,es15.8,a,es15.8,a)')
'rel_', this%label,
' = ', this%val_rel,
' (', this%tol_rel,
')'
84 class(convergence_criterion_t),
intent(inout) :: this
85 logical,
intent(out) :: is_converged
89 this%val_abs = abs(this%value_diff)
91 assert(
associated(this%norm))
92 if (abs(this%norm) <
m_tiny)
then
95 this%val_rel = this%val_abs / abs(this%norm)
98 if (this%tol_abs <=
m_zero)
then
101 is_converged = this%val_abs < this%tol_abs
104 if (this%tol_rel >
m_zero)
then
105 is_converged = is_converged .and. this%val_rel < this%tol_rel
115 class(convergence_criterion_t),
intent(inout) :: this
116 real(real64),
target,
intent(in) :: value_diff
117 real(real64),
target,
intent(in) :: value_norm
121 this%value_diff => value_diff
122 this%norm => value_norm
133 nullify(this%value_diff)
136 if (
allocated(this%label))
then
138 deallocate(this%label)
146 class(criterion_list_t) :: this
147 class(convergence_criterion_t),
target :: criterion
151 call this%add_ptr(criterion)
163 select type (ptr => this%get_next_ptr())
class(convergence_criterion_t) function, pointer criterion_iterator_get_next(this)
subroutine criterion_set_quantity_pointers(this, value_diff, value_norm)
Setting pointers to the in, out and norm values.
subroutine, public convergence_criterion_end(this)
subroutine convergence_criterion_is_converged(this, is_converged)
Is the convergence reached ?
subroutine criterion_list_add_node(this, criterion)
subroutine criterion_write_info(this, iunit)
real(real64), parameter, public m_huge
real(real64), parameter, public m_zero
real(real64), parameter, public m_tiny
This module implements fully polymorphic linked lists, and some specializations thereof.
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
character(len=20) pure function, public units_abbrev(this)
These classes extend the list and list iterator to make a criterion list.
This class implements an iterator for the polymorphic linked list.
This class implements a linked list of unlimited polymorphic values.