tem_simControl_load Subroutine

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

Load sim control settings from a configuration script.

The sim control should be started beforhand to ensure a sane setting of the current time. The main setting here, is the time_control, which is also attempted to be read directly, if there is no sim_control table provided. Solvers may pass solverAborts to load additional abort criteria that are to be loaded from the configuration.

Arguments

Type IntentOptional Attributes Name
type(tem_simControl_type), intent(inout) :: me

Simulation control parameters to set.

type(flu_State) :: conf

Handle to the configuration script to load the settings from.

integer, intent(in), optional :: parent

Potential parent table, in which the simulation control table is to be found.

character(len=*), optional :: key

Name for the simulation control table. Default is 'sim_control'.

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

Solver specific abort criteria to load.


Source Code

  subroutine tem_simControl_load(me, conf, parent, key, solverAborts)
    ! -------------------------------------------------------------------- !
    !> Simulation control parameters to set.
    type(tem_simControl_type), intent(inout) :: me

    !> Handle to the configuration script to load the settings from.
    type(flu_state) :: conf

    !> Potential parent table, in which the simulation control table is to be
    !! found.
    integer, intent(in), optional :: parent

    !> Name for the simulation control table. Default is 'sim_control'.
    character(len=*), 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 = 'sim_control'
    if (present(key)) loc_key = key

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

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

    if (thandle /= 0) then
      ! There is a sim control table in the configuration.
      call tem_timeControl_load(me          = me%timeControl, &
        &                       conf        = conf,           &
        &                       parent      = thandle,        &
        &                       delay_check = me%delay_check  )

      call tem_abortCriteria_load( me     = me%abortCriteria,  &
        &                          conf   = conf,              &
        &                          parent = thandle,           &
        &                          solverAborts = solverAborts )
    else
      ! No sim control table found, try to load the time control table itself.
      call tem_timeControl_load(me%timeControl, conf, parent)
      me%abortCriteria = tem_abortCriteria_new()
    end if

    if (me%delay_check) then
      write(logUnit(1),*) 'Delaying status checks by one interval' &
        // '(delay_check=True).'
    end if

    call aot_table_close(L = conf, thandle = thandle)

    ! Overwrite the min of the simulation time range to point to the current
    ! simulation time.
    call tem_timeControl_start_at_sim(me = me%timeControl, now = me%now)

    call tem_addTimer( timerHandle = me%syncUpdate_timer, &
      &                timerName = 'tem_syncUpdate'       )

  end subroutine tem_simControl_load