load_spatial_random Subroutine

private subroutine load_spatial_random(me, conf, thandle)

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.

Arguments

Type IntentOptional 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


Calls

proc~~load_spatial_random~~CallsGraph proc~load_spatial_random load_spatial_random aot_get_val aot_get_val proc~load_spatial_random->aot_get_val proc~tem_abort tem_abort proc~load_spatial_random->proc~tem_abort mpi_abort mpi_abort proc~tem_abort->mpi_abort

Called by

proc~~load_spatial_random~~CalledByGraph proc~load_spatial_random load_spatial_random proc~load_spatial_predefined load_spatial_predefined proc~load_spatial_predefined->proc~load_spatial_random proc~tem_load_spatial tem_load_spatial proc~tem_load_spatial->proc~load_spatial_predefined proc~load_spacetime_predefined load_spacetime_predefined proc~load_spacetime_predefined->proc~tem_load_spatial proc~tem_load_ic tem_load_ic proc~tem_load_ic->proc~tem_load_spatial proc~tem_load_spacetime_single tem_load_spacetime_single proc~tem_load_spacetime_single->proc~load_spacetime_predefined

Source Code

  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