2#include "AMReX_Interp_3D_C.H"
3#include "AMReX_PlotFileUtil.H"
9template<
typename V,
typename T>
18#ifndef REMORA_USE_NETCDF
46 for (
int n = 0; n <
ncons; ++n) {
53 for (
int n = 0; n <
ncons; ++n) {
96 amrex::Abort(
"Don't know this plotfile type");
113 for (
auto&
b :
bl2d) {
210 amrex::Abort(
"Found while writing output: visc2 contains nan or inf");
213 const Box&
bx =
mfi.validbox();
214 const int K =
mfi.index();
224 for (
int n = 0; n <
ncons; ++n) {
229 const Box&
bx =
mfi.validbox();
230 const int K =
mfi.index();
241 for (
int n = 0; n <
ncons; ++n) {
252 amrex::Abort(
"Attempting to write longwave radiation flux to plotfile. Variable not allocated when bulk_fluxes turned off");
259 amrex::Abort(
"Attempting to write latent heat flux to plotfile. Variable not allocated when bulk_fluxes turned off");
266 amrex::Abort(
"Attempting to write shortwave radiation flux to plotfile. Variable not allocated when bulk_fluxes turned off");
273 amrex::Abort(
"Attempting to write sensible heat flux to plotfile. Variable not allocated when bulk_fluxes turned off");
342 amrex::Abort(
"Found while writing output: " +
cons_names[
i] +
343 " contains nan or inf");
358 amrex::Abort(
"Found while writing output: u velocity contains nan or inf");
365 amrex::Abort(
"Found while writing output: v velocity contains nan or inf");
372 amrex::Abort(
"Found while writing output: z velocity contains nan or inf");
379 Real
dx =
Geom()[
lev].CellSizeArray()[0];
380 Real
dy =
Geom()[
lev].CellSizeArray()[1];
391#pragma omp parallel if (Gpu::notInLaunchRegion())
394 const Box&
bx =
mfi.tilebox();
417#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
421 const Box&
bx =
mfi.tilebox();
426 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);
429 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);
440#ifdef REMORA_USE_PARTICLES
469 Real
dz =
Geom()[
lev].CellSizeArray()[2];
470 int N =
Geom()[
lev].Domain().size()[2];
473#pragma omp parallel if (Gpu::notInLaunchRegion())
477 const Box&
bx =
mfi.tilebox();
494 amrex::Print() <<
"Writing plotfile " <<
plotfilename <<
"\n";
510#ifdef REMORA_USE_PARTICLES
518 amrex::Print() <<
"Writing plotfile " <<
plotfilename <<
"\n";
540 {
Geom()[0].isPeriodic(0),
Geom()[0].isPeriodic(1),
Geom()[0].isPeriodic(2)};
564 for (
int n = 0; n <
mf2[0].nComp(); n++) {
602#ifdef REMORA_USE_PARTICLES
620#ifdef REMORA_USE_PARTICLES
628#ifdef REMORA_USE_NETCDF
647 amrex::Abort(
"Don't know this plotfile type");
692 BL_PROFILE(
"WriteMultiLevelPlotfileWithBathymetry()");
708 ParallelDescriptor::Barrier();
710 if (ParallelDescriptor::MyProc() == ParallelDescriptor::NProcs()-1) {
719 VisMF::IO_Buffer
io_buffer(VisMF::IO_Buffer_Size);
724 std::ofstream::trunc |
725 std::ofstream::binary);
733 if (AsyncOut::UseAsyncOut()) {
734 AsyncOut::Submit(std::move(
f));
750 if (AsyncOut::UseAsyncOut()) {
786 const MultiFab* data;
787 std::unique_ptr<MultiFab>
mf_tmp;
1062 Gpu::streamSynchronize();
constexpr amrex::Real zero
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
pp_prob query("traditional", traditional)
bool containerHasElement(const V &iterable, const T &query)
static PhysBCFunctNoOp null_bc_for_fill
static PlotfileType plotfile_type
Native or NetCDF plotfile output.
int ncons
Number of conserved scalars in the state (temperature + salt + passive scalars + biology tracers)
static bool plot_staggered_vels
Whether to write the staggered velocities (not averaged to cell centers)
amrex::Vector< amrex::BCRec > domain_bcs_type
vector (over BCVars) of BCRecs
amrex::Vector< std::string > cons_names
Names of scalars for plotfile output.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_fcor
coriolis factor (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_h
multilevel data container for current step's z velocities (largely unused; W stored separately)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm
horizontal scaling factor: 1 / dx (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_lrflx
longwave radiation
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive tracer
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskr
land/sea mask at cell centers (2D)
amrex::Real plotfile_fill_value
fill value for masked arrays in amrex plotfiles
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.
amrex::Vector< amrex::MultiFab * > zvel_new
multilevel data container for current step's z velocities (largely unused; W stored separately)
int foextrap_bc() const noexcept
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_msku
land/sea mask at x-faces (2D)
amrex::Vector< amrex::MultiFab * > yvel_new
multilevel data container for current step's y velocities (v in ROMS)
static bool plot_nodal_data
Whether to write nodal data (Nu_nd) to plotfiles.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_shflx
sensible heat flux
amrex::Vector< amrex::MultiFab * > xvel_new
multilevel data container for current step's x velocities (u in ROMS)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_lhflx
latent heat flux
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=false)
Fill a new MultiFab by copying in phi from valid region and filling ghost cells without applying boun...
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskv
land/sea mask at y-faces (2D)
amrex::Vector< int > istep
which step?
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.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_visc2_r
Harmonic viscosity defined on the rho points (centers)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_svstr
Surface stress in the v direction.
void FillBdyCCVels(int lev, amrex::MultiFab &mf_cc_vel)
Fill the physical boundary conditions for cell-centered velocity (diagnostic only)
void WriteNCPlotFile(int istep, amrex::MultiFab const *plotMF)
Write plotfile using NetCDF (wrapper)
amrex::Vector< amrex::Real > t_new
new time at each level
static SolverChoice solverChoice
Container for algorithmic choices.
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
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_vbar
barotropic y velocity (2D)
bool expand_plotvars_to_unif_rr
whether plotfile variables should be expanded to a uniform refinement ratio
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_ubar
barotropic x velocity (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bustr
Bottom stress in the u direction.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bvstr
Bottom stress in the v direction.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_z_phys_nd
z coordinates at psi points (cell nodes)
amrex::Real netcdf_fill_value
fill value for masked arrays in netcdf output
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
amrex::Vector< std::string > plot_var_names_3d
Names of 3D variables to output to AMReX plotfile.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_stflux
Surface tracer flux; input arrays.
std::string plot_file_name
Plotfile prefix.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Zt_avg1
Average of the free surface, zeta (2D)
void WritePlotFile(int istep)
main driver for writing AMReX plotfiles
amrex::Vector< std::string > plot_var_names_2d
Names of 2D variables to output to AMReX plotfile.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_srflx
Shortwave radiation flux [W/m²], defined at rho-points.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_diff2
Harmonic diffusivity for temperature / salinity.
static constexpr int t
cons component Temp_comp
static constexpr int null
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)