aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers@lbl.gov> 2021-01-15 11:24:50 -0800
committerGravatar GitHub <noreply@github.com> 2021-01-15 11:24:50 -0800
commit3af650078efea347ef4522060ef8ca88b2e1e17d (patch)
tree6d74b6fb9c56e9429c004bbf62d48f2999afb9f0 /Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
parent531ba5d42f9b6610393657fdedd8e8cadfa9f853 (diff)
downloadWarpX-3af650078efea347ef4522060ef8ca88b2e1e17d.tar.gz
WarpX-3af650078efea347ef4522060ef8ca88b2e1e17d.tar.zst
WarpX-3af650078efea347ef4522060ef8ca88b2e1e17d.zip
Handle units properly in the particle filter function. (#1598)
* Handle units properly in the particle filter function * have the particle filter func work in normalized units. * need to convert units before * Apply suggestions from code review
Diffstat (limited to 'Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp')
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
index 6b5f94ac8..6676841b2 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
@@ -268,7 +268,7 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir,
for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
WarpXParticleContainer* pc = particle_diags[i].getParticleContainer();
- amrex::ParticleContainer<0, 0, PIdx::nattribs> tmp(pc->GetParGDB());
+ PhysicalParticleContainer tmp(&WarpX::GetInstance());
Vector<std::string> real_names;
Vector<std::string> int_names;
Vector<int> int_flags;
@@ -304,15 +304,16 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir,
}
#endif
- // Convert momentum to SI
pc->ConvertUnits(ConvertDirection::WarpX_to_SI);
RandomFilter const random_filter(particle_diags[i].m_do_random_filter,
particle_diags[i].m_random_fraction);
UniformFilter const uniform_filter(particle_diags[i].m_do_uniform_filter,
particle_diags[i].m_uniform_stride);
- ParserFilter const parser_filter(particle_diags[i].m_do_parser_filter,
- getParser(particle_diags[i].m_particle_filter_parser));
+ ParserFilter parser_filter(particle_diags[i].m_do_parser_filter,
+ getParser(particle_diags[i].m_particle_filter_parser),
+ pc->getMass());
+ parser_filter.m_units = InputUnits::SI;
GeometryFilter const geometry_filter(particle_diags[i].m_do_geom_filter,
particle_diags[i].m_diag_domain);
@@ -332,7 +333,6 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir,
particle_diags[i].plot_flags, int_flags,
real_names, int_names);
- // Convert momentum back to WarpX units
pc->ConvertUnits(ConvertDirection::SI_to_WarpX);
}
}