poisson_fft_t Derived Type

type, public, abstract :: poisson_fft_t

FFT based Poisson solver Each backend extends this type once per boundary condition case (000, 010, 100, and 11x for both 110 and 111), and each case type supplies its own transforms, spectral postprocess and periodicity reorder.


Inherits

type~~poisson_fft_t~~InheritsGraph type~poisson_fft_t poisson_fft_t type~mesh_t mesh_t type~poisson_fft_t->type~mesh_t mesh type~geo_t geo_t type~mesh_t->type~geo_t geo type~grid_t grid_t type~mesh_t->type~grid_t grid type~par_t par_t type~mesh_t->type~par_t par

Inherited by

type~~poisson_fft_t~~InheritedByGraph type~poisson_fft_t poisson_fft_t type~base_backend_t base_backend_t type~base_backend_t->type~poisson_fft_t poisson_fft type~cuda_poisson_fft_t cuda_poisson_fft_t type~cuda_poisson_fft_t->type~poisson_fft_t type~omp_poisson_fft_t omp_poisson_fft_t type~omp_poisson_fft_t->type~poisson_fft_t type~abl_diagnostics_t abl_diagnostics_t type~abl_diagnostics_t->type~base_backend_t backend type~abl_t abl_t type~abl_t->type~base_backend_t backend type~adm_t adm_t type~adm_t->type~base_backend_t backend type~alm_t alm_t type~alm_t->type~base_backend_t backend type~backend_setup_t backend_setup_t type~backend_setup_t->type~base_backend_t backend type~cuda_backend_t cuda_backend_t type~backend_setup_t->type~cuda_backend_t cuda_backend type~omp_backend_t omp_backend_t type~backend_setup_t->type~omp_backend_t omp_backend type~omptgt_backend_t omptgt_backend_t type~backend_setup_t->type~omptgt_backend_t omptgt_backend type~cuda_backend_t->type~base_backend_t type~cuda_poisson_000_t cuda_poisson_000_t type~cuda_poisson_000_t->type~cuda_poisson_fft_t type~cuda_poisson_010_t cuda_poisson_010_t type~cuda_poisson_010_t->type~cuda_poisson_fft_t type~cuda_poisson_100_t cuda_poisson_100_t type~cuda_poisson_100_t->type~cuda_poisson_fft_t type~cuda_poisson_11x_t cuda_poisson_11x_t type~cuda_poisson_11x_t->type~cuda_poisson_fft_t type~ibm_t ibm_t type~ibm_t->type~base_backend_t backend type~inflow_plane_writer_t inflow_plane_writer_t type~inflow_plane_writer_t->type~base_backend_t backend type~omp_backend_t->type~base_backend_t type~omp_poisson_000_t omp_poisson_000_t type~omp_poisson_000_t->type~omp_poisson_fft_t type~omp_poisson_010_t omp_poisson_010_t type~omp_poisson_010_t->type~omp_poisson_fft_t type~omp_poisson_100_t omp_poisson_100_t type~omp_poisson_100_t->type~omp_poisson_fft_t type~omp_poisson_11x_t omp_poisson_11x_t type~omp_poisson_11x_t->type~omp_poisson_fft_t type~omptgt_backend_t->type~base_backend_t type~solver_t solver_t type~solver_t->type~base_backend_t backend type~solver_t->type~ibm_t ibm type~time_intg_t time_intg_t type~solver_t->type~time_intg_t time_integrator type~vector_calculus_t vector_calculus_t type~solver_t->type~vector_calculus_t vector_calculus type~time_intg_t->type~base_backend_t backend type~vector_calculus_t->type~base_backend_t backend type~base_case_t base_case_t type~base_case_t->type~solver_t solver type~case_abl_t case_abl_t type~case_abl_t->type~abl_diagnostics_t diagnostics type~case_abl_t->type~abl_t abl type~case_abl_t->type~inflow_plane_writer_t inflow_writer type~case_abl_t->type~base_case_t type~case_channel_t case_channel_t type~case_channel_t->type~base_case_t type~case_cylinder_t case_cylinder_t type~case_cylinder_t->type~base_case_t type~case_generic_t case_generic_t type~case_generic_t->type~base_case_t type~case_tgv_t case_tgv_t type~case_tgv_t->type~base_case_t type~case_wind_turbine_t case_wind_turbine_t type~case_wind_turbine_t->type~base_case_t

Components

Type Visibility Attributes Name Initial
type(mesh_t), public, pointer :: mesh => null()
integer, public :: nx_glob

Global dimensions

integer, public :: ny_glob

Global dimensions

integer, public :: nz_glob

Global dimensions

integer, public :: nx_loc

Local dimensions

integer, public :: ny_loc

Local dimensions

integer, public :: nz_loc

Local dimensions

integer, public :: nx_perm

Local dimensions in the permuted slabs

integer, public :: ny_perm

Local dimensions in the permuted slabs

integer, public :: nz_perm

Local dimensions in the permuted slabs

integer, public :: nx_spec

Local dimensions in the permuted slabs in spectral space

integer, public :: ny_spec

Local dimensions in the permuted slabs in spectral space

integer, public :: nz_spec

Local dimensions in the permuted slabs in spectral space

integer, public :: sp_st(3)

Offset per spectral dimension (dim1, dim2, dim3) in spectral space

complex(kind=dp), public, allocatable, dimension(:, :, :) :: waves

Local domain sized array storing the spectral equivalence constants

real(kind=dp), public, allocatable, dimension(:) :: ax

Wave numbers in x, y, and z

real(kind=dp), public, allocatable, dimension(:) :: bx

Wave numbers in x, y, and z

real(kind=dp), public, allocatable, dimension(:) :: ay

Wave numbers in x, y, and z

real(kind=dp), public, allocatable, dimension(:) :: by

Wave numbers in x, y, and z

real(kind=dp), public, allocatable, dimension(:) :: az

Wave numbers in x, y, and z

real(kind=dp), public, allocatable, dimension(:) :: bz

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: kx

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: ky

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: kz

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: exs

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: eys

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: ezs

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: k2x

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: k2y

Wave numbers in x, y, and z

complex(kind=dp), public, allocatable, dimension(:) :: k2z

Wave numbers in x, y, and z

real(kind=dp), public, allocatable, dimension(:) :: trans_x_re

Staggered grid transformation

real(kind=dp), public, allocatable, dimension(:) :: trans_x_im

Staggered grid transformation

real(kind=dp), public, allocatable, dimension(:) :: trans_y_re

Staggered grid transformation

real(kind=dp), public, allocatable, dimension(:) :: trans_y_im

Staggered grid transformation

real(kind=dp), public, allocatable, dimension(:) :: trans_z_re

Staggered grid transformation

real(kind=dp), public, allocatable, dimension(:) :: trans_z_im

Staggered grid transformation

logical, public :: periodic_x

Periodicity in x, y, and z

logical, public :: periodic_y

Periodicity in x, y, and z

logical, public :: periodic_z

Periodicity in x, y, and z

logical, public :: stretched_y = .false.

Periodicity in x, y, and z

logical, public :: stretched_y_sym

Periodicity in x, y, and z

character(len=3), public :: bc_code

Boundary condition case, see poisson_bc_code. The backend's init sets it first, ahead of base_init.

real(kind=dp), public, allocatable, dimension(:, :, :, :) :: a_odd_re

Stretching operator matrices

real(kind=dp), public, allocatable, dimension(:, :, :, :) :: a_odd_im

Stretching operator matrices

real(kind=dp), public, allocatable, dimension(:, :, :, :) :: a_even_re

Stretching operator matrices

real(kind=dp), public, allocatable, dimension(:, :, :, :) :: a_even_im

Stretching operator matrices

real(kind=dp), public, allocatable, dimension(:, :, :, :) :: a_re

Stretching operator matrices

real(kind=dp), public, allocatable, dimension(:, :, :, :) :: a_im

Stretching operator matrices

logical, public :: lowmem = .false.

lowmem option, only used in CUDA backend


Type-Bound Procedures

procedure(fft_forward), public, deferred :: fft_forward

  • subroutine fft_forward(self, f_in) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    class(field_t), intent(in) :: f_in

procedure(fft_backward), public, deferred :: fft_backward

  • subroutine fft_backward(self, f_out) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    class(field_t), intent(inout) :: f_out

procedure(fft_postprocess), public, deferred :: fft_postprocess

  • subroutine fft_postprocess(self) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self

procedure, public :: enforce_periodicity

  • public subroutine enforce_periodicity(self, f_out, f_in)

    Reorder hook of solve_poisson, overridden by every case that has a non-periodic direction.

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    class(field_t), intent(inout) :: f_out
    class(field_t), intent(in) :: f_in

procedure, public :: undo_periodicity

  • public subroutine undo_periodicity(self, f_out, f_in)

    Inverse of enforce_periodicity.

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    class(field_t), intent(inout) :: f_out
    class(field_t), intent(in) :: f_in

procedure, public :: base_init

  • public subroutine base_init(self, mesh, xdirps, ydirps, zdirps, n_spec, n_sp_st, n_blk, blk_st)

    Sets up the state every case shares. The backend's init calls it once it has set bc_code, which the spectral extents it passes in already depend on. The supported BC codes are the cases of the backend factories, create_omp_poisson_fft and create_cuda_poisson_fft. n_blk and blk_st are passed on to stretching_matrix.

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    type(mesh_t), intent(in), target :: mesh
    type(dirps_t), intent(in) :: xdirps
    type(dirps_t), intent(in) :: ydirps
    type(dirps_t), intent(in) :: zdirps
    integer, intent(in), dimension(3) :: n_spec
    integer, intent(in), dimension(3) :: n_sp_st
    integer, intent(in), optional, dimension(3) :: n_blk

    Size and offset of the block the stretching matrices cover

    integer, intent(in), optional, dimension(3) :: blk_st

    Size and offset of the block the stretching matrices cover

procedure, public :: solve_poisson

  • public subroutine solve_poisson(self, f, temp)

    Gathers each non-periodic line into a periodic one, so that a plain FFT can stand in for the cosine transform, solves in spectral space, and scatters the result back. The 000 case has nothing to reorder and overrides this to transform f in place.

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    class(field_t), intent(inout) :: f
    class(field_t), intent(inout) :: temp

procedure, public :: stretching_matrix

  • public subroutine stretching_matrix(self, geo, xdirps, ydirps, zdirps, n_blk, blk_st)

    Stretching necessitates a special operation in spectral space. The coefficients for the operation are stored in matrix form. The matrices and trans_ cover the spectral block of size n_blk at offset blk_st, the local spectral pencil by default. trans_ hold the modes of the block and take the local index.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    type(geo_t), intent(in) :: geo
    type(dirps_t), intent(in) :: xdirps
    type(dirps_t), intent(in) :: ydirps
    type(dirps_t), intent(in) :: zdirps
    integer, intent(in), optional, dimension(3) :: n_blk
    integer, intent(in), optional, dimension(3) :: blk_st

procedure, public :: fill_stretching_sym

  • public subroutine fill_stretching_sym(self, geo, a_odd_re, a_odd_im, a_even_re, a_even_im, n, st)

    Fill the odd and even matrices of the symmetric (centred and top-bottom) stretching on the spectral block of size n at offset st. The arrays have the shape (n(1), n(2)/2, n(3), 5). The routine zeroes them first. The trans_* arrays must already hold the modes of the block. The arrays must not belong to self.

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t), intent(in) :: self
    type(geo_t), intent(in) :: geo
    real(kind=dp), intent(out), dimension(:, :, :, :) :: a_odd_re
    real(kind=dp), intent(out), dimension(:, :, :, :) :: a_odd_im
    real(kind=dp), intent(out), dimension(:, :, :, :) :: a_even_re
    real(kind=dp), intent(out), dimension(:, :, :, :) :: a_even_im
    integer, intent(in) :: n(3)
    integer, intent(in) :: st(3)

procedure, public :: waves_set

  • public subroutine waves_set(self, geo, xdirps, ydirps, zdirps)

    Spectral equivalence constants: the modified wavenumber of the discrete div(grad) on each spectral entry, k2x(tytz)2 + k2y(txtz)2 + k2z(txty)**2, where t is the transfer function of the staggered interpolation. The expression is symmetric in the three directions, so it is built from the 1D factors of each spectral dimension (spectral_line), whatever direction spectral_dirs puts there.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    type(geo_t), intent(in) :: geo
    type(dirps_t), intent(in) :: xdirps
    type(dirps_t), intent(in) :: ydirps
    type(dirps_t), intent(in) :: zdirps

procedure, public :: get_km

  • public function get_km(self, i, j, k) result(km)

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    integer, intent(in) :: i
    integer, intent(in) :: j
    integer, intent(in) :: k

    Return Value complex(kind=dp)

procedure, public :: get_km_re

  • public function get_km_re(self, i, j, k) result(re)

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    integer, intent(in) :: i
    integer, intent(in) :: j
    integer, intent(in) :: k

    Return Value real(kind=dp)

procedure, public :: get_km_im

  • public function get_km_im(self, i, j, k) result(re)

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self
    integer, intent(in) :: i
    integer, intent(in) :: j
    integer, intent(in) :: k

    Return Value real(kind=dp)