Loads the variable mapping from a table defined by given key for the variable names defined in possVars list. A variable mapping is used to link a user defined variable to a variable expected from, e.g., an equation system. These mappings are stored in varDict, which basically is a dictionary, whereas the key contains the name of the expected variable and the value contains the name of the user defined variable in the variable table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_possible_variable_type), | intent(in) | :: | possVars |
Possible variable names expected by the solver |
||
type(flu_State), | intent(in) | :: | conf |
lua config file |
||
integer, | intent(in), | optional | :: | parent |
optional parent handle |
|
character(len=*), | intent(in), | optional | :: | key |
optional key for the table |
|
type(grw_stringkeyvaluepairarray_type), | intent(inout) | :: | varDict |
The dictionary that contains the mapping between expected variables and the actual variables defined by the user. |
||
type(tem_varSys_type), | intent(inout) | :: | varSys |
Variable system to append anonymous variables to. |
subroutine tem_variable_loadMapping_vector( possVars, conf, parent, key, &
& varDict, varSys )
!---------------------------------------------------------------------------
!> Possible variable names expected by the solver
type(tem_possible_variable_type), intent(in) :: possVars
!> lua config file
type(flu_state), intent(in) :: conf
!> optional parent handle
integer, optional, intent(in) :: parent
!> optional key for the table
character(len=*), optional, intent(in) :: key
!> The dictionary that contains the mapping between expected variables
!! and the actual variables defined by the user.
type(grw_stringKeyValuePairArray_type), intent(inout) :: varDict
!> Variable system to append anonymous variables to.
type(tem_varSys_type), intent(inout) :: varSys
!---------------------------------------------------------------------------
character(len=32) :: localKey
integer :: iVar, srchandle
integer :: ErrorCode(possVars%varname%nVals)
!---------------------------------------------------------------------------
if( present( key )) then
localKey = key
else
localKey = 'source'
endif
write(logUnit(1),*) 'Loading the mappings from table: ' // trim(localkey)
if (possVars%varname%nVals == 0) then
write(logUnit(1),*) 'WARNING: No possible variables are defined!' &
& // ' Definitions from ' // trim(localKey) // ' are not loaded.'
return
end if
! Try to open the mapping table
call aot_table_open( L = conf, &
& parent = parent, &
& thandle = srchandle, &
& key = localkey )
! if mapping table is defined
if (srchandle > 0) then
! loop over all possible variables
do iVar = 1, possVars%varname%nVals
! check if expected variable is defined in lua file
! and if variable exist then store in stringKeyValuePairArray
call tem_variable_loadMapping_single( &
& expectedName = possVars%varName%val(iVar), &
& conf = conf, &
& thandle = srchandle, &
& varDict = varDict, &
& varSys = varSys, &
& nComp = possVars%nComponents%val(iVar), &
& ErrCode = ErrorCode(iVar) )
end do
call aot_table_close( L = conf, thandle = srchandle)
else
write(logUnit(1),*) 'Table ' // trim(localKey) &
& // ' could not be opened for reading variable mappings!'
end if
end subroutine tem_variable_loadMapping_vector