load_defaultTargetState Subroutine

private subroutine load_defaultTargetState(conf, parent, nDim, nComp, targetState)

This routine loads state names from target_state table

Arguments

Type IntentOptional 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


Calls

proc~~load_defaulttargetstate~~CallsGraph proc~load_defaulttargetstate load_defaultTargetState aot_get_val aot_get_val proc~load_defaulttargetstate->aot_get_val aot_table_close aot_table_close proc~load_defaulttargetstate->aot_table_close aot_table_open aot_table_open proc~load_defaulttargetstate->aot_table_open proc~tem_abort tem_abort proc~load_defaulttargetstate->proc~tem_abort mpi_abort mpi_abort proc~tem_abort->mpi_abort

Called by

proc~~load_defaulttargetstate~~CalledByGraph proc~load_defaulttargetstate load_defaultTargetState proc~load_spongelayer load_spongeLayer proc~load_spongelayer->proc~load_defaulttargetstate proc~tem_load_spongelayer_box tem_load_spongeLayer_box proc~tem_load_spongelayer_box->proc~load_spongelayer proc~tem_load_spongelayer_plane tem_load_spongeLayer_plane proc~tem_load_spongelayer_plane->proc~load_spongelayer proc~tem_load_spongelayer_radial tem_load_spongeLayer_radial proc~tem_load_spongelayer_radial->proc~load_spongelayer proc~load_spatial_predefined load_spatial_predefined proc~load_spatial_predefined->proc~tem_load_spongelayer_box proc~load_spatial_predefined->proc~tem_load_spongelayer_plane proc~load_spatial_predefined->proc~tem_load_spongelayer_radial proc~tem_load_spatial tem_load_spatial proc~tem_load_spatial->proc~load_spatial_predefined

Source Code

  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