diff options
author | 2019-03-26 13:05:08 -0700 | |
---|---|---|
committer | 2019-03-26 13:05:08 -0700 | |
commit | 6cbef7fe051228c09b1b58736c43a630c90eb26c (patch) | |
tree | 71a9b1049048f4189ec668b06319a69f1651b327 /Source/Diagnostics/WarpXIO.cpp | |
parent | ed956830818e660bd9ea0c4688c5cd50af668864 (diff) | |
parent | b534b688dedd48b645bac47854260321e7960bf9 (diff) | |
download | WarpX-6cbef7fe051228c09b1b58736c43a630c90eb26c.tar.gz WarpX-6cbef7fe051228c09b1b58736c43a630c90eb26c.tar.zst WarpX-6cbef7fe051228c09b1b58736c43a630c90eb26c.zip |
Merge branch 'dev' into reorganize_io_raw
Diffstat (limited to 'Source/Diagnostics/WarpXIO.cpp')
-rw-r--r-- | Source/Diagnostics/WarpXIO.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp index 1551a7df6..ee1991c21 100644 --- a/Source/Diagnostics/WarpXIO.cpp +++ b/Source/Diagnostics/WarpXIO.cpp @@ -470,13 +470,26 @@ WarpX::WritePlotFile () const const std::string& plotfilename = amrex::Concatenate(plot_file,istep[0]); amrex::Print() << " Writing plotfile " << plotfilename << "\n"; - // Average the fields from the simulation to the cell centers + // Average the fields from the simulation grid to the cell centers const int ngrow = 0; Vector<std::string> varnames; // Name of the written fields // mf_avg will contain the averaged, cell-centered fields Vector<MultiFab> mf_avg; WarpX::AverageAndPackFields( varnames, mf_avg, ngrow ); + // Coarsen the fields, if requested by the user + Vector<const MultiFab*> output_mf; // will point to the data to be written + Vector<MultiFab> coarse_mf; // will remain empty if there is no coarsening + Vector<Geometry> output_geom; + if (plot_coarsening_ratio != 1) { + coarsenCellCenteredFields( coarse_mf, output_geom, mf_avg, Geom(), + plot_coarsening_ratio, finest_level ); + output_mf = amrex::GetVecOfConstPtrs(coarse_mf); + } else { // No averaging necessary, simply point to mf_avg + output_mf = amrex::GetVecOfConstPtrs(mf_avg); + output_geom = Geom(); + } + // Write the fields contained in `mf_avg`, and corresponding to the // names `varnames`, into a plotfile. // Prepare extra directory (filled later), for the raw fields @@ -484,11 +497,9 @@ WarpX::WritePlotFile () const VisMF::Header::Version current_version = VisMF::GetHeaderVersion(); VisMF::SetHeaderVersion(plotfile_headerversion); if (plot_raw_fields) rfs.emplace_back("raw_fields"); - amrex::WriteMultiLevelPlotfile( - plotfilename, finest_level+1, - amrex::GetVecOfConstPtrs(mf_avg), - varnames, Geom(), t_new[0], istep, - refRatio(), + amrex::WriteMultiLevelPlotfile(plotfilename, finest_level+1, + output_mf, varnames, output_geom, + t_new[0], istep, refRatio(), "HyperCLaw-V1.1", "Level_", "Cell", |