tem_abortCriteria_load Subroutine

public subroutine tem_abortCriteria_load(me, conf, parent, key, solverAborts)

Load the abortCriteria from a given configuration.

The abort_critera are defined in a table as follows:

 abort_criteria = {stop_file='', steady_state=false}

stop_file indicates, which file should be checked for to stop the execution. A typical setting would for example be stop_file = 'stop'. If the string is empty, no checks are performed. The default is an empty string. Empty stop files will be deleted after they are encountered. Non-empty ones are kept.

steady_state indicates if the simulation should stop when a steady_state solution is found. Default ist false.

If steady_state is True then load convergence table for condition to check for steady state

Solvers may pass an additional solverAborts for specific abort parameters to be filled from the abort_criteria table.

Arguments

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

Abort criteria to load from the Lua table.

type(flu_State) :: conf

Handle for the Lua script.

integer, intent(in), optional :: parent

Parent table to read from.

character(len=*), intent(in), optional :: key

Name of the time control table. Default: 'time_control'

class(tem_solverAborts_type), intent(inout), optional :: solverAborts

Solver specific abort criteria to load.


Source Code

  subroutine tem_abortCriteria_load(me, conf, parent, key, solverAborts)
    ! -------------------------------------------------------------------- !
    !> Abort criteria to load from the Lua table.
    type(tem_abortCriteria_type), intent(out) :: me

    !> Handle for the Lua script.
    type(flu_state) :: conf

    !> Parent table to read from.
    integer, intent(in), optional :: parent

    !> Name of the time control table. Default: 'time_control'
    character(len=*), intent(in), optional :: key

    !> Solver specific abort criteria to load.
    class(tem_solverAborts_type), intent(inout), optional :: solverAborts
    ! -------------------------------------------------------------------- !
    character(len=labelLen) :: loc_key
    integer :: thandle
    integer :: iErr
    ! -------------------------------------------------------------------- !

    loc_key = 'abort_criteria'
    if (present(key)) loc_key = key

    call aot_table_open( L       = conf,    &
      &                  parent  = parent,  &
      &                  thandle = thandle, &
      &                  key     = loc_key  )

    if (thandle /= 0) then

      call aot_get_val( L       = conf,         &
        &               thandle = thandle,      &
        &               val     = me%stop_file, &
        &               key     = 'stop_file',  &
        &               default = '',           &
        &               ErrCode = iErr          )

      call aot_get_val( L       = conf,            &
        &               thandle = thandle,         &
        &               val     = me%steady_state, &
        &               key     = 'steady_state',  &
        &               default = .false.,         &
        &               ErrCode = iErr             )

      if (me%steady_state) then
        call tem_convergence_load( me           = me%convergence, &
          &                        conf         = conf,           &
          &                        parent       = thandle,        &
          &                        steady_state = me%steady_state )
      end if

      if (present(solverAborts)) then
        call solverAborts%load( conf        = conf,   &
          &                     abort_table = thandle )
      end if

    else

      me%stop_file = ''
      me%steady_state = .false.

    end if

    ! If no steady state is defined
    if (.not. me%steady_state) allocate(me%convergence(0))

    call aot_table_close( L       = conf,   &
      &                   thandle = thandle )

  end subroutine tem_abortCriteria_load