m_base_backend Module


Uses

  • module~~m_base_backend~~UsesGraph module~m_base_backend m_base_backend iso_c_binding iso_c_binding module~m_base_backend->iso_c_binding m_mpi m_mpi module~m_base_backend->m_mpi module~m_allocator m_allocator module~m_base_backend->module~m_allocator module~m_common m_common module~m_base_backend->module~m_common module~m_field m_field module~m_base_backend->module~m_field module~m_logger m_logger module~m_base_backend->module~m_logger module~m_mesh m_mesh module~m_base_backend->module~m_mesh module~m_poisson_fft m_poisson_fft module~m_base_backend->module~m_poisson_fft module~m_tdsops m_tdsops module~m_base_backend->module~m_tdsops module~m_allocator->module~m_common module~m_allocator->module~m_field module~m_common->m_mpi module~m_common->module~m_logger module~m_field->iso_c_binding module~m_field->module~m_common module~m_logger->m_mpi iso_fortran_env iso_fortran_env module~m_logger->iso_fortran_env module~m_mesh->m_mpi module~m_mesh->module~m_common module~m_mesh->module~m_field module~m_mesh->module~m_logger module~m_mesh_content m_mesh_content module~m_mesh->module~m_mesh_content module~m_poisson_fft->module~m_common module~m_poisson_fft->module~m_field module~m_poisson_fft->module~m_logger module~m_poisson_fft->module~m_mesh module~m_poisson_fft->module~m_tdsops 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_base_backend~~UsedByGraph module~m_base_backend m_base_backend 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_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 module~m_io_session->module~m_io_base module~m_les->module~m_base_backend 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 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_cuda_memcheck_device m_cuda_memcheck_device 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_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_ibm module~m_memcheck_build->module~m_memory_estimate module~m_memcheck_build->module~m_monitoring module~m_memcheck_context m_memcheck_context module~m_memcheck_build->module~m_memcheck_context module~m_memcheck_estimate m_memcheck_estimate module~m_memcheck_build->module~m_memcheck_estimate module~m_memcheck_report m_memcheck_report module~m_memcheck_build->module~m_memcheck_report 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 program~xcompact xcompact program~xcompact->module~m_backend_setup program~xcompact->module~m_base_case program~xcompact->module~m_case_factory module~m_memcheck_context->module~m_cuda_memcheck_device module~m_memcheck_estimate->module~m_memory_estimate module~m_memcheck_estimate->module~m_memcheck_context module~m_memcheck_report->module~m_cuda_memcheck_device module~m_memcheck_report->module~m_memory_estimate module~m_memcheck_report->module~m_memcheck_context module~m_memcheck_report->module~m_memcheck_estimate program~x3d2_memcheck x3d2_memcheck program~x3d2_memcheck->module~m_memcheck_build program~x3d2_memcheck->module~m_memory_estimate program~x3d2_memcheck->module~m_memcheck_context program~x3d2_memcheck->module~m_memcheck_estimate program~x3d2_memcheck->module~m_memcheck_report

Derived Types

type, public, abstract ::  base_backend_t

base_backend class defines all the operations that the solver class requires.

Read more…

Components

Type Visibility Attributes Name Initial
integer, public :: n_halo = 4

DistD2 implementation is hardcoded for 4 halo layers for all backends

type(mesh_t), public, pointer :: mesh
class(allocator_t), public, pointer :: allocator
class(poisson_fft_t), public, pointer :: poisson_fft

Type-Bound Procedures

procedure, public :: transeq_x => transeq_x_base
procedure, public :: transeq_y => transeq_y_base
procedure, public :: transeq_z => transeq_z_base
procedure, public :: transeq_species => transeq_species_base
procedure, public :: tds_solve => tds_solve_base
procedure, public :: thom_solve => thom_solve_base
procedure, public :: reorder => reorder_base
procedure, public :: sum_yintox => sum_yintox_base
procedure, public :: sum_zintox => sum_zintox_base
procedure, public :: veccopy => veccopy_base
procedure, public :: vecadd => vecadd_base
procedure, public :: vecmult => vecmult_base
procedure, public :: scalar_product => scalar_product_base
procedure, public :: vector_norm_squared => vector_norm_squared_base
procedure, public :: field_labelled_sums => field_labelled_sums_base
procedure, public :: field_labelled_axpy => field_labelled_axpy_base
procedure, public :: field_sample_points => field_sample_points_base
procedure, public :: field_add_gaussian_sources => field_add_gaussian_sources_base
procedure, public :: field_max_mean => field_max_mean_base
procedure, public :: slice_max_sum => slice_max_sum_base
procedure, public :: x_slice_weighted_sum => x_slice_weighted_sum_base
procedure, public :: field_plane_sums => field_plane_sums_base
procedure, public :: field_scale => field_scale_base
procedure, public :: field_shift => field_shift_base
procedure, public :: field_volume_integral => field_volume_integral_base
procedure, public :: field_set_face => field_set_face_base
procedure, public :: field_set_y_plane => field_set_y_plane_base
procedure, public :: field_set_abl_wall_stress => field_set_abl_wall_stress_base
procedure, public :: field_shift_blend_x_band => field_shift_blend_x_band_base
procedure, public :: field_set_face_from_field => field_set_face_from_field_base
procedure, public :: set_field_face_data => set_field_face_data_base
procedure, public :: field_add_face_from_field => field_add_face_from_field_base
procedure, public :: field_add_const_x_face => field_add_const_x_face_base
procedure, public :: field_set_x_inlet_plane => field_set_x_inlet_plane_base
procedure, public :: compute_vorticity => compute_vorticity_base
procedure, public :: compute_qcriterion => compute_qcriterion_base
procedure, public :: compute_smagorinsky_nut => compute_smagorinsky_nut_base
procedure, public :: compute_sgs_stress => compute_sgs_stress_base
procedure, public :: copy_data_to_f => copy_data_to_f_base
procedure, public :: copy_f_to_data => copy_f_to_data_base
procedure, public :: alloc_tdsops => alloc_tdsops_base
procedure, public :: init_poisson_fft => init_poisson_fft_base
procedure, public :: sync => sync_base
procedure, public :: get_device_bw_info => get_device_bw_info_base
procedure, public :: base_init
procedure, public :: get_field_data
procedure, public :: set_field_data
procedure, public :: supports_device_field_export
procedure, public :: export_field_to_device

Functions

public function abl_wall_upper_plane(sample_plane, sample_weight, ny) result(upper_plane)

The y-vertex above the ABL wall-model sample plane, checked against the interpolation weight. With a zero weight the upper plane is not read, so the sample may then sit on the last vertex.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: sample_plane
real(kind=dp), intent(in) :: sample_weight
integer, intent(in) :: ny

Return Value integer

public function supports_device_field_export(self, f)

Whether export_field_to_device can pack field f without staging it through host memory. Backends without device memory keep this default and report no support.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t), intent(in) :: self
class(field_t), intent(in) :: f

Return Value logical

public function scalar_product_base(self, x, y) result(s)

Calculates the scalar product of two input fields

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(in) :: x
class(field_t), intent(in) :: y

Return Value real(kind=dp)

public function vector_norm_squared_base(self, a, b, c) result(norm_squared)

Computes the global discrete squared norm of a three-component field.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(in) :: a
class(field_t), intent(in) :: b
class(field_t), intent(in) :: c

Return Value real(kind=dp)

public function field_volume_integral_base(self, f) result(s)

Reduces field to a scalar by integrating over the volume

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(in) :: f

Return Value real(kind=dp)

public pure function shifted_z_source(kg, nshift, nz)

Global z plane that global plane kg takes its value from in a circular shift by nshift planes

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: kg
integer, intent(in) :: nshift
integer, intent(in) :: nz

Return Value integer


Subroutines

public subroutine base_init(self)

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self

public subroutine get_field_data(self, data, f, dir)

Extract data from field f optionally reordering into dir orientation. To output in same orientation as f, use call ...%get_field_data(data, f, f%dir)

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out), dimension(:, :, :) :: data

Output array

class(field_t), intent(in) :: f

Field

integer, intent(in), optional :: dir

Desired orientation of output array (defaults to Cartesian)

public subroutine set_field_data(self, f, data, dir)

Arguments

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

Field

real(kind=dp), intent(in), dimension(:, :, :) :: data

Input array

integer, intent(in), optional :: dir

Orientation of input array (defaults to Cartesian)

public subroutine export_field_to_device(self, buffer, f, dims, to_sp)

Pack the first dims Cartesian points of field f into a contiguous device buffer, in (i, j, k) order without padding.

Read more…

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
type(c_ptr), intent(in) :: buffer
class(field_t), intent(in) :: f
integer, intent(in) :: dims(3)
logical, intent(in) :: to_sp

public subroutine sync_base(self)

Waits for outstanding device work.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self

public subroutine get_device_bw_info_base(self, mem_clock_rt, mem_bus_width, available)

Reports the memory clock rate and bus width of the target device, used to work out a theoretical peak bandwidth.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
integer, intent(out) :: mem_clock_rt
integer, intent(out) :: mem_bus_width
logical, intent(out) :: available

public subroutine transeq_x_base(self, du, dv, dw, u, v, w, nu, dirps)

transeq equation obtains the derivatives direction by direction, and the exact algorithm used to obtain these derivatives are decided at runtime. Backend implementations are responsible from directing calls to transeq_x into the correct algorithm.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(inout) :: dv
class(field_t), intent(inout) :: dw
class(field_t), intent(in) :: u
class(field_t), intent(in) :: v
class(field_t), intent(in) :: w
real(kind=dp), intent(in) :: nu
type(dirps_t), intent(in) :: dirps

public subroutine transeq_y_base(self, du, dv, dw, u, v, w, nu, dirps)

As transeq_x, for the y direction.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(inout) :: dv
class(field_t), intent(inout) :: dw
class(field_t), intent(in) :: u
class(field_t), intent(in) :: v
class(field_t), intent(in) :: w
real(kind=dp), intent(in) :: nu
type(dirps_t), intent(in) :: dirps

public subroutine transeq_z_base(self, du, dv, dw, u, v, w, nu, dirps)

As transeq_x, for the z direction.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(inout) :: dv
class(field_t), intent(inout) :: dw
class(field_t), intent(in) :: u
class(field_t), intent(in) :: v
class(field_t), intent(in) :: w
real(kind=dp), intent(in) :: nu
type(dirps_t), intent(in) :: dirps

public subroutine transeq_species_base(self, dspec, uvw, spec, nu, dirps, sync)

As transeq_x, for a scalar species transported by uvw.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: dspec
class(field_t), intent(in) :: uvw
class(field_t), intent(in) :: spec
real(kind=dp), intent(in) :: nu
type(dirps_t), intent(in) :: dirps
logical, intent(in) :: sync

public subroutine tds_solve_base(self, du, u, tdsops)

Applies a tridiagonal operator to u, the exact algorithm used being decided at runtime. Backend implementations are responsible from directing calls to tds_solve to the correct algorithm.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
class(tdsops_t), intent(in) :: tdsops

public subroutine thom_solve_base(self, du, u, tdsops)

As tds_solve, solving the tridiagonal system with the Thomas algorithm.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
class(tdsops_t), intent(in) :: tdsops

public subroutine reorder_base(self, u_, u, direction)

reorder subroutines are straightforward, they rearrange data into our specialist data structure so that regardless of the direction tridiagonal systems are solved efficiently and fast.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: u_
class(field_t), intent(in) :: u
integer, intent(in) :: direction

public subroutine sum_yintox_base(self, u, u_)

sum_yintox combines a y directional field into the corresponding x directional field.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: u
class(field_t), intent(in) :: u_

public subroutine sum_zintox_base(self, u, u_)

As sum_yintox, for a z directional field.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: u
class(field_t), intent(in) :: u_

public subroutine veccopy_base(self, dst, src)

copy vectors: y = x

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: dst
class(field_t), intent(in) :: src

public subroutine vecadd_base(self, a, x, b, y)

adds two vectors together: y = ax + by

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(in) :: a
class(field_t), intent(in) :: x
real(kind=dp), intent(in) :: b
class(field_t), intent(inout) :: y

public subroutine vecmult_base(self, y, x)

pointwise multiplication between two vectors: y(:) = y(:) * x(:)

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: y
class(field_t), intent(in) :: x

public subroutine field_labelled_sums_base(self, sums, g, label, a, b, c)

Computes this rank's sums of ga, gb and g*c separately for each label in a single pass over DIR_X fields. label holds integer values stored as reals; points labelled l in 1..size(sums, 2) add to sums(:, l) and all other points are skipped. No MPI reduction is done, so the caller can reduce all labels together in one MPI call.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out) :: sums(:,:)
class(field_t), intent(in) :: g
class(field_t), intent(in) :: label
class(field_t), intent(in) :: a
class(field_t), intent(in) :: b
class(field_t), intent(in) :: c

public subroutine field_labelled_axpy_base(self, coeffs, g, label, a, b, c)

Adds coeffs(1, l)g, coeffs(2, l)g and coeffs(3, l)*g to a, b and c at every point of the DIR_X fields labelled l in 1..size(coeffs, 2). Points with any other label are left unchanged.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(in) :: coeffs(:,:)
class(field_t), intent(in) :: g
class(field_t), intent(in) :: label
class(field_t), intent(inout) :: a
class(field_t), intent(inout) :: b
class(field_t), intent(inout) :: c

public subroutine field_sample_points_base(self, vals, points, a, b, c)

Computes this rank's part of the trilinear interpolation of the DIR_X VERT fields a, b and c at points(1:3, p): vals(1:3, p) sums the interpolation weight times a, b and c over the corners of the cell holding point p that this rank owns. Every grid point is owned by one rank, so an MPI sum over ranks gives the full interpolation without a halo exchange. Corners beyond a periodic boundary wrap around; corners outside a non-periodic boundary are skipped. Needs a uniform grid. No MPI reduction is done, so the caller can reduce once for all points.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out) :: vals(:,:)
real(kind=dp), intent(in) :: points(:,:)
class(field_t), intent(in) :: a
class(field_t), intent(in) :: b
class(field_t), intent(in) :: c

public subroutine field_add_gaussian_sources_base(self, a, b, c, points, coeffs, eps, r_cut)

Adds isotropic Gaussian sources to the DIR_X VERT fields a, b and c: at every grid point x within distance r_cut of points(1:3, s), a += coeffs(1, s)*exp(-|x - points(:, s)|^2/eps^2), and likewise b and c with coeffs(2, s) and coeffs(3, s). The kernel wraps across periodic boundaries, consistent with field_sample_points, and is cut at non-periodic ones. Needs a uniform grid.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: a
class(field_t), intent(inout) :: b
class(field_t), intent(inout) :: c
real(kind=dp), intent(in) :: points(:,:)
real(kind=dp), intent(in) :: coeffs(:,:)
real(kind=dp), intent(in) :: eps
real(kind=dp), intent(in) :: r_cut

public subroutine source_index_boxes(mesh, points, r_cut, lo, hi)

Global zero-based VERT index box [lo, hi] of the grid points within r_cut of each point, on a uniform grid. In a periodic direction the box is left unclipped, so it may run past either end of the domain; the projection wraps those indices onto the grid, which keeps the whole kernel. In a non-periodic direction it is clipped to the domain, so a kernel crossing an inflow, outflow or wall loses that part, as in Incompact3d. Stops the run if a box is wider than a periodic direction, as the wrapped kernel would then cover points twice.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
real(kind=dp), intent(in) :: points(:,:)
real(kind=dp), intent(in) :: r_cut
integer, intent(out) :: lo(:,:)
integer, intent(out) :: hi(:,:)

public subroutine check_point_fields(a, b, c)

Checks the fields passed to the point sampling and source operations are DIR_X VERT fields.

Arguments

Type IntentOptional Attributes Name
class(field_t), intent(in) :: a
class(field_t), intent(in) :: b
class(field_t), intent(in) :: c

public subroutine check_labelled_fields(g, label, a, b, c)

Checks the fields passed to the labelled field operations share a valid data location and the DIR_X layout.

Arguments

Type IntentOptional Attributes Name
class(field_t), intent(in) :: g
class(field_t), intent(in) :: label
class(field_t), intent(in) :: a
class(field_t), intent(in) :: b
class(field_t), intent(in) :: c

public subroutine field_max_mean_base(self, max_val, mean_val, f, enforced_data_loc)

Obtains maximum and mean values in a field

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out) :: max_val
real(kind=dp), intent(out) :: mean_val
class(field_t), intent(in) :: f
integer, intent(in), optional :: enforced_data_loc

public subroutine slice_max_sum_base(self, max_val, sum_val, f, i_slice, enforced_data_loc)

Reduces a single slice of f at index i_slice along f's DIR axis. Returns signed max (not abs) and signed sum. No division by count. Caller is responsible for MPI_Allreduce across ranks.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out) :: max_val
real(kind=dp), intent(out) :: sum_val
class(field_t), intent(in) :: f
integer, intent(in) :: i_slice
integer, intent(in), optional :: enforced_data_loc

public subroutine x_slice_weighted_sum_base(self, sum_val, f, i_slice, y_weights)

Weighted sum of the x slice f(i_slice, :, :) of a DIR_X field: the point with local y index j counts y_weights(j) times. Gives the flow rate through an x face as the discrete divergence sees it, whose y interpolation weights the boundary planes differently from the interior ones. Caller is responsible for MPI_Allreduce across ranks.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out) :: sum_val
class(field_t), intent(in) :: f
integer, intent(in) :: i_slice
real(kind=dp), intent(in) :: y_weights(:)

public subroutine field_plane_sums_base(self, sums, f)

Sum a DIR_X field over x and z on every local y-plane: sums(j) is the sum over the plane of y index j. The order of summation is fixed, so the result is reproducible.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
real(kind=dp), intent(out) :: sums(:)
class(field_t), intent(in) :: f

public subroutine field_scale_base(self, f, a)

Scales a field by a

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(in) :: f
real(kind=dp), intent(in) :: a

public subroutine field_shift_base(self, f, a)

Shifts a field by a

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(in) :: f
real(kind=dp), intent(in) :: a

public subroutine field_set_face_base(self, f, c_start, c_end, face, bc_start, bc_end, flow_rate_diff)

A field is a subdomain with a rectangular cuboid shape. It has 6 faces, and these faces are either a subdomain boundary or a global domain boundary based on the location of the subdomain. This subroutine allows us to set any of these faces to a value, 'c_start' and 'c_end' for faces at opposite sides. 'face' is one of X_FACE, Y_FACE, Z_FACE from common.f90 Optionally, bc_start/bc_end select the BC type (default BC_DIRICHLET).

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in) :: c_start
real(kind=dp), intent(in) :: c_end
integer, intent(in) :: face
integer, intent(in), optional :: bc_start
integer, intent(in), optional :: bc_end
real(kind=dp), intent(in), optional :: flow_rate_diff

public subroutine field_set_y_plane_base(self, f, c, plane)

Set one interior y-plane of a DIR_X field to a constant.

Read more…

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in) :: c
integer, intent(in) :: plane

1-based y-vertex index

public subroutine field_set_abl_wall_stress_base(self, stress, u, w, sample_plane, sample_weight, stress_plane, drag_coeff, component)

Replace one SGS stress plane using the local sampled velocity. The velocity is interpolated linearly between y-vertices sample_plane and sample_plane + 1, with weight sample_weight on the upper one, as Incompact3d samples at a non-integer dsampling.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: stress
class(field_t), intent(in) :: u
class(field_t), intent(in) :: w
integer, intent(in) :: sample_plane
real(kind=dp), intent(in) :: sample_weight

in [0, 1)

integer, intent(in) :: stress_plane
real(kind=dp), intent(in) :: drag_coeff
integer, intent(in) :: component

public subroutine field_shift_blend_x_band_base(self, f, lambda, i_start, i_offset, nshift, z_plane_rank)

Blend an x band of a DIR_X vertex field towards a spanwise-shifted copy of an upstream band (the ABL shifted periodic fringe): f(i + i_offset, j, k) = lambdaf(i, j, k - nshift) + (1 - lambda)f(i + i_offset, j, k) for i = i_start, ..., i_start + size(lambda) - 1, with k circular over the global z planes. x and y must not be decomposed; z_plane_rank(kg) is the rank holding global z plane kg.

Read more…

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in) :: lambda(:)
integer, intent(in) :: i_start
integer, intent(in) :: i_offset
integer, intent(in) :: nshift
integer, intent(in) :: z_plane_rank(:)

public subroutine post_z_shift_exchange(band, shifted, n_plane, nz_local, z_offset, nshift, z_plane_rank, rank, requests, n_req)

Post the sends and receives of a circular z shift by nshift planes for the planes held by other ranks; band(:, :, k) and shifted(:, :, k) are this rank's local plane k. The tag is the receiving global plane.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: band(:,:,:)
real(kind=dp), intent(inout) :: shifted(:,:,:)
integer, intent(in) :: n_plane
integer, intent(in) :: nz_local
integer, intent(in) :: z_offset
integer, intent(in) :: nshift
integer, intent(in) :: z_plane_rank(:)
integer, intent(in) :: rank
integer, intent(inout) :: requests(:)
integer, intent(out) :: n_req

public subroutine field_set_face_from_field_base(self, f, f_start, c_end, face, bc_start, bc_end, flow_rate_diff)

As field_set_face but with a spatially-varying inlet face field instead of a scalar c_start.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
class(field_t), intent(in) :: f_start
real(kind=dp), intent(in) :: c_end
integer, intent(in) :: face
integer, intent(in), optional :: bc_start
integer, intent(in), optional :: bc_end
real(kind=dp), intent(in), optional :: flow_rate_diff

public subroutine set_field_face_data_base(self, f, data_start, data_end, face)

Write host 2D planes into the face planes of a DIR_X field and touch nothing else. For Y_FACE the planes are (nx, nz) and are written to y = 1 (data_start) and y = ny (data_end). For X_FACE the planes are (ny, nz) and are written to x = 1 (data_start) and x = nx (data_end). data_end is optional, when absent only the start face is written.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in), dimension(:, :) :: data_start
real(kind=dp), intent(in), optional, dimension(:, :) :: data_end
integer, intent(in) :: face

public subroutine field_add_face_from_field_base(self, f, g, face, bc_start, bc_end)

Add the face planes of g onto those of f, on Dirichlet faces only. Both fields are DIR_X; X_FACE and Y_FACE are supported.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
class(field_t), intent(in) :: g
integer, intent(in) :: face
integer, intent(in) :: bc_start
integer, intent(in) :: bc_end

public subroutine field_add_const_x_face_base(self, f, c, at_end)

Adds a uniform constant c to one x-normal face plane of a DIR_X field, in place. Used to enforce exact outlet mass conservation: after the convective outflow update, the outlet-plane mean is shifted uniformly so that it matches the prescribed inlet mean (mirrors Incompact3d's bxxn = bxxn - ut + ut1). at_end = .true. -> the x = nx plane (outlet) at_end = .false. -> the x = 1 plane (inlet)

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in) :: c
logical, intent(in) :: at_end

public subroutine field_set_x_inlet_plane_base(self, f, plane)

Overwrites the x = 1 plane (pencil index 1) of a DIR_X field with the host array plane(ny, nz), in local VERT dims. Only the plane crosses to the device, so a time-varying inlet can be refreshed without uploading and reordering a full 3D field. A thin wrapper on set_field_face_data with face = X_FACE.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in), dimension(:, :) :: plane

public subroutine compute_vorticity_base(self, field_out, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

Computes the vorticity magnitude from velocity gradients

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: field_out
class(field_t), intent(in) :: dudx
class(field_t), intent(in) :: dudy
class(field_t), intent(in) :: dudz
class(field_t), intent(in) :: dvdx
class(field_t), intent(in) :: dvdy
class(field_t), intent(in) :: dvdz
class(field_t), intent(in) :: dwdx
class(field_t), intent(in) :: dwdy
class(field_t), intent(in) :: dwdz

public subroutine compute_qcriterion_base(self, field_out, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

Computes the Q-criterion from velocity gradients

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: field_out
class(field_t), intent(in) :: dudx
class(field_t), intent(in) :: dudy
class(field_t), intent(in) :: dudz
class(field_t), intent(in) :: dvdx
class(field_t), intent(in) :: dvdy
class(field_t), intent(in) :: dvdz
class(field_t), intent(in) :: dwdx
class(field_t), intent(in) :: dwdy
class(field_t), intent(in) :: dwdz

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

Computes nut=l_s^2sqrt(2S_ij*S_ij) from velocity gradients.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: nut
class(field_t), intent(in) :: mixing_length_sq
class(field_t), intent(in) :: dudx
class(field_t), intent(in) :: dudy
class(field_t), intent(in) :: dudz
class(field_t), intent(in) :: dvdx
class(field_t), intent(in) :: dvdy
class(field_t), intent(in) :: dvdz
class(field_t), intent(in) :: dwdx
class(field_t), intent(in) :: dwdy
class(field_t), intent(in) :: dwdz

public subroutine compute_sgs_stress_base(self, stress, nut, gradient_a, gradient_b, scale_a, scale_b)

Forms nut(scale_agradient_a + scale_b*gradient_b).

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(field_t), intent(inout) :: stress
class(field_t), intent(in) :: nut
class(field_t), intent(in) :: gradient_a
class(field_t), intent(in) :: gradient_b
real(kind=dp), intent(in) :: scale_a
real(kind=dp), intent(in) :: scale_b

public subroutine copy_data_to_f_base(self, f, data)

Copy a regular 3D array in host memory into the specialist data structure field that lives on device or host

Arguments

Type IntentOptional Attributes Name
class(base_backend_t), intent(inout) :: self
class(field_t), intent(inout) :: f
real(kind=dp), intent(in), dimension(:, :, :) :: data

public subroutine copy_f_to_data_base(self, data, f)

Copy the specialist data structure from device or host back to a regular 3D data array in host memory.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t), intent(inout) :: self
real(kind=dp), intent(out), dimension(:, :, :) :: data
class(field_t), intent(in) :: f

public subroutine alloc_tdsops_base(self, tdsops, n_tds, delta, operation, scheme, bc_start, bc_end, stretch, stretch_correct, n_halo, from_to, sym, c_nu, nu0_nu, filter_alpha)

Allocates the backend's own tdsops type and fills in the coefficients of the requested operation.

Arguments

Type IntentOptional Attributes Name
class(base_backend_t) :: self
class(tdsops_t), intent(inout), allocatable :: tdsops
integer, intent(in) :: n_tds
real(kind=dp), intent(in) :: delta
character(len=*), intent(in) :: operation
character(len=*), intent(in) :: scheme
integer, intent(in) :: bc_start
integer, intent(in) :: bc_end
real(kind=dp), intent(in), optional :: stretch(:)
real(kind=dp), intent(in), optional :: stretch_correct(:)
integer, intent(in), optional :: n_halo
character(len=*), intent(in), optional :: from_to
logical, intent(in), optional :: sym
real(kind=dp), intent(in), optional :: c_nu
real(kind=dp), intent(in), optional :: nu0_nu
real(kind=dp), intent(in), optional :: filter_alpha

public subroutine init_poisson_fft_base(self, mesh, xdirps, ydirps, zdirps, lowmem)

Allocates and initialises the backend's FFT based Poisson solver.

Arguments

Type IntentOptional Attributes Name
class(base_backend_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
logical, intent(in), optional :: lowmem