diff options
Diffstat (limited to 'Source/WarpX.cpp')
-rw-r--r-- | Source/WarpX.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 1c0d01ce5..1f5ade13a 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -387,36 +387,46 @@ WarpX::ReadParameters () pp.query("dump_plotfiles", dump_plotfiles); pp.query("plot_raw_fields", plot_raw_fields); pp.query("plot_raw_fields_guards", plot_raw_fields_guards); - if (ParallelDescriptor::NProcs() == 1) { - plot_proc_number = false; - } - // Fields to dump into plotfiles - pp.query("plot_E_field" , plot_E_field); - pp.query("plot_B_field" , plot_B_field); - pp.query("plot_J_field" , plot_J_field); - pp.query("plot_part_per_cell", plot_part_per_cell); - pp.query("plot_part_per_grid", plot_part_per_grid); - pp.query("plot_part_per_proc", plot_part_per_proc); - pp.query("plot_proc_number" , plot_proc_number); - pp.query("plot_dive" , plot_dive); - pp.query("plot_divb" , plot_divb); - pp.query("plot_rho" , plot_rho); - pp.query("plot_F" , plot_F); pp.query("plot_coarsening_ratio", plot_coarsening_ratio); + bool user_fields_to_plot; + user_fields_to_plot = pp.queryarr("fields_to_plot", fields_to_plot); + if (not user_fields_to_plot){ + // If not specified, set default values + fields_to_plot = {"Ex", "Ey", "Ez", "Bx", "By", + "Bz", "jx", "jy", "jz", + "part_per_cell"}; + } + // set plot_rho to true of the users requests it, so that + // rho is computed at each iteration. + if (std::find(fields_to_plot.begin(), fields_to_plot.end(), "rho") + != fields_to_plot.end()){ + plot_rho = true; + } + // Sanity check if user requests to plot F + if (std::find(fields_to_plot.begin(), fields_to_plot.end(), "F") + != fields_to_plot.end()){ + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(do_dive_cleaning, + "plot F only works if warpx.do_dive_cleaning = 1"); + } + // If user requests to plot proc_number for a serial run, + // delete proc_number from fields_to_plot + if (ParallelDescriptor::NProcs() == 1){ + fields_to_plot.erase(std::remove(fields_to_plot.begin(), + fields_to_plot.end(), + "proc_number"), + fields_to_plot.end()); + } // Check that the coarsening_ratio can divide the blocking factor for (int lev=0; lev<maxLevel(); lev++){ for (int comp=0; comp<AMREX_SPACEDIM; comp++){ if ( blockingFactor(lev)[comp] % plot_coarsening_ratio != 0 ){ - amrex::Abort("plot_coarsening_ratio should be an integer divisor of the blocking factor."); + amrex::Abort("plot_coarsening_ratio should be an integer " + "divisor of the blocking factor."); } } } - if (plot_F){ - AMREX_ALWAYS_ASSERT_WITH_MESSAGE(do_dive_cleaning, - "plot_F only works if warpx.do_dive_cleaning = 1"); - } pp.query("plot_finepatch", plot_finepatch); if (maxLevel() > 0) { pp.query("plot_crsepatch", plot_crsepatch); |