diff options
author | 2019-06-20 16:22:24 -0700 | |
---|---|---|
committer | 2019-06-20 16:22:24 -0700 | |
commit | ae9fdb55a96d44f411d93c5bddcc31ea3be0c0dd (patch) | |
tree | e7b78ba43f53fb5a25544f9f62b58c7756d7a50b /Source/Diagnostics/ParticleIO.cpp | |
parent | 7e0bae5661709febce5c40db627f4a3f5dfeee84 (diff) | |
parent | b1beba190f3a4b55f1ec16a1b0c81dfcabfa5b95 (diff) | |
download | WarpX-ae9fdb55a96d44f411d93c5bddcc31ea3be0c0dd.tar.gz WarpX-ae9fdb55a96d44f411d93c5bddcc31ea3be0c0dd.tar.zst WarpX-ae9fdb55a96d44f411d93c5bddcc31ea3be0c0dd.zip |
Merge branch 'dev' of https://github.com/ECP-WarpX/WarpX into SliceGeneration_with_yt_compliance_for_viz
Diffstat (limited to 'Source/Diagnostics/ParticleIO.cpp')
-rw-r--r-- | Source/Diagnostics/ParticleIO.cpp | 85 |
1 files changed, 81 insertions, 4 deletions
diff --git a/Source/Diagnostics/ParticleIO.cpp b/Source/Diagnostics/ParticleIO.cpp index ba413dcae..f2a543ed5 100644 --- a/Source/Diagnostics/ParticleIO.cpp +++ b/Source/Diagnostics/ParticleIO.cpp @@ -5,6 +5,53 @@ using namespace amrex; void +RigidInjectedParticleContainer::ReadHeader (std::istream& is) +{ + is >> charge >> mass; + WarpX::GotoNextLine(is); + + int nlevs; + is >> nlevs; + WarpX::GotoNextLine(is); + + AMREX_ASSERT(zinject_plane_levels.size() == 0); + AMREX_ASSERT(done_injecting.size() == 0); + + for (int i = 0; i < nlevs; ++i) + { + int zinject_plane_tmp; + is >> zinject_plane_tmp; + zinject_plane_levels.push_back(zinject_plane_tmp); + WarpX::GotoNextLine(is); + } + + for (int i = 0; i < nlevs; ++i) + { + int done_injecting_tmp; + is >> done_injecting_tmp; + done_injecting.push_back(done_injecting_tmp); + WarpX::GotoNextLine(is); + } +} + +void +RigidInjectedParticleContainer::WriteHeader (std::ostream& os) const +{ + // no need to write species_id + os << charge << " " << mass << "\n"; + int nlevs = zinject_plane_levels.size(); + os << nlevs << "\n"; + for (int i = 0; i < nlevs; ++i) + { + os << zinject_plane_levels[i] << "\n"; + } + for (int i = 0; i < nlevs; ++i) + { + os << done_injecting[i] << "\n"; + } +} + +void WarpXParticleContainer::ReadHeader (std::istream& is) { is >> charge >> mass; @@ -27,15 +74,45 @@ MultiParticleContainer::Checkpoint (const std::string& dir) const } void -MultiParticleContainer::WritePlotFile (const std::string& dir, - const Vector<std::string>& real_names) const +MultiParticleContainer::WritePlotFile (const std::string& dir) const { Vector<std::string> int_names; Vector<int> int_flags; - + for (unsigned i = 0, n = species_names.size(); i < n; ++i) { - auto& pc = allcontainers[i]; + auto& pc = allcontainers[i]; if (pc->plot_species) { + + Vector<std::string> real_names; + real_names.push_back("weight"); + + real_names.push_back("momentum_x"); + real_names.push_back("momentum_y"); + real_names.push_back("momentum_z"); + + real_names.push_back("Ex"); + real_names.push_back("Ey"); + real_names.push_back("Ez"); + + real_names.push_back("Bx"); + real_names.push_back("By"); + real_names.push_back("Bz"); + +#ifdef WARPX_RZ + real_names.push_back("theta"); +#endif + + if (WarpX::do_boosted_frame_diagnostic && pc->DoBoostedFrameDiags()) + { + real_names.push_back("xold"); + real_names.push_back("yold"); + real_names.push_back("zold"); + + real_names.push_back("uxold"); + real_names.push_back("uyold"); + real_names.push_back("uzold"); + } + // Convert momentum to SI pc->ConvertUnits(ConvertDirection::WarpX_to_SI); // real_names contains a list of all particle attributes. |