m_cuda_spectral Module


Uses

  • module~~m_cuda_spectral~~UsesGraph module~m_cuda_spectral m_cuda_spectral cudafor cudafor module~m_cuda_spectral->cudafor module~m_common m_common module~m_cuda_spectral->module~m_common mpi mpi module~m_common->mpi

Used by

  • module~~m_cuda_spectral~~UsedByGraph module~m_cuda_spectral m_cuda_spectral module~m_cuda_poisson_fft m_cuda_poisson_fft module~m_cuda_poisson_fft->module~m_cuda_spectral module~m_cuda_backend m_cuda_backend module~m_cuda_backend->module~m_cuda_poisson_fft program~xcompact xcompact program~xcompact->module~m_cuda_backend

Subroutines

public subroutine memcpy3D(dst, src, nx, ny, nz)

Copy data between x3d2 padded arrays and cuFFTMp descriptors

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: dst
real(kind=dp), intent(in), device, dimension(:, :, :) :: src
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine memcpy3D_with_transpose(dst, src, nx, ny, nz)

Copy with transpose: src(nx, ny, nz) -> dst(ny, nx, nz) Used for 100 case forward FFT

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: dst
real(kind=dp), intent(in), device, dimension(:, :, :) :: src
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine memcpy3D_with_transpose_back(dst, src, nx, ny, nz)

Copy with transpose back: src(ny, nx, nz) -> dst(nx, ny, nz) Used for 100 case backward FFT

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: dst
real(kind=dp), intent(in), device, dimension(:, :, :) :: src
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine transpose_xyz_to_zxy(dst, src, nx, ny, nz)

Used before R2C FFT for 110 case to put Z (periodic) in fast dim.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: dst
real(kind=dp), intent(in), device, dimension(:, :, :) :: src
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine transpose_zxy_to_xyz(dst, src, nx, ny, nz)

Transpose back: src(nz, nx, ny) -> dst(nx, ny, nz) Used after C2R FFT for 110 case.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: dst
real(kind=dp), intent(in), device, dimension(:, :, :) :: src
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine process_spectral_000(div_u, waves, nx_spec, ny_spec, y_sp_st, nx, ny, nz, ax, bx, ay, by, az, bz)

Post-processes the divergence of velocity in spectral space, including scaling w.r.t. grid size.

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u

Divergence of velocity in spectral space

complex(kind=dp), intent(in), device, dimension(:, :, :) :: waves

Spectral equivalence constants

integer, intent(in), value :: nx_spec

Grid size in spectral space

integer, intent(in), value :: ny_spec

Grid size in spectral space

integer, intent(in), value :: y_sp_st

Offset in y direction in the permuted slabs in spectral space

integer, intent(in), value :: nx

Grid size

integer, intent(in), value :: ny

Grid size

integer, intent(in), value :: nz

Grid size

real(kind=dp), intent(in), device, dimension(:) :: ax
real(kind=dp), intent(in), device, dimension(:) :: bx
real(kind=dp), intent(in), device, dimension(:) :: ay
real(kind=dp), intent(in), device, dimension(:) :: by
real(kind=dp), intent(in), device, dimension(:) :: az
real(kind=dp), intent(in), device, dimension(:) :: bz

public subroutine process_spectral_010(div_u, waves, nx_spec, ny_spec, y_sp_st, nx, ny, nz, ax, bx, ay, by, az, bz)

Post-processes the divergence of velocity in spectral space, including scaling w.r.t. grid size.

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u

Divergence of velocity in spectral space

complex(kind=dp), intent(in), device, dimension(:, :, :) :: waves

Spectral equivalence constants

integer, intent(in), value :: nx_spec

Grid size in spectral space

integer, intent(in), value :: ny_spec

Grid size in spectral space

integer, intent(in), value :: y_sp_st

Offset in y direction in the permuted slabs in spectral space

integer, intent(in), value :: nx

Grid size

integer, intent(in), value :: ny

Grid size

integer, intent(in), value :: nz

Grid size

real(kind=dp), intent(in), device, dimension(:) :: ax
real(kind=dp), intent(in), device, dimension(:) :: bx
real(kind=dp), intent(in), device, dimension(:) :: ay
real(kind=dp), intent(in), device, dimension(:) :: by
real(kind=dp), intent(in), device, dimension(:) :: az
real(kind=dp), intent(in), device, dimension(:) :: bz

public subroutine process_spectral_010_fw(div_u, nx_spec, ny_spec, y_sp_st, nx, ny, nz, ax, bx, ay, by, az, bz)

Post-processes the divergence of velocity in spectral space, including scaling w.r.t. grid size.

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u

Divergence of velocity in spectral space

integer, intent(in), value :: nx_spec

Grid size in spectral space

integer, intent(in), value :: ny_spec

Grid size in spectral space

integer, intent(in), value :: y_sp_st

Offset in y direction in the permuted slabs in spectral space

integer, intent(in), value :: nx

Grid size

integer, intent(in), value :: ny

Grid size

integer, intent(in), value :: nz

Grid size

real(kind=dp), intent(in), device, dimension(:) :: ax

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: bx

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: ay

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: by

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: az

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: bz

Spectral equivalence constants

public subroutine process_spectral_010_poisson(div_u, a_re, a_im, off, inc, nx_spec, n, nx, ny, nz)

Solve the Poisson equation at cell centres with non-perioic BC along y

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u

Divergence of velocity in spectral space

real(kind=dp), intent(inout), device, dimension(:, :, :, :) :: a_re

Spectral equivalence constants

real(kind=dp), intent(inout), device, dimension(:, :, :, :) :: a_im

Spectral equivalence constants

integer, intent(in), value :: off

offset and increment. increment is 2 when considering only odd or even

integer, intent(in), value :: inc

offset and increment. increment is 2 when considering only odd or even

integer, intent(in), value :: nx_spec

Grid size in spectral space

integer, intent(in), value :: n

Grid size in spectral space

integer, intent(in), value :: nx

Grid size in spectral space

integer, intent(in), value :: ny

Grid size in spectral space

integer, intent(in), value :: nz

Grid size in spectral space

public subroutine process_spectral_010_bw(div_u, nx_spec, ny_spec, y_sp_st, nx, ny, nz, ax, bx, ay, by, az, bz)

Post-processes the divergence of velocity in spectral space, including scaling w.r.t. grid size.

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u

Divergence of velocity in spectral space

integer, intent(in), value :: nx_spec

Grid size in spectral space

integer, intent(in), value :: ny_spec

Grid size in spectral space

integer, intent(in), value :: y_sp_st

Offset in y direction in the permuted slabs in spectral space

integer, intent(in), value :: nx

Grid size

integer, intent(in), value :: ny

Grid size

integer, intent(in), value :: nz

Grid size

real(kind=dp), intent(in), device, dimension(:) :: ax

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: bx

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: ay

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: by

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: az

Spectral equivalence constants

real(kind=dp), intent(in), device, dimension(:) :: bz

Spectral equivalence constants

public subroutine process_spectral_110_norm_z(div_u, nz_h, nx, ny, nz, az, bz)

Step 1 (forward): normalise + Z periodic post-process Z is dim1 (serial j loop), periodic R2C — no sign flip needed since j only goes to nz/2+1.

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz
real(kind=dp), intent(in), device, dimension(:) :: az
real(kind=dp), intent(in), device, dimension(:) :: bz

public subroutine process_spectral_110_x_pair_fw(div_u, nz_h, nx, ny, x_sp_st, ax, bx)

Step 2 (forward): X paired even/odd split X is dim2 (thread i). Only i in [2, nx/2+1] executes. Writes to i and nx-i+2. Race-free (pair doesn't enter).

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: x_sp_st
real(kind=dp), intent(in), device, dimension(:) :: ax
real(kind=dp), intent(in), device, dimension(:) :: bx

public subroutine process_spectral_110_y_pair_fw(div_u, nz_h, nx, ny, y_sp_st, ay, by)

Step 3 (forward): Y paired even/odd split Y is dim3 (blockIdx%y = k). Only k in [2, ny/2+1] executes. Writes to k and ny-k+2. Race-free (pair block doesn't enter).

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: y_sp_st
real(kind=dp), intent(in), device, dimension(:) :: ay
real(kind=dp), intent(in), device, dimension(:) :: by

public subroutine process_spectral_110_poisson(div_u, waves, nz_h, nx, ny, nz, x_sp_st)

Step 4: Poisson solve — divide by waves

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
complex(kind=dp), intent(in), device, dimension(:, :, :) :: waves
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz
integer, intent(in), value :: x_sp_st

public subroutine process_spectral_110_y_pair_bw(div_u, nz_h, nx, ny, y_sp_st, ay, by)

Step 5 (backward): Y paired even/odd recombine

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: y_sp_st
real(kind=dp), intent(in), device, dimension(:) :: ay
real(kind=dp), intent(in), device, dimension(:) :: by

public subroutine process_spectral_110_x_pair_bw(div_u, nz_h, nx, ny, x_sp_st, ax, bx)

Step 6 (backward): X paired even/odd recombine

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: x_sp_st
real(kind=dp), intent(in), device, dimension(:) :: ax
real(kind=dp), intent(in), device, dimension(:) :: bx

public subroutine process_spectral_110_z_bw(div_u, nz_h, nx, ny, az, bz)

Step 7 (backward): Z periodic undo

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), device, dimension(:, :, :) :: div_u
integer, intent(in), value :: nz_h
integer, intent(in), value :: nx
integer, intent(in), value :: ny
real(kind=dp), intent(in), device, dimension(:) :: az
real(kind=dp), intent(in), device, dimension(:) :: bz

public subroutine enforce_periodicity_x(f_out, f_in, nx)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: f_out
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_in
integer, intent(in), value :: nx

public subroutine undo_periodicity_x(f_out, f_in, nx)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: f_out
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_in
integer, intent(in), value :: nx

public subroutine enforce_periodicity_y(f_out, f_in, ny)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: f_out
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_in
integer, intent(in), value :: ny

public subroutine undo_periodicity_y(f_out, f_in, ny)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: f_out
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_in
integer, intent(in), value :: ny

public subroutine enforce_periodicity_xy(f_out, f_in, nx, ny)

Combined X and Y periodicity enforcement (interleave shuffle).

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: f_out
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_in
integer, intent(in), value :: nx
integer, intent(in), value :: ny

public subroutine undo_periodicity_xy(f_out, f_in, nx, ny)

Combined X and Y periodicity undo (reverse interleave shuffle).

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: f_out
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_in
integer, intent(in), value :: nx
integer, intent(in), value :: ny