tem_timeControl_load Subroutine

public subroutine tem_timeControl_load(me, conf, parent, key, delay_check)

Load a time control definition from a Lua script.

The time control description me is loaded from conf within parent and under the name key. If no key is provided the name is assumed to be 'time_control'. If the table is not found at all, all components of the control are set to never.

Arguments

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

Time control definition to load from a Lua config.

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'

logical, intent(in), optional :: delay_check

Default setting for the delay_check.

If set to true the check will use a nonblocking iAllreduce and delay the evaluation by one check_iter block. This setting may be overwritten by the user in the timecontrol block.


Calls

proc~~tem_timecontrol_load~~CallsGraph proc~tem_timecontrol_load tem_timeControl_load aot_get_val aot_get_val proc~tem_timecontrol_load->aot_get_val aot_table_close aot_table_close proc~tem_timecontrol_load->aot_table_close aot_table_open aot_table_open proc~tem_timecontrol_load->aot_table_open proc~tem_time_default_zero tem_time_default_zero proc~tem_timecontrol_load->proc~tem_time_default_zero proc~tem_time_load tem_time_load proc~tem_timecontrol_load->proc~tem_time_load proc~tem_time_needs_reduce tem_time_needs_reduce proc~tem_timecontrol_load->proc~tem_time_needs_reduce proc~tem_time_never tem_time_never proc~tem_timecontrol_load->proc~tem_time_never proc~tem_time_load->aot_get_val proc~tem_time_load->aot_table_close proc~tem_time_load->aot_table_open mpi_wtime mpi_wtime proc~tem_time_load->mpi_wtime

Called by

proc~~tem_timecontrol_load~~CalledByGraph proc~tem_timecontrol_load tem_timeControl_load proc~tem_balance_load tem_balance_load proc~tem_balance_load->proc~tem_timecontrol_load proc~tem_load_adapt tem_load_adapt proc~tem_load_adapt->proc~tem_timecontrol_load proc~tem_load_convergenceheader tem_load_convergenceHeader proc~tem_load_convergenceheader->proc~tem_timecontrol_load proc~tem_load_output tem_load_output proc~tem_load_output->proc~tem_timecontrol_load proc~tem_load_restart tem_load_restart proc~tem_load_restart->proc~tem_timecontrol_load proc~tem_load_surfdata tem_load_surfData proc~tem_load_surfdata->proc~tem_timecontrol_load proc~tem_load_trackingconfig tem_load_trackingConfig proc~tem_load_trackingconfig->proc~tem_timecontrol_load proc~tem_simcontrol_load tem_simControl_load proc~tem_simcontrol_load->proc~tem_timecontrol_load proc~tem_abortcriteria_load tem_abortCriteria_load proc~tem_simcontrol_load->proc~tem_abortcriteria_load proc~tem_convergence_load tem_convergence_load proc~tem_convergence_load->proc~tem_load_convergenceheader proc~tem_load_general tem_load_general proc~tem_load_general->proc~tem_balance_load proc~tem_load_general->proc~tem_simcontrol_load proc~tem_load_tracking tem_load_tracking proc~tem_load_tracking->proc~tem_load_trackingconfig proc~tem_abortcriteria_load->proc~tem_convergence_load

Source Code

  subroutine tem_timeControl_load(me, conf, parent, key, delay_check)
    ! -------------------------------------------------------------------- !
    !> Time control definition to load from a Lua config.
    type(tem_timeControl_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

    !> Default setting for the delay_check.
    !!
    !! If set to true the check will use a nonblocking iAllreduce and delay
    !! the evaluation by one check_iter block.
    !! This setting may be overwritten by the user in the timecontrol block.
    logical, intent(in), optional :: delay_check
    ! -------------------------------------------------------------------- !
    type(tem_time_type) :: usermin
    integer :: thandle, iErr
    character(len=labelLen) :: localKey
    logical :: def_delay
    ! -------------------------------------------------------------------- !

    if (present(key)) then
      localKey = key
    else
      localKey = 'time_control'
    end if

    if (present(delay_check)) then
      def_delay = delay_check
    else
      def_delay = .false.
    end if

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

    if (thandle /= 0) then

      call tem_time_load(me     = usermin, &
        &                conf   = conf,    &
        &                key    = 'min',   &
        &                parent = thandle  )

      call tem_time_load(me     = me%max, &
        &                conf   = conf,   &
        &                key    = 'max',  &
        &                parent = thandle )

      call tem_time_load(me     = me%interval, &
        &                conf   = conf,        &
        &                key    = 'interval',  &
        &                parent = thandle      )

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

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

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

      ! check iter can not be smaller than 1
      if ( me%check_iter < 1 ) then
        me%check_iter = 1
      end if

    else

      ! No table defined, set all times to never.
      usermin     = tem_time_never()
      me%max      = tem_time_never()
      me%interval = tem_time_never()
      me%check_iter = 1

    end if

    call aot_table_close(L = conf, thandle = thandle)

    me%min = tem_time_default_zero( time       = usermin,    &
      &                             dependency = me%interval )

    me%trigger = me%min
    me%min_reached = .false.

    me%needs_reduce = (     tem_time_needs_reduce(me%min)      &
      &                .or. tem_time_needs_reduce(me%max)      &
      &                .or. tem_time_needs_reduce(me%interval) )

  end subroutine tem_timeControl_load