m_poisson_fft Module


Uses

  • module~~m_poisson_fft~~UsesGraph module~m_poisson_fft m_poisson_fft module~m_common m_common module~m_poisson_fft->module~m_common module~m_field m_field module~m_poisson_fft->module~m_field module~m_logger m_logger module~m_poisson_fft->module~m_logger module~m_mesh m_mesh module~m_poisson_fft->module~m_mesh module~m_tdsops m_tdsops module~m_poisson_fft->module~m_tdsops module~m_common->module~m_logger m_mpi m_mpi module~m_common->m_mpi module~m_field->module~m_common iso_c_binding iso_c_binding module~m_field->iso_c_binding iso_fortran_env iso_fortran_env module~m_logger->iso_fortran_env module~m_logger->m_mpi module~m_mesh->module~m_common module~m_mesh->module~m_field module~m_mesh->module~m_logger module~m_mesh->m_mpi module~m_mesh_content m_mesh_content module~m_mesh->module~m_mesh_content module~m_tdsops->module~m_common module~m_tdsops->module~m_logger module~m_mesh_content->module~m_common module~m_mesh_content->module~m_logger

Used by

  • module~~m_poisson_fft~~UsedByGraph module~m_poisson_fft m_poisson_fft module~m_base_backend m_base_backend module~m_base_backend->module~m_poisson_fft module~m_cuda_poisson_fft m_cuda_poisson_fft module~m_cuda_poisson_fft->module~m_poisson_fft module~m_omp_poisson_fft m_omp_poisson_fft module~m_omp_poisson_fft->module~m_poisson_fft module~m_abl m_abl module~m_abl->module~m_base_backend module~m_les m_les module~m_abl->module~m_les module~m_abl_diagnostics m_abl_diagnostics module~m_abl_diagnostics->module~m_base_backend module~m_abl_diagnostics->module~m_les module~m_adm m_adm module~m_adm->module~m_base_backend module~m_io_session m_io_session module~m_adm->module~m_io_session module~m_turbine_model m_turbine_model module~m_adm->module~m_turbine_model module~m_alm m_alm module~m_alm->module~m_base_backend module~m_alm->module~m_io_session module~m_alm->module~m_turbine_model module~m_backend_setup m_backend_setup module~m_backend_setup->module~m_base_backend module~m_cuda_backend m_cuda_backend module~m_backend_setup->module~m_cuda_backend module~m_omp_backend m_omp_backend module~m_backend_setup->module~m_omp_backend module~m_omptgt_backend m_omptgt_backend module~m_backend_setup->module~m_omptgt_backend module~m_base_case m_base_case module~m_base_case->module~m_base_backend module~m_solver m_solver module~m_base_case->module~m_solver module~m_io_manager m_io_manager module~m_base_case->module~m_io_manager module~m_monitoring m_monitoring module~m_base_case->module~m_monitoring module~m_postprocess m_postprocess module~m_base_case->module~m_postprocess module~m_case_abl m_case_abl module~m_case_abl->module~m_base_backend module~m_case_abl->module~m_abl module~m_case_abl->module~m_abl_diagnostics module~m_case_abl->module~m_base_case module~m_inflow_planes m_inflow_planes module~m_case_abl->module~m_inflow_planes module~m_case_abl->module~m_turbine_model module~m_turbine_setup m_turbine_setup module~m_case_abl->module~m_turbine_setup module~m_case_channel m_case_channel module~m_case_channel->module~m_base_backend module~m_case_channel->module~m_base_case module~m_case_channel->module~m_solver module~m_case_cylinder m_case_cylinder module~m_case_cylinder->module~m_base_backend module~m_case_cylinder->module~m_base_case module~m_case_cylinder->module~m_solver module~m_case_factory m_case_factory module~m_case_factory->module~m_base_backend module~m_case_factory->module~m_base_case module~m_case_factory->module~m_case_abl module~m_case_factory->module~m_case_channel module~m_case_factory->module~m_case_cylinder module~m_case_generic m_case_generic module~m_case_factory->module~m_case_generic module~m_case_tgv m_case_tgv module~m_case_factory->module~m_case_tgv module~m_case_wind_turbine m_case_wind_turbine module~m_case_factory->module~m_case_wind_turbine module~m_case_generic->module~m_base_backend module~m_case_generic->module~m_base_case module~m_case_generic->module~m_solver module~m_case_tgv->module~m_base_backend module~m_case_tgv->module~m_base_case module~m_case_tgv->module~m_solver module~m_case_wind_turbine->module~m_base_backend module~m_case_wind_turbine->module~m_base_case module~m_case_wind_turbine->module~m_solver module~m_case_wind_turbine->module~m_turbine_model module~m_case_wind_turbine->module~m_turbine_setup module~m_cuda_backend->module~m_base_backend module~m_cuda_backend->module~m_cuda_poisson_fft module~m_cuda_memcheck_device m_cuda_memcheck_device module~m_cuda_memcheck_device->module~m_cuda_poisson_fft module~m_cuda_memcheck_device->module~m_base_case module~m_memory_estimate m_memory_estimate module~m_cuda_memcheck_device->module~m_memory_estimate module~m_ibm m_ibm module~m_ibm->module~m_base_backend module~m_ibm->module~m_io_session module~m_inflow_planes->module~m_base_backend module~m_inflow_planes->module~m_io_session module~m_io_backend m_io_backend module~m_io_backend->module~m_base_backend module~m_io_base m_io_base module~m_io_backend->module~m_io_base module~m_io_backend~2 m_io_backend module~m_io_backend~2->module~m_base_backend module~m_io_backend~2->module~m_io_base module~m_io_base->module~m_base_backend module~m_io_session->module~m_base_backend module~m_io_session->module~m_io_backend~2 module~m_io_session->module~m_io_base module~m_les->module~m_base_backend module~m_memcheck_estimate m_memcheck_estimate module~m_memcheck_estimate->module~m_cuda_poisson_fft module~m_memcheck_context m_memcheck_context module~m_memcheck_estimate->module~m_memcheck_context module~m_memcheck_estimate->module~m_memory_estimate module~m_omp_backend->module~m_base_backend module~m_omptgt_backend->module~m_base_backend module~m_solver->module~m_base_backend module~m_solver->module~m_ibm module~m_solver->module~m_les module~m_tdsops_setup m_tdsops_setup module~m_solver->module~m_tdsops_setup module~m_time_integrator m_time_integrator module~m_solver->module~m_time_integrator module~m_vector_calculus m_vector_calculus module~m_solver->module~m_vector_calculus module~m_tdsops_setup->module~m_base_backend module~m_time_integrator->module~m_base_backend module~m_turbine_dummy m_turbine_dummy module~m_turbine_dummy->module~m_base_backend module~m_turbine_dummy->module~m_io_session module~m_turbine_dummy->module~m_turbine_model module~m_turbine_model->module~m_base_backend module~m_checkpoint_state m_checkpoint_state module~m_turbine_model->module~m_checkpoint_state module~m_vector_calculus->module~m_base_backend proc~init_omp_poisson_fft m_omp_backend::omp_backend_t%init_omp_poisson_fft proc~init_omp_poisson_fft->module~m_omp_poisson_fft program~x3d2_poisson_solver x3d2_poisson_solver program~x3d2_poisson_solver->module~m_base_backend program~x3d2_poisson_solver->module~m_backend_setup program~x3d2_poisson_solver->module~m_tdsops_setup module~m_checkpoint_manager m_checkpoint_manager module~m_checkpoint_manager->module~m_io_session module~m_checkpoint_manager->module~m_solver module~m_checkpoint_manager->module~m_checkpoint_state module~m_io_field_utils m_io_field_utils module~m_checkpoint_manager->module~m_io_field_utils module~m_stats m_stats module~m_checkpoint_manager->module~m_stats module~m_checkpoint_state->module~m_io_session module~m_io_field_utils->module~m_io_base module~m_io_field_utils->module~m_solver module~m_io_manager->module~m_solver module~m_io_manager->module~m_checkpoint_manager module~m_io_manager->module~m_checkpoint_state module~m_snapshot_manager m_snapshot_manager module~m_io_manager->module~m_snapshot_manager module~m_io_manager->module~m_stats module~m_memcheck_build m_memcheck_build module~m_memcheck_build->module~m_backend_setup module~m_memcheck_build->module~m_base_case module~m_memcheck_build->module~m_case_abl module~m_memcheck_build->module~m_case_factory module~m_memcheck_build->module~m_memcheck_estimate module~m_memcheck_build->module~m_memcheck_context module~m_memcheck_report m_memcheck_report module~m_memcheck_build->module~m_memcheck_report module~m_memcheck_build->module~m_memory_estimate module~m_memcheck_build->module~m_monitoring module~m_memcheck_context->module~m_cuda_memcheck_device module~m_memcheck_report->module~m_cuda_memcheck_device module~m_memcheck_report->module~m_memcheck_estimate module~m_memcheck_report->module~m_memcheck_context module~m_memcheck_report->module~m_memory_estimate module~m_memory_estimate->module~m_time_integrator module~m_monitoring->module~m_solver module~m_postprocess->module~m_solver module~m_snapshot_manager->module~m_io_session module~m_snapshot_manager->module~m_solver module~m_snapshot_manager->module~m_io_field_utils module~m_stats->module~m_io_session module~m_stats->module~m_solver module~m_turbine_setup->module~m_adm module~m_turbine_setup->module~m_alm module~m_turbine_setup->module~m_solver module~m_turbine_setup->module~m_turbine_dummy module~m_turbine_setup->module~m_turbine_model module~m_turbine_setup->module~m_io_manager proc~resolve_gpu_io_mode m_memcheck_context::resolve_gpu_io_mode proc~resolve_gpu_io_mode->module~m_io_backend~2 program~x3d2_memcheck x3d2_memcheck program~x3d2_memcheck->module~m_memcheck_estimate program~x3d2_memcheck->module~m_memcheck_build program~x3d2_memcheck->module~m_memcheck_context program~x3d2_memcheck->module~m_memcheck_report program~x3d2_memcheck->module~m_memory_estimate program~xcompact xcompact program~xcompact->module~m_backend_setup program~xcompact->module~m_base_case program~xcompact->module~m_case_factory

Abstract Interfaces

abstract interface

  • public subroutine fft_forward(self, f_in)

    Arguments

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

abstract interface

  • public subroutine fft_backward(self, f_out)

    Arguments

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

abstract interface

  • public subroutine fft_postprocess(self)

    Arguments

    Type IntentOptional Attributes Name
    class(poisson_fft_t) :: self

Derived Types

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.

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
procedure(fft_backward), public, deferred :: fft_backward
procedure(fft_postprocess), public, deferred :: fft_postprocess
procedure, public :: enforce_periodicity
procedure, public :: undo_periodicity
procedure, public :: base_init
procedure, public :: solve_poisson
procedure, public :: stretching_matrix
procedure, public :: fill_stretching_sym
procedure, public :: waves_set
procedure, public :: get_km
procedure, public :: get_km_re
procedure, public :: get_km_im

Functions

public pure function poisson_bc_code(periodic) result(bc_code)

Names the boundary condition case of the FFT Poisson solver, one digit per direction in x, y, z order: 0 for periodic, 1 otherwise. The 000 case is periodic everywhere, 110 is non-periodic in x and y.

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: periodic(3)

Return Value character(len=3)

public pure function fft_bc_class(bc_code) result(fft_bc)

The FFT_BC_* class of a poisson_bc_code case, or FFT_BC_UNSUPPORTED. The CUDA solver passes it to the helpers it shares with x3d2-memcheck, so it classifies through poisson_bc_code alone. x3d2-memcheck has no mesh and takes the class from m_mesh's classify_boundaries; test_poisson_bc_code checks that the two agree.

Arguments

Type IntentOptional Attributes Name
character(len=3), intent(in) :: bc_code

Return Value integer

public pure function spectral_dirs(bc_code) result(dirs)

The physical direction held in each dimension of the spectral array. The r2c transform runs along dim1, so a case with x non-periodic permutes a periodic direction into dim1 ahead of the FFT: 100 swaps x and y, 110 brings z to the front. 111 has no periodic direction and keeps the 110 layout, with z folded so that the r2c transform stands in for a cosine transform (see waves_set).

Arguments

Type IntentOptional Attributes Name
character(len=3), intent(in) :: bc_code

Return Value integer, (3)

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)

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)

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)

public function get_real(complx) result(re)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: complx

Return Value real(kind=dp)

public function get_imag(complx) result(im)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: complx

Return Value real(kind=dp)


Subroutines

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

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

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

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

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

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)

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

public subroutine spectral_line(self, dir, geo, xdirps, ydirps, zdirps, n, st, is_r2c, line)

The 1D factors of waves_set along the spectral dimension that holds direction dir: the squared modified wavenumber k2 and the interpolation transfer function t of the n local modes from offset st. Along the r2c dimension (is_r2c) of a non-periodic direction, the imaginary factors are those of the mirrored mode N - k (see waves_set). The mean mode has no mirror; its imaginary part carries no data, so it keeps its own factors.

Arguments

Type IntentOptional Attributes Name
class(poisson_fft_t), intent(in) :: self
integer, intent(in) :: dir
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) :: n
integer, intent(in) :: st
logical, intent(in) :: is_r2c
type(spectral_line_t), intent(out) :: line

public subroutine wave_numbers(a, b, k, e, k2, n, L, d, periodic, c_a, c_b, c_alpha)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), dimension(:) :: a
real(kind=dp), intent(out), dimension(:) :: b
complex(kind=dp), intent(out), dimension(:) :: k
complex(kind=dp), intent(out), dimension(:) :: e
complex(kind=dp), intent(out), dimension(:) :: k2
integer, intent(in) :: n
real(kind=dp), intent(in) :: L
real(kind=dp), intent(in) :: d
logical, intent(in) :: periodic
real(kind=dp), intent(in) :: c_a
real(kind=dp), intent(in) :: c_b
real(kind=dp), intent(in) :: c_alpha