Skip to content

Commit

Permalink
Merge branch 'development' into WindModels_GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Jul 2, 2024
2 parents 757c24e + 2b24783 commit 4fee4bc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/IO/Plotfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ ERF::WritePlotFile (int which, Vector<std::string> plot_var_names)
writeJobInfo(plotfilename);

#ifdef ERF_USE_PARTICLES
particleData.Checkpoint(plotfilename);
particleData.writePlotFile(plotfilename);
#endif
#ifdef ERF_USE_HDF5
} else if (plotfile_type == "hdf5" || plotfile_type == "HDF5") {
Expand Down Expand Up @@ -1398,7 +1398,7 @@ ERF::WritePlotFile (int which, Vector<std::string> plot_var_names)
writeJobInfo(plotfilename);

#ifdef ERF_USE_PARTICLES
particleData.Checkpoint(plotfilename);
particleData.writePlotFile(plotfilename);
#endif

#ifdef ERF_USE_NETCDF
Expand Down
21 changes: 21 additions & 0 deletions Source/Particles/ParticleData.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class ParticleData
ParticleData ()
{
BL_PROFILE("ParticleData::ParticleData()");

amrex::ParmParse pp("particles");
m_disable_particle_op = false;
pp.query("disable_plt", m_disable_particle_op);

m_particle_species.clear();
m_namelist.clear();
m_namelist_unalloc.clear();
Expand All @@ -50,6 +55,19 @@ class ParticleData
m_namelist_unalloc.clear();
}

/*! Write particle info to plot files */
void writePlotFile ( const std::string& a_fname ) const
{
BL_PROFILE("ParticleData::writePlotFile");
if (!m_disable_particle_op) {
for (ParticlesNamesVector::size_type i = 0; i < m_namelist.size(); i++) {
auto name( m_namelist[i] );
auto particles( m_particle_species.at(name) );
particles->Checkpoint( a_fname, name, true, particles->varNames() );
}
}
}

/*! Write checkpoint files */
void Checkpoint ( const std::string& a_fname ) const
{
Expand Down Expand Up @@ -234,6 +252,9 @@ class ParticleData
ParticlesNamesVector m_namelist;
/*! List with names of unallocated species */
ParticlesNamesList m_namelist_unalloc;

/*! Disable particle output in plotfile? (because expensive) */
bool m_disable_particle_op;
};

#endif
Expand Down

0 comments on commit 4fee4bc

Please sign in to comment.