m_cuda_kernels_fieldops Module


Uses

  • module~~m_cuda_kernels_fieldops~~UsesGraph module~m_cuda_kernels_fieldops m_cuda_kernels_fieldops cudafor cudafor module~m_cuda_kernels_fieldops->cudafor module~m_common m_common module~m_cuda_kernels_fieldops->module~m_common module~m_cuda_common m_cuda_common module~m_cuda_kernels_fieldops->module~m_cuda_common m_mpi m_mpi module~m_common->m_mpi module~m_logger m_logger module~m_common->module~m_logger module~m_logger->m_mpi iso_fortran_env iso_fortran_env module~m_logger->iso_fortran_env

Used by

  • module~~m_cuda_kernels_fieldops~~UsedByGraph module~m_cuda_kernels_fieldops m_cuda_kernels_fieldops module~m_cuda_backend m_cuda_backend module~m_cuda_backend->module~m_cuda_kernels_fieldops module~m_backend_setup m_backend_setup module~m_backend_setup->module~m_cuda_backend module~m_memcheck_build m_memcheck_build module~m_memcheck_build->module~m_backend_setup program~x3d2_poisson_solver x3d2_poisson_solver program~x3d2_poisson_solver->module~m_backend_setup program~xcompact xcompact program~xcompact->module~m_backend_setup program~x3d2_memcheck x3d2_memcheck program~x3d2_memcheck->module~m_memcheck_build

Functions

public function local_index(g, n_glob, offset, n_loc, periodic)

Local one-based index of the zero-based global index g, wrapped when periodic; 0 when it is off this rank or outside the domain.

Arguments

Type IntentOptional Attributes Name
integer, intent(in), value :: g
integer, intent(in), value :: n_glob
integer, intent(in), value :: offset
integer, intent(in), value :: n_loc
logical, intent(in), value :: periodic

Return Value integer


Subroutines

public subroutine copy(n, dst, src)

Arguments

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

public subroutine axpby(n, alpha, x, beta, y)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), value :: n
real(kind=dp), intent(in), value :: alpha
real(kind=dp), intent(in), device, dimension(:, :, :) :: x
real(kind=dp), intent(in), value :: beta
real(kind=dp), intent(inout), device, dimension(:, :, :) :: y

public subroutine pwmul(y, x, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: y
real(kind=dp), intent(in), device, dimension(:, :, :) :: x
integer, intent(in), value :: n

public subroutine buffer_copy(u_send_s, u_send_e, u, n, n_halo)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: u_send_s
real(kind=dp), intent(inout), device, dimension(:, :, :) :: u_send_e
real(kind=dp), intent(in), device, dimension(:, :, :) :: u
integer, intent(in), value :: n
integer, intent(in), value :: n_halo

public subroutine field_scale(f, alpha, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), value :: alpha
integer, intent(in), value :: n

public subroutine field_shift(f, const, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), value :: const
integer, intent(in), value :: n

public subroutine vorticity_from_gradients(vort, dudy, dudz, dvdx, dvdz, dwdx, dwdy, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: vort
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudz
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdz
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdy
integer, intent(in), value :: n

public subroutine qcriterion_from_gradients(qcrit, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: qcrit
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudz
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdz
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdz
integer, intent(in), value :: n

public subroutine smagorinsky_from_gradients(nut, mixing_length_sq, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: nut
real(kind=dp), intent(in), device, dimension(:, :, :) :: mixing_length_sq
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dudz
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dvdz
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdx
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdy
real(kind=dp), intent(in), device, dimension(:, :, :) :: dwdz
integer, intent(in), value :: n

public subroutine sgs_stress_from_gradients(stress, nut, gradient_a, gradient_b, scale_a, scale_b, n)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: stress
real(kind=dp), intent(in), device, dimension(:, :, :) :: nut
real(kind=dp), intent(in), device, dimension(:, :, :) :: gradient_a
real(kind=dp), intent(in), device, dimension(:, :, :) :: gradient_b
real(kind=dp), intent(in), value :: scale_a
real(kind=dp), intent(in), value :: scale_b
integer, intent(in), value :: n

public subroutine scalar_product(s, x, y, n, n_i_pad, n_j)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device :: s
real(kind=dp), intent(in), device, dimension(:, :, :) :: x
real(kind=dp), intent(in), device, dimension(:, :, :) :: y
integer, intent(in), value :: n
integer, intent(in), value :: n_i_pad
integer, intent(in), value :: n_j

public subroutine vector_norm_squared(s, a, b, c, n, n_i_pad, n_j)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device :: s
real(kind=dp), intent(in), device, dimension(:, :, :) :: a
real(kind=dp), intent(in), device, dimension(:, :, :) :: b
real(kind=dp), intent(in), device, dimension(:, :, :) :: c
integer, intent(in), value :: n
integer, intent(in), value :: n_i_pad
integer, intent(in), value :: n_j

public subroutine labelled_sums(s, g, label, a, b, c, n_label, n, n_i_pad, n_j)

s(1:3, l) += sums of ga, gb and g*c over the points labelled l; launch as vector_norm_squared. Each thread accumulates runs of equal labels along its pencil and flushes a run when the label changes, so the atomics scale with the label changes rather than the points.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device :: s(3,n_label)
real(kind=dp), intent(in), device, dimension(:, :, :) :: g
real(kind=dp), intent(in), device, dimension(:, :, :) :: label
real(kind=dp), intent(in), device, dimension(:, :, :) :: a
real(kind=dp), intent(in), device, dimension(:, :, :) :: b
real(kind=dp), intent(in), device, dimension(:, :, :) :: c
integer, intent(in), value :: n_label
integer, intent(in), value :: n
integer, intent(in), value :: n_i_pad
integer, intent(in), value :: n_j

public subroutine labelled_axpy(coeffs, g, label, a, b, c, n_label, n, n_i_pad, n_j)

a, b, c += coeffs(1:3, l)*g at the points labelled l; launch as vector_norm_squared.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in), device :: coeffs(3,n_label)
real(kind=dp), intent(in), device, dimension(:, :, :) :: g
real(kind=dp), intent(in), device, dimension(:, :, :) :: label
real(kind=dp), intent(inout), device, dimension(:, :, :) :: a
real(kind=dp), intent(inout), device, dimension(:, :, :) :: b
real(kind=dp), intent(inout), device, dimension(:, :, :) :: c
integer, intent(in), value :: n_label
integer, intent(in), value :: n
integer, intent(in), value :: n_i_pad
integer, intent(in), value :: n_j

public subroutine field_max_sum(max_f, sum_f, f, n, n_i_pad, n_j)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device :: max_f
real(kind=dp), intent(inout), device :: sum_f
real(kind=dp), intent(in), device, dimension(:, :, :) :: f
integer, intent(in), value :: n
integer, intent(in), value :: n_i_pad
integer, intent(in), value :: n_j

public subroutine field_set_y_face(f, c_start, c_end, set_start, set_end, flow_rate_diff, nx, ny, nz)

Set domain Y_FACE boundary values. c_start: Dirichlet value applied at the bottom face (j = 1) c_end: Dirichlet value applied at the top face (j = ny) set_start/set_end: whether that face carries a prescribed value at all, so the two y-faces can differ (ABL: no-slip floor, free-slip lid).

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), value :: c_start
real(kind=dp), intent(in), value :: c_end
logical, intent(in), value :: set_start
logical, intent(in), value :: set_end
real(kind=dp), intent(in), value :: flow_rate_diff
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine field_plane_partial_sums(partial, f, nx, ny, nz)

First pass of field_plane_sums: partial(j, z) is the sum over x of y index j at z. Launch with threads = dim3(SZ, 1, 1) and blocks = dim3(n_y_blocks, nz, 1).

Arguments

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

public subroutine field_plane_sums_reduce(sums, partial, ny, nz)

Second pass of field_plane_sums: sums(j) = sum over z of partial(j, z), in a fixed order. Launch with one thread per y index.

Arguments

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

public subroutine field_set_y_plane(f, c, i_in_block, group_offset, nx)

Set one interior y-plane to a constant. The caller resolves the plane into its position within a y-block and the group offset for that block, so this kernel stays free of layout arithmetic.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), value :: c
integer, intent(in), value :: i_in_block
integer, intent(in), value :: group_offset
integer, intent(in), value :: nx

public subroutine field_set_abl_wall_stress(stress, u, w, drag_coeff, upper_weight, sample_i, upper_i, stress_i, sample_offset, upper_offset, stress_offset, nx, component)

Drag law tau = drag_coeffu_c|u_h| from each column's own sampled velocity, written into one stress plane (component 1: x, 3: z). The velocity is interpolated between the sample plane and the one above it.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: stress
real(kind=dp), intent(in), device, dimension(:, :, :) :: u
real(kind=dp), intent(in), device, dimension(:, :, :) :: w
real(kind=dp), intent(in), value :: drag_coeff
real(kind=dp), intent(in), value :: upper_weight
integer, intent(in), value :: sample_i
integer, intent(in), value :: upper_i
integer, intent(in), value :: stress_i
integer, intent(in), value :: sample_offset
integer, intent(in), value :: upper_offset
integer, intent(in), value :: stress_offset
integer, intent(in), value :: nx
integer, intent(in), value :: component

public subroutine field_get_x_band(band, f, i_start, nz)

band(i, j, k) = f(i_start + i - 1, j, k) for a DIR_X vertex field; one thread per i, one block per (j, k)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out), device, dimension(:, :, :) :: band
real(kind=dp), intent(in), device, dimension(:, :, :) :: f
integer, intent(in), value :: i_start
integer, intent(in), value :: nz

public subroutine field_blend_x_band(f, band, lambda, i_start, nz)

f(i_start + i - 1, j, k) = lambda(i)band(i, j, k) + (1 - lambda(i))f(i_start + i - 1, j, k) for a DIR_X vertex field; one thread per i, one block per (j, k)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), device, dimension(:, :, :) :: band
real(kind=dp), intent(in), device, dimension(:) :: lambda
integer, intent(in), value :: i_start
integer, intent(in), value :: nz

public subroutine field_set_y_face_from_field(f, f_start, nx, ny, nz)

Set domain Y_FACE boundary values from another field. Both f and f_start are DIR_X VERT pencil-layout. Only the bottom (j = 1) and top (j = ny) y-pencil planes of f_start are read.

Read more…

Arguments

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

public subroutine field_set_x_face(f, c_start, c_end, bc_start, bc_end, flow_rate_diff, nx, ny, nz)

Set domain X_FACE boundary values. c_start: Dirichlet value applied at the left face (i = 1) c_end: convective velocity Uc = uxmax * gdt / dx, used as multiplier in the outflow scheme du/dt + Uc*du/dx = 0

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), value :: c_start
real(kind=dp), intent(in), value :: c_end
integer, intent(in), value :: bc_start
integer, intent(in), value :: bc_end
real(kind=dp), intent(in), value :: flow_rate_diff
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine field_set_x_face_from_field(f, f_start, c_end, bc_start, bc_end, flow_rate_diff, nx, ny, nz)

Set domain X_FACE boundary values with a spatially-varying inlet.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), device, dimension(:, :, :) :: f_start
real(kind=dp), intent(in), value :: c_end
integer, intent(in), value :: bc_start
integer, intent(in), value :: bc_end
real(kind=dp), intent(in), value :: flow_rate_diff
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine field_set_y_face_from_plane(f, p_start, p_end, apply_end, nx, ny, nz)

Write two (nx, nz) planes into the y = 1 and y = ny planes of a DIR_X field. p_end is read only when apply_end = 1. Launch convention matches field_set_y_face_from_field.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), device, dimension(:, :) :: p_start
real(kind=dp), intent(in), device, dimension(:, :) :: p_end
integer, intent(in), value :: apply_end
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine field_set_x_face_from_plane(f, p_start, p_end, apply_end, nx, ny, nz)

Write two (ny, nz) planes into the x = 1 and x = nx planes of a DIR_X field. p_end is read only when apply_end = 1. Launch convention matches field_set_x_face_from_field.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), device, dimension(:, :) :: p_start
real(kind=dp), intent(in), device, dimension(:, :) :: p_end
integer, intent(in), value :: apply_end
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine add_scalar_x_face(f, c, i_plane, nx, ny, nz)

Adds a uniform constant c to a single x-normal plane (pencil index i_plane) of a DIR_X VERT field, in place.

Read more…

Arguments

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

public subroutine field_add_x_face_from_field(f, g, set_start, set_end, nx, ny, nz)

f += g on the x-faces (pencil index 1 and nx) flagged by set_start/set_end. Launch as field_set_x_face_from_field.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), device, dimension(:, :, :) :: g
logical, intent(in), value :: set_start
logical, intent(in), value :: set_end
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine field_add_y_face_from_field(f, g, set_start, set_end, nx, ny, nz)

f += g on the y-faces (j = 1 and ny) flagged by set_start/set_end. Launch as field_set_y_face.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: f
real(kind=dp), intent(in), device, dimension(:, :, :) :: g
logical, intent(in), value :: set_start
logical, intent(in), value :: set_end
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz

public subroutine volume_integral(s, f, n, n_i_pad, n_j)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device :: s
real(kind=dp), intent(in), device, dimension(:, :, :) :: f
integer, intent(in), value :: n
integer, intent(in), value :: n_i_pad
integer, intent(in), value :: n_j

public subroutine sample_points(vals, points, a, b, c, n_points, dx, dy, dz, nx, ny, nz, gx, gy, gz, ox, oy, oz, px, py, pz, n_i_pad)

vals(1:3, p) = this rank's part of the trilinear interpolation of a, b and c at points(:, p), one thread per point; see field_sample_points. (dx, dy, dz) is the grid spacing, (nx, ny, nz) and (gx, gy, gz) the local and global VERT dims, (ox, oy, oz) the rank offsets and (px, py, pz) flag periodic directions.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device :: vals(3,n_points)
real(kind=dp), intent(in), device :: points(3,n_points)
real(kind=dp), intent(in), device, dimension(:, :, :) :: a
real(kind=dp), intent(in), device, dimension(:, :, :) :: b
real(kind=dp), intent(in), device, dimension(:, :, :) :: c
integer, intent(in), value :: n_points
real(kind=dp), intent(in), value :: dx
real(kind=dp), intent(in), value :: dy
real(kind=dp), intent(in), value :: dz
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz
integer, intent(in), value :: gx
integer, intent(in), value :: gy
integer, intent(in), value :: gz
integer, intent(in), value :: ox
integer, intent(in), value :: oy
integer, intent(in), value :: oz
logical, intent(in), value :: px
logical, intent(in), value :: py
logical, intent(in), value :: pz
integer, intent(in), value :: n_i_pad

public subroutine add_gaussian_sources(a, b, c, src, box, n_src, inv_eps2, r_cut2, dx, dy, dz, nx, ny, nz, gx, gy, gz, ox, oy, oz, px, py, pz, n_i_pad)

a, b, c += src(4:6, s)*exp(-dist^2/eps^2) within r_cut of the point src(1:3, s), over the global index box box(1:3, s)..box(4:6, s); see source_index_boxes. Box indices are wrapped across periodic boundaries and skipped where this rank does not own them. Launch with blocks (n_src, box extent in z) and threads striding y within the box; sources overlap, so the adds are atomic.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), device, dimension(:, :, :) :: a
real(kind=dp), intent(inout), device, dimension(:, :, :) :: b
real(kind=dp), intent(inout), device, dimension(:, :, :) :: c
real(kind=dp), intent(in), device :: src(6,n_src)
integer, intent(in), device :: box(6,n_src)
integer, intent(in), value :: n_src
real(kind=dp), intent(in), value :: inv_eps2
real(kind=dp), intent(in), value :: r_cut2
real(kind=dp), intent(in), value :: dx
real(kind=dp), intent(in), value :: dy
real(kind=dp), intent(in), value :: dz
integer, intent(in), value :: nx
integer, intent(in), value :: ny
integer, intent(in), value :: nz
integer, intent(in), value :: gx
integer, intent(in), value :: gy
integer, intent(in), value :: gz
integer, intent(in), value :: ox
integer, intent(in), value :: oy
integer, intent(in), value :: oz
logical, intent(in), value :: px
logical, intent(in), value :: py
logical, intent(in), value :: pz
integer, intent(in), value :: n_i_pad