18 Vector<std::string> varnames_3d;
21 Vector<std::string> varnames_2d;
24 Vector<std::string> varnames_2d_rho;
25 Vector<std::string> varnames_2d_u;
26 Vector<std::string> varnames_2d_v;
28 const int ncomp_mf_3d = varnames_3d.size();
29 const auto ngrow_vars = IntVect(
NGROW-1,
NGROW-1,0);
32 int ncomp_mf_2d_rho = 0;
33 int ncomp_mf_2d_u = 0;
34 int ncomp_mf_2d_v = 0;
37 for (
auto plot_name : varnames_2d) {
39 if (plot_name ==
"zeta" ) {varnames_2d_rho.push_back(plot_name); ncomp_mf_2d_rho++;}
40 if (plot_name ==
"h" ) {varnames_2d_rho.push_back(plot_name); ncomp_mf_2d_rho++;}
41 if (plot_name ==
"ubar" ) {varnames_2d_u.push_back(plot_name); ncomp_mf_2d_u++;}
42 if (plot_name ==
"sustr") {varnames_2d_u.push_back(plot_name); ncomp_mf_2d_u++;}
43 if (plot_name ==
"bustr") {varnames_2d_u.push_back(plot_name); ncomp_mf_2d_u++;}
44 if (plot_name ==
"vbar" ) {varnames_2d_v.push_back(plot_name); ncomp_mf_2d_v++;}
45 if (plot_name ==
"svstr") {varnames_2d_v.push_back(plot_name); ncomp_mf_2d_v++;}
46 if (plot_name ==
"bvstr") {varnames_2d_v.push_back(plot_name); ncomp_mf_2d_v++;}
52 for (
int lev = 0; lev <= finest_level; ++lev) {
59 Real fill_value = 0.0_rt;
60 for (
int lev = 0; lev <= finest_level; ++lev) {
65 Vector<MultiFab> mf(finest_level+1);
66 for (
int lev = 0; lev <= finest_level; ++lev) {
67 mf[lev].define(grids[lev], dmap[lev], ncomp_mf_3d, ngrow_vars);
71 Vector<MultiFab> mf_2d_rho(finest_level+1);
72 Vector<MultiFab> mf_2d_u(finest_level+1);
73 Vector<MultiFab> mf_2d_v(finest_level+1);
74 for (
int lev = 0; lev <= finest_level; ++lev) {
75 BoxArray ba(grids[lev]);
76 BoxList bl2d = ba.boxList();
77 for (
auto& b : bl2d) {
80 BoxArray ba2d(std::move(bl2d));
81 mf_2d_rho[lev].define(ba2d, dmap[lev], ncomp_mf_2d_rho, IntVect(0,0,0));
82 mf_2d_u[lev].define(ba2d, dmap[lev], ncomp_mf_2d_u , IntVect(0,0,0));
83 mf_2d_v[lev].define(ba2d, dmap[lev], ncomp_mf_2d_v , IntVect(0,0,0));
87 Vector<MultiFab> mf_nd(finest_level+1);
88 for (
int lev = 0; lev <= finest_level; ++lev) {
89 BoxArray nodal_grids(grids[lev]); nodal_grids.surroundingNodes();
90 mf_nd[lev].define(nodal_grids, dmap[lev], AMREX_SPACEDIM, 0);
91 mf_nd[lev].setVal(0.);
95 Vector<MultiFab> mf_u(finest_level+1);
96 Vector<MultiFab> mf_v(finest_level+1);
97 Vector<MultiFab> mf_w(finest_level+1);
99 for (
int lev = 0; lev <= finest_level; ++lev) {
100 BoxArray grid_stag_u(grids[lev]); grid_stag_u.surroundingNodes(0);
101 BoxArray grid_stag_v(grids[lev]); grid_stag_v.surroundingNodes(1);
102 BoxArray grid_stag_w(grids[lev]); grid_stag_w.surroundingNodes(2);
103 mf_u[lev].define(grid_stag_u, dmap[lev], 1, 0);
104 mf_v[lev].define(grid_stag_v, dmap[lev], 1, 0);
105 mf_w[lev].define(grid_stag_w, dmap[lev], 1, 0);
106 MultiFab::Copy(mf_u[lev],*
xvel_new[lev],0,0,1,0);
107 MultiFab::Copy(mf_v[lev],*
yvel_new[lev],0,0,1,0);
108 MultiFab::Copy(mf_w[lev],*
zvel_new[lev],0,0,1,0);
113 Vector<MultiFab> mf_cc_vel(finest_level+1);
120 for (
int lev = 0; lev <= finest_level; ++lev) {
121 mf_cc_vel[lev].define(grids[lev], dmap[lev], AMREX_SPACEDIM, IntVect(1,1,0));
122 mf_cc_vel[lev].setVal(0.0_rt);
123 average_face_to_cellcenter(mf_cc_vel[lev],0,
125 mf_cc_vel[lev].FillBoundary(geom[lev].periodicity());
129 amrex::Interpolater* mapper = &cell_cons_interp;
131 for (
int lev = 1; lev <= finest_level; ++lev) {
132 Vector<MultiFab*> fmf = {&(mf_cc_vel[lev]), &(mf_cc_vel[lev])};
133 Vector<Real> ftime = {
t_new[lev],
t_new[lev]};
134 Vector<MultiFab*> cmf = {&mf_cc_vel[lev-1], &mf_cc_vel[lev-1]};
135 Vector<Real> ctime = {
t_new[lev],
t_new[lev]};
138 amrex::FillPatchTwoLevels(mf_cc_vel[lev], mf_cc_vel[lev].nGrowVect(), IntVect(0,0,0),
139 t_new[lev], cmf, ctime, fmf, ftime,
140 0, 0, mf_cc_vel[lev].nComp(), geom[lev-1], geom[lev],
147 for (
auto plot_name : varnames_2d_rho)
149 if (plot_name ==
"zeta" ) {
150 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_rho[lev],*
vec_Zt_avg1[lev],0,icomp_rho,1,0); }
153 if (plot_name ==
"h" ) {
154 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_rho[lev],*
vec_h[lev],0,icomp_rho,1,0); }
160 for (
auto plot_name : varnames_2d_u)
162 if (plot_name ==
"ubar" ) {
163 for (
int lev = 0; lev <= finest_level; ++lev) {
164 MultiFab::Copy(mf_2d_u[lev],*
vec_DU_avg1[lev],0,icomp_u,1,0);
168 if (plot_name ==
"sustr" ) {
169 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_u[lev],*
vec_sustr[lev],0,icomp_u,1,0); }
172 if (plot_name ==
"bustr" ) {
173 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_u[lev],*
vec_bustr[lev],0,icomp_u,1,0); }
179 for (
auto plot_name : varnames_2d_v)
181 if (plot_name ==
"vbar" ) {
182 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_v[lev],*
vec_DV_avg1[lev],0,icomp_v,1,0); }
185 if (plot_name ==
"svstr" ) {
186 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_v[lev],*
vec_svstr[lev],0,icomp_v,1,0); }
189 if (plot_name ==
"bvstr" ) {
190 for (
int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_v[lev],*
vec_bvstr[lev],0,icomp_v,1,0); }
195 for (
int lev = 0; lev <= finest_level; ++lev)
201 for (
int i = 0; i <
NCONS; ++i) {
204 amrex::Abort(
"Found while writing output: Cons (salt, temp, or scalar, etc) contains nan or inf");
206 MultiFab::Copy(mf[lev],*
cons_new[lev],i,mf_comp,1,ngrow_vars);
213 if (mf_cc_vel[lev].contains_nan(0,1) || mf_cc_vel[lev].contains_inf(0,1)) {
214 amrex::Abort(
"Found while writing output: u velocity contains nan or inf");
216 MultiFab::Copy(mf[lev], mf_cc_vel[lev], 0, mf_comp, 1, 0);
220 if (mf_cc_vel[lev].contains_nan(1,1) || mf_cc_vel[lev].contains_inf(1,1)) {
221 amrex::Abort(
"Found while writing output: v velocity contains nan or inf");
223 MultiFab::Copy(mf[lev], mf_cc_vel[lev], 1, mf_comp, 1, 0);
227 if (mf_cc_vel[lev].contains_nan(2,1) || mf_cc_vel[lev].contains_inf(2,1)) {
228 amrex::Abort(
"Found while writing output: z velocity contains nan or inf");
230 MultiFab::Copy(mf[lev], mf_cc_vel[lev], 2, mf_comp, 1, 0);
235 auto calculate_derived = [&](
const std::string& der_name,
239 MultiFab dmf(mf[lev], make_alias, mf_comp, 1);
241#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
243 for (MFIter mfi(dmf, TilingIfNotGPU()); mfi.isValid(); ++mfi)
245 const Box& bx = mfi.tilebox();
246 auto& dfab = dmf[mfi];
248 if (der_name ==
"vorticity") {
249 auto const& sfab = mf_cc_vel[lev][mfi];
250 der_function(bx, dfab, 0, 1, sfab,
vec_pm[lev]->const_array(mfi),
vec_pn[lev]->const_array(mfi),
vec_mskr[lev]->const_array(mfi), Geom(lev),
t_new[0],
nullptr, lev);
252 auto const& sfab = (*
cons_new[lev])[mfi];
253 der_function(bx, dfab, 0, 1, sfab,
vec_pm[lev]->const_array(mfi),
vec_pn[lev]->const_array(mfi),
vec_mskr[lev]->const_array(mfi), Geom(lev),
t_new[0],
nullptr, lev);
265 Real dx = Geom()[lev].CellSizeArray()[0];
266 Real dy = Geom()[lev].CellSizeArray()[1];
273 MultiFab dmf(mf[lev], make_alias, mf_comp, AMREX_SPACEDIM);
275#pragma omp parallel if (Gpu::notInLaunchRegion())
277 for (MFIter mfi(dmf, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
278 const Box& bx = mfi.tilebox();
279 const Array4<Real> loc_arr = dmf.array(mfi);
280 const Array4<Real const> zp_arr =
vec_z_phys_nd[lev]->const_array(mfi);
282 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
283 loc_arr(i,j,k,0) = (i+0.5_rt) * dx;
284 loc_arr(i,j,k,1) = (j+0.5_rt) * dy;
285 loc_arr(i,j,k,2) = 0.125_rt * (zp_arr(i,j ,k ) + zp_arr(i+1,j ,k ) +
286 zp_arr(i,j+1,k ) + zp_arr(i+1,j+1,k ) +
287 zp_arr(i,j ,k+1) + zp_arr(i+1,j ,k+1) +
288 zp_arr(i,j+1,k+1) + zp_arr(i+1,j+1,k+1) );
291 mf_comp += AMREX_SPACEDIM;
294#ifdef REMORA_USE_PARTICLES
295 const auto& particles_namelist( particleData.getNames() );
296 for (ParticlesNamesVector::size_type i = 0; i < particles_namelist.size(); i++) {
298 MultiFab temp_dat(mf[lev].boxArray(), mf[lev].DistributionMap(), 1, 0);
300 particleData[particles_namelist[i]]->Increment(temp_dat, lev);
301 MultiFab::Copy(mf[lev], temp_dat, 0, mf_comp, 1, 0);
306 Vector<std::string> particle_mesh_plot_names(0);
307 particleData.GetMeshPlotVarNames( particle_mesh_plot_names );
308 for (
int i = 0; i < particle_mesh_plot_names.size(); i++) {
309 std::string plot_var_name(particle_mesh_plot_names[i]);
311 MultiFab temp_dat(mf[lev].boxArray(), mf[lev].DistributionMap(), 1, 1);
313 particleData.GetMeshPlotVar(plot_var_name, temp_dat, lev);
314 MultiFab::Copy(mf[lev], temp_dat, 0, mf_comp, 1, 0);
321 Real dz = Geom()[lev].CellSizeArray()[2];
322 int N = Geom()[lev].Domain().size()[2];
325#pragma omp parallel if (Gpu::notInLaunchRegion())
327 for (MFIter mfi(mf_nd[lev], TilingIfNotGPU()); mfi.isValid(); ++mfi)
329 const Box& bx = mfi.tilebox();
330 Array4<Real> mf_arr = mf_nd[lev].array(mfi);
331 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
332 mf_arr(i,j,k,2) = mf_arr(i,j,k,2) + (N-k) * dz;
340 if (finest_level == 0)
343 amrex::Print() <<
"Writing plotfile " << plotfilename <<
"\n";
345 GetVecOfConstPtrs(mf),
346 GetVecOfConstPtrs(mf_nd),
347 GetVecOfConstPtrs(mf_u),
348 GetVecOfConstPtrs(mf_v),
349 GetVecOfConstPtrs(mf_w),
350 GetVecOfConstPtrs(mf_2d_rho),
351 GetVecOfConstPtrs(mf_2d_u),
352 GetVecOfConstPtrs(mf_2d_v),
353 varnames_3d, varnames_2d_rho,
354 varnames_2d_u, varnames_2d_v,
359#ifdef REMORA_USE_PARTICLES
360 particleData.Checkpoint(plotfilename);
363#ifdef REMORA_USE_HDF5
365 amrex::Print() <<
"Writing plotfile " << plotfilename+
"d01.h5" <<
"\n";
366 WriteMultiLevelPlotfileHDF5(plotfilename, finest_level+1,
367 GetVecOfConstPtrs(mf),
372 amrex::Abort(
"User specified unknown plot_filetype");
377 amrex::Print() <<
"Writing plotfile " << plotfilename <<
"\n";
379 [[maybe_unused]]
int desired_ratio = std::max(std::max(ref_ratio[lev0][0],ref_ratio[lev0][1]),ref_ratio[lev0][2]);
380 bool any_ratio_one = ( ( (ref_ratio[lev0][0] == 1) || (ref_ratio[lev0][1] == 1) ) ||
381 (ref_ratio[lev0][2] == 1) );
382 for (
int lev = 1; lev < finest_level; lev++) {
383 any_ratio_one = any_ratio_one ||
384 ( ( (ref_ratio[lev][0] == 1) || (ref_ratio[lev][1] == 1) ) ||
385 (ref_ratio[lev][2] == 1) );
388 Vector<IntVect> r2(finest_level);
389 Vector<Geometry> g2(finest_level+1);
390 Vector<MultiFab> mf2(finest_level+1);
392 mf2[0].define(grids[0], dmap[0], ncomp_mf_3d, 0);
395 MultiFab::Copy(mf2[0],mf[0],0,0,mf[0].nComp(),0);
398 Array<int,AMREX_SPACEDIM> periodicity =
399 {Geom()[0].isPeriodic(0),Geom()[0].isPeriodic(1),Geom()[0].isPeriodic(2)};
400 g2[0].define(Geom()[0].Domain(),&(Geom()[0].ProbDomain()),0,periodicity.data());
402 r2[0] = IntVect(1,1,ref_ratio[0][0]);
403 for (
int lev = 1; lev <= finest_level; ++lev) {
407 r2[lev-1][2] = r2[lev-2][2] * ref_ratio[lev-1][0];
410 mf2[lev].define(refine(grids[lev],r2[lev-1]), dmap[lev], ncomp_mf_3d, 0);
413 Box d2(Geom()[lev].Domain());
414 d2.refine(r2[lev-1]);
416 g2[lev].define(d2,&(Geom()[lev].ProbDomain()),0,periodicity.data());
421 amrex::Vector<amrex::BCRec> null_dom_bcs;
422 null_dom_bcs.resize(mf2[0].nComp());
423 for (
int n = 0; n < mf2[0].nComp(); n++) {
424 for (
int dir = 0; dir < AMREX_SPACEDIM; dir++) {
431 for (
int lev = 1; lev <= finest_level; ++lev) {
432 Interpolater* mapper_c = &pc_interp;
433 InterpFromCoarseLevel(mf2[lev],
t_new[lev], mf[lev],
434 0, 0, mf2[lev].nComp(),
437 r2[lev-1], mapper_c, null_dom_bcs, 0);
441 Vector<IntVect> rr(finest_level);
442 for (
int lev = 0; lev < finest_level; ++lev) {
443 rr[lev] = IntVect(ref_ratio[lev][0],ref_ratio[lev][1],ref_ratio[lev][0]);
447 GetVecOfConstPtrs(mf2),
448 GetVecOfConstPtrs(mf_nd),
449 GetVecOfConstPtrs(mf_u),
450 GetVecOfConstPtrs(mf_v),
451 GetVecOfConstPtrs(mf_w),
452 GetVecOfConstPtrs(mf_2d_rho),
453 GetVecOfConstPtrs(mf_2d_u),
454 GetVecOfConstPtrs(mf_2d_v),
455 varnames_3d, varnames_2d_rho,
456 varnames_2d_u, varnames_2d_v,
461#ifdef REMORA_USE_PARTICLES
462 particleData.Checkpoint(plotfilename);
466 GetVecOfConstPtrs(mf),
467 GetVecOfConstPtrs(mf_nd),
468 GetVecOfConstPtrs(mf_u),
469 GetVecOfConstPtrs(mf_v),
470 GetVecOfConstPtrs(mf_w),
471 GetVecOfConstPtrs(mf_2d_rho),
472 GetVecOfConstPtrs(mf_2d_u),
473 GetVecOfConstPtrs(mf_2d_v),
474 varnames_3d, varnames_2d_rho,
475 varnames_2d_u, varnames_2d_v,
479#ifdef REMORA_USE_PARTICLES
480 particleData.Checkpoint(plotfilename);
485 for (
int lev = 0; lev <= finest_level; ++lev) {
510 const Vector<const MultiFab*>& mf,
511 const Vector<const MultiFab*>& mf_nd,
512 const Vector<const MultiFab*>& mf_u,
513 const Vector<const MultiFab*>& mf_v,
514 const Vector<const MultiFab*>& mf_w,
515 const Vector<const MultiFab*>& mf_2d_rho,
516 const Vector<const MultiFab*>& mf_2d_u,
517 const Vector<const MultiFab*>& mf_2d_v,
518 const Vector<std::string>& varnames_3d,
519 const Vector<std::string>& varnames_2d_rho,
520 const Vector<std::string>& varnames_2d_u,
521 const Vector<std::string>& varnames_2d_v,
522 const Vector<Geometry>& my_geom,
524 const Vector<int>& level_steps,
525 const Vector<IntVect>& rr,
526 const std::string &versionName,
527 const std::string &levelPrefix,
528 const std::string &mfPrefix,
529 const Vector<std::string>& extra_dirs)
const
531 BL_PROFILE(
"WriteMultiLevelPlotfileWithBathymetry()");
533 BL_ASSERT(nlevels <= mf.size());
534 BL_ASSERT(nlevels <= ref_ratio.size()+1);
535 BL_ASSERT(nlevels <= level_steps.size());
537 BL_ASSERT(mf[0]->nComp() == varnames_3d.size());
539 bool callBarrier(
false);
540 PreBuildDirectorHierarchy(plotfilename, levelPrefix, nlevels, callBarrier);
541 if (!extra_dirs.empty()) {
542 for (
const auto& d : extra_dirs) {
543 const std::string ed = plotfilename+
"/"+d;
544 PreBuildDirectorHierarchy(ed, levelPrefix, nlevels, callBarrier);
547 ParallelDescriptor::Barrier();
549 if (ParallelDescriptor::MyProc() == ParallelDescriptor::NProcs()-1) {
550 Vector<BoxArray> boxArrays(nlevels);
551 for(
int level(0); level < boxArrays.size(); ++level) {
552 boxArrays[level] = mf[level]->boxArray();
556 VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
557 std::string HeaderFileName(plotfilename +
"/Header");
558 std::ofstream HeaderFile;
559 HeaderFile.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
560 HeaderFile.open(HeaderFileName.c_str(), std::ofstream::out |
561 std::ofstream::trunc |
562 std::ofstream::binary);
563 if( ! HeaderFile.good()) FileOpenFailed(HeaderFileName);
565 varnames_2d_rho, varnames_2d_u, varnames_2d_v,
566 my_geom, time, level_steps, rr, versionName,
567 levelPrefix, mfPrefix);
570 if (AsyncOut::UseAsyncOut()) {
571 AsyncOut::Submit(std::move(f));
577 std::string mf_nodal_prefix =
"Nu_nd";
578 std::string mf_uface_prefix =
"UFace";
579 std::string mf_vface_prefix =
"VFace";
580 std::string mf_wface_prefix =
"WFace";
581 std::string mf_2d_rho_prefix =
"rho2d";
582 std::string mf_2d_u_prefix =
"u2d";
583 std::string mf_2d_v_prefix =
"v2d";
585 for (
int level = 0; level <= finest_level; ++level)
587 if (AsyncOut::UseAsyncOut()) {
588 VisMF::AsyncWrite(*mf[level],
589 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mfPrefix),
591 VisMF::AsyncWrite(*mf_nd[level],
592 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_nodal_prefix),
595 VisMF::AsyncWrite(*mf_u[level],
596 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_uface_prefix),
598 VisMF::AsyncWrite(*mf_v[level],
599 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_vface_prefix),
601 VisMF::AsyncWrite(*mf_w[level],
602 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_wface_prefix),
605 if (mf_2d_rho[level]->nComp() > 0) {
606 VisMF::AsyncWrite(*mf_2d_rho[level],
607 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_rho_prefix),
610 if (mf_2d_u[level]->nComp() > 0) {
611 VisMF::AsyncWrite(*mf_2d_u[level],
612 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_u_prefix),
615 if (mf_2d_v[level]->nComp() > 0) {
616 VisMF::AsyncWrite(*mf_2d_v[level],
617 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_v_prefix),
621 const MultiFab* data;
622 std::unique_ptr<MultiFab> mf_tmp;
623 if (mf[level]->nGrowVect() != 0) {
624 mf_tmp = std::make_unique<MultiFab>(mf[level]->boxArray(),
625 mf[level]->DistributionMap(),
626 mf[level]->nComp(), 0, MFInfo(),
627 mf[level]->Factory());
628 MultiFab::Copy(*mf_tmp, *mf[level], 0, 0, mf[level]->nComp(), 0);
633 VisMF::Write(*data , MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mfPrefix));
634 VisMF::Write(*mf_nd[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_nodal_prefix));
636 VisMF::Write(*mf_u[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_uface_prefix));
637 VisMF::Write(*mf_v[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_vface_prefix));
638 VisMF::Write(*mf_w[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_wface_prefix));
640 if (mf_2d_rho[level]->nComp() > 0) {
641 VisMF::Write(*mf_2d_rho[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_rho_prefix));
643 if (mf_2d_u[level]->nComp() > 0) {
644 VisMF::Write(*mf_2d_u[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_u_prefix));
646 if (mf_2d_v[level]->nComp() > 0) {
647 VisMF::Write(*mf_2d_v[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_v_prefix));
669 [[maybe_unused]]
int nlevels,
670 const Vector<BoxArray> &bArray,
671 const Vector<std::string> &varnames_3d,
672 const Vector<std::string> &varnames_2d_rho,
673 const Vector<std::string> &varnames_2d_u,
674 const Vector<std::string> &varnames_2d_v,
675 const Vector<Geometry>& my_geom,
677 const Vector<int> &level_steps,
678 const Vector<IntVect>& my_ref_ratio,
679 const std::string &versionName,
680 const std::string &levelPrefix,
681 const std::string &mfPrefix)
const
683 BL_ASSERT(nlevels <= bArray.size());
684 BL_ASSERT(nlevels <= ref_ratio.size()+1);
685 BL_ASSERT(nlevels <= level_steps.size());
687 int num_extra_mfs = 1;
692 HeaderFile.precision(17);
695 HeaderFile << versionName <<
'\n';
697 HeaderFile << varnames_3d.size() <<
'\n';
699 for (
int ivar = 0; ivar < varnames_3d.size(); ++ivar) {
700 HeaderFile << varnames_3d[ivar] <<
"\n";
702 HeaderFile << AMREX_SPACEDIM <<
'\n';
703 HeaderFile << time <<
'\n';
704 HeaderFile << finest_level <<
'\n';
705 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
706 HeaderFile << my_geom[0].ProbLo(i) <<
' ';
709 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
710 HeaderFile << my_geom[0].ProbHi(i) <<
' ';
713 for (
int i = 0; i < finest_level; ++i) {
714 HeaderFile << my_ref_ratio[i][0] <<
' ';
717 for (
int i = 0; i <= finest_level; ++i) {
718 HeaderFile << my_geom[i].Domain() <<
' ';
721 for (
int i = 0; i <= finest_level; ++i) {
722 HeaderFile << level_steps[i] <<
' ';
725 for (
int i = 0; i <= finest_level; ++i) {
726 for (
int k = 0; k < AMREX_SPACEDIM; ++k) {
727 HeaderFile << my_geom[i].CellSize()[k] <<
' ';
731 HeaderFile << (int) my_geom[0].
Coord() <<
'\n';
734 for (
int level = 0; level <= finest_level; ++level) {
735 HeaderFile << level <<
' ' << bArray[level].size() <<
' ' << time <<
'\n';
736 HeaderFile << level_steps[level] <<
'\n';
738 const IntVect& domain_lo = my_geom[level].Domain().smallEnd();
739 for (
int i = 0; i < bArray[level].size(); ++i)
744 const Box& b = shift(bArray[level][i], -domain_lo);
745 RealBox loc = RealBox(b, my_geom[level].CellSize(), my_geom[level].ProbLo());
746 for (
int n = 0; n < AMREX_SPACEDIM; ++n) {
747 HeaderFile << loc.lo(n) <<
' ' << loc.hi(n) <<
'\n';
751 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mfPrefix) <<
'\n';
753 HeaderFile << num_extra_mfs <<
"\n";
754 HeaderFile <<
"3" <<
"\n";
755 HeaderFile <<
"amrexvec_nu_x" <<
"\n";
756 HeaderFile <<
"amrexvec_nu_y" <<
"\n";
757 HeaderFile <<
"amrexvec_nu_z" <<
"\n";
758 std::string mf_nodal_prefix =
"Nu_nd";
759 for (
int level = 0; level <= finest_level; ++level) {
760 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_nodal_prefix) <<
'\n';
763 HeaderFile <<
"1" <<
"\n";
764 HeaderFile <<
"u_vel" <<
"\n";
765 std::string mf_uface_prefix =
"UFace";
766 for (
int level = 0; level <= finest_level; ++level) {
767 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_uface_prefix) <<
'\n';
769 HeaderFile <<
"1" <<
"\n";
770 HeaderFile <<
"v_vel" <<
"\n";
771 std::string mf_vface_prefix =
"VFace";
772 for (
int level = 0; level <= finest_level; ++level) {
773 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_vface_prefix) <<
'\n';
775 HeaderFile <<
"1" <<
"\n";
776 HeaderFile <<
"w_vel" <<
"\n";
777 std::string mf_wface_prefix =
"WFace";
778 for (
int level = 0; level <= finest_level; ++level) {
779 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_wface_prefix) <<
'\n';
783 if (varnames_2d_rho.size() > 0) {
784 HeaderFile << varnames_2d_rho.size() <<
"\n";
785 for (
int ivar = 0; ivar < varnames_2d_rho.size(); ++ivar) {
786 HeaderFile << varnames_2d_rho[ivar] <<
"\n";
788 std::string mf_2d_rho_prefix =
"rho2d";
789 for (
int level = 0; level <= finest_level; ++level) {
790 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_2d_rho_prefix) <<
"\n";
794 if (varnames_2d_u.size() > 0) {
795 HeaderFile << varnames_2d_u.size() <<
"\n";
796 for (
int ivar = 0; ivar < varnames_2d_u.size(); ++ivar) {
797 HeaderFile << varnames_2d_u[ivar] <<
"\n";
799 std::string mf_2d_u_prefix =
"u2d";
800 for (
int level = 0; level <= finest_level; ++level) {
801 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_2d_u_prefix) <<
"\n";
805 if (varnames_2d_v.size() > 0) {
806 HeaderFile << varnames_2d_v.size() <<
"\n";
807 for (
int ivar = 0; ivar < varnames_2d_v.size(); ++ivar) {
808 HeaderFile << varnames_2d_v[ivar] <<
"\n";
810 std::string mf_2d_v_prefix =
"v2d";
811 for (
int level = 0; level <= finest_level; ++level) {
812 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_2d_v_prefix) <<
"\n";