REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_Plotfile.cpp
Go to the documentation of this file.
1#include <REMORA.H>
2#include "AMReX_Interp_3D_C.H"
3#include "AMReX_PlotFileUtil.H"
4
5using namespace amrex;
6
7PhysBCFunctNoOp null_bc_for_fill;
8
9template<typename V, typename T>
10bool containerHasElement(const V& iterable, const T& query) {
11 return std::find(iterable.begin(), iterable.end(), query) != iterable.end();
12}
13
14// Write plotfile to disk
15void
17{
18 Vector<std::string> varnames_3d;
19 varnames_3d.insert(varnames_3d.end(), plot_var_names_3d.begin(), plot_var_names_3d.end());
20
21 Vector<std::string> varnames_2d;
22 varnames_2d.insert(varnames_2d.end(), plot_var_names_2d.begin(), plot_var_names_2d.end());
23
24 Vector<std::string> varnames_2d_rho;
25 Vector<std::string> varnames_2d_u;
26 Vector<std::string> varnames_2d_v;
27
28 const int ncomp_mf_3d = varnames_3d.size();
29 const auto ngrow_vars = IntVect(NGROW-1,NGROW-1,0);
30
31 // These are the ncomp for the 2D cell-centered, x-face-based, y-face-based MultiFabs respectively
32 int ncomp_mf_2d_rho = 0;
33 int ncomp_mf_2d_u = 0;
34 int ncomp_mf_2d_v = 0;
35
36 // Check to see if we found all the requested variables
37 for (auto plot_name : varnames_2d) {
38 {
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++;}
47 }
48 }
49
50 // We fillpatch here because some of the derived quantities require derivatives
51 // which require ghost cells to be filled. Don't fill the boundary, though.
52 for (int lev = 0; lev <= finest_level; ++lev) {
53 FillPatchNoBC(lev, t_new[lev], *cons_new[lev], cons_new, BdyVars::t,0,true,false);
54 FillPatchNoBC(lev, t_new[lev], *xvel_new[lev], xvel_new, BdyVars::u,0,true,false);
55 FillPatchNoBC(lev, t_new[lev], *yvel_new[lev], yvel_new, BdyVars::v,0,true,false);
56 FillPatchNoBC(lev, t_new[lev], *zvel_new[lev], zvel_new, BdyVars::null,0,true,false);
57 }
58
59 Real fill_value = 0.0_rt;
60 for (int lev = 0; lev <= finest_level; ++lev) {
61 mask_arrays_for_write(lev, (Real) fill_value, 0.0_rt);
62 }
63
64 // Array of 3D MultiFabs to hold the plotfile data
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);
68 }
69
70 // Array of 2D MultiFabs to hold the plotfile data
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) {
78 b.setRange(2,0);
79 }
80 BoxArray ba2d(std::move(bl2d));
81 mf_2d_rho[lev].define(ba2d, dmap[lev], ncomp_mf_2d_rho, ngrow_vars);
82 mf_2d_u[lev].define(ba2d, dmap[lev], ncomp_mf_2d_u , ngrow_vars);
83 mf_2d_v[lev].define(ba2d, dmap[lev], ncomp_mf_2d_v , ngrow_vars);
84 }
85
86 // Array of MultiFabs for nodal data
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.);
92 }
93
94 // Vector of MultiFabs for face-centered velocity
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);
109 }
110 }
111
112 // Array of MultiFabs for cell-centered velocity
113 Vector<MultiFab> mf_cc_vel(finest_level+1);
114
115 if (containerHasElement(plot_var_names_3d, "x_velocity") ||
116 containerHasElement(plot_var_names_3d, "y_velocity") ||
117 containerHasElement(plot_var_names_3d, "z_velocity") ||
118 containerHasElement(plot_var_names_3d, "vorticity") ) {
119
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); // zero out velocity in case we have any wall boundaries
123 average_face_to_cellcenter(mf_cc_vel[lev],0,
124 Array<const MultiFab*,3>{xvel_new[lev],yvel_new[lev],zvel_new[lev]},IntVect(1,1,0));
125 mf_cc_vel[lev].FillBoundary(geom[lev].periodicity());
126 } // lev
127
128 // We need ghost cells if computing vorticity
129 amrex::Interpolater* mapper = &cell_cons_interp;
130 if ( containerHasElement(plot_var_names_3d, "vorticity") ) {
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]};
136
137 MultiFab mf_to_fill;
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],
141 refRatio(lev-1), mapper, domain_bcs_type, BCVars::foextrap_bc);
142 } // lev
143 } // if
144 } // if
145
146 int icomp_rho = 0;
147 for (auto plot_name : varnames_2d_rho)
148 {
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); icomp_rho++;}
151 }
152 if (plot_name == "h" ) {
153 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_rho[lev],*vec_h[lev],0,icomp_rho,1,0); icomp_rho++;}
154 }
155 }
156
157 int icomp_u = 0;
158 for (auto plot_name : varnames_2d_u)
159 {
160 if (plot_name == "ubar" ) {
161 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_u[lev],*vec_DU_avg1[lev],0,icomp_u,1,0); icomp_u++;}
162 }
163 if (plot_name == "sustr" ) {
164 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_u[lev],*vec_sustr[lev],0,icomp_u,1,0); icomp_u++;}
165 }
166 if (plot_name == "bustr" ) {
167 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_u[lev],*vec_bustr[lev],0,icomp_u,1,0); icomp_u++;}
168 }
169 }
170
171 int icomp_v = 0;
172 for (auto plot_name : varnames_2d_v)
173 {
174 if (plot_name == "vbar" ) {
175 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_v[lev],*vec_DV_avg1[lev],0,icomp_v,1,0); icomp_v++;}
176 }
177 if (plot_name == "svstr" ) {
178 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_v[lev],*vec_svstr[lev],0,icomp_v,1,0); icomp_v++;}
179 }
180 if (plot_name == "bvstr" ) {
181 for (int lev = 0; lev <= finest_level; ++lev) { MultiFab::Copy(mf_2d_v[lev],*vec_bvstr[lev],0,icomp_v,1,0); icomp_v++;}
182 }
183 }
184
185 for (int lev = 0; lev <= finest_level; ++lev)
186 {
187 int mf_comp = 0;
188
189 // First, copy any of the conserved state variables into the output plotfile
190 AMREX_ALWAYS_ASSERT(cons_names.size() == NCONS);
191 for (int i = 0; i < NCONS; ++i) {
193 if (cons_new[lev]->contains_nan() || cons_new[lev]->contains_inf()) {
194 amrex::Abort("Found while writing output: Cons (salt, temp, or scalar, etc) contains nan or inf");
195 }
196 MultiFab::Copy(mf[lev],*cons_new[lev],i,mf_comp,1,ngrow_vars);
197 mf_comp++;
198 }
199 } // NCONS
200
201 // Next, check for velocities
202 if (containerHasElement(plot_var_names_3d, "x_velocity")) {
203 if (mf_cc_vel[lev].contains_nan(0,1) || mf_cc_vel[lev].contains_inf(0,1)) {
204 amrex::Abort("Found while writing output: u velocity contains nan or inf");
205 }
206 MultiFab::Copy(mf[lev], mf_cc_vel[lev], 0, mf_comp, 1, 0);
207 mf_comp += 1;
208 }
209 if (containerHasElement(plot_var_names_3d, "y_velocity")) {
210 if (mf_cc_vel[lev].contains_nan(1,1) || mf_cc_vel[lev].contains_inf(1,1)) {
211 amrex::Abort("Found while writing output: v velocity contains nan or inf");
212 }
213 MultiFab::Copy(mf[lev], mf_cc_vel[lev], 1, mf_comp, 1, 0);
214 mf_comp += 1;
215 }
216 if (containerHasElement(plot_var_names_3d, "z_velocity")) {
217 if (mf_cc_vel[lev].contains_nan(2,1) || mf_cc_vel[lev].contains_inf(2,1)) {
218 amrex::Abort("Found while writing output: z velocity contains nan or inf");
219 }
220 MultiFab::Copy(mf[lev], mf_cc_vel[lev], 2, mf_comp, 1, 0);
221 mf_comp += 1;
222 }
223
224 // Define standard process for calling the functions in Derive.cpp
225 auto calculate_derived = [&](const std::string& der_name,
226 decltype(derived::remora_dernull)& der_function)
227 {
228 if (containerHasElement(plot_var_names_3d, der_name)) {
229 MultiFab dmf(mf[lev], make_alias, mf_comp, 1);
230#ifdef _OPENMP
231#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
232#endif
233 for (MFIter mfi(dmf, TilingIfNotGPU()); mfi.isValid(); ++mfi)
234 {
235 const Box& bx = mfi.tilebox();
236 auto& dfab = dmf[mfi];
237
238 if (der_name == "vorticity") {
239 auto const& sfab = mf_cc_vel[lev][mfi];
240 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);
241 } else {
242 auto const& sfab = (*cons_new[lev])[mfi];
243 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);
244 }
245 }
246
247 mf_comp++;
248 }
249 };
250
251 // Note: All derived variables must be computed in order of "derived_names" defined in REMORA.H
252 calculate_derived("vorticity", derived::remora_dervort);
253
254 // Fill cell-centered location
255 Real dx = Geom()[lev].CellSizeArray()[0];
256 Real dy = Geom()[lev].CellSizeArray()[1];
257
258 // Next, check for location names -- if we write one we write all
262 {
263 MultiFab dmf(mf[lev], make_alias, mf_comp, AMREX_SPACEDIM);
264#ifdef _OPENMP
265#pragma omp parallel if (Gpu::notInLaunchRegion())
266#endif
267 for (MFIter mfi(dmf, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
268 const Box& bx = mfi.tilebox();
269 const Array4<Real> loc_arr = dmf.array(mfi);
270 const Array4<Real const> zp_arr = vec_z_phys_nd[lev]->const_array(mfi);
271
272 ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
273 loc_arr(i,j,k,0) = (i+0.5_rt) * dx;
274 loc_arr(i,j,k,1) = (j+0.5_rt) * dy;
275 loc_arr(i,j,k,2) = 0.125_rt * (zp_arr(i,j ,k ) + zp_arr(i+1,j ,k ) +
276 zp_arr(i,j+1,k ) + zp_arr(i+1,j+1,k ) +
277 zp_arr(i,j ,k+1) + zp_arr(i+1,j ,k+1) +
278 zp_arr(i,j+1,k+1) + zp_arr(i+1,j+1,k+1) );
279 });
280 } // mfi
281 mf_comp += AMREX_SPACEDIM;
282 } // if containerHasElement
283
284#ifdef REMORA_USE_PARTICLES
285 const auto& particles_namelist( particleData.getNames() );
286 for (ParticlesNamesVector::size_type i = 0; i < particles_namelist.size(); i++) {
287 if (containerHasElement(plot_var_names_3d, std::string(particles_namelist[i]+"_count"))) {
288 MultiFab temp_dat(mf[lev].boxArray(), mf[lev].DistributionMap(), 1, 0);
289 temp_dat.setVal(0);
290 particleData[particles_namelist[i]]->Increment(temp_dat, lev);
291 MultiFab::Copy(mf[lev], temp_dat, 0, mf_comp, 1, 0);
292 mf_comp += 1;
293 }
294 }
295
296 Vector<std::string> particle_mesh_plot_names(0);
297 particleData.GetMeshPlotVarNames( particle_mesh_plot_names );
298 for (int i = 0; i < particle_mesh_plot_names.size(); i++) {
299 std::string plot_var_name(particle_mesh_plot_names[i]);
300 if (containerHasElement(plot_var_names_3d, plot_var_name) ) {
301 MultiFab temp_dat(mf[lev].boxArray(), mf[lev].DistributionMap(), 1, 1);
302 temp_dat.setVal(0);
303 particleData.GetMeshPlotVar(plot_var_name, temp_dat, lev);
304 MultiFab::Copy(mf[lev], temp_dat, 0, mf_comp, 1, 0);
305 mf_comp += 1;
306 }
307 }
308#endif
309
310 MultiFab::Copy(mf_nd[lev],*vec_z_phys_nd[lev],0,2,1,0);
311 Real dz = Geom()[lev].CellSizeArray()[2];
312 int N = Geom()[lev].Domain().size()[2];
313
314#ifdef _OPENMP
315#pragma omp parallel if (Gpu::notInLaunchRegion())
316#endif
317 for (MFIter mfi(mf_nd[lev], TilingIfNotGPU()); mfi.isValid(); ++mfi)
318 {
319 const Box& bx = mfi.tilebox();
320 Array4<Real> mf_arr = mf_nd[lev].array(mfi);
321 ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
322 mf_arr(i,j,k,2) = mf_arr(i,j,k,2) + (N-k) * dz;
323 });
324 } // mfi
325
326 } // lev
327
328 std::string plotfilename = Concatenate(plot_file_name, istep[0], file_min_digits);
329
330 if (finest_level == 0)
331 {
333 amrex::Print() << "Writing plotfile " << plotfilename << "\n";
334 WriteMultiLevelPlotfileWithBathymetry(plotfilename, finest_level+1,
335 GetVecOfConstPtrs(mf),
336 GetVecOfConstPtrs(mf_nd),
337 GetVecOfConstPtrs(mf_u),
338 GetVecOfConstPtrs(mf_v),
339 GetVecOfConstPtrs(mf_w),
340 GetVecOfConstPtrs(mf_2d_rho),
341 GetVecOfConstPtrs(mf_2d_u),
342 GetVecOfConstPtrs(mf_2d_v),
343 varnames_3d, varnames_2d_rho,
344 varnames_2d_u, varnames_2d_v,
345 Geom(),
346 t_new[0], istep, refRatio());
347 writeJobInfo(plotfilename);
348
349#ifdef REMORA_USE_PARTICLES
350 particleData.Checkpoint(plotfilename);
351#endif
352
353#ifdef REMORA_USE_HDF5
354 } else if (plotfile_type == PlotfileType::hdf5) {
355 amrex::Print() << "Writing plotfile " << plotfilename+"d01.h5" << "\n";
356 WriteMultiLevelPlotfileHDF5(plotfilename, finest_level+1,
357 GetVecOfConstPtrs(mf),
358 varnames_3d,
359 Geom(), t_new[0], istep, refRatio());
360#endif
361 } else if (!(plotfile_type == PlotfileType::netcdf)) {
362 amrex::Abort("User specified unknown plot_filetype");
363 }
364
365 } else { // multilevel
367 amrex::Print() << "Writing plotfile " << plotfilename << "\n";
368 int lev0 = 0;
369 [[maybe_unused]] int desired_ratio = std::max(std::max(ref_ratio[lev0][0],ref_ratio[lev0][1]),ref_ratio[lev0][2]);
370 bool any_ratio_one = ( ( (ref_ratio[lev0][0] == 1) || (ref_ratio[lev0][1] == 1) ) ||
371 (ref_ratio[lev0][2] == 1) );
372 for (int lev = 1; lev < finest_level; lev++) {
373 any_ratio_one = any_ratio_one ||
374 ( ( (ref_ratio[lev][0] == 1) || (ref_ratio[lev][1] == 1) ) ||
375 (ref_ratio[lev][2] == 1) );
376 }
377 if (any_ratio_one && expand_plotvars_to_unif_rr) {
378 Vector<IntVect> r2(finest_level);
379 Vector<Geometry> g2(finest_level+1);
380 Vector<MultiFab> mf2(finest_level+1);
381
382 mf2[0].define(grids[0], dmap[0], ncomp_mf_3d, 0);
383
384 // Copy level 0 as is
385 MultiFab::Copy(mf2[0],mf[0],0,0,mf[0].nComp(),0);
386
387 // Define a new multi-level array of Geometry's so that we pass the new "domain" at lev > 0
388 Array<int,AMREX_SPACEDIM> periodicity =
389 {Geom()[0].isPeriodic(0),Geom()[0].isPeriodic(1),Geom()[0].isPeriodic(2)};
390 g2[0].define(Geom()[0].Domain(),&(Geom()[0].ProbDomain()),0,periodicity.data());
391
392 r2[0] = IntVect(1,1,ref_ratio[0][0]);
393 for (int lev = 1; lev <= finest_level; ++lev) {
394 if (lev > 1) {
395 r2[lev-1][0] = 1;
396 r2[lev-1][1] = 1;
397 r2[lev-1][2] = r2[lev-2][2] * ref_ratio[lev-1][0];
398 }
399
400 mf2[lev].define(refine(grids[lev],r2[lev-1]), dmap[lev], ncomp_mf_3d, 0);
401
402 // Set the new problem domain
403 Box d2(Geom()[lev].Domain());
404 d2.refine(r2[lev-1]);
405
406 g2[lev].define(d2,&(Geom()[lev].ProbDomain()),0,periodicity.data());
407 }
408
409 // Make a vector of BCRec with default values so we can use it here -- note the values
410 // aren't actually used because we do PCInterp
411 amrex::Vector<amrex::BCRec> null_dom_bcs;
412 null_dom_bcs.resize(mf2[0].nComp());
413 for (int n = 0; n < mf2[0].nComp(); n++) {
414 for (int dir = 0; dir < AMREX_SPACEDIM; dir++) {
415 null_dom_bcs[n].setLo(dir, REMORABCType::int_dir);
416 null_dom_bcs[n].setHi(dir, REMORABCType::int_dir);
417 }
418 }
419
420 // Do piecewise interpolation of mf into mf2
421 for (int lev = 1; lev <= finest_level; ++lev) {
422 Interpolater* mapper_c = &pc_interp;
423 InterpFromCoarseLevel(mf2[lev], t_new[lev], mf[lev],
424 0, 0, mf2[lev].nComp(),
425 geom[lev], g2[lev],
427 r2[lev-1], mapper_c, null_dom_bcs, 0);
428 }
429
430 // Define an effective ref_ratio which is isotropic to be passed into WriteMultiLevelPlotfile
431 Vector<IntVect> rr(finest_level);
432 for (int lev = 0; lev < finest_level; ++lev) {
433 rr[lev] = IntVect(ref_ratio[lev][0],ref_ratio[lev][1],ref_ratio[lev][0]);
434 }
435
436 WriteMultiLevelPlotfileWithBathymetry(plotfilename, finest_level+1,
437 GetVecOfConstPtrs(mf2),
438 GetVecOfConstPtrs(mf_nd),
439 GetVecOfConstPtrs(mf_u),
440 GetVecOfConstPtrs(mf_v),
441 GetVecOfConstPtrs(mf_w),
442 GetVecOfConstPtrs(mf_2d_rho),
443 GetVecOfConstPtrs(mf_2d_u),
444 GetVecOfConstPtrs(mf_2d_v),
445 varnames_3d, varnames_2d_rho,
446 varnames_2d_u, varnames_2d_v,
447 g2,
448 t_new[0], istep, rr);
449 writeJobInfo(plotfilename);
450
451#ifdef REMORA_USE_PARTICLES
452 particleData.Checkpoint(plotfilename);
453#endif
454 } else {
455 WriteMultiLevelPlotfileWithBathymetry(plotfilename, finest_level+1,
456 GetVecOfConstPtrs(mf),
457 GetVecOfConstPtrs(mf_nd),
458 GetVecOfConstPtrs(mf_u),
459 GetVecOfConstPtrs(mf_v),
460 GetVecOfConstPtrs(mf_w),
461 GetVecOfConstPtrs(mf_2d_rho),
462 GetVecOfConstPtrs(mf_2d_u),
463 GetVecOfConstPtrs(mf_2d_v),
464 varnames_3d, varnames_2d_rho,
465 varnames_2d_u, varnames_2d_v,
466 Geom(),
467 t_new[0], istep, ref_ratio);
468 writeJobInfo(plotfilename);
469#ifdef REMORA_USE_PARTICLES
470 particleData.Checkpoint(plotfilename);
471#endif
472 }
473 }
474 } // end multi-level
475 for (int lev = 0; lev <= finest_level; ++lev) {
476 mask_arrays_for_write(lev, 0.0_rt, (Real) fill_value);
477 }
478}
479
480/**
481 * @param plotfilename name of plotfile to write to
482 * @param nlevels number of levels to write out
483 * @param mf MultiFab of data to write out
484 * @param mf_nd Multifab of nodal data to write out
485 * @param varnames_3d 3D variable names to write out
486 * @param varnames_2d_rho 2D cell-centered variable names to write out
487 * @param varnames_2d_u 2D x-face-based variable names to write out
488 * @param varnames_2d_v 2D y-face-based variable names to write out
489 * @param my_geom geometry to use for writing plotfile
490 * @param time time at which to output
491 * @param level_steps vector over level of iterations
492 * @param rr refinement ratio to use for writing plotfile
493 * @param versionName version string for VisIt
494 * @param levelPrefix string to prepend to level number
495 * @param mfPrefix subdirectory for multifab data
496 * @param extra_dirs additional subdirectories within plotfile
497 */
498 void
499 REMORA::WriteMultiLevelPlotfileWithBathymetry (const std::string& plotfilename, int nlevels,
500 const Vector<const MultiFab*>& mf,
501 const Vector<const MultiFab*>& mf_nd,
502 const Vector<const MultiFab*>& mf_u,
503 const Vector<const MultiFab*>& mf_v,
504 const Vector<const MultiFab*>& mf_w,
505 const Vector<const MultiFab*>& mf_2d_rho,
506 const Vector<const MultiFab*>& mf_2d_u,
507 const Vector<const MultiFab*>& mf_2d_v,
508 const Vector<std::string>& varnames_3d,
509 const Vector<std::string>& varnames_2d_rho,
510 const Vector<std::string>& varnames_2d_u,
511 const Vector<std::string>& varnames_2d_v,
512 const Vector<Geometry>& my_geom,
513 Real time,
514 const Vector<int>& level_steps,
515 const Vector<IntVect>& rr,
516 const std::string &versionName,
517 const std::string &levelPrefix,
518 const std::string &mfPrefix,
519 const Vector<std::string>& extra_dirs) const
520{
521 BL_PROFILE("WriteMultiLevelPlotfileWithBathymetry()");
522
523 BL_ASSERT(nlevels <= mf.size());
524 BL_ASSERT(nlevels <= ref_ratio.size()+1);
525 BL_ASSERT(nlevels <= level_steps.size());
526
527 BL_ASSERT(mf[0]->nComp() == varnames_3d.size());
528
529 bool callBarrier(false);
530 PreBuildDirectorHierarchy(plotfilename, levelPrefix, nlevels, callBarrier);
531 if (!extra_dirs.empty()) {
532 for (const auto& d : extra_dirs) {
533 const std::string ed = plotfilename+"/"+d;
534 PreBuildDirectorHierarchy(ed, levelPrefix, nlevels, callBarrier);
535 }
536 }
537 ParallelDescriptor::Barrier();
538
539 if (ParallelDescriptor::MyProc() == ParallelDescriptor::NProcs()-1) {
540 Vector<BoxArray> boxArrays(nlevels);
541 for(int level(0); level < boxArrays.size(); ++level) {
542 boxArrays[level] = mf[level]->boxArray();
543 }
544
545 auto f = [=]() {
546 VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
547 std::string HeaderFileName(plotfilename + "/Header");
548 std::ofstream HeaderFile;
549 HeaderFile.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
550 HeaderFile.open(HeaderFileName.c_str(), std::ofstream::out |
551 std::ofstream::trunc |
552 std::ofstream::binary);
553 if( ! HeaderFile.good()) FileOpenFailed(HeaderFileName);
554 WriteGenericPlotfileHeaderWithBathymetry(HeaderFile, nlevels, boxArrays, varnames_3d,
555 varnames_2d_rho, varnames_2d_u, varnames_2d_v,
556 my_geom, time, level_steps, rr, versionName,
557 levelPrefix, mfPrefix);
558 };
559
560 if (AsyncOut::UseAsyncOut()) {
561 AsyncOut::Submit(std::move(f));
562 } else {
563 f();
564 }
565 }
566
567 std::string mf_nodal_prefix = "Nu_nd";
568 std::string mf_uface_prefix = "UFace";
569 std::string mf_vface_prefix = "VFace";
570 std::string mf_wface_prefix = "WFace";
571 std::string mf_2d_rho_prefix = "rho2d";
572 std::string mf_2d_u_prefix = "u2d";
573 std::string mf_2d_v_prefix = "v2d";
574
575 for (int level = 0; level <= finest_level; ++level)
576 {
577 if (AsyncOut::UseAsyncOut()) {
578 VisMF::AsyncWrite(*mf[level],
579 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mfPrefix),
580 true);
581 VisMF::AsyncWrite(*mf_nd[level],
582 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_nodal_prefix),
583 true);
585 VisMF::AsyncWrite(*mf_u[level],
586 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_uface_prefix),
587 true);
588 VisMF::AsyncWrite(*mf_v[level],
589 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_vface_prefix),
590 true);
591 VisMF::AsyncWrite(*mf_w[level],
592 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_wface_prefix),
593 true);
594 }
595 if (mf_2d_rho[level]->nComp() > 0) {
596 VisMF::AsyncWrite(*mf_2d_rho[level],
597 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_rho_prefix),
598 true);
599 }
600 if (mf_2d_u[level]->nComp() > 0) {
601 VisMF::AsyncWrite(*mf_2d_u[level],
602 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_u_prefix),
603 true);
604 }
605 if (mf_2d_v[level]->nComp() > 0) {
606 VisMF::AsyncWrite(*mf_2d_v[level],
607 MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_v_prefix),
608 true);
609 }
610 } else {
611 const MultiFab* data;
612 std::unique_ptr<MultiFab> mf_tmp;
613 if (mf[level]->nGrowVect() != 0) {
614 mf_tmp = std::make_unique<MultiFab>(mf[level]->boxArray(),
615 mf[level]->DistributionMap(),
616 mf[level]->nComp(), 0, MFInfo(),
617 mf[level]->Factory());
618 MultiFab::Copy(*mf_tmp, *mf[level], 0, 0, mf[level]->nComp(), 0);
619 data = mf_tmp.get();
620 } else {
621 data = mf[level];
622 }
623 VisMF::Write(*data , MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mfPrefix));
624 VisMF::Write(*mf_nd[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_nodal_prefix));
626 VisMF::Write(*mf_u[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_uface_prefix));
627 VisMF::Write(*mf_v[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_vface_prefix));
628 VisMF::Write(*mf_w[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_wface_prefix));
629 }
630 if (mf_2d_rho[level]->nComp() > 0) {
631 VisMF::Write(*mf_2d_rho[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_rho_prefix));
632 }
633 if (mf_2d_u[level]->nComp() > 0) {
634 VisMF::Write(*mf_2d_u[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_u_prefix));
635 }
636 if (mf_2d_v[level]->nComp() > 0) {
637 VisMF::Write(*mf_2d_v[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mf_2d_v_prefix));
638 }
639 }
640 } // level
641}
642
643/**
644 * @param HeaderFile output stream for header
645 * @param nlevels number of levels to write out
646 * @param bArray vector over levels of BoxArrays
647 * @param varnames_3d 3D variable names to write out
648 * @param varnames_2d 2D variable names to write out
649 * @param my_geom geometry to use for writing plotfile
650 * @param time time at which to output
651 * @param level_steps vector over level of iterations
652 * @param my_ref_ratio refinement ratio to use for writing plotfile
653 * @param versionName version string for VisIt
654 * @param levelPrefix string to prepend to level number
655 * @param mfPrefix subdirectory for multifab data
656 */
657void
659 [[maybe_unused]] int nlevels,
660 const Vector<BoxArray> &bArray,
661 const Vector<std::string> &varnames_3d,
662 const Vector<std::string> &varnames_2d_rho,
663 const Vector<std::string> &varnames_2d_u,
664 const Vector<std::string> &varnames_2d_v,
665 const Vector<Geometry>& my_geom,
666 Real time,
667 const Vector<int> &level_steps,
668 const Vector<IntVect>& my_ref_ratio,
669 const std::string &versionName,
670 const std::string &levelPrefix,
671 const std::string &mfPrefix) const
672{
673 BL_ASSERT(nlevels <= bArray.size());
674 BL_ASSERT(nlevels <= ref_ratio.size()+1);
675 BL_ASSERT(nlevels <= level_steps.size());
676
677 int num_extra_mfs = 1; // for nodal, which is always on
679 num_extra_mfs += 3; // for nodal, which is always on
680 }
681
682 HeaderFile.precision(17);
683
684 // ---- this is the generic plot file type name
685 HeaderFile << versionName << '\n';
686
687 HeaderFile << varnames_3d.size() << '\n';
688
689 for (int ivar = 0; ivar < varnames_3d.size(); ++ivar) {
690 HeaderFile << varnames_3d[ivar] << "\n";
691 }
692 HeaderFile << AMREX_SPACEDIM << '\n';
693 HeaderFile << time << '\n';
694 HeaderFile << finest_level << '\n';
695 for (int i = 0; i < AMREX_SPACEDIM; ++i) {
696 HeaderFile << my_geom[0].ProbLo(i) << ' ';
697 }
698 HeaderFile << '\n';
699 for (int i = 0; i < AMREX_SPACEDIM; ++i) {
700 HeaderFile << my_geom[0].ProbHi(i) << ' ';
701 }
702 HeaderFile << '\n';
703 for (int i = 0; i < finest_level; ++i) {
704 HeaderFile << my_ref_ratio[i][0] << ' ';
705 }
706 HeaderFile << '\n';
707 for (int i = 0; i <= finest_level; ++i) {
708 HeaderFile << my_geom[i].Domain() << ' ';
709 }
710 HeaderFile << '\n';
711 for (int i = 0; i <= finest_level; ++i) {
712 HeaderFile << level_steps[i] << ' ';
713 }
714 HeaderFile << '\n';
715 for (int i = 0; i <= finest_level; ++i) {
716 for (int k = 0; k < AMREX_SPACEDIM; ++k) {
717 HeaderFile << my_geom[i].CellSize()[k] << ' ';
718 }
719 HeaderFile << '\n';
720 }
721 HeaderFile << (int) my_geom[0].Coord() << '\n';
722 HeaderFile << "0\n";
723
724 for (int level = 0; level <= finest_level; ++level) {
725 HeaderFile << level << ' ' << bArray[level].size() << ' ' << time << '\n';
726 HeaderFile << level_steps[level] << '\n';
727
728 const IntVect& domain_lo = my_geom[level].Domain().smallEnd();
729 for (int i = 0; i < bArray[level].size(); ++i)
730 {
731 // Need to shift because the RealBox ctor we call takes the
732 // physical location of index (0,0,0). This does not affect
733 // the usual cases where the domain index starts with 0.
734 const Box& b = shift(bArray[level][i], -domain_lo);
735 RealBox loc = RealBox(b, my_geom[level].CellSize(), my_geom[level].ProbLo());
736 for (int n = 0; n < AMREX_SPACEDIM; ++n) {
737 HeaderFile << loc.lo(n) << ' ' << loc.hi(n) << '\n';
738 }
739 }
740
741 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mfPrefix) << '\n';
742 }
743 HeaderFile << num_extra_mfs << "\n";
744 HeaderFile << "3" << "\n";
745 HeaderFile << "amrexvec_nu_x" << "\n";
746 HeaderFile << "amrexvec_nu_y" << "\n";
747 HeaderFile << "amrexvec_nu_z" << "\n";
748 std::string mf_nodal_prefix = "Nu_nd";
749 for (int level = 0; level <= finest_level; ++level) {
750 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_nodal_prefix) << '\n';
751 }
753 HeaderFile << "1" << "\n"; // number of components in the multifab
754 HeaderFile << "u_vel" << "\n";
755 std::string mf_uface_prefix = "UFace";
756 for (int level = 0; level <= finest_level; ++level) {
757 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_uface_prefix) << '\n';
758 }
759 HeaderFile << "1" << "\n";
760 HeaderFile << "v_vel" << "\n";
761 std::string mf_vface_prefix = "VFace";
762 for (int level = 0; level <= finest_level; ++level) {
763 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_vface_prefix) << '\n';
764 }
765 HeaderFile << "1" << "\n";
766 HeaderFile << "w_vel" << "\n";
767 std::string mf_wface_prefix = "WFace";
768 for (int level = 0; level <= finest_level; ++level) {
769 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_wface_prefix) << '\n';
770 }
771 }
772
773 if (varnames_2d_rho.size() > 0) {
774 HeaderFile << varnames_2d_rho.size() << "\n"; // number of components in the 2D rho multifab
775 for (int ivar = 0; ivar < varnames_2d_rho.size(); ++ivar) {
776 HeaderFile << varnames_2d_rho[ivar] << "\n";
777 }
778 std::string mf_2d_rho_prefix = "rho2d";
779 for (int level = 0; level <= finest_level; ++level) {
780 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_2d_rho_prefix) << "\n";
781 }
782 }
783
784 if (varnames_2d_u.size() > 0) {
785 HeaderFile << varnames_2d_u.size() << "\n"; // number of components in the 2D rho multifab
786 for (int ivar = 0; ivar < varnames_2d_u.size(); ++ivar) {
787 HeaderFile << varnames_2d_u[ivar] << "\n";
788 }
789 std::string mf_2d_u_prefix = "u2d";
790 for (int level = 0; level <= finest_level; ++level) {
791 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_2d_u_prefix) << "\n";
792 }
793 }
794
795 if (varnames_2d_v.size() > 0) {
796 HeaderFile << varnames_2d_v.size() << "\n"; // number of components in the 2D v multifab
797 for (int ivar = 0; ivar < varnames_2d_v.size(); ++ivar) {
798 HeaderFile << varnames_2d_v[ivar] << "\n";
799 }
800 std::string mf_2d_v_prefix = "v2d";
801 for (int level = 0; level <= finest_level; ++level) {
802 HeaderFile << MultiFabHeaderPath(level, levelPrefix, mf_2d_v_prefix) << "\n";
803 }
804 }
805}
806
807/**
808 * @param lev level to mask
809 * @param fill_value fill value to mask with
810 * @param fill_where value at cells where we will apply the mask. This is necessary because rivers
811 */
812void
813REMORA::mask_arrays_for_write(int lev, Real fill_value, Real fill_where) {
814 for (MFIter mfi(*cons_new[lev],false); mfi.isValid(); ++mfi) {
815 Box gbx1 = mfi.growntilebox(IntVect(NGROW+1,NGROW+1,0));
816 Box ubx = mfi.grownnodaltilebox(0,IntVect(NGROW,NGROW,0));
817 Box vbx = mfi.grownnodaltilebox(1,IntVect(NGROW,NGROW,0));
818
819 Array4<Real> const& Zt_avg1 = vec_Zt_avg1[lev]->array(mfi);
820 Array4<Real> const& ubar = vec_ubar[lev]->array(mfi);
821 Array4<Real> const& vbar = vec_vbar[lev]->array(mfi);
822 Array4<Real> const& xvel = xvel_new[lev]->array(mfi);
823 Array4<Real> const& yvel = yvel_new[lev]->array(mfi);
824 Array4<Real> const& temp = cons_new[lev]->array(mfi,Temp_comp);
825 Array4<Real> const& salt = cons_new[lev]->array(mfi,Salt_comp);
826
827 Array4<Real const> const& mskr = vec_mskr[lev]->array(mfi);
828 Array4<Real const> const& msku = vec_msku[lev]->array(mfi);
829 Array4<Real const> const& mskv = vec_mskv[lev]->array(mfi);
830
831 ParallelFor(makeSlab(gbx1,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int )
832 {
833 if (mskr(i,j,0) == 0.0) { // Explicitly compare to 0.0
834 Zt_avg1(i,j,0) = fill_value;
835 }
836 });
837 ParallelFor(gbx1, [=] AMREX_GPU_DEVICE (int i, int j, int k)
838 {
839 if (mskr(i,j,0) == 0.0) { // Explicitly compare to 0.0
840 temp(i,j,k) = fill_value;
841 salt(i,j,k) = fill_value;
842 }
843 });
844 ParallelFor(makeSlab(ubx,2,0), 3, [=] AMREX_GPU_DEVICE (int i, int j, int , int n)
845 {
846 if (msku(i,j,0) == 0.0 && ubar(i,j,0)==fill_where) { // Explicitly compare to 0.0
847 ubar(i,j,0,n) = fill_value;
848 }
849 });
850 ParallelFor(makeSlab(vbx,2,0), 3, [=] AMREX_GPU_DEVICE (int i, int j, int , int n)
851 {
852 if (mskv(i,j,0) == 0.0 && vbar(i,j,0)==fill_where) { // Explicitly compare to 0.0
853 vbar(i,j,0,n) = fill_value;
854 }
855 });
856 ParallelFor(ubx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
857 {
858 if (msku(i,j,0) == 0.0 && xvel(i,j,k)==fill_where) { // Explicitly compare to 0.0
859 xvel(i,j,k) = fill_value;
860 }
861 });
862 ParallelFor(vbx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
863 {
864 if (mskv(i,j,0) == 0.0 && yvel(i,j,k)==fill_where) { // Explicitly compare to 0.0
865 yvel(i,j,k) = fill_value;
866 }
867 });
868 }
869 Gpu::streamSynchronize();
870}
Coord
Coordinates.
#define NGROW
#define Temp_comp
#define Salt_comp
#define NCONS
bool containerHasElement(const V &iterable, const T &query)
PhysBCFunctNoOp null_bc_for_fill
static PlotfileType plotfile_type
Native or NetCDF plotfile output.
Definition REMORA.H:1343
const amrex::Vector< std::string > cons_names
Names of scalars for plotfile output.
Definition REMORA.H:1293
amrex::Vector< amrex::BCRec > domain_bcs_type
vector (over BCVars) of BCRecs
Definition REMORA.H:1196
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_h
Bathymetry data (2D, positive valued, h in ROMS)
Definition REMORA.H:253
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm
horizontal scaling factor: 1 / dx (2D)
Definition REMORA.H:386
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive scalar
Definition REMORA.H:241
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskr
land/sea mask at cell centers (2D)
Definition REMORA.H:375
void writeJobInfo(const std::string &dir) const
Write job info to stdout.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_sustr
Surface stress in the u direction.
Definition REMORA.H:311
amrex::Vector< amrex::MultiFab * > zvel_new
multilevel data container for current step's z velocities (largely unused; W stored separately)
Definition REMORA.H:247
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_msku
land/sea mask at x-faces (2D)
Definition REMORA.H:377
void FillPatchNoBC(int lev, amrex::Real time, amrex::MultiFab &mf_to_be_filled, amrex::Vector< amrex::MultiFab * > const &mfs, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const bool fill_set=true)
Fill a new MultiFab by copying in phi from valid region and filling ghost cells without applying boun...
amrex::Vector< amrex::MultiFab * > yvel_new
multilevel data container for current step's y velocities (v in ROMS)
Definition REMORA.H:245
amrex::Vector< amrex::MultiFab * > xvel_new
multilevel data container for current step's x velocities (u in ROMS)
Definition REMORA.H:243
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskv
land/sea mask at y-faces (2D)
Definition REMORA.H:379
amrex::Vector< int > istep
which step?
Definition REMORA.H:1170
void WriteMultiLevelPlotfileWithBathymetry(const std::string &plotfilename, int nlevels, const amrex::Vector< const amrex::MultiFab * > &mf, const amrex::Vector< const amrex::MultiFab * > &mf_nd, const amrex::Vector< const amrex::MultiFab * > &mf_u, const amrex::Vector< const amrex::MultiFab * > &mf_v, const amrex::Vector< const amrex::MultiFab * > &mf_w, const amrex::Vector< const amrex::MultiFab * > &mf_2d_rho, const amrex::Vector< const amrex::MultiFab * > &mf_2d_u, const amrex::Vector< const amrex::MultiFab * > &mf_2d_v, const amrex::Vector< std::string > &varnames_3d, const amrex::Vector< std::string > &varnames_2d_rho, const amrex::Vector< std::string > &varnames_2d_u, const amrex::Vector< std::string > &varnames_2d_v, const amrex::Vector< amrex::Geometry > &my_geom, amrex::Real time, const amrex::Vector< int > &level_steps, const amrex::Vector< amrex::IntVect > &rr, const std::string &versionName="HyperCLaw-V1.1", const std::string &levelPrefix="Level_", const std::string &mfPrefix="Cell", const amrex::Vector< std::string > &extra_dirs=amrex::Vector< std::string >()) const
write out particular data to an AMReX plotfile
void mask_arrays_for_write(int lev, amrex::Real fill_value, amrex::Real fill_where)
Mask data arrays before writing output.
static int file_min_digits
Minimum number of digits in plotfile name or chunked history file.
Definition REMORA.H:1337
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_svstr
Surface stress in the v direction.
Definition REMORA.H:313
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_DV_avg1
time average of barotropic y velocity flux
Definition REMORA.H:358
amrex::Vector< amrex::Real > t_new
new time at each level
Definition REMORA.H:1174
void WriteGenericPlotfileHeaderWithBathymetry(std::ostream &HeaderFile, int nlevels, const amrex::Vector< amrex::BoxArray > &bArray, const amrex::Vector< std::string > &varnames_3d, const amrex::Vector< std::string > &varnames_2d_rho, const amrex::Vector< std::string > &varnames_2d_u, const amrex::Vector< std::string > &varnames_2d_v, const amrex::Vector< amrex::Geometry > &my_geom, amrex::Real time, const amrex::Vector< int > &level_steps, const amrex::Vector< amrex::IntVect > &rr, const std::string &versionName, const std::string &levelPrefix, const std::string &mfPrefix) const
write out header data for an AMReX plotfile
static int plot_staggered_vels
Whether to write the staggered velocities (not averaged to cell centers)
Definition REMORA.H:1340
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_vbar
barotropic y velocity (2D)
Definition REMORA.H:370
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_DU_avg1
time average of barotropic x velocity flux (2D)
Definition REMORA.H:354
bool expand_plotvars_to_unif_rr
whether plotfile variables should be expanded to a uniform refinement ratio
Definition REMORA.H:1302
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_ubar
barotropic x velocity (2D)
Definition REMORA.H:368
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bustr
Bottom stress in the u direction.
Definition REMORA.H:349
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bvstr
Bottom stress in the v direction.
Definition REMORA.H:351
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_z_phys_nd
z coordinates at psi points (cell nodes)
Definition REMORA.H:305
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
Definition REMORA.H:388
amrex::Vector< std::string > plot_var_names_3d
Names of 3D variables to output to AMReX plotfile.
Definition REMORA.H:1289
std::string plot_file_name
Plotfile prefix.
Definition REMORA.H:1266
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Zt_avg1
Average of the free surface, zeta (2D)
Definition REMORA.H:308
void WritePlotFile()
main driver for writing AMReX plotfiles
amrex::Vector< std::string > plot_var_names_2d
Names of 2D variables to output to AMReX plotfile.
Definition REMORA.H:1291
void remora_dervort(const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Array4< const amrex::Real > &pm, const amrex::Array4< const amrex::Real > &pn, const amrex::Array4< const amrex::Real > &, const amrex::Geometry &, amrex::Real, const int *, const int)
void remora_dernull(const amrex::Box &, amrex::FArrayBox &, int, int, const amrex::FArrayBox &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Geometry &, amrex::Real, const int *, const int)