tem_varSys_append_luaVar Subroutine

public subroutine tem_varSys_append_luaVar(luaVar, varSys, st_funList, solverData_evalElem)

subroutine to add the variables from the input lua script to the varsys

Arguments

Type IntentOptional Attributes Name
type(tem_variable_type), intent(in) :: luaVar(:)

variables defined in the lua file

type(tem_varSys_type), intent(inout) :: varSys

global variable system to which luaVar to be appended

type(tem_st_fun_linkedList_type), intent(inout) :: st_funList

contains spacetime functions of all variables

type(tem_varSys_solverData_evalElem_type), intent(in), optional :: solverData_evalElem

A callback routine to allow the definition of solver specific element evaluation for space-time functions.

This routine can be used to construct more than a single degree of freedom for a spacetime function in an element.


Source Code

  subroutine tem_varSys_append_luaVar( luaVar, varSys, st_funList, &
    &                                  solverData_evalElem         )
    !--------------------------------------------------------------------------
    !> variables defined in the lua file
    type(tem_variable_type), intent(in) :: luaVar(:)

    !> global variable system to which luaVar to be appended
    type(tem_varSys_type), intent(inout) :: varSys

    !> contains spacetime functions of all variables
    type(tem_st_fun_linkedList_type), intent(inout) :: st_funList

    !> A callback routine to allow the definition of solver specific
    !! element evaluation for space-time functions.
    !!
    !! This routine can be used to construct more than a single degree of
    !! freedom for a spacetime function in an element.
    type(tem_varSys_solverData_evalElem_type), &
      &  optional, intent(in) :: solverData_evalElem
    ! --------------------------------------------------------------------------
    integer :: iVar, varPos
    ! --------------------------------------------------------------------------
    if (size(luaVar) > 0) &
      & write(logUnit(5),*) 'Append variables defined in lua file to varSys'

    do iVar = 1, size(luaVar)
      write(logUnit(5),'(A,I2,A)') 'Appending variable ', iVar, ': ' &
        & // trim(luaVar(iVar)%label)
      varPos = PositionOfVal( me  = varSys%varName,          &
        &                     val = trim(luaVar(iVar)%label) )
      ! If variable already exist in varSys then do nothing
      if (varPos>0) then
        write(logUnit(5),*) 'Variable already exists!'
        cycle
      end if

      select case(trim(luaVar(iVar)%varType))
      case('st_fun')
        call tem_varSys_append_stFun(                    &
          &    stFunVar            = luaVar(iVar),       &
          &    varSys              = varSys,             &
          &    st_funList          = st_funList,         &
          &    solverData_evalElem = solverData_evalElem )

      case('operation')
        call tem_varSys_append_operVar(                       &
          &    operVar                  = luaVar(iVar),       &
          &    varSys                   = varSys,             &
          &    solverData_evalElem      = solverData_evalElem )

      case default
        if (associated(luaVar(iVar)%append_solverVar)) then
          call luaVar(iVar)%append_solverVar(                           &
            &                 varSys              = varSys,             &
            &                 solverData_evalElem = solverData_evalElem )
        else
          write(logUnit(1),*) 'WARNING: varType: '           &
            &                 // trim(luaVar(iVar)%varType)  &
            &                 // ' not supported. Variable ' &
            &                 // trim(luaVar(iVar)%label)    &
            &                 // ' is not appended.'
          cycle ! go to next variable
        end if
      end select

    end do !iVar

  end subroutine tem_varSys_append_luaVar