8 #ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_
9 #define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_
19 #include <AMReX_Config.H>
37 #include <type_traits>
87 template<
typename ReduceOp>
90 using namespace amrex::literals;
95 constexpr
int lev = 0;
116 constexpr
int reduction_comp = 0;
120 using ReduceTuple =
typename decltype(reduce_data)::Type;
134 for (
int i = 0;
i < AMREX_SPACEDIM; ++
i){
152 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
159 const auto& arrEx = Ex[mfi].
array();
160 const auto& arrEy = Ey[mfi].
array();
161 const auto& arrEz = Ez[mfi].
array();
162 const auto& arrBx = Bx[mfi].
array();
163 const auto& arrBy = By[mfi].
array();
164 const auto& arrBz = Bz[mfi].
array();
165 const auto& arrjx = jx[mfi].
array();
166 const auto& arrjy = jy[mfi].
array();
167 const auto& arrjz = jz[mfi].
array();
169 reduce_op.
eval(box, reduce_data,
174 #if defined(WARPX_DIM_1D_Z)
175 const amrex::Real
x = 0._rt;
176 const amrex::Real y = 0._rt;
177 const amrex::Real z = (k + 0.5_rt)*
dx[0] + real_box.
lo(0);
178 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
179 const amrex::Real
x = (
i + 0.5_rt)*
dx[0] + real_box.
lo(0);
180 const amrex::Real y = 0._rt;
181 const amrex::Real z = (j + 0.5_rt)*
dx[1] + real_box.
lo(1);
183 const amrex::Real
x = (
i + 0.5_rt)*
dx[0] + real_box.
lo(0);
184 const amrex::Real y = (j + 0.5_rt)*
dx[1] + real_box.
lo(1);
185 const amrex::Real z = (k + 0.5_rt)*
dx[2] + real_box.
lo(2);
188 reduction_coarsening_ratio,
i, j, k, reduction_comp);
190 reduction_coarsening_ratio,
i, j, k, reduction_comp);
192 reduction_coarsening_ratio,
i, j, k, reduction_comp);
194 reduction_coarsening_ratio,
i, j, k, reduction_comp);
196 reduction_coarsening_ratio,
i, j, k, reduction_comp);
198 reduction_coarsening_ratio,
i, j, k, reduction_comp);
200 reduction_coarsening_ratio,
i, j, k, reduction_comp);
202 reduction_coarsening_ratio,
i, j, k, reduction_comp);
204 reduction_coarsening_ratio,
i, j, k, reduction_comp);
206 return reduction_function_parser(
x, y, z, Ex_interp, Ey_interp, Ez_interp,
207 Bx_interp, By_interp, Bz_interp,
208 jx_interp, jy_interp, jz_interp);
212 amrex::Real reduce_value = amrex::get<0>(reduce_data.
value());
228 #if defined(WARPX_DIM_1D_Z)
229 reduce_value *=
dx[0];
230 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
231 reduce_value *=
dx[0]*
dx[1];
233 reduce_value *=
dx[0]*
dx[1]*
dx[2];
Definition: FieldReduction.H:46
static constexpr int m_nvars
Definition: FieldReduction.H:72
FieldReduction(const std::string &rd_name)
Definition: FieldReduction.cpp:25
int m_reduction_type
Definition: FieldReduction.H:76
void BackwardCompatibility()
Definition: FieldReduction.cpp:90
void ComputeFieldReduction()
Definition: FieldReduction.H:88
void ComputeDiags(int step) final
Definition: FieldReduction.cpp:103
std::unique_ptr< amrex::Parser > m_parser
Definition: FieldReduction.H:73
Definition: ReducedDiags.H:24
std::vector< amrex::Real > m_data
output data
Definition: ReducedDiags.H:49
static WarpX & GetInstance()
Definition: WarpX.cpp:239
GpuArray< Real, AMREX_SPACEDIM > CellSizeArray() const noexcept
IndexType ixType() const noexcept
Array4< typename FabArray< FArrayBox >::value_type const > array(const MFIter &mfi) const noexcept
const RealBox & ProbDomain() const noexcept
AMREX_GPU_HOST_DEVICE const Real * lo() const &noexcept
std::enable_if_t< IsFabArray< MF >::value > eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Interp(amrex::Array4< amrex::Real const > const &arr_src, amrex::GpuArray< int, 3 > const &sf, amrex::GpuArray< int, 3 > const &sc, amrex::GpuArray< int, 3 > const &cr, const int i, const int j, const int k, const int comp)
Interpolates the floating point data contained in the source Array4 arr_src, extracted from a fine Mu...
Definition: sample.H:49
void ReduceRealMin(Vector< std::reference_wrapper< Real > > const &)
void ReduceRealSum(Vector< std::reference_wrapper< Real > > const &)
void ReduceRealMax(Vector< std::reference_wrapper< Real > > const &)
bool TilingIfNotGPU() noexcept
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Box enclosedCells(const Box &b, int dir) noexcept
i
Definition: check_interp_points_and_weights.py:174
tuple dx
lab frame
Definition: stencil.py:429
value
Definition: updateAMReX.py:141