Convert a multilevel AMReX plotfile into NetCDF format.
59 const int narg = amrex::command_argument_count();
69 while (farg <= narg) {
70 const std::string fname = amrex::get_command_argument(farg);
71 if (fname ==
"-h" || fname ==
"--help") {
73 }
else if (fname ==
"-v") {
82 amrex::Print() <<
"No plotfilename specified " << std::endl;
86 if (iFile.back() ==
'/') {
90 amrex::Print() <<
"Reading " << iFile << std::endl;
94 PlotFileData pf_data(iFile);
96 int finest_level = pf_data.finestLevel();
98 int ncomp = pf_data.nComp();
101 amrex::Print() <<
"Finished defining pf with finest level " << finest_level <<
" and ncomp " << ncomp << std::endl;
104 const Vector<std::string>& varnames = pf_data.varNames();
106 Vector<int> istep{3};
107 double time = pf_data.time();
109 int max_grid_size = 64;
111 Vector<MultiFab> mfvec(finest_level+1);
112 Vector<Geometry> geom(finest_level+1);
114 double start_bdy_time = time;
121 Vector<Real> zlevels_stag;
123 for (
int lev = 0; lev <= finest_level; lev++)
125 mfvec[lev].define(pf_data.boxArray(lev), pf_data.DistributionMap(lev), ncomp, 0);
127 for (
int icomp = 0; icomp < ncomp; icomp++) {
128 MultiFab tmp_data = pf_data.get(lev, varnames[icomp]);
129 MultiFab::Copy(mfvec[lev],tmp_data,0,icomp,1,0);
133 BoxArray ba(pf_data.boxArray(lev));
134 Box bounding_region = (lev == 0) ? pf_data.probDomain(lev) : ba.minimalBox();
139 writeNCPlotFile(lev, which, iFile, GetVecOfConstPtrs(mfvec), varnames, istep,
140 pf_data.probLo(), pf_data.probHi(), pf_data.cellSize(lev), bounding_region,
141 time, start_bdy_time, solverChoice, zlevels_stag);
void writeNCPlotFile(int lev, int which_subdomain, const std::string &dir, const Vector< const MultiFab * > &plotMF, const Vector< std::string > &plot_var_names, const Vector< int > &, Array< Real, AMREX_SPACEDIM > prob_lo, Array< Real, AMREX_SPACEDIM > prob_hi, Array< Real, AMREX_SPACEDIM > dx_in, const Box &subdomain, const double &time, const double &start_bdy_time, const SolverChoice &solverChoice, const Vector< Real > &zlevels_stag)
Definition: ERF_NCPlotFile.cpp:20
static void PrintUsage()
Definition: ERF_PlotfileToNetCDF.cpp:37
Definition: ERF_DataStruct.H:634