tem_load_ic Subroutine

public subroutine tem_load_ic(me, conf, parent, StateName, key, errCode)

Load initial condition

Check if restart file is defined. Then use restart file to initialize variables. If not then load state variables either as constant or function \author Kannan Masilamani

Arguments

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

Initial condition type

type(flu_State) :: conf

lua state type

integer, intent(in), optional :: parent
character(len=*), intent(in) :: StateName(:)

array of defined initial state variables

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

key for the initial cond.

integer, intent(out) :: errCode(:)

errCode of variables Solver should take appropriate action according to errCode


Calls

proc~~tem_load_ic~~CallsGraph proc~tem_load_ic tem_load_ic proc~aot_table_open aot_table_open proc~tem_load_ic->proc~aot_table_open proc~tem_load_spatial tem_load_spatial proc~tem_load_ic->proc~tem_load_spatial proc~tem_horizontalspacer tem_horizontalSpacer proc~tem_load_ic->proc~tem_horizontalspacer proc~aot_table_close aot_table_close proc~tem_load_ic->proc~aot_table_close proc~tem_abort tem_abort proc~tem_load_ic->proc~tem_abort proc~tem_load_spatial->proc~aot_table_open proc~tem_load_spatial->proc~aot_table_close proc~tem_load_spatial->proc~tem_abort proc~load_spatial_predefined load_spatial_predefined proc~tem_load_spatial->proc~load_spatial_predefined interface~tem_tostr tem_toStr proc~tem_load_spatial->interface~tem_tostr proc~aot_get_val~2 aot_get_val proc~tem_load_spatial->proc~aot_get_val~2 proc~aot_reference_for aot_reference_for proc~tem_load_spatial->proc~aot_reference_for proc~aot_fun_open aot_fun_open proc~tem_load_spatial->proc~aot_fun_open proc~aot_fun_close aot_fun_close proc~tem_load_spatial->proc~aot_fun_close proc~load_spatial_asconst load_spatial_asConst proc~tem_load_spatial->proc~load_spatial_asconst mpi_abort mpi_abort proc~tem_abort->mpi_abort

Contents

Source Code


Source Code

  subroutine tem_load_ic(me, conf, parent, StateName, key, errCode )
    ! ---------------------------------------------------------------------------
    !> Initial condition type
    type(tem_ini_condition_type), intent(out) :: me
    !> lua state type
    type(flu_State) :: conf
    !> array of defined initial state variables
    character(len=*), intent(in) :: StateName(:)
    !> errCode of variables
    !! Solver should take appropriate action according to errCode
    integer, intent(out) :: errCode(:)
    !>
    integer, intent(in), optional :: parent
    !> key for the initial cond.
    character(len=*), intent(in), optional :: key
    ! ---------------------------------------------------------------------------
    integer :: iState, nStates
    integer :: ic_table
    character(len=labelLen) :: lockey ! key for the initial cond.
    ! ---------------------------------------------------------------------------

    nStates = size(StateName)

    allocate(me%StateName(nStates))
    allocate(me%ini_state(nStates))
    me%StateName = StateName
    if ( present(key) ) then
      lockey = key
    else
      lockey = 'initial_condition'
    end if
    call aot_table_open(L=conf, parent=parent, thandle=ic_table, key=lockey)
    call tem_horizontalSpacer(fUnit=logUnit(1))
    write(logUnit(1),*) ' Loading initial conditions'
    if (ic_table == 0) then
      ! Interpret the initial_condition entry as name for the restart file,
      ! if it is not a table.
      call tem_abort('Initial condition table is not found!')
    else
      ! We are not doing a restart, need to find initial conditions for all
      ! requested states.
      do iState = 1, nStates
        call tem_load_spatial( me           = me%ini_state(iState),       &
          &                    conf         = conf,                       &
          &                    parent       = ic_table,                   &
          &                    key          = trim(me%stateName(iState)), &
          &                    errCode      = errCode( iState ),          &
          &                    defaultValue = 0._rk                       )
        ! check if the initial condition has kind = none
        ! if ( me%ini_state(iState)%kind == 'none' ) then
        !   write(*,*) 'Initial condition variable', trim(me%stateName(iState)), &
        !    & 'has kind none, stopping ...'
        !   call tem_abort()
        ! end if
      end do

    end if
    call aot_table_close(L=conf, thandle=ic_table)

  end subroutine tem_load_ic