Skip to content

Commit

Permalink
BTD fields with RZ + openPMD - single mode only (ECP-WarpX#3350)
Browse files Browse the repository at this point in the history
* cell center BTD functors for RZ with openpmd

* add RZ modes to output varnames too

* update varnames once and set map for RZ fields in BTfunctor

* fix access to varname field instead of unallocated m_varnames, and update hi ki-index after flush

* set back trasnformed fields to false if fields_to_plot is none. Separate PArticle and Field io further. Also, clean up Particle Buffer initialize so its consistent with Field box, boxarray, dmap, and geom

* clean commented line

* assert for single rz mode

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove unused var

* Apply suggestions from code review

From Axels' review

Co-authored-by: Axel Huebl <[email protected]>

* adding comments, doxygen, and clean-up

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Axel Huebl <[email protected]>
  • Loading branch information
3 people authored and dpgrote committed Nov 22, 2022
1 parent 9626fac commit b1484bc
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 118 deletions.
31 changes: 31 additions & 0 deletions Source/Diagnostics/BTDiagnostics.H
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ private:
* is initialized.
*/
void InitializeFieldFunctors (int lev) override;
/** Initialize functors that store pointers to the fields in RZ requested by the user.
* Additionally, the cell-center functors that stores pointers to all fields,
* namely, Er, Et, Ez, Br, Bt, Bz, jr, jt, jz, and rho is also initialized.
* \param[in] lev level on which the vector of unique_ptrs to field functors
* is initialized.
*/
void InitializeFieldFunctorsRZopenPMD (int lev) override;
/** Populating m_varnames with real and imaginary parts of each RZ mode.
* Modes are numbered from 0 to (nmodes-1) and mode 0 is purely real.
* Both m_cellcenter_varnames (storing cell-centered data) and
* m_varnames (storing back-transformed field data) are modified to include RZ modes to include
* field_modeid_real/imag. For example, for Er with two modes, the varnames are
* Er_0_real, Er_1_real, Er_1_imag
* \param[in] field field-name
* \param[in] ncomp number of rz components (if 2 modes, the ncomp is 2*nmodes-1)
* \param[in] cellcenter_data if true, m_cellcenter_varnames are updated
if false, m_varnames is updated
*/
void AddRZModesToOutputNames (const std::string& field, const int ncomp, bool cellcenter_data);
/** This function allocates and initializes particle buffers for all the snapshots.
* This is currently an empty function:
* The particle containers required for this must be added to populate this function.
Expand Down Expand Up @@ -313,9 +332,20 @@ private:
* All the fields are stored regardless of the specific fields to plot selected
* by the user.
*/
#ifdef WARPX_DIM_RZ
amrex::Vector< std::string > m_cellcenter_varnames = {"Er", "Et", "Ez",
"Br", "Bt", "Bz",
"jr", "jt", "jz", "rho"};
amrex::Vector< std::string > m_cellcenter_varnames_fields = {"Er", "Et", "Ez",
"Br", "Bt", "Bz",
"jr", "jt", "jz",
"rho"};
#else
amrex::Vector< std::string > m_cellcenter_varnames = {"Ex", "Ey", "Ez",
"Bx", "By", "Bz",
"jx", "jy", "jz", "rho"};
#endif


/** Merge the lab-frame buffer multifabs so it can be visualized as
* a single plotfile
Expand Down Expand Up @@ -356,6 +386,7 @@ private:
void ClearParticleBuffer(int i_buffer);
/** Redistributes particles to the buffer box array in the lab-frame */
void RedistributeParticleBuffer (const int i_buffer);
void UpdateVarnamesForRZopenPMD();

};
#endif // WARPX_BTDIAGNOSTICS_H_
Loading

0 comments on commit b1484bc

Please sign in to comment.