aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/ReducedDiags/FieldReduction.H
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Diagnostics/ReducedDiags/FieldReduction.H')
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldReduction.H34
1 files changed, 31 insertions, 3 deletions
diff --git a/Source/Diagnostics/ReducedDiags/FieldReduction.H b/Source/Diagnostics/ReducedDiags/FieldReduction.H
index 46fcfc295..c4c81c016 100644
--- a/Source/Diagnostics/ReducedDiags/FieldReduction.H
+++ b/Source/Diagnostics/ReducedDiags/FieldReduction.H
@@ -60,10 +60,16 @@ public:
*/
virtual void ComputeDiags(int step) override final;
+ /**
+ * This function queries deprecated input parameters and aborts
+ * the run if one of them is specified.
+ */
+ void BackwardCompatibility();
+
private:
/// Parser to read expression to be reduced from the input file.
- /// 9 elements are x, y, z, Ex, Ey, Ez, Bx, By, Bz
- static constexpr int m_nvars = 9;
+ /// 12 elements are x, y, z, Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz
+ static constexpr int m_nvars = 12;
std::unique_ptr<amrex::Parser> m_parser;
// Type of reduction (e.g. Maximum, Minimum or Sum)
@@ -99,6 +105,10 @@ public:
const amrex::MultiFab & Bx = warpx.getBfield(lev,0);
const amrex::MultiFab & By = warpx.getBfield(lev,1);
const amrex::MultiFab & Bz = warpx.getBfield(lev,2);
+ const amrex::MultiFab & jx = warpx.getcurrent_fp(lev,0);
+ const amrex::MultiFab & jy = warpx.getcurrent_fp(lev,1);
+ const amrex::MultiFab & jz = warpx.getcurrent_fp(lev,2);
+
// General preparation of interpolation and reduction operations
const amrex::GpuArray<int,3> cellCenteredtype{0,0,0};
@@ -118,6 +128,9 @@ public:
auto Bxtype = amrex::GpuArray<int,3>{0,0,0};
auto Bytype = amrex::GpuArray<int,3>{0,0,0};
auto Bztype = amrex::GpuArray<int,3>{0,0,0};
+ auto jxtype = amrex::GpuArray<int,3>{0,0,0};
+ auto jytype = amrex::GpuArray<int,3>{0,0,0};
+ auto jztype = amrex::GpuArray<int,3>{0,0,0};
for (int i = 0; i < AMREX_SPACEDIM; ++i){
Extype[i] = Ex.ixType()[i];
Eytype[i] = Ey.ixType()[i];
@@ -125,6 +138,10 @@ public:
Bxtype[i] = Bx.ixType()[i];
Bytype[i] = By.ixType()[i];
Bztype[i] = Bz.ixType()[i];
+ jxtype[i] = jx.ixType()[i];
+ jytype[i] = jy.ixType()[i];
+ jztype[i] = jz.ixType()[i];
+
}
// get parser
@@ -145,6 +162,9 @@ public:
const auto& arrBx = Bx[mfi].array();
const auto& arrBy = By[mfi].array();
const auto& arrBz = Bz[mfi].array();
+ const auto& arrjx = jx[mfi].array();
+ const auto& arrjy = jy[mfi].array();
+ const auto& arrjz = jz[mfi].array();
reduce_op.eval(box, reduce_data,
[=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
@@ -176,8 +196,16 @@ public:
reduction_coarsening_ratio, i, j, k, reduction_comp);
const amrex::Real Bz_interp = ablastr::coarsen::sample::Interp(arrBz, Bztype, cellCenteredtype,
reduction_coarsening_ratio, i, j, k, reduction_comp);
+ const amrex::Real jx_interp = ablastr::coarsen::sample::Interp(arrjx, jxtype, cellCenteredtype,
+ reduction_coarsening_ratio, i, j, k, reduction_comp);
+ const amrex::Real jy_interp = ablastr::coarsen::sample::Interp(arrjy, jytype, cellCenteredtype,
+ reduction_coarsening_ratio, i, j, k, reduction_comp);
+ const amrex::Real jz_interp = ablastr::coarsen::sample::Interp(arrjz, jztype, cellCenteredtype,
+ reduction_coarsening_ratio, i, j, k, reduction_comp);
+
return reduction_function_parser(x, y, z, Ex_interp, Ey_interp, Ez_interp,
- Bx_interp, By_interp, Bz_interp);
+ Bx_interp, By_interp, Bz_interp,
+ jx_interp, jy_interp, jz_interp);
});
}