tem_spatial_for_treeIDs Function

private function tem_spatial_for_treeIDs(me, treeIds, tree, n) result(res)

This function invokes different spatial boundary kinds like constant, lua function or predefined Fortran function for given treeIDs

If a spatial block is not defined, default value is set to 1.0 or default value passed while loading tem_load_spatial. If both spatial and temporal block are not defined in the lua file, the return value = 1.0_rk. based spatial_kind(kind).

  1. const - set constant value
  2. lua_fun - lua function
  3. gausspulse - fortran gauss pulse function
  4. 2dcrvp - fortran spinning vortex function
  5. parabol - fotran parabolic function

Arguments

Type IntentOptional Attributes Name
type(tem_spatial_type) :: me

spatial type for given boundary state

integer(kind=long_k), intent(in) :: treeIds(n)

treeIds of elements in given level

type(treelmesh_type), intent(in) :: tree

global treelm mesh

integer, intent(in) :: n

number of return values

Return Value real(kind=rk), (n)

return value of a function


Source Code

  function tem_spatial_for_treeIDs( me, treeIds, tree, n) result( res )
    ! -------------------------------------------------------------------- !
    !> spatial type for given boundary state
    type( tem_spatial_type ) :: me
    !> global treelm mesh
    type( treelmesh_type ), intent(in) ::tree
    !> number of return values
    integer, intent(in) :: n
    !> treeIds of elements in given level
    integer(kind=long_k), intent(in) :: treeIds(n)
    !> return value of a function
    real( kind=rk ) :: res(n)
    ! -------------------------------------------------------------------- !

    select case( trim(adjustl(me%kind)) )
    case( 'none', 'const' )
      res = me%const(1)

    case( 'lua_fun' )
      res = tem_spatial_lua_for( me%lua_fun_ref, me%conf, treeIds, tree, n)

    case( 'parabol' )
      select case( trim(adjustl(me%parabol%geometry%canoND(1)%kind)) )
      case('line')
        res = tem_spatial_parabol2d_for( me%parabol%geometry%canoND(1), &
          &                              treeIds,                       &
          &                              tree,                          &
          &                              n                              )
      case('plane')
        res = tem_spatial_parabol3d_for( me%parabol%geometry%canoND(1), &
          &                              treeIds,                       &
          &                              tree,                          &
          &                              n                              )
      end select
      res = res*me%parabol%amplitude(1)

    case ('random')
      res = tem_spatial_random_for(me%random, n)

    case( 'spongelayer_plane', 'spongelayer_plane_2d', 'spongelayer_plane_1d' )
      res = tem_spongeLayer_plane_for(me%spongePlane, treeids, tree, n)

    case( 'spongelayer_box' )
      res = tem_spongeLayer_box_for(me%spongeBox, treeids, tree, n)

    case( 'spongelayer_box_2d' )
      res = tem_spongeLayer_box2d_for(me%spongeBox, treeids, tree, n)

    case( 'spongelayer_radial_2d')
      res = tem_spongeLayer_radial_for( &
        & me      = me%spongeRadial,    &
        & treeids = treeids,            &
        & tree    = tree,               &
        & n       = n,                  &
        & nDim    = 2                   )

    case( 'spongelayer_radial')
      res = tem_spongeLayer_radial_for( &
        & me      = me%spongeRadial,    &
        & treeids = treeids,            &
        & tree    = tree,               &
        & n       = n,                  &
        & nDim    = 3                   )

    case( 'viscous_spongelayer_plane' )
      res = tem_viscSpongeLayer_plane_for(me%spongePlane, treeids, tree, n)

    case( 'viscous_spongelayer_box' )
      res = tem_viscSpongeLayer_box_for(me%spongeBox, treeids, tree, n)

    case( 'viscous_spongelayer_box_2d' )
      res = tem_viscSpongeLayer_box2d_for(me%spongeBox, treeids, tree, n)

    case( 'viscous_spongelayer_radial_2d')
      res = tem_viscSpongeLayer_radial_for( &
        & me      = me%spongeRadial,        &
        & treeids = treeids,                &
        & tree    = tree,                   &
        & n       = n,                      &
        & nDim    = 2                       )

    case( 'viscous_spongelayer_radial')
      res = tem_viscSpongeLayer_radial_for( &
        & me      = me%spongeRadial,        &
        & treeids = treeids,                &
        & tree    = tree,                   &
        & n       = n,                      &
        & nDim    = 3                       )

    case default
      call tem_abort(                                                   &
        & 'ERROR: Unknown spatial function in tem_spatial_for_treeIDs.' )

    end select

   end function tem_spatial_for_treeIDs