fft_obj Derived Type

type, public :: fft_obj

A utility to perform Fast Fourier Transforms


Inherits

type~~fft_obj~~InheritsGraph type~fft_obj fft_obj C_PTR C_PTR type~fft_obj->C_PTR p_in, p_out, plan_f, plan_b type~block_obj block_obj type~fft_obj->type~block_obj block type~fftbuf_obj fftbuf_obj type~fft_obj->type~fftbuf_obj buffers type~parallel_obj parallel_obj type~fft_obj->type~parallel_obj parallel type~block_obj->type~parallel_obj parallel MPI_Datatype MPI_Datatype type~block_obj->MPI_Datatype gc_slab_r, gc_slab_i type~axis_obj axis_obj type~block_obj->type~axis_obj axis, axis_partition type~hdf5_obj hdf5_obj type~block_obj->type~hdf5_obj hdf5 type~parallel_obj->MPI_Datatype REAL_SP, REAL_DP, REAL_WP, COMPLEX_SP, COMPLEX_DP, COMPLEX_WP, INTEGER, INT8, LOGICAL type~communicators communicators type~parallel_obj->type~communicators comm type~patch patch type~parallel_obj->type~patch rank MPI_Comm MPI_Comm type~communicators->MPI_Comm w, g type~hdf5_obj->type~parallel_obj parallel type~hashtbl_obj hashtbl_obj type~hdf5_obj->type~hashtbl_obj tbl type~sllist_obj sllist_obj type~hashtbl_obj->type~sllist_obj vec type~sllist_obj->type~sllist_obj child

Components

Type Visibility Attributes Name Initial
integer, public :: Ng(3)

Global number of grid points in each direction

type(block_obj), public, pointer :: block => null()

Associated block structure

type(fftbuf_obj), public :: buffers(3)

Input/Output buffers passed to FFTW

integer, public :: contig_dir = 0

Continguous direction

logical, public :: fft_dir(3) = .false.

Flags for FFT in each direction

integer, public :: l_dims(3)

Size of original array in each direction

integer, public :: l_offsets(3)

Offsets of the local original array in global array

type(C_PTR), public :: p_in(3) = C_NULL_PTR

Pointer to input array

type(C_PTR), public :: p_out(3) = C_NULL_PTR

Pointer to output array

type(parallel_obj), public, pointer :: parallel => null()

Associated parallel structure

type(C_PTR), public :: plan_b(3) = C_NULL_PTR

Pointer to FFTW plan for inverse transform

type(C_PTR), public :: plan_f(3) = C_NULL_PTR

Pointer to FFTW plan for forward transform

integer, private, allocatable :: r_counts(:)

Element count to be received by this MPI rank

integer, private, allocatable :: r_displs(:)

Element displacements received by this MPI rank

integer, private, allocatable :: r_ptr(:)

Pointers in received buffers

integer, private, allocatable :: s_counts(:)

Element count to be sent by this MPI rank

integer, private, allocatable :: s_displs(:)

Element displacements sent by this MPI rank

integer, private, allocatable :: s_ptr(:)

Pointers in sent buffers


Type-Bound Procedures

procedure, public :: Finalize => fft_obj_Final

  • private impure subroutine fft_obj_Final(this)

    Finalizes object and frees memory.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

procedure, public :: GetOriginalLayout => fft_obj_GetOriginalLayout

  • private impure subroutine fft_obj_GetOriginalLayout(this)

    Determines data layout of original array.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

procedure, public :: GetRankFromLayout => fft_obj_GetRankFromLayout

  • private impure function fft_obj_GetRankFromLayout(this, idx, Ng) result(rank)

    Returns the rank owning a given grid index

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    integer, intent(in) :: idx(3)

    Grid index

    integer, intent(in) :: Ng(3)

    Global grid points in each direction

    Return Value integer

    Rank owning this index

procedure, public :: GetTransposeLayout => fft_obj_GetTransposeLayout

  • private impure subroutine fft_obj_GetTransposeLayout(this, swap_1, swap_2, Ng, Ng_T, l_dims_T, l_offsets_T)

    Returns the new layout and decomposition resulting from swapping two directions.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    integer, intent(in) :: swap_1

    Direction to swap

    integer, intent(in) :: swap_2

    Direction to swap

    integer, intent(in) :: Ng(3)

    Global number of grid points in each direction in the original layout

    integer, intent(out) :: Ng_T(3)

    Global number of grid points in each direction in the transposed layout

    integer, intent(out) :: l_dims_T(3)

    Size of each subblock in the transposed layout

    integer, intent(out) :: l_offsets_T(3)

    Offsets of each subblock in the transposed layout

procedure, public :: Initialize => fft_obj_Init

  • private impure subroutine fft_obj_Init(this, block, parallel)

    Initializes the FFT object.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    type(block_obj), intent(in), target :: block

    A block object

    type(parallel_obj), intent(in), target :: parallel

    Parallel structure to link with

procedure, public :: Inverse => fft_obj_Inverse

  • private impure subroutine fft_obj_Inverse(this, field)

    Computes the Inverse of a Fourier Transform and stores it back in the input field. The FFT must be given in the halfcomplex format.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    type(eulerian_obj_r), intent(inout) :: field

    Field containing FFT coefficient in halfcomplex format

procedure, public :: SetContigDirection => fft_obj_SetContigDirection

  • private impure subroutine fft_obj_SetContigDirection(this)

    Ensures that there is at least one contiguous direction and selects the one with largest number of grid points since that direction will be decomposed by the transpose.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

procedure, public :: SetFFTDirections => fft_obj_SetFFTDirections

  • private impure subroutine fft_obj_SetFFTDirections(this, dir_flag)

    Sets the FFT directions.

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    logical, intent(in) :: dir_flag(3)

    FFT directions

procedure, public :: Transform => fft_obj_Transform

  • private impure subroutine fft_obj_Transform(this, field)

    Computes the Fourier Transform of field and stores it back in the input field in the "halfcomplex" (r2r) format. E.g. if the FFT is to be carried out in the 1-dir, then field%cell(:,j,k) contains the fourier transform in the 1-dir stored as follows r_0, r_1, ..., r_(Ng(1)1/2), i_(Ng(1)+1/2-1),..., i_1 r_m is the real part of mode m2pi/L(1) and i_m is the imaginary part of mode m2pi/L(1) for points at location y(j) (or ym(j), depending on the field staggering), z(k) (or zm(k)).

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    type(eulerian_obj_r), intent(inout) :: field

    Input field

procedure, public :: Transpose => fft_obj_Transpose

  • private impure subroutine fft_obj_Transpose(this, swap_1, swap_2, A, Ng, l_dims, l_offsets, A_T, Ng_T, l_dims_T, l_offsets_T)

    Builds the transposed array A_T by swapping directions (swap_1) and (swap_2) of input array A. Note that the MPI decomposition remains unchanged. E.g.: 1) dir1=1 and dir2=2: field_T%cell(i,j,k) = field%cell(j,i,k) 2) dir1=3 and dir2=2: field_T%cell(i,j,k) = field%cell(i,k,j)

    Arguments

    Type IntentOptional Attributes Name
    class(fft_obj), intent(inout) :: this

    A FFT object

    integer, intent(in) :: swap_1

    Direction to swap

    integer, intent(in) :: swap_2

    Direction to swap

    real(kind=wp), intent(in) :: A(:,:,:)

    Input array to transpose

    integer, intent(in) :: Ng(3)

    Global nbr of grid points in the original layout

    integer, intent(in) :: l_dims(3)

    Size of each subblock in the original layout

    integer, intent(in) :: l_offsets(3)

    Offsets of each subblock in the original layout

    real(kind=wp), intent(out), allocatable :: A_T(:,:,:)

    Transposed array

    integer, intent(out) :: Ng_T(3)

    Global nbr of grid points in the transposed layout

    integer, intent(out) :: l_dims_T(3)

    Size of each subblock in the transposed layout

    integer, intent(out) :: l_offsets_T(3)

    Offsets of each subblock in the transposed layout