ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF::Interpolation Namespace Reference

Functions

template<typename ParticleType >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void interpolateFields (const ParticleType &p, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &plo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxi, const amrex::Array4< const amrex::Real > *field_arrays, amrex::ParticleReal *result_values, int num_fields)
 Interpolate multiple field values at a particle position using CIC. More...
 
template<typename ParticleType , typename Array4Type >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE bool stencilOutOfBoundsZ (const ParticleType &p, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &plo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxi, const Array4Type &zheight) noexcept
 Test whether a particle's vertical CIC stencil reads past the local fab. cic_interpolate reads cell-centered data at k0+1 and k0+2 with k0 in {pk-1, pk}, so the maximum read offset is pk+2. Returns true if the stencil is out of bounds and the caller should skip the particle. More...
 

Function Documentation

◆ interpolateFields()

template<typename ParticleType >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void ERF::Interpolation::interpolateFields ( const ParticleType &  p,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  plo,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  dxi,
const amrex::Array4< const amrex::Real > *  field_arrays,
amrex::ParticleReal *  result_values,
int  num_fields 
)

Interpolate multiple field values at a particle position using CIC.

31  {
32  for (int i = 0; i < num_fields; ++i) {
33  cic_interpolate(p, plo, dxi, field_arrays[i], &result_values[i], 1);
34  }
35 }
@ p
Definition: ERF_WSM6.H:191

◆ stencilOutOfBoundsZ()

template<typename ParticleType , typename Array4Type >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE bool ERF::Interpolation::stencilOutOfBoundsZ ( const ParticleType &  p,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  plo,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  dxi,
const Array4Type &  zheight 
)
noexcept

Test whether a particle's vertical CIC stencil reads past the local fab. cic_interpolate reads cell-centered data at k0+1 and k0+2 with k0 in {pk-1, pk}, so the maximum read offset is pk+2. Returns true if the stencil is out of bounds and the caller should skip the particle.

52 {
53  const int pk = int(amrex::Math::floor((p.pos(AMREX_SPACEDIM-1) - plo[AMREX_SPACEDIM-1])
54  * dxi[AMREX_SPACEDIM-1]));
55  return (pk < zheight.begin[2] || pk + 2 >= zheight.end[2]);
56 }