tem_varSys_append_meshInfoVar Subroutine

public subroutine tem_varSys_append_meshInfoVar(varSys)

This subroutine appends the list of meshInfo variables (e.g. element volume, element volume fraction, treeID, ... )

Arguments

Type IntentOptional Attributes Name
type(tem_varSys_type), intent(inout) :: varSys

global variable system to which meshInfoVar to be appended


Calls

proc~~tem_varsys_append_meshinfovar~~CallsGraph proc~tem_varsys_append_meshinfovar tem_varSys_append_meshInfoVar proc~tem_varsys_append_dervar tem_varSys_append_derVar proc~tem_varsys_append_meshinfovar->proc~tem_varsys_append_dervar interface~positionofval~5 positionofval proc~tem_varsys_append_dervar->interface~positionofval~5 interface~append~9 append proc~tem_varsys_append_dervar->interface~append~9 proc~posofval_label posofval_label interface~positionofval~5->proc~posofval_label proc~append_da_label append_da_label interface~append~9->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~9->proc~append_da_veclabel interface~sortedposofval~5 sortedposofval proc~posofval_label->interface~sortedposofval~5 proc~append_da_label->interface~sortedposofval~5 interface~expand~9 expand proc~append_da_label->interface~expand~9 proc~append_da_veclabel->interface~expand~9

Contents


Source Code

  subroutine tem_varSys_append_meshInfoVar( varSys )
    ! -------------------------------------------------------------------- !
    !> global variable system to which meshInfoVar to be appended
    type(tem_varSys_type), intent(inout)        :: varSys
    ! -------------------------------------------------------------------- !
    integer :: iVar, addedPos, nComponents
    logical :: wasAdded
    procedure(tem_varSys_proc_point), pointer :: get_point => NULL()
    procedure(tem_varSys_proc_element), pointer :: get_element => NULL()
    procedure(tem_varSys_proc_setParams), pointer :: set_params => null()
    procedure(tem_varSys_proc_getParams), pointer :: get_params => null()
    procedure(tem_varSys_proc_setupIndices), pointer :: &
      &                                      setup_indices => null()
    procedure(tem_varSys_proc_getValOfIndex), pointer :: &
      &                                       get_valOfIndex => null()
    ! Mesh info variables
    integer :: nMeshVars
    character(len=labelLen), allocatable ::  meshInfoVar(:)
    ! -------------------------------------------------------------------- !
    write(logUnit(5),*) 'Append meshInfo variables to varSys'

    nMeshVars = 9
    allocate(meshInfoVar(nMeshVars))
    meshInfoVar = [  'treeid       ', 'process      ', &
      &              'weight       ',                  &
      &              'elem_vol     ', 'vol_frac     ', &
      &              'level        ', 'solidified   ', &
      &              'has_ibm      ', 'has_sendhalos'  ]

    do iVar = 1, nMeshVars
      ! all meshInfo variables are scalar.
      ! If not change nComp for that variable
      nComponents = 1
      select case( trim(adjustl(meshInfoVar(iVar))) )
      case ('treeid')
        get_element => getTreeID
      case ('weight')
        get_element => getElemWeight
      case ('process')
        get_element => getMPIproc
      case ('elem_vol')
        get_element => deriveElemVol
      case ('vol_frac')
        get_element => deriveVolFrac
      case ('solidified', 'has_ibm', 'has_sendhalos')
        get_element => deriveProperty
      case ('level')
        get_element => deriveLevel
      case default
        write(logUnit(1),*) 'WARNING: Cannot append meshInfo variable: ' &
          &                 // trim(meshInfoVar(iVar))
        write(logUnit(1),*) 'without variable operation routine'
        cycle !go to next variable
      end select

      ! append variable to varSys
      call tem_varSys_append_derVar( me             = varSys,                  &
        &                            varName        = trim(meshInfoVar(iVar)), &
        &                            operType       = 'st_fun',                &
        &                            nComponents    = nComponents,             &
        &                            method_data    = c_null_ptr,              &
        &                            get_point      = get_point,               &
        &                            get_element    = get_element,             &
        &                            set_params     = set_params,              &
        &                            get_params     = get_params,              &
        &                            setup_indices  = setup_indices,           &
        &                            get_valOfIndex = get_valOfIndex,          &
        &                            pos            = addedPos,                &
        &                            wasAdded       = wasAdded                 )

      if (wasAdded) then
        write(logUnit(10),*) ' Appended variable:'//trim(meshInfoVar(iVar))
      else if (addedpos < 1) then
        write(logUnit(1),*) 'Error: variable '//trim(meshInfoVar(iVar)) &
          &                 // ' is not added to variable system'
      end if

    end do ! iVar

  end subroutine tem_varSys_append_meshInfoVar