HYPE
Loading...
Searching...
No Matches
random_routines Module Reference

Data Types

type  randxy_data

Functions/Subroutines

real function rgauss ()
subroutine resample_randxy_data (randxy)
subroutine init_randxy_data (randxy, np, xp, yp, lscale, gridsize, index_corr)
subroutine deallocate_randxy_data (randxy)
subroutine adjust_nxl4fft (nxl)
subroutine random_field (nxl, nyl, kmax, lmax, spec_dens_2d, pert_field, ifaxx, ifaxy, trigsx, trigsy)
subroutine corr_to_spec (index_corr, lscale, nxl, nyl, gridsize, kmax, lmax, corr, spec_dens_2d, ifaxx, ifaxy, trigsx, trigsy)
subroutine gen_corr (index_corr, gridsize, lscale, nxl, nyl, corr)
subroutine interpol_grid2point (np, xp, yp, zp, nx, ny, x, y, z)
subroutine fft2d (inv, nxl, nyl, a, kmax, lmax, ahat, ifaxx, ifaxy, trigsx, trigsy)
subroutine fft99a (a, work, trigs, inc, jump, n, lot)
subroutine fft99b (work, a, trigs, inc, jump, n, lot)
subroutine fft991 (a, work, trigs, ifax, inc, jump, n, lot, isign)
subroutine set99 (trigs, ifax, n)
subroutine fax (ifax, n, mode)
subroutine fftrig (trigs, n, mode)
subroutine vpassm (a, b, c, d, trigs, inc1, inc2, inc3, inc4, lot, n, ifac, la)

Detailed Description

Routines for random number generation, including routines for spatially correlated random fields.

Function/Subroutine Documentation

◆ adjust_nxl4fft()

subroutine random_routines::adjust_nxl4fft ( integer, intent(inout) nxl)

Adjust the size of random field to fulfill requirement of subroutine fft991.

Here is the caller graph for this function:

◆ corr_to_spec()

subroutine random_routines::corr_to_spec ( integer index_corr,
real lscale,
integer nxl,
integer nyl,
real gridsize,
integer kmax,
integer lmax,
real, dimension(nxl,nyl) corr,
real, dimension(0:kmax,-lmax:lmax) spec_dens_2d,
integer, dimension(13) ifaxx,
integer, dimension(13) ifaxy,
real, dimension(3*nxl/2+1) trigsx,
real, dimension(3*nyl/2+1) trigsy )

Generate correlation in physical space and transform to spectral density in spectral space.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocate_randxy_data()

subroutine random_routines::deallocate_randxy_data ( type(randxy_data), intent(inout) randxy)

Subroutine that deallocates any allocated memory in a randxy_data variable.

◆ fax()

subroutine random_routines::fax ( integer, dimension(10) ifax,
integer n,
integer mode )
Here is the caller graph for this function:

◆ fft2d()

subroutine random_routines::fft2d ( logical inv,
integer nxl,
integer nyl,
real, dimension(nxl,nyl) a,
integer kmax,
integer lmax,
complex, dimension(0:kmax,-lmax:lmax) ahat,
integer, dimension(13) ifaxx,
integer, dimension(13) ifaxy,
real, dimension(3*nxl/2+1) trigsx,
real, dimension(3*nyl/2+1) trigsy )

2D Fourier transform to spectal space

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft991()

subroutine random_routines::fft991 ( real, dimension(*) a,
real, dimension(*) work,
real, dimension(*) trigs,
integer, dimension(13) ifax,
integer inc,
integer jump,
integer n,
integer lot,
integer isign )

Multiple real/half-complex periodic Fast Fourier Transform.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft99a()

subroutine random_routines::fft99a ( real, dimension(*) a,
real, dimension(*) work,
real, dimension(*) trigs,
integer inc,
integer jump,
integer n,
integer lot )

Preprocessing for fft99 routine (spectral to grid point transform).

Here is the caller graph for this function:

◆ fft99b()

subroutine random_routines::fft99b ( real, dimension(*) work,
real, dimension(*) a,
real, dimension(*) trigs,
integer inc,
integer jump,
integer n,
integer lot )

Postprocessing for fft99 routine (grid point to spectral transform).

Here is the caller graph for this function:

◆ fftrig()

subroutine random_routines::fftrig ( real, dimension(*) trigs,
integer n,
integer mode )
Here is the caller graph for this function:

◆ gen_corr()

subroutine random_routines::gen_corr ( integer index_corr,
real gridsize,
real lscale,
integer nxl,
integer nyl,
real, dimension(nxl,nyl) corr )

Generate correlation function in physical space.

Here is the caller graph for this function:

◆ init_randxy_data()

subroutine random_routines::init_randxy_data ( type(randxy_data), intent(inout) randxy,
integer, intent(in) np,
real, dimension(np), intent(in) xp,
real, dimension(np), intent(in) yp,
real, intent(in) lscale,
real, intent(in) gridsize,
integer, intent(in) index_corr )

Initialisation of data used for generation of spatially correlated random numbers with the subroutine resample_randxy_data.

Parameters
[in,out]randxydata structure
[in]npn:o spatial points (model units, sub-basins)
[in]xpeasting(x) coordinates
[in]ypnorthing(y) coordinates
[in]lscalecorrelation length scale
[in]gridsizegridsize for the 2D field where the random numbers are generated
[in]index_corrcorrelation type: 1 Gaussian, 2 Compact 5th degree polynomial, 3 Power law
Here is the call graph for this function:
Here is the caller graph for this function:

◆ interpol_grid2point()

subroutine random_routines::interpol_grid2point ( integer, intent(in) np,
real, dimension(np), intent(in) xp,
real, dimension(np), intent(in) yp,
real, dimension(np), intent(out) zp,
integer, intent(in) nx,
integer, intent(in) ny,
real, dimension(nx), intent(in) x,
real, dimension(ny), intent(in) y,
real, dimension(nx,ny), intent(in) z )

Interpolation from regular grid Z(X,Y) to points zp(xp,yp) using bilinear interpolation.

Here is the caller graph for this function:

◆ random_field()

subroutine random_routines::random_field ( integer nxl,
integer nyl,
integer kmax,
integer lmax,
real, dimension(0:kmax,-lmax:lmax) spec_dens_2d,
real, dimension(nxl,nyl) pert_field,
integer, dimension(13) ifaxx,
integer, dimension(13) ifaxy,
real, dimension(3*nxl/2+1) trigsx,
real, dimension(3*nyl/2+1) trigsy )

Generates a sample of a 2D spatially correlated random field with mean 0 and stdev 1.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resample_randxy_data()

subroutine random_routines::resample_randxy_data ( type(randxy_data), intent(inout) randxy)

Subroutine for creating pseudo-random number (gaussian) with spatial correlation for point coordinates (x,y).

Algorithm

Generate a new 2D random field

Interpolate to the requested x,y coordinates

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rgauss()

real function random_routines::rgauss

Function for generation pseudo-random number from normal distribution N(0,1).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set99()

subroutine random_routines::set99 ( real, dimension(*) trigs,
integer, dimension(13) ifax,
integer n )

An initialisation routine that must be called once before a sequence of calls to the FFT routines (provided that N is not changed).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vpassm()

subroutine random_routines::vpassm ( real, dimension(*) a,
real, dimension(*) b,
real, dimension(*) c,
real, dimension(*) d,
real, dimension(*) trigs,
integer inc1,
integer inc2,
integer inc3,
integer inc4,
integer lot,
integer n,
integer ifac,
integer la )

Performs one pass through data as part of the multiple complex FFT routine,.

Here is the caller graph for this function: