tem_load_bc_header Subroutine

public subroutine tem_load_bc_header(me, conf, parentHandle, BC_prop)

This subroutine reads in the boundary conditions specified in the configuration file, and connects them to the corresponding entries in the treelmesh. If there boundary conditions in the mesh, for which no configuration is found, the program is aborted!

Arguments

Type IntentOptional Attributes Name
type(tem_bc_header_type), intent(inout) :: me

The boundary conditions to fill

type(flu_State) :: conf

A handle to the Lua configuration script, to read the data from

integer, intent(in), optional :: parentHandle

handle for schemes table

type(tem_BC_prop_type), intent(in) :: BC_prop

The boundary properties of the treelmesh, to connect the header to


Calls

proc~~tem_load_bc_header~~CallsGraph proc~tem_load_bc_header tem_load_bc_header aot_get_val aot_get_val proc~tem_load_bc_header->aot_get_val aot_table_close aot_table_close proc~tem_load_bc_header->aot_table_close aot_table_length aot_table_length proc~tem_load_bc_header->aot_table_length aot_table_open aot_table_open proc~tem_load_bc_header->aot_table_open proc~tem_horizontalspacer tem_horizontalSpacer proc~tem_load_bc_header->proc~tem_horizontalspacer proc~tem_init_bc_header tem_init_bc_header proc~tem_load_bc_header->proc~tem_init_bc_header proc~tem_match_bc_header tem_match_bc_header proc~tem_load_bc_header->proc~tem_match_bc_header proc~tem_abort tem_abort proc~tem_match_bc_header->proc~tem_abort mpi_abort mpi_abort proc~tem_abort->mpi_abort

Source Code

  subroutine tem_load_bc_header( me, conf, parentHandle, BC_prop )
    ! ---------------------------------------------------------------------------
    !> The boundary conditions to fill
    type(tem_bc_header_type), intent(inout) :: me
    !> A handle to the Lua configuration script, to read the data from
    type(flu_State) :: conf
    !> The boundary properties of the treelmesh, to connect the header to
    type(tem_BC_prop_type), intent(in) :: BC_prop
    !> handle for schemes table
    integer, intent(in),optional       :: parentHandle
    ! ---------------------------------------------------------------------------
    integer :: iBC, nBCs
    integer :: bc_handle, myHandle
    integer :: iError
    ! ---------------------------------------------------------------------------

    call tem_horizontalSpacer(fUnit=logUnit(1))
    write(logUnit(1),*) ' Loading BC header'
    ! if fluid informations in scheme table parentHandle /= 0
    call aot_table_open( L       = conf,                                       &
      &                  parent  = parentHandle,                               &
      &                  thandle = bc_handle,                                  &
      &                  key     = 'boundary_condition' )
    nBCs = aot_table_length(L=conf, thandle=bc_handle)

    ! allocate the label, bc_kind and BC_ID arrays in me
    call tem_init_bc_header( me, nBCs )

    do iBC = 1, nBCs
      call aot_table_open( L       = conf,                                     &
        &                  parent  = bc_handle,                                &
        &                  thandle = myHandle,                                 &
        &                  pos     = iBC )
      if (myHandle /= 0) then
        call aot_get_val( L       = conf,                                      &
          &               thandle = myHandle,                                  &
          &               val     = me%label(iBC),                             &
          &               ErrCode = iError,                                    &
          &               key     = 'label',                                   &
          &               default = 'unnamed' )

        call aot_get_val( L       = conf,                                      &
          &               thandle = myHandle,                                  &
          &               val     = me%BC_kind(iBC),                           &
          &               ErrCode = iError,                                    &
          &               key     = 'kind',                                    &
          &               default = 'none' )
        write(logUnit(1),*)'  Found BC '//trim(me%Label(iBC))//' of kind '//   &
          &            trim(me%BC_kind(iBC))
      else
        write(logUnit(1),*)'WARNING: BC definition should be a table!'
        write(logUnit(1),*)'       : Assuming unnamed BC with kind none!'
        me%Label(iBC) = 'unnamed'
        me%BC_kind(iBC) = 'none'
      end if
      call aot_table_close(L=conf, thandle=myHandle)
    end do ! iBC

    call aot_table_close(L=conf, thandle=bc_handle)

    ! Now all the BCs defined in the config file are known,
    ! try to match them against the labels in the BC_prop.
    ! if a bc label can not be matched, treat it as a fatal error.
    call tem_match_bc_header( me = me, BC_prop = BC_prop )

    if ( nBCs .gt. 0 ) then
      write(logUnit(1),"(A, I0)") ' Number of Boundaries: ', me%nBCs
    else
      write(logUnit(1),*) ' No Boundary conditions!'
    end if

  end subroutine tem_load_bc_header