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) |
Routines for random number generation, including routines for spatially correlated random fields.
subroutine random_routines::adjust_nxl4fft | ( | integer, intent(inout) | nxl | ) |
Adjust the size of random field to fulfill requirement of subroutine fft991.
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.
subroutine random_routines::deallocate_randxy_data | ( | type(randxy_data), intent(inout) | randxy | ) |
Subroutine that deallocates any allocated memory in a randxy_data variable.
subroutine random_routines::fax | ( | integer, dimension(10) | IFAX, |
integer | N, | ||
integer | MODE | ||
) |
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
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.
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)
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)
subroutine random_routines::fftrig | ( | real, dimension(*) | TRIGS, |
integer | N, | ||
integer | MODE | ||
) |
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.
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.
[in,out] | randxy | data structure |
[in] | np | n:o spatial points (model units, sub-basins) |
[in] | xp | easting(x) coordinates |
[in] | yp | northing(y) coordinates |
[in] | lscale | correlation length scale |
[in] | gridsize | gridsize for the 2D field where the random numbers are generated |
[in] | index_corr | correlation type: 1 Gaussian, 2 Compact 5th degree polynomial, 3 Power law |
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.
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.
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
real function random_routines::rgauss |
Function for generation pseudo-random number from normal distribution N(0,1).
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).
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,.