tem_loadStencil Subroutine

public subroutine tem_loadStencil(stencil, parent_handle, conf)

Load the stencil configuration from the lua file

Arguments

Type IntentOptional Attributes Name
type(tem_stencilHeader_type) :: stencil

stencil type to fill

integer, intent(in) :: parent_handle

handle of the parent table

type(flu_State) :: conf

lua state type


Calls

proc~~tem_loadstencil~~CallsGraph proc~tem_loadstencil tem_loadStencil proc~init_stencilheader init_stencilHeader proc~tem_loadstencil->proc~init_stencilheader proc~aot_table_open aot_table_open proc~tem_loadstencil->proc~aot_table_open proc~aot_table_close aot_table_close proc~tem_loadstencil->proc~aot_table_close proc~aot_get_val aot_get_val proc~tem_loadstencil->proc~aot_get_val proc~aot_table_length aot_table_length proc~tem_loadstencil->proc~aot_table_length interface~init~22 init proc~init_stencilheader->interface~init~22 proc~tem_stencil_createcxcx tem_stencil_createCxcx proc~init_stencilheader->proc~tem_stencil_createcxcx proc~tem_identify_inversedirections tem_identify_inverseDirections proc~init_stencilheader->proc~tem_identify_inversedirections proc~init_ga2d_real init_ga2d_real interface~init~22->proc~init_ga2d_real

Contents

Source Code


Source Code

  subroutine tem_loadStencil( stencil, parent_handle, conf )
    ! -------------------------------------------------------------------- !
    !> stencil type to fill
    type(tem_stencilHeader_type) :: stencil
    !> handle of the parent table
    integer, intent(in)    :: parent_handle
    !> lua state type
    type(flu_State) :: conf
    ! -------------------------------------------------------------------- !
    integer :: nCartDiscVel, iCartDiscVel
    integer :: nDiscreteVel, iDiscreteVel
    integer :: discVel_handle
    integer :: discVel_cart_handle
    integer :: iError
    ! -------------------------------------------------------------------- !
    ! Usually, the stencil to read applies for all elements
    ! (Compute stencil)
    stencil%useAll = .true.

    ! read the number of discrete velocities QQ
    ! @todo{ MH: Do we really need to read QQ explicitly?
    ! Isn't it enough to just count the number of entries below?}
    call aot_get_val( L       = conf,          &
      &               thandle = parent_handle, &
      &               val     = stencil%QQ,    &
      &               ErrCode = iError,        &
      &               key     = 'QQ'           )

    ! read the discrete velocities
    call aot_table_open( L       = conf,           &
      &                  parent  = parent_handle,  &
      &                  thandle = discVel_handle, &
      &                  key     = 'disc_vel'      )

    ! Check the length of the discrete velocity table
    nDiscreteVel = aot_table_length( L       = conf,          &
      &                              thandle = discVel_handle )

    if (nDiscreteVel == stencil%QQ ) then
      ! If the number of discrete velocities matches the given stencil QQ
      call init_stencilHeader( me     = stencil,     &
        &                      QQN    = stencil%QQN, &
        &                      QQ     = stencil%QQ,  &
        &                      useAll = .true.       )

      do iDiscreteVel = 1, nDiscreteVel

        call aot_table_open( L       = conf,                &
          &                  parent  = discVel_handle,      &
          &                  thandle = discVel_cart_handle, &
          &                  pos     = iDiscreteVel         )

        nCartDiscVel = aot_table_length( L       = conf,               &
          &                              thandle = discVel_cart_handle )

        if (nCartDiscVel == 3) then

          do iCartDiscVel = 1, nCartDiscVel
            call aot_get_val(                                                  &
              &         L       = conf,                                        &
              &         thandle = discVel_cart_handle,                         &
              &         val     = stencil%cxDir( iCartDiscVel, iDiscreteVel ), &
              &         ErrCode = iError,                                      &
              &         pos     = iCartDiscVel                                 )

            stencil%cxDirRK(iCartDiscVel, iDiscreteVel) &
              & = real( stencil%cxDir(iCartDiscVel, iDiscreteVel), rk )
          end do ! iCartDiscVel

        else

          write(logUnit(1),*) "Not every velocity has three cartesian " &
            &                 //"coordinates!!"

        end if

      end do ! iDiscreteVel

      call aot_table_close( L       = conf,               &
        &                   thandle = discVel_cart_handle )

    else
      write(logUnit(1),*) "The number of discrete velocities for the " &
        &                 //"new stencil does not match QQ!!"
      STOP
    end if

  end subroutine tem_loadStencil