diff options
author | 2023-08-20 14:26:37 -0700 | |
---|---|---|
committer | 2023-08-20 14:26:37 -0700 | |
commit | 5b74a61c631102a1c121a3668d0c02098c259b9b (patch) | |
tree | 818d73a3b4b75cf191b51e0bdb581b145d63b0eb /Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp | |
parent | 9ce0b9c2cbd8f4881347a3f0d5a6cbf04c7a7919 (diff) | |
download | WarpX-5b74a61c631102a1c121a3668d0c02098c259b9b.tar.gz WarpX-5b74a61c631102a1c121a3668d0c02098c259b9b.tar.zst WarpX-5b74a61c631102a1c121a3668d0c02098c259b9b.zip |
Include `J` in diagnostic output when an electromagnetic solver is not used (#4116)
* include current density in diagnostic output even if an electromagnetic solver is not used
* do not redeposit current for the magnetostatic solver
* update CI benchmarks for tests that previously did not register current density
* fix remaining failing CI test
* Apply suggestions from code review
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
* do not output current density in collision tests
* update `JFunctor` constructor doc-string
* code cleanup - reduce code duplication
* specify `Ex Ey Ez Bx By Bz` fields to plot for collision CI tests
* specify `Er Et Ez Br Bt Bz` as output for rz collision test
* rename `InterpolateToDst` to `InterpolateMFForDiag`
* only deposit current density once per diagnostic output (if not already deposited)
* write deposited current for all directions into `current_fp` during diagnostic step deposition
* use `amrex::make_alias` to directly deposit current density into `warpx.current_fp` during diagnostic step deposition
* add class variable `solver_deposits_current` to `FullDiagnostics` so that there is only one place where the determination is made whether current should be deposited during diagnostic output
* correct logic to determine `m_solver_deposits_current`
---------
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Diffstat (limited to 'Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp')
-rw-r--r-- | Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp index f43714a9c..fe5037131 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp +++ b/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.cpp @@ -1,11 +1,6 @@ #include "CellCenterFunctor.H" -#include "Utils/TextMsg.H" -#ifdef WARPX_DIM_RZ -# include "WarpX.H" -#endif - -#include <ablastr/coarsen/sample.H> +#include "WarpX.H" #include <AMReX.H> #include <AMReX_IntVect.H> @@ -21,29 +16,7 @@ CellCenterFunctor::CellCenterFunctor(amrex::MultiFab const * mf_src, int lev, void CellCenterFunctor::operator()(amrex::MultiFab& mf_dst, int dcomp, const int /*i_buffer*/) const { -#ifdef WARPX_DIM_RZ - if (m_convertRZmodes2cartesian) { - // In cylindrical geometry, sum real part of all modes of m_mf_src in - // temporary multifab mf_dst_stag, and cell-center it to mf_dst. - WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - nComp()==1, - "The RZ averaging over modes must write into 1 single component"); - auto& warpx = WarpX::GetInstance(); - amrex::MultiFab mf_dst_stag(m_mf_src->boxArray(), warpx.DistributionMap(m_lev), 1, m_mf_src->nGrowVect()); - // Mode 0 - amrex::MultiFab::Copy(mf_dst_stag, *m_mf_src, 0, 0, 1, m_mf_src->nGrowVect()); - for (int ic=1 ; ic < m_mf_src->nComp() ; ic += 2) { - // All modes > 0 - amrex::MultiFab::Add(mf_dst_stag, *m_mf_src, ic, 0, 1, m_mf_src->nGrowVect()); - } - ablastr::coarsen::sample::Coarsen( mf_dst, mf_dst_stag, dcomp, 0, nComp(), 0, m_crse_ratio); - } else { - ablastr::coarsen::sample::Coarsen( mf_dst, *m_mf_src, dcomp, 0, nComp(), 0, m_crse_ratio); - } -#else - // In cartesian geometry, coarsen and interpolate from simulation MultiFab, m_mf_src, - // to output diagnostic MultiFab, mf_dst. - ablastr::coarsen::sample::Coarsen(mf_dst, *m_mf_src, dcomp, 0, nComp(), mf_dst.nGrowVect(), m_crse_ratio); - amrex::ignore_unused(m_lev, m_convertRZmodes2cartesian); -#endif + auto& warpx = WarpX::GetInstance(); + InterpolateMFForDiag(mf_dst, *m_mf_src, dcomp, warpx.DistributionMap(m_lev), + m_convertRZmodes2cartesian); } |