This routine loads state names from target_state table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | conf |
lua state type |
|||
integer, | intent(in) | :: | parent |
aotus parent handle |
||
integer, | intent(in) | :: | nDim |
Number of dimension |
||
integer, | intent(in) | :: | nComp |
Number of component of St-Fun variable under which this spatial function is defined |
||
real(kind=rk), | intent(out), | allocatable | :: | targetState(:) |
Target state value |
subroutine load_defaultTargetState(conf, parent, nDim, nComp, targetState)
! --------------------------------------------------------------------------
!> lua state type
type(flu_State) :: conf
!> aotus parent handle
integer, intent(in) :: parent
!> Number of dimension
integer, intent(in) :: nDim
!> Number of component of St-Fun variable under which this spatial function
!! is defined
integer, intent(in) :: nComp
!> Target state value
real(kind=rk), allocatable, intent(out) :: targetState(:)
! --------------------------------------------------------------------------
integer :: thandle, iState, nState
integer :: iError
!> List of stateNames
character(len=labelLen), allocatable :: stateName(:)
! --------------------------------------------------------------------------
nState = 0
select case (nDim)
case (3)
nState = 5
allocate(stateName(nState))
stateName = [ 'density ', 'velocityX', &
& 'velocityY', 'velocityZ', &
& 'pressure ' ]
case (2)
nState = 4
allocate(stateName(nState))
stateName = [ 'density ', 'velocityX', &
& 'velocityY', 'pressure ' ]
case (1)
nState = 3
allocate(stateName(nState))
stateName = [ 'density ', 'velocityX', &
& 'pressure ' ]
end select
! nState must be nComp - 1 to return all target states when evaluating
! the space-time function
if (nComp /= nState+1) then
write(logUnit(1),*) 'Error: Expected ncomponents = ', nState+1
write(logUnit(1),*) ' Defined ncomponents in st-fun is ', ncomp
call tem_abort()
end if
! target_state
allocate(targetState(nState))
call aot_table_open( L = conf, &
& parent = parent, &
& thandle = thandle, &
& key = 'target_state' )
write(logUnit(1),*) ' * Target state:'
do iState = 1, nState
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = trim(stateName(iState)), &
& val = targetState(iState), &
& ErrCode = iError )
if (btest(iError, aoterr_Fatal)) then
write(*,*) 'FATAL Error occured, when loading target state: ' &
& // trim(stateName(iState))// '! Aborting'
call tem_abort()
end if
write(logUnit(1),*) ' '//trim(stateName(iState))//' =', &
& targetState(iState)
end do
call aot_table_close(conf, thandle)
end subroutine load_defaultTargetState