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, int is_periodic_z=1, const amrex::Array4< amrex::Real > *zheight=nullptr)
 Helper function to interpolate multiple field values at a particle position. 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,
int  is_periodic_z = 1,
const amrex::Array4< amrex::Real > *  zheight = nullptr 
)

Helper function to interpolate multiple field values at a particle position.

This function interpolates values from multiple field arrays at a particle's position using the cloud-in-cell (CIC) interpolation method. It supports both periodic and non-periodic z-boundaries.

Template Parameters
ParticleTypeThe type of particle
Parameters
pThe particle
ploThe domain lower bounds
dxiThe inverse of cell spacing
field_arraysArray of field arrays to interpolate from
result_valuesOutput array to store interpolated values
num_fieldsNumber of fields to interpolate
is_periodic_zWhether the z-boundary is periodic
zheightHeight field array (only used for non-periodic z-boundary)
46  {
47  // Iterate over each field and interpolate its value at the particle position
48  for (int i = 0; i < num_fields; ++i) {
49  if (is_periodic_z != 0) {
50  cic_interpolate(p, plo, dxi, field_arrays[i], &result_values[i], 1);
51  } else {
52  cic_interpolate_mapped_z(p, plo, dxi, field_arrays[i], *zheight, &result_values[i], 1);
53  }
54  }
55 }
Real * p
Definition: ERF_InitCustomPert_SquallLine.H:61