This subroutine loads the information needed to read data from a file.
Example: Read time periodic velocity signals from file 'data.dat' as inlet condition without interpolation between the velocity signals.
boundary_condition =
{
{ label = 'inlet',
kind = 'inlet_ubb',
velocityX = { kind = 'combined',
temporal = { predefined = 'datafile',
filename = 'data.dat',
intp = 'none',
periodic = true
}
},
velocityY = 0.0
velocityZ = 0.0
}
}
The options for interpolating the values are \li \a 'none': No interpolation is used. The signals will be chosen by: [t1,t2[ = v1, [t2,t3[ = v2, ... \li \a 'linear': A linear interpolation is done between neighboring values according to the following equation: \f[ \frac{v_{i+1}-v_{i}}{t_{i+1}-t_{i}} \cdot (t_{sim} \% t_{period} - t_{i}) + v_{i} \f]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_from_file_temporal_type), | intent(inout) | :: | me |
temporal predefined from_file type |
||
type(flu_State) | :: | conf |
lua state type |
|||
integer, | intent(in) | :: | thandle |
aotus parent handle |
subroutine load_temporal_from_file( me, conf, thandle )
! ---------------------------------------------------------------------------
!> temporal predefined from_file type
type(tem_from_file_temporal_type),intent(inout) :: me
!> lua state type
type(flu_State) :: conf
!> aotus parent handle
integer, intent(in) :: thandle
! ---------------------------------------------------------------------------
! local variables
integer :: iError
! aotus handle for ramping table
integer :: rampHandle
! ---------------------------------------------------------------------------
! read the filename of the datafile
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'filename', &
& val = me%datafile, &
& ErrCode = iError )
if (btest(iError, aoterr_Fatal)) then
write(logUnit(1),*)'FATAL Error occured, while retrieving datafile:'
if (btest(iError, aoterr_NonExistent)) &
& write(logUnit(1),*)'Variable not existent!'
if (btest(iError, aoterr_WrongType)) &
& write(logUnit(1),*)'Variable has wrong type!'
write(logUnit(1),*)'STOPPING'
call tem_abort()
end if
! read the interpolation kind for the data
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'intp', &
& val = me%intp, &
& ErrCode = iError, &
& default = 'none' )
if (btest(iError, aoterr_Fatal)) then
write(logUnit(1),*)'FATAL Error occured, while retrieving interpolation:'
if (btest(iError, aoterr_NonExistent)) &
& write(logUnit(1),*)'Variable not existent!'
if (btest(iError, aoterr_WrongType)) &
& write(logUnit(1),*)'Variable has wrong type!'
write(logUnit(1),*)'STOPPING'
call tem_abort()
end if
! open the ramping table
call aot_table_open( L = conf, &
& thandle = rampHandle, &
& parent = thandle, &
& key = 'ramping')
if (rampHandle /= 0) then
me%ramp = .true.
! read the ramping time
call aot_get_val( L = conf, &
& thandle = rampHandle, &
& key = 'rampVal', &
& val = me%rampVal, &
& ErrCode = iError)
if (btest(iError, aoterr_Fatal)) then
write(logUnit(1),*)'FATAL Error occured, while retrieving ramping '// &
& 'value:'
if (btest(iError, aoterr_NonExistent)) &
& write(logUnit(1),*)'Variable not existent!'
if (btest(iError, aoterr_WrongType)) &
& write(logUnit(1),*)'Variable has wrong type!'
write(logUnit(1),*)'STOPPING'
call tem_abort()
end if
! read the ramping time
call aot_get_val( L = conf, &
& thandle = rampHandle, &
& key = 'rampT', &
& val = me%rampT, &
& ErrCode = iError)
if (btest(iError, aoterr_Fatal)) then
write(logUnit(1),*)'FATAL Error occured, while retrieving ramping time:'
if (btest(iError, aoterr_NonExistent)) &
& write(logUnit(1),*)'Variable not existent!'
if (btest(iError, aoterr_WrongType)) &
& write(logUnit(1),*)'Variable has wrong type!'
write(logUnit(1),*)'STOPPING'
call tem_abort()
end if
end if
! read the factor
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'fac', &
& val = me%fac, &
& ErrCode = iError, &
& default = 1.0_rk )
if (btest(iError, aoterr_Fatal)) then
write(logUnit(1),*)'FATAL Error occured, while retrieving factor: '
if (btest(iError, aoterr_NonExistent)) &
& write(logUnit(1),*)'Variable not existent!'
if (btest(iError, aoterr_WrongType)) &
& write(logUnit(1),*)'Variable has wrong type!'
write(logUnit(1),*)'STOPPING'
call tem_abort()
end if
! read in wether the data should be treated periodic
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'periodic', &
& val = me%periodic, &
& ErrCode = iError, &
& default = .false. )
if (btest(iError, aoterr_Fatal)) then
write(logUnit(1),*)'FATAL Error occured, while retrieving periodic:'
if (btest(iError, aoterr_NonExistent)) &
& write(logUnit(1),*)'Variable not existent!'
if (btest(iError, aoterr_WrongType)) &
& write(logUnit(1),*)'Variable has wrong type!'
write(logUnit(1),*)'STOPPING'
call tem_abort()
end if
write(logUnit(3),*)"Using data from file: "//trim(me%datafile)
write(logUnit(3),*)" interpolation: "//trim(me%intp)
if (rampHandle /= 0) then
write(logUnit(3),*)" ramping time: ",me%rampT
write(logUnit(3),*)" ramping value: ",me%rampVal
end if
write(logUnit(3),*)" periodic: ",me%periodic
! load the data from file
call load_datafile( me )
end subroutine load_temporal_from_file