aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/ComputeDiagFunctors
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2020-10-26 13:09:50 -0700
committerGravatar GitHub <noreply@github.com> 2020-10-26 13:09:50 -0700
commit1140e9f8c3c20c969363dddfc184696f27c2ac72 (patch)
tree264fb581c547fef4d7774bf622dc9bd1fedb168f /Source/Diagnostics/ComputeDiagFunctors
parente85b70c01aa81f28958e8d9080a220f06a08250a (diff)
downloadWarpX-1140e9f8c3c20c969363dddfc184696f27c2ac72.tar.gz
WarpX-1140e9f8c3c20c969363dddfc184696f27c2ac72.tar.zst
WarpX-1140e9f8c3c20c969363dddfc184696f27c2ac72.zip
Filter diagnostic rho (#1295)
* First cut of adding filtering of rho diagnostic - not yet working * Fixed the handling of parallel transfers in RhoFunctor when filtering is turned on * Fixed end of line space * In RhoFunctor, only do kspace filter with RZ and PSATD * PICMI analytic applied fields (#1306) * PICMI Added applied fields * PICMI fixed typo in Constants * Change picmistandard version requirement to 0.0.9 * Increment required picmi version Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Updated checksums with filter of diagnostic rho * Fix comment in rho diagnostic * Updated LaserIonAcc2d benchmark after filtering rho * Update galilean_rz_psatd benchmark with filtering of rho Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
Diffstat (limited to 'Source/Diagnostics/ComputeDiagFunctors')
-rw-r--r--Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp
index c8ccb2ded..e48703e91 100644
--- a/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp
+++ b/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp
@@ -2,6 +2,10 @@
#include "RhoFunctor.H"
#include "Utils/CoarsenIO.H"
+#ifdef WARPX_DIM_RZ
+#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#endif
+
#include <AMReX.H>
RhoFunctor::RhoFunctor (const int lev,
@@ -21,17 +25,36 @@ RhoFunctor::operator() ( amrex::MultiFab& mf_dst, const int dcomp, const int /*i
auto& warpx = WarpX::GetInstance();
std::unique_ptr<amrex::MultiFab> rho;
+ // Deposit charge density
+ // Call this with local=true since the parallel transfers will be handled
+ // by ApplyFilterandSumBoundaryRho
+
// Dump total rho
if (m_species_index == -1) {
auto& mypc = warpx.GetPartContainer();
- rho = mypc.GetChargeDensity(m_lev);
+ rho = mypc.GetChargeDensity(m_lev, true);
}
// Dump rho per species
else {
auto& mypc = warpx.GetPartContainer().GetParticleContainer(m_species_index);
- rho = mypc.GetChargeDensity(m_lev);
+ rho = mypc.GetChargeDensity(m_lev, true);
}
+ // Handle the parallel transfers of guard cells and
+ // apply the filtering if requested.
+ warpx.ApplyFilterandSumBoundaryRho(m_lev, m_lev, *rho, 0, rho->nComp());
+
+#if (defined WARPX_DIM_RZ) && (defined WARPX_USE_PSATD)
+ using Idx = SpectralAvgFieldIndex;
+ if (WarpX::use_kspace_filter) {
+ auto & solver = warpx.get_spectral_solver_fp(m_lev);
+ solver.ForwardTransform(*rho, Idx::rho_new);
+ solver.ApplyFilter(Idx::rho_new);
+ solver.BackwardTransform(*rho, Idx::rho_new);
+ }
+#endif
+
+
#ifdef WARPX_DIM_RZ
if (m_convertRZmodes2cartesian) {
// In cylindrical geometry, sum real part of all modes of rho in