71#ifdef REMORA_USE_NETCDF
74 amrex::Abort(
"remora.biology_ic_type = netcdf requires a NetCDF build");
106#ifdef REMORA_USE_NETCDF
109 amrex::Abort(
"remora.biology_ic_type = netcdf requires a NetCDF build");
132#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
138 Box
bx =
mfi.tilebox();
188 auto N =
Geom(
lev).Domain().size()[2]-1;
218 for (
int k=0;
k<=
N;
k++) {
231 for(
int k=0;
k<=
N;
k++) {
240 FillPatch(
lev,
t_new[
lev], *
vec_ubar[
lev],
GetVecOfPtrs(
vec_ubar),
ubar_bc(),
bdy_ubar(),0,
false,
false,0,0,
zero,*
vec_ubar[
lev]);
241 FillPatch(
lev,
t_new[
lev], *
vec_vbar[
lev],
GetVecOfPtrs(
vec_vbar),
vbar_bc(),
bdy_vbar(),0,
false,
false,0,0,
zero,*
vec_vbar[
lev]);
257 for (
int n = 0; n <
NAT; n++) {
261 auto N =
Geom(
lev).Domain().size()[2]-1;
264#pragma omp parallel if (Gpu::notInLaunchRegion())
305#ifdef REMORA_USE_NETCDF
311 amrex::Print() <<
"No remora.nc_clim_coeff_file given; climatology nudging will use "
312 "the constant timescales from remora.tnudg, m2nudg, and m3nudg"
315 amrex::Print() <<
"Calling init_clim_nudg_coeff_from_netcdf \n " << std::endl;
317 amrex::Print() <<
"Climatology weights loaded from netcdf file \n " << std::endl;
325 int nz =
geom[0].Domain().length(2);
334const DistributionMapping&
475 const Real
pm =
dxi[0];
476 const Real
pn =
dxi[1];
479 const Box&
bx =
mfi.growntilebox();
484 xr(
i,
j,0) = (
i + Real(0.5)) /
pm;
485 yr(
i,
j,0) = (
j + Real(0.5)) /
pn;
constexpr amrex::Real zero
mf_h setVal(geomdata.ProbHi(2))
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskr_full_domain
Land/sea mask at cell centers on the whole domain at each potential level. Specified at hires_grid_le...
ProbCoords prob_coords(int lev) const
Coordinate arrays of level lev, for the prob functions.
int ncons
Number of conserved scalars in the state (temperature + salt + passive scalars + biology tracers)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_zeta_full_domain
high resolution initial free surface height (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_fcor
coriolis factor (2D)
void allocate_init_full_domain()
Allocate multifabs for storing full-domain high resolution initial data.
void init_gls_vmix(int lev, SolverChoice solver_choice)
Initialize GLS variables.
void init_biology_from_netcdf(int lev)
Biology initialization from NetCDF file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_xvel_full_domain
multilevel data container for high res initial x velocities (u in ROMS)
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)
void init_biology_ic(int lev)
Initialize biology tracers from whichever source remora.biology_ic_type selects. Call after the physi...
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive tracer
void init_biology_ic_full_domain()
Full-domain counterpart of init_biology_ic, for the hires_init_level average-down path.
amrex::Gpu::DeviceVector< amrex::Real > s_w
Scaled vertical coordinate (range [0,1]) that transforms to z, defined at w-points (cell faces)
REMORABiology::BiologyModel biology_model
Active biology package.
std::unique_ptr< ProblemBase > prob
Pointer to container of analytical functions for problem definition.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskr
land/sea mask at cell centers (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_tke
Turbulent kinetic energy.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_gls
Turbulent generic length scale.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_xr
x_grid on rho points (2D)
void init_biology_full_domain_from_netcdf()
Full-domain high-res biology initialization from NetCDF file.
void set_grid_scale(int lev)
Set pm and pn arrays and x/y coords on level lev.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Lscale
Vertical mixing turbulent length scale.
amrex::DistributionMapping dm_full_domain
the DistributionMapping every full-domain multifab is built on. Each of those covers the domain in a ...
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Hz
Width of cells in the vertical (z-) direction (3D, Hz in ROMS)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akt
Vertical diffusion coefficient (3D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm_full_domain
horizontal scaling factor: 1 / dx (2D) on whole domain
amrex::Vector< amrex::MultiFab * > yvel_new
multilevel data container for current step's y velocities (v in ROMS)
amrex::Box nc_hires_init_box
Box for the full domain at nc_hires_init_level.
amrex::Gpu::DeviceVector< amrex::Real > s_r
Scaled vertical coordinate (range [0,1]) that transforms to z, defined at rho points (cell centers)
amrex::Vector< amrex::IntVect > cum_ref_ratios
Cumulative refinement ratio between level 0 and level i.
void stretch_transform_full_domain(int lev, const amrex::MultiFab &mf_h, const amrex::MultiFab &mf_zeta, amrex::MultiFab &mf_z_r, amrex::MultiFab &mf_z_w)
Calculate z_r and z_w on full-domain arrays at a level not yet created.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_z_r
z coordinates at rho points (cell centers)
void coarsen_bathymetry_with_grow_cells(int crse_lev)
Coarsen the full-domain bathymetry from crse_lev+1 onto crse_lev, grow cells included,...
amrex::Vector< amrex::MultiFab * > xvel_new
multilevel data container for current step's x velocities (u in ROMS)
int bdy_zeta() const noexcept
void init_beta_plane_coriolis(int lev)
Calculate Coriolis parameters from beta plane parametrization.
std::string nc_clim_coeff_file
NetCDF climatology coefficient file.
void coarsen_masks_with_grow_cells(int crse_lev)
Coarsen the full-domain rho-mask from crse_lev+1 onto crse_lev, grow cells included,...
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_yvel_full_domain
multilevel data container for high res initial y velocities (v in ROMS)
void calc_stretch_coeffs()
calculate vertical stretch coefficients
void set_zeta_average(int lev)
Set Zt_avg1 to zeta.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_h_full_domain
Bathymetry data on the whole domain at each potential level.
void init_full_domain_from_analytic()
Initialize high-resolution initial data, zeta included, from analytic functions.
int hires_init_level
Which level the high resolution initialization data is at.
int bdy_vbar() const noexcept
amrex::Gpu::DeviceVector< amrex::Real > Cs_r
Stretching coefficients at rho points.
amrex::Vector< amrex::Real > t_new
new time at each level, in seconds since start_time
void init_stretch_coeffs()
initialize and calculate stretch coefficients
static SolverChoice solverChoice
Container for algorithmic choices.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akk
Turbulent kinetic energy vertical diffusion coefficient.
int bdy_ubar() const noexcept
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_zeta
free surface height (2D)
int ubar_bc() const noexcept
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_vbar
barotropic y velocity (2D)
amrex::Box nc_hires_grid_box
Box for the full domain at nc_hires_grid_level.
amrex::Gpu::DeviceVector< amrex::Real > Cs_w
Stretching coefficients at w points.
void set_2darrays(int lev)
Set 2D momentum arrays from 3D momentum.
void init_analytic(int lev)
Initialize initial problem data from analytic functions.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_ubar
barotropic x velocity (2D)
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.
void init_clim_nudg_coeff_from_netcdf(int lev)
Climatology nudging coefficient initialization from NetCDF file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_cons_full_domain
multilevel data container for high res initial data: temperature, salinity, passive tracer
int vbar_bc() const noexcept
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn_full_domain
horizontal scaling factor: 1 / dy (2D) on whole domain
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > vec_nudg_coeff
Climatology nudging coefficients.
const amrex::DistributionMapping & full_domain_dmap()
The shared full-domain DistributionMapping, built on first use.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akv
Vertical viscosity coefficient (3D)
void init_masks_full_domain_from_analytic()
Full domain land-sea mask initialization from analytic.
REMORABiology::FennelParameters fennel_params
Runtime parameters for the Fennel biology package.
void allocate_bathymetry_grid_vars_full_domain()
Allocate multifabs for storing full-domain bathymetry and grid vars data.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Zt_avg1
Average of the free surface, zeta (2D)
void average_down_with_grow_cells(int lev, amrex::Vector< std::unique_ptr< amrex::MultiFab > > &mf, bool use_mask=false)
Average down from level lev+1 to lev in mf, including grow cells.
void init_clim_nudg_coeff(int lev)
Wrapper to initialize climatology nudging coefficient.
void init_bathymetry_full_domain_from_analytic()
Full domain bathymetry data initialization from analytic.
int hires_grid_level
Which level the high resolution bathymetry is at.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_z_w
z coordinates at w points (faces between z-cells)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_yr
y_grid on rho points (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akp
Turbulent length scale vertical diffusion coefficient.
REMORABiology::BiologyICType biology_ic_type
Source of the biology tracer initial condition, independent of remora.ic_type. Default follows ic_typ...
int cons(int icomp) noexcept
bool has_biology(BiologyModel model) noexcept
@ follow_ic_type
default: NetCDF when ic_type is netcdf, else analytic
Coordinates a prob function reads, on the BoxArray and DistributionMapping of the MultiFab it fills.
const amrex::MultiFab * x_r
amrex::Real coriolis_beta
amrex::Vector< amrex::Real > nudg_coeff