| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| class(field_t), | intent(in) | :: | f_in |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| class(field_t), | intent(inout) | :: | f_out |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self |
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.
| 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 |
| 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 |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | periodic(3) |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=3), | intent(in) | :: | bc_code |
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).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=3), | intent(in) | :: | bc_code |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| integer, | intent(in) | :: | i | |||
| integer, | intent(in) | :: | j | |||
| integer, | intent(in) | :: | k |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| integer, | intent(in) | :: | i | |||
| integer, | intent(in) | :: | j | |||
| integer, | intent(in) | :: | k |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| integer, | intent(in) | :: | i | |||
| integer, | intent(in) | :: | j | |||
| integer, | intent(in) | :: | k |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=dp), | intent(in) | :: | complx |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=dp), | intent(in) | :: | complx |
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.
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| class(field_t), | intent(inout) | :: | f | |||
| class(field_t), | intent(inout) | :: | temp |
Reorder hook of solve_poisson, overridden by every case that has a non-periodic direction.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| class(field_t), | intent(inout) | :: | f_out | |||
| class(field_t), | intent(in) | :: | f_in |
Inverse of enforce_periodicity.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(poisson_fft_t) | :: | self | ||||
| class(field_t), | intent(inout) | :: | f_out | |||
| class(field_t), | intent(in) | :: | f_in |
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.
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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) |
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.
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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 |
| Type | Intent | Optional | 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 |