Load the convergence definition table The convergence object must be part of a convergence object, for which the format has been set to format = 'convergence' In the convergence table, you then must define a norm:

• simple: just check against the state value of the last check, and reach convergence if below the defined threshold
• average: build the average over a defined set of last checks with nvals stop, if the difference to the current state value is below the given threshold
• nvals: define, how many last checks should be taken into account for averaging procedure

The error is by default calculated to be a relative error. If an absolute error is desired, choose absolute=true in the convergence object

The stopping criterion is defined as a general condition object, where the threshold and the operator has to be given

  condition = { threshold = 1.E-6, operator = '<' }


A sample convergence object with a convergence definition can look as follows (within time_control table):

  abort_criteria = {
stop_file = 'stop',
convergence = {
variable = {'pressure','velocity'},
shape = {kind = 'all'},
time_control = {
min = {iter=0},
max = {iter=tmax},
interval = {iter=10*dt}},
reduction = {'average','average'},
norm='average', nvals = 100, absolute = true,
condition = {
{ threshold = 1.e-15, operator = '<=' },
{ threshold = 1.e-12, operator = '<=' }
}
}
}


Or another sample:

  abort_criteria = {
stop_file     = 'stop',
convergence   = {
variable = {'pressure_phy'},
shape = {
{kind = 'canoND', object = {origin ={0.15-dx,0.2,zpos} }},
{kind = 'canoND', object = {origin ={0.25+dx,0.2,zpos} }}
},
time_control = {min = 0, max = tmax, interval = 10*dt},
reduction = {'average'},
norm      = 'average',
nvals     = 50,
absolute  = true,
condition = { threshold = 1.e-10, operator = '<=' }
}
}


### Arguments

Type IntentOptional Attributes Name
type(tem_convergence_type), intent(out), allocatable :: me(:)

list of the convergence entities to create

type(flu_State) :: conf

general control parameters handle of the lua config file

integer, optional :: parent

if the convergence table is a child-table of some other table, use the parent as a reference

Steady flag in abort_criteria to check for convergence

## Source Code

  subroutine tem_convergence_load(me, conf, parent, steady_state)
! ---------------------------------------------------------------------------
!> list of the convergence entities to create
type( tem_convergence_type ), allocatable, intent(out) :: me(:)
!> general control parameters
!> handle of the lua config file
type( flu_state ) :: conf
!> if the convergence table is a child-table of some other table,
!! use the parent as a reference
integer, optional :: parent
!> Steady flag in abort_criteria to check for convergence
! ---------------------------------------------------------------------------
integer :: conv_handle, sub_handle
integer :: iConv, nConv
! ---------------------------------------------------------------------------

! Read the number of convergences in the lua file
call aot_table_open( L       = conf,          &
&                  thandle = conv_handle,   &
&                  key     = 'convergence', &
&                  parent  = parent         )

if (conv_handle == 0) then
write(logUnit(1),*) 'WARNING: Abort criteria, steady state is true but'
write(logUnit(1),*) '         No Convergence table is defined with '
write(logUnit(1),*) '         conditions to check for steady state'
write(logUnit(1),*) 'NOTE: Steady state is deactivated'
call aot_table_close(L=conf, thandle=conv_handle)
call tem_horizontalSpacer(fUnit=logUnit(1))
return
end if

! Check whether convergence had a subtable
! If no, then it is a single table, load single convergence entry
! else load multiple tables, open convergence subtable
call aot_table_open( L       = conf,        &
&                  parent  = conv_handle, &
&                  thandle = sub_handle,  &
&                  pos     = 1            )

! Only single table
if (sub_handle == 0) then
nConv = 1
write(logUnit(1),*) 'Convergence is a single table'
allocate( me( nConv ) )
&                              sub_handle = conv_handle, &
&                              me         = me(1)        )
call aot_table_close(L=conf, thandle=sub_handle)
else ! Multiple table
call aot_table_close(L=conf, thandle=sub_handle)
nConv = aot_table_length(L=conf, thandle=conv_handle)
! Allocate the defined number of convergence entities
allocate( me( nConv ))
write(logUnit(1),*) 'Number of Convergence entities: ', nConv

! Loop over all the definitions and assign the variables from the lua
! file on the tem_convergence_type.
! Inside this routine it will open convergence subtable. Each subtable
! contains one or more convergence variables the stuff is done in the
do iConv = 1, nConv
call aot_table_open( L       = conf,        &
&                  parent  = conv_handle, &
&                  thandle = sub_handle,  &
&                  pos     = iConv      )