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
Type | Intent | Optional | 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 |
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