Reading the definition for a random distribution function.
This spatial function will return random numbers within a given interval. The interval has to be specified by 'min' and 'max' in the Lua configuration. Resulting values will be given by: min + (max-min)*random_number The range defaults to min=0.0 - max=1.0.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(spatial_random_type), | intent(out) | :: | me |
random spatial specification |
||
type(flu_State) | :: | conf |
lua state type |
|||
integer, | intent(in) | :: | thandle |
aotus parent handle |
subroutine load_spatial_random( me, conf, thandle )
! -------------------------------------------------------------------- !
!> random spatial specification
type(spatial_random_type),intent(out) :: me
!> lua state type
type(flu_State) :: conf
!> aotus parent handle
integer, intent(in) :: thandle
! -------------------------------------------------------------------- !
integer :: iError
! -------------------------------------------------------------------- !
! val_min
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'min', &
& val = me%val_min, &
& ErrCode = iError, &
& default = 0.0_rk )
if ( btest( iError, aoterr_Fatal ) ) then
write(logUnit(1),*) 'FATAL Error occured in definition of the spatial' &
& // ' function'
write(logUnit(1),*) 'while retrieving the min for random numbers!'
call tem_abort()
end if
if( btest( iError, aoterr_NonExistent ))then
write(logUnit(1),*) ' WARNING: min is non-existent.' &
& // ' Using default value 0.0.'
end if
write(logUnit(1),*) ' * val_min =', me%val_min
! val_max
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'max', &
& val = me%val_max, &
& ErrCode = iError, &
& default = 1.0_rk )
if( btest( iError, aoterr_Fatal ))then
write(logUnit(1),*) 'FATAL Error occured in definition of the spatial' &
& // ' function'
write(logUnit(1),*) 'while retrieving the max for random numbers!'
call tem_abort()
end if
if( btest( iError, aoterr_NonExistent ))then
write(logUnit(1),*) ' WARNING: max is non-existent.' &
& // ' Using default value 1.0.'
end if
write(logUnit(1),*) ' * val_max =', me%val_max
me%val_range = me%val_max - me%val_min
end subroutine load_spatial_random