TreeMig Code
Loading...
Searching...
No Matches
GFTConvolution2D.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine gft2dconvolution (isp, ny, mx, niy, mjx, spatdatain, kerneltransf, spatdataout)
 
subroutine gft2dtransformkernel (ny, mx, niy, mjx, y_dim_kernel, x_dim_kernel, kernelin, kerneltransf)
 GFT2DTransformKernel

 
subroutine setdimsforfft (ispec)
 SetDimsForFFT

 
subroutine lowpassfilter (dimy_start, dimy_end, dimx_start, dimx_end, filterexpo, filter)
 LowPassFilter

 

Function/Subroutine Documentation

◆ gft2dconvolution()

subroutine gft2dconvolution ( integer, intent(in) isp,
integer, intent(in) ny,
integer, intent(in) mx,
integer, intent(in) niy,
integer, intent(in) mjx,
real(kind=gft_prec), dimension(0:ny-1,mx), intent(in) spatdatain,
complex(kind=gft_prec), dimension(0:niy/2,mjx), intent(in) kerneltransf,
real(kind=gft_prec), dimension(0:ny-1,mx), intent(out) spatdataout )

GFT2DConvolution
Convolution by Fast Fourier Transform (FFT) of seed dispersal kernel and seed production area


done in several steps:

  1. The seed production intermediate area is stored to the 0,0 corner of the large area for zero-padding !>
  2. A forward 2D FFT (REAL to complex) is done with the seed production on the large area
  3. The fourier transformed seed production is multiplied with the fourier transformed dispersal kernel, Convolution
  4. the product is back-fourier-transformed (complex to REAL)
  5. The resulting REAL area is cleaned from noise (negative or very low positive values) ยจ
  6. and stored to the intermediate area (adapted from example program rcr.f90)

USE GFT

  • IN:
    • Parameters
      nymaxlatEvenext, y-dimension of intermediate area, a bit more than maxlat
      mxmaxlonEvenext, x-dimension of intermediate area, a bit more than maxlon
      niymaxlatExt, y-dimension of large area
      mjxmaxlonExt, x-dimension of large area
      kernelTransftransformed kernel
    • FROM GFT
      • GFT_Prec : INTEGER : precision of the GFT calculations
      • GFT_RCR : TYPE : derived TYPE for 1D, 2D and 3D Real-Complex and Complex-Real FFT
      • GFT_set_fft : INTERFACE : contains settings for all kind of FFTs
      • GFT_do_fft : INTERFACE : contains subroutines for performing all kind of FFTs
      • GFT_end_fft : INTERFACE : contains subroutines for ending all kind of FFTs
  • OUT:
    • spatDataOut: the seed rain on the intermediate area
  • CALLED FROM:
  • CALLS:
    • GFT_set_fft.f90, GFT_do_fft.f90, GFT_end_fft.f90 from modules starting with "GFT" for the FFTs
    • PrintMatrixASXY2File (in GFT_Interact.f90)

Definition at line 37 of file GFTConvolution2D.f90.

◆ gft2dtransformkernel()

subroutine gft2dtransformkernel ( integer, intent(in) ny,
integer, intent(in) mx,
integer, intent(in) niy,
integer, intent(in) mjx,
integer, intent(in) y_dim_kernel,
integer, intent(in) x_dim_kernel,
real (kind=gft_prec), dimension(0:(y_dim_kernel-1),x_dim_kernel ), intent(in) kernelin,
complex(kind=gft_prec), dimension(0:(niy/2),mjx), intent(out) kerneltransf )

GFT2DTransformKernel


Fast Fourier transforms the seed dispersal kernel to the frequency domain !> done in several steps: #- the kernel is stored to the center of the intermediate area #- it is mirrored to the corners of this intermediate area #- the intermediate area with the mirrored kernel is stored to the 0,0, corner of the large are #- the fft transformation is done

  • USE: GFT
  • IN:
    • Parameters
      nymaxlatEvenext, y-dimension of intermediate area, a bit more than maxlat
      mxmaxlonEvenext, x-dimension of intermediate area, a bit more than maxlon
      niymaxlatExt, y-dimension of large area
      mjxmaxlonExt, x-dimension of large area
      y_dim_kernelrad* 2 +2.; y-dimension of kernel
      x_dim_kernelrad* 2 +2.; x-dimension of kernel (normally the same as y_dim_kernel
      kernelInthis is the kernel
    • FROM GFT
      • GFT_Prec : INTEGER : precision of the GFT calculations
      • GFT_RCR : TYPE : derived TYPE for 1D, 2D and 3D Real-Complex and Complex-Real FFT
      • GFT_set_fft : INTERFACE : contains settings for all kind of FFTs
      • GFT_do_fft : INTERFACE : contains subroutines for performing all kind of FFTs
      • GFT_end_fft : INTERFACE : contains subroutines for ending all kind of FFTs
  • OUT:
    • Parameters
      kernelTransfthe Fourier Transform of the kernel on the large area (complex)
  • CALLED FROM:
  • CALLS:

Definition at line 166 of file GFTConvolution2D.f90.

◆ lowpassfilter()

subroutine lowpassfilter ( integer, intent(in) dimy_start,
integer, intent(in) dimy_end,
integer, intent(in) dimx_start,
integer, intent(in) dimx_end,
real, intent(in) filterexpo,
complex(kind=gft_prec), dimension(dimy_start:dimy_end,dimx_start:dimx_end), intent(out) filter )

LowPassFilter


Attempt for filtering the noise out in frequency domain. Not used currently.
Here a distance weighted low pass filter, i.e. decreasing with distance from (0,1) cell. dimy-start is normally 0, dimx_start is normally 1

  • USE: GFT
  • IN:
    • Parameters
      dimy_start,dimy_end,dimx_start,dimx_end: INTEGER, dimension bounds of the areas in frequency domain
      filterexpo:factordetermining the slope of decrease with distance
    • FROM GFT
      • GFT_Prec : INTEGER : precision of the GFT calculations
  • OUT:
    • Parameters
      filter,thefilter to be multiplied to the signal, i.e. the transformed kernel, the transformed seed production
  • CALLED FROM:

Definition at line 283 of file GFTConvolution2D.f90.

◆ setdimsforfft()

subroutine setdimsforfft ( integer, intent(in) ispec)

SetDimsForFFT


Sets the dimenstions of the Fast Fourier Transformations, for the next even (intermediate) area and for the large extended area

  • USE: All_par
  • IN:
    • Parameters
      ispec: species identifier
    • FROM All_par
      • maxlat, maxlon: INTEGER: y-dimension and x-dimension of simulation area
  • OUT: :
    • via All_par
      • spec(maxspc) : TYPE(SpecProperties) : species properties, here the area dimensions for fft:
        • maxlatExt, maxlonExt: INTEGER, dimensions of large extended area
        • maxlatEvenExt, maxlonEvenExt: INTEGER, dimensions of intermediate area (here set to maxlatEven and maxlonEven)
  • CALLED FROM:

Definition at line 236 of file GFTConvolution2D.f90.