aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2022-06-24 00:20:19 -0700
committerGravatar GitHub <noreply@github.com> 2022-06-24 00:20:19 -0700
commitf8cf3bc6276aab1d66b32a383c2021592676d69d (patch)
tree923cac9f50a5d227785dfa7e2547159571b905bf /Source
parent6be401a3c7322e64efc91a89bf9644bca83f2db9 (diff)
downloadWarpX-f8cf3bc6276aab1d66b32a383c2021592676d69d.tar.gz
WarpX-f8cf3bc6276aab1d66b32a383c2021592676d69d.tar.zst
WarpX-f8cf3bc6276aab1d66b32a383c2021592676d69d.zip
Added `none` as an option for fields_to_plot (#2419)
* Added `none` as an option for fields_to_plot * Added CI test case * Further updates, for picmi and CI tests * Skip the call to amrex::WriteMultiLevelPlotfile when writing no fields * Now clears m_varnames_fields * Don't allocate m_mf_output if no varnames * Updated WarpX-tests.ini
Diffstat (limited to 'Source')
-rw-r--r--Source/Diagnostics/Diagnostics.cpp4
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp20
-rw-r--r--Source/Diagnostics/FullDiagnostics.cpp5
3 files changed, 19 insertions, 10 deletions
diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp
index caf9aea13..3259994bd 100644
--- a/Source/Diagnostics/Diagnostics.cpp
+++ b/Source/Diagnostics/Diagnostics.cpp
@@ -169,6 +169,10 @@ Diagnostics::BaseReadParameters ()
);
}
+ if (WarpXUtilStr::is_in(m_varnames_fields, "none")){
+ m_varnames_fields.clear();
+ }
+
m_varnames = m_varnames_fields;
// Generate names of averaged particle fields and append to m_varnames
for (int ivar=0; ivar<m_pfield_varnames.size(); ivar++) {
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
index 4655128d5..513d97f3a 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
@@ -71,15 +71,17 @@ FlushFormatPlotfile::WriteToFile (
VisMF::Header::Version current_version = VisMF::GetHeaderVersion();
VisMF::SetHeaderVersion(amrex::VisMF::Header::Version_v1);
if (plot_raw_fields) rfs.emplace_back("raw_fields");
- amrex::WriteMultiLevelPlotfile(filename, nlev,
- amrex::GetVecOfConstPtrs(mf),
- varnames, geom,
- static_cast<Real>(time), iteration, warpx.refRatio(),
- "HyperCLaw-V1.1",
- "Level_",
- "Cell",
- rfs
- );
+ if (varnames.size() > 0) {
+ amrex::WriteMultiLevelPlotfile(filename, nlev,
+ amrex::GetVecOfConstPtrs(mf),
+ varnames, geom,
+ static_cast<Real>(time), iteration, warpx.refRatio(),
+ "HyperCLaw-V1.1",
+ "Level_",
+ "Cell",
+ rfs
+ );
+ }
WriteAllRawFields(plot_raw_fields, nlev, filename, plot_raw_fields_guards);
diff --git a/Source/Diagnostics/FullDiagnostics.cpp b/Source/Diagnostics/FullDiagnostics.cpp
index cb51301ee..5fb9abbcb 100644
--- a/Source/Diagnostics/FullDiagnostics.cpp
+++ b/Source/Diagnostics/FullDiagnostics.cpp
@@ -541,7 +541,10 @@ FullDiagnostics::InitializeBufferData (int i_buffer, int lev ) {
// Allocate output MultiFab for diagnostics. The data will be stored at cell-centers.
int ngrow = (m_format == "sensei" || m_format == "ascent") ? 1 : 0;
// The zero is hard-coded since the number of output buffers = 1 for FullDiagnostics
- m_mf_output[i_buffer][lev] = amrex::MultiFab(ba, dmap, static_cast<int>(m_varnames.size()), ngrow);
+ int const ncomp = static_cast<int>(m_varnames.size());
+ if (ncomp > 0) {
+ m_mf_output[i_buffer][lev] = amrex::MultiFab(ba, dmap, ncomp, ngrow);
+ }
if (lev == 0) {