27#pragma omp parallel if (Gpu::notInLaunchRegion())
31 const Box&
vbx =
mfi.validbox();
32 const int klo =
vbx.smallEnd(2);
33 const int khi =
vbx.bigEnd(2);
37 const Box&
gbx =
mfi.fabbox();
63 const IntVect
ng =
mf.nGrowVect();
66#pragma omp parallel if (Gpu::notInLaunchRegion())
70 const Box&
vbx =
mfi.validbox();
71 const Box
gbx =
mfi.growntilebox(IntVect(
ng[0],
ng[1],0));
74 const int ilo =
vbx.smallEnd(0);
const int ihi =
vbx.bigEnd(0);
75 const int jlo =
vbx.smallEnd(1);
const int jhi =
vbx.bigEnd(1);
81 amrex::min(amrex::max(
j,
jlo),
jhi),
k);
104 const Geometry&
geom,
117 "REMORAErrorTag: RELGRAD and VORT have no mask guard; "
118 "give them one before building them from inputs");
130 mskr3d->DistributionMap() ==
mf->DistributionMap());
143 for (
int d = 0;
d < 2; ++
d) {
154 auto const&
datma =
mf->const_arrays();
159 "Threshold values not properly set in REMORAErrorTag");
228 Gpu::streamSynchronize();
243 const int tagval = TagBox::SET;
265 names +=
"x_velocity, y_velocity, z_velocity, vorticity, mask";
266#ifdef REMORA_USE_PARTICLES
267 names +=
", <particle>_count";
280 IntVect
mask_lo = IntVect::TheZeroVector();
281 IntVect
mask_hi = IntVect::TheZeroVector();
335#pragma omp parallel if (Gpu::notInLaunchRegion())
339 const Box&
bx =
mfi.tilebox();
345 derived::remora_dervort(
bx,
dfab, 0, 1,
sfab,
pm,
pn,
maskr,
Geom(
levc),
time,
nullptr,
levc);
379 const Box
bx =
mfi.growntilebox(IntVect(1,1,0));
388#ifdef REMORA_USE_PARTICLES
404 IntVect
rr = IntVect::TheUnitVector();
464 const Box&
bx =
mfi.validbox();
467 const int klo =
bx.smallEnd(2);
468 const int khi =
bx.bigEnd(2);
525 amrex::Abort(
"Must only specify box for refinement using real OR index space with fine/coarse grid indices");
574 amrex::Print() <<
"Fine box on level " <<
lev_for_box <<
" adjusted from " <<
bx_old <<
" to " <<
bx <<
" to make it valid for refinement." << std::endl;
577 amrex::Print() <<
"Saving in 'boxes at level' as " <<
bx << std::endl;
587 amrex::Abort(
"Don't use n_error_buf > 0 when setting the box explicitly");
601 if (!domain.contains(
bx)) {
602 amrex::Print() <<
"\n";
603 amrex::Print() <<
"Box specified is " <<
bx << std::endl;
604 amrex::Print() <<
"But domain at level is " << domain << std::endl;
605 amrex::Error(
"Specified box doesn't fit in the domain");
617 amrex::Print()<<
"Requested ilo in x-direction : " <<
box_lo[0] << std::endl;
618 amrex::Print() <<
"ilo = " <<
box_lo[0] <<
" is not divisible by ref_ratio in x direction = " <<
620 amrex::Error(
"Adjust in_box_lo_indices in x-direction to be divisible by ref_ratio and try again");
623 amrex::Print()<<
"Requested ihi in x-direction : " <<
box_hi[0] << std::endl;
624 amrex::Print() <<
"ihi+1 = " <<
box_hi[0]+1 <<
" is not divisible by ref_ratio in x direction = " <<
626 amrex::Error(
"Adjust in_box_hi_indices in x-direction to be divisible by ref_ratio and try again");
629 amrex::Print()<<
"Requested jlo in y-direction : " <<
box_lo[1] << std::endl;
630 amrex::Print() <<
"jlo = " <<
box_lo[1] <<
" is not divisible by ref_ratio in y direction = " <<
632 amrex::Error(
"Adjust in_box_lo_indices in y-direction to be divisible by ref_ratio and try again");
635 amrex::Print()<<
"Requested jhi in y-direction : " <<
box_hi[1] << std::endl;
636 amrex::Print() <<
"jhi+1 = " <<
box_hi[1]+1 <<
" is not divisible by ref_ratio in y direction = " <<
638 amrex::Error(
"Adjust in_box_hi_indices in y-direction to be divisible by ref_ratio and try again");
641 amrex::Print()<<
"Requested klo in z-direction : " <<
box_lo[2] << std::endl;
642 amrex::Print() <<
"klo = " <<
box_lo[2] <<
" is not divisible by ref_ratio in z direction = " <<
644 amrex::Error(
"Adjust in_box_lo_indices in z-direction to be divisible by ref_ratio and try again");
647 amrex::Print()<<
"Requested khi in z-direction : " <<
box_hi[2] << std::endl;
648 amrex::Print() <<
"khi+1 = " <<
box_hi[2]+1 <<
" is not divisible by ref_ratio in z direction = " <<
650 amrex::Error(
"Adjust in_box_hi_indices in z-direction to be divisible by ref_ratio and try again");
654 Print() <<
"Saving in 'boxes at level' as " <<
bx << std::endl;
664 amrex::Abort(
"Don't use n_error_buf > 0 when setting the box explicitly");
678 amrex::Print() <<
"\n";
679 amrex::Print() <<
"(Coarse) Box specified is " <<
bx << std::endl;
680 amrex::Print() <<
"But (coarse) domain at level is " <<
geom[
lev_for_box-1].Domain() << std::endl;
681 amrex::Error(
"Specified box doesn't fit in the domain");
696 Print() <<
"Saving in 'boxes at level' as " <<
bx << std::endl;
707 double ref_min_time = std::numeric_limits<double>::lowest();
708 double ref_max_time = std::numeric_limits<double>::max();
711 if (
ppr.countval(
"max_level") > 0) {
716 if (
ppr.countval(
"value_greater")) {
723 else if (
ppr.countval(
"value_less")) {
730 else if (
ppr.countval(
"adjacent_difference_greater")) {
731 int num_val =
ppr.countval(
"adjacent_difference_greater");
constexpr amrex::Real zero
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
void operator()(amrex::TagBoxArray &tba, const amrex::MultiFab *mf, const amrex::MultiFab *mskr3d, char clearval, char tagval, amrex::Real time, int level, const amrex::Geometry &geom, const amrex::IntVect &mask_lo=amrex::IntVect::TheZeroVector(), const amrex::IntVect &mask_hi=amrex::IntVect::TheZeroVector()) const
int ncons
Number of conserved scalars in the state (temperature + salt + passive scalars + biology tracers)
int zvel_bc() const noexcept
int xvel_bc() const noexcept
amrex::Vector< std::string > cons_names
Names of scalars for plotfile output.
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< 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)
int yvel_bc() const noexcept
amrex::Vector< amrex::MultiFab * > zvel_new
multilevel data container for current step's z velocities (largely unused; W stored separately)
amrex::Vector< amrex::Vector< amrex::Box > > boxes_at_level
the boxes specified at each level by tagging criteria
amrex::Vector< amrex::MultiFab * > yvel_new
multilevel data container for current step's y velocities (v in ROMS)
amrex::Vector< int > num_boxes_at_level
how many boxes specified at each level by tagging criteria
amrex::Vector< amrex::MultiFab * > xvel_new
multilevel data container for current step's x velocities (u in ROMS)
void refinement_criteria_setup()
Set refinement criteria.
virtual void ErrorEst(int lev, amrex::TagBoxArray &tags, amrex::Real time, int ngrow) override
Tag cells for refinement.
void FillBdyCCVels(int lev, amrex::MultiFab &mf_cc_vel)
Fill the physical boundary conditions for cell-centered velocity (diagnostic only)
std::string pp_prefix
default prefix for input file parameters
static SolverChoice solverChoice
Container for algorithmic choices.
void FillPatch(int lev, amrex::Real time, amrex::MultiFab &mf_to_be_filled, amrex::Vector< amrex::MultiFab * > const &mfs, const int bccomp, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const bool fill_set=false, const int n_not_fill=0, const int icomp_calc=0, const amrex::Real dt=zero, const amrex::MultiFab &mf_calc=amrex::MultiFab(), amrex::Vector< amrex::MultiFab * > const &mfs_crse_old={}, amrex::Vector< amrex::MultiFab * > const &mfs_crse_new={})
Fill a new MultiFab by copying in phi from valid region and filling ghost cells.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
double model_time(amrex::Real elapsed) const noexcept
Time on the model clock, in seconds, of an elapsed time such as t_new.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskr3d
land/sea mask at cell centers, copied to all z levels (3D)
static amrex::Vector< REMORAErrorTag > ref_tags
Holds info for dynamically generated tagging criteria.
static constexpr int cons_bc
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)