8 #ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_
9 #define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_
18 #include <AMReX_Config.H>
36 #include <type_traits>
81 template<
typename ReduceOp>
84 using namespace amrex::literals;
89 constexpr
int lev = 0;
106 constexpr
int reduction_comp = 0;
110 using ReduceTuple =
typename decltype(reduce_data)::Type;
121 for (
int i = 0;
i < AMREX_SPACEDIM; ++
i){
135 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
141 const amrex::Box& box = enclosedCells(mfi.nodaltilebox());
142 const auto& arrEx = Ex[mfi].
array();
143 const auto& arrEy = Ey[mfi].
array();
144 const auto& arrEz = Ez[mfi].
array();
145 const auto& arrBx = Bx[mfi].
array();
146 const auto& arrBy = By[mfi].
array();
147 const auto& arrBz = Bz[mfi].
array();
149 reduce_op.
eval(box, reduce_data,
154 #if defined(WARPX_DIM_1D_Z)
155 const amrex::Real
x = 0._rt;
156 const amrex::Real
y = 0._rt;
157 const amrex::Real
z = (k + 0.5_rt)*
dx[0] + real_box.
lo(0);
158 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
159 const amrex::Real
x = (
i + 0.5_rt)*
dx[0] + real_box.
lo(0);
160 const amrex::Real
y = 0._rt;
161 const amrex::Real
z = (j + 0.5_rt)*
dx[1] + real_box.
lo(1);
163 const amrex::Real
x = (
i + 0.5_rt)*
dx[0] + real_box.
lo(0);
164 const amrex::Real
y = (j + 0.5_rt)*
dx[1] + real_box.
lo(1);
165 const amrex::Real
z = (k + 0.5_rt)*
dx[2] + real_box.
lo(2);
168 reduction_coarsening_ratio,
i, j, k, reduction_comp);
170 reduction_coarsening_ratio,
i, j, k, reduction_comp);
172 reduction_coarsening_ratio,
i, j, k, reduction_comp);
174 reduction_coarsening_ratio,
i, j, k, reduction_comp);
176 reduction_coarsening_ratio,
i, j, k, reduction_comp);
178 reduction_coarsening_ratio,
i, j, k, reduction_comp);
179 return reduction_function_parser(
x,
y,
z, Ex_interp, Ey_interp, Ez_interp,
180 Bx_interp, By_interp, Bz_interp);
184 amrex::Real reduce_value = amrex::get<0>(reduce_data.
value());
200 #if defined(WARPX_DIM_1D_Z)
201 reduce_value *=
dx[0];
202 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
203 reduce_value *=
dx[0]*
dx[1];
205 reduce_value *=
dx[0]*
dx[1]*
dx[2];
Definition: FieldReduction.H:46
static constexpr int m_nvars
Definition: FieldReduction.H:66
virtual void ComputeDiags(int step) override final
Definition: FieldReduction.cpp:89
int m_reduction_type
Definition: FieldReduction.H:70
void ComputeFieldReduction()
Definition: FieldReduction.H:82
FieldReduction(std::string rd_name)
Definition: FieldReduction.cpp:25
std::unique_ptr< amrex::Parser > m_parser
Definition: FieldReduction.H:67
Definition: ReducedDiags.H:24
std::vector< amrex::Real > m_data
output data
Definition: ReducedDiags.H:46
static WarpX & GetInstance()
Definition: WarpX.cpp:309
GpuArray< Real, AMREX_SPACEDIM > CellSizeArray() const noexcept
IndexType ixType() const noexcept
Array4< typename FabArray< FAB >::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)
def y
Definition: Excitation_Flag_Generator.py:76
def x
Formats datastring to remove "+" at the end of the string #####.
Definition: Excitation_Flag_Generator.py:75
def z
Definition: Excitation_Flag_Generator.py:77
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:50
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
i
Definition: check_interp_points_and_weights.py:174
int dx
Definition: stencil.py:436
value
Definition: updateAMReX.py:141
Definition: NCIGodfreyTables.H:14