tem_load_spongeLayer_box Subroutine

public subroutine tem_load_spongeLayer_box(me, conf, thandle, nDim, nComp, stateName)

This subroutine load data for sponge layer box Example:

 spatial = {
   --supported options: 'spongelayer_box', 'spongelayer_box_2d'
   --                   'viscous_spongelayer_box',
   predefined = 'spongelayer_box',
   origin = {0.0,0.0,0.0},
   extent = {1.0, 2.0, 3.0},
   thickness = 0.3,
   damp_profile = 'linear', --'exponential', 'polynomial_n5', 'polynomial_n6'
   damp_factor = 0.5,
   damp_exponent = 1.0,
   target_state = {
     Default: density, velocityX, velocityY, velocityZ and pressure
     density = 1.0,
     pressure = 1.0,
     velocityX = 0.0, velocityY = 0.0, velocityZ = 0.0
 }

Arguments

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

Box spongeLayer data type

type(flu_State) :: conf

lua state type

integer, intent(in) :: thandle

aotus parent handle

integer, intent(in) :: nDim

number of Dimension for nonViscous sponges

integer, intent(in) :: nComp

Number of component of St-Fun variable under which this spatial function is defined

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

Load stateName from target_state table


Calls

proc~~tem_load_spongelayer_box~~CallsGraph proc~tem_load_spongelayer_box tem_load_spongeLayer_box aot_get_val aot_get_val proc~tem_load_spongelayer_box->aot_get_val proc~load_spongelayer load_spongeLayer proc~tem_load_spongelayer_box->proc~load_spongelayer proc~tem_abort tem_abort proc~tem_load_spongelayer_box->proc~tem_abort proc~load_spongelayer->aot_get_val proc~load_spongelayer->proc~tem_abort aot_table_close aot_table_close proc~load_spongelayer->aot_table_close aot_table_open aot_table_open proc~load_spongelayer->aot_table_open proc~load_defaulttargetstate load_defaultTargetState proc~load_spongelayer->proc~load_defaulttargetstate mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~load_defaulttargetstate->aot_get_val proc~load_defaulttargetstate->proc~tem_abort proc~load_defaulttargetstate->aot_table_close proc~load_defaulttargetstate->aot_table_open

Called by

proc~~tem_load_spongelayer_box~~CalledByGraph proc~tem_load_spongelayer_box tem_load_spongeLayer_box proc~load_spatial_predefined load_spatial_predefined proc~load_spatial_predefined->proc~tem_load_spongelayer_box proc~tem_load_spatial tem_load_spatial proc~tem_load_spatial->proc~load_spatial_predefined proc~load_spacetime_predefined load_spacetime_predefined proc~load_spacetime_predefined->proc~tem_load_spatial proc~tem_load_ic tem_load_ic proc~tem_load_ic->proc~tem_load_spatial proc~tem_load_spacetime_single tem_load_spacetime_single proc~tem_load_spacetime_single->proc~load_spacetime_predefined

Source Code

  subroutine tem_load_spongeLayer_box(me, conf, thandle, ndim, nComp, stateName)
    ! --------------------------------------------------------------------------
    !> Box spongeLayer data type
    type(tem_spongeLayer_box_type), intent(out) :: me
    !> lua state type
    type(flu_State) :: conf
    !> aotus parent handle
    integer, intent(in) :: thandle
    !> number of Dimension for nonViscous sponges
    integer, intent(in) :: nDim
    !> Number of component of St-Fun variable under which this spatial function
    !! is defined
    integer, intent(in) :: nComp
    !> Load stateName from target_state table
    character(len=*), intent(in), optional :: stateName
    ! --------------------------------------------------------------------------
    integer :: vError(3), errfatal(3), iError
    real(kind=rk) :: min_halfextent
    ! --------------------------------------------------------------------------
    errfatal = aotErr_Fatal
    ! Box origin
    call aot_get_val( L       = conf,      &
      &               thandle = thandle,   &
      &               key     = 'origin',  &
      &               val     = me%origin, &
      &               ErrCode = vError     )
    if (any(btest( vError, errFatal )) ) then
      write(logUnit(1),*) 'ERROR reading the origin of box sponge layer. ' &
        &              // 'It should have 3 entries for each coordinate.'
      call tem_abort()
    end if

    write(logUnit(1),*) ' * Origin =', me%origin

    ! Box extent
    call aot_get_val( L       = conf,      &
      &               thandle = thandle,   &
      &               key     = 'extent',  &
      &               val     = me%extent, &
      &               ErrCode = vError     )
    if (any(btest( vError, errFatal )) ) then
      write(logUnit(1),*) 'ERROR reading the extent of box sponge layer. ' &
        &              // 'It should have 3 entries for each dimension.'
      call tem_abort()
    end if

    write(logUnit(1),*) ' * Extent =', me%extent

    ! Additional parameters for box with rounded corner
    call aot_get_val( L       = conf,              &
      &               thandle = thandle,           &
      &               key     = 'rounded_corner',  &
      &               val     = me%rounded_corner, &
      &               default = .false.,           &
      &               ErrCode = iError             )
    if (btest( iError, aotErr_Fatal )) then
      write(logUnit(1),*) 'WARNING: reading the rounded_corner of box '&
        &               //'sponge layer. Setting it to false'
      me%rounded_corner = .false.
    end if
    write(logUnit(1),*) ' * Rounded_corner =', me%rounded_corner

    if (me%rounded_corner) then
      call aot_get_val( L       = conf,              &
        &               thandle = thandle,           &
        &               key     = 'corner_radius',   &
        &               val     = me%corner_radius,  &
        &               ErrCode = iError             )
      if (btest( iError, aotErr_Fatal )) then
        write(logUnit(1),*) 'ERROR reading the corner_radius of box '&
          &               //'sponge layer with rounded corner.'
        call tem_abort()
      end if
      ! if corner radius is greater than minimum half extent of the box
      ! then set corner_radius to minimum of half extent
      min_halfextent = minval(me%extent(1:nDim))*0.5_rk
      if (me%corner_radius > min_halfextent) then
        write(logUnit(1),*) 'WARNING: corner_radius is greater than half of '
        write(logUnit(1),*) '  min of box extent. '
        write(logUnit(1),*) 'Setting it to half of min extent'
        me%corner_radius = min_halfextent
      end if
      write(logUnit(1),*) ' * Corner radius =', me%corner_radius
    end if

    ! Load base information required for sponge layer definition like
    ! damp_factor, damp_exponent and target_state
    call load_spongeLayer( conf      = conf,                     &
      &                    thandle   = thandle,                  &
      &                    me        = me%spongeLayer_base_type, &
      &                    nDim      = nDim,                     &
      &                    nComp     = nComp,                    &
      &                    stateName = stateName                 )

  end subroutine tem_load_spongeLayer_box