8#ifdef REMORA_USE_NETCDF
12#include <AMReX_buildInfo.H>
49#ifdef REMORA_USE_NETCDF
72 if (ParallelDescriptor::IOProcessor()) {
75 const char*
buildgithash = amrex::buildInfoGetBuildGitHash();
76 const char*
buildgitname = amrex::buildInfoGetBuildGitName();
79 amrex::Print() <<
"\n"
83 amrex::Print() <<
"AMReX git hash: " <<
amrex_hash <<
"\n";
89 amrex::Print() <<
"\n";
150 amrex::Print() <<
"Refinement ratio at level " <<
lev <<
" set to be " <<
155 amrex::Print() <<
"********************************************************************************" << std::endl;
156 amrex::Print() <<
"We don't allow refinement in the vertical -- make sure to set ref_ratio = 1 in z" << std::endl;
157 amrex::Print() <<
"It's possible you set amr.ref_ratio when you meant to set amr.ref_ratio_vect " << std::endl;
158 amrex::Print() <<
"********************************************************************************" << std::endl;
174 if (ParallelDescriptor::IOProcessor()) {
177 const char*
buildgithash = amrex::buildInfoGetBuildGitHash();
178 const char*
buildgitname = amrex::buildInfoGetBuildGitName();
181 amrex::Print() <<
"\n"
185 amrex::Print() <<
"AMReX git hash: " <<
amrex_hash <<
"\n";
191 amrex::Print() <<
"\n";
230 amrex::Print() <<
"Refinement ratio at level " <<
lev <<
" set to be " <<
235 amrex::Print() <<
"********************************************************************************" << std::endl;
236 amrex::Print() <<
"We don't allow refinement in the vertical -- make sure to set ref_ratio = 1 in z" << std::endl;
237 amrex::Print() <<
"It's possible you set amr.ref_ratio when you meant to set amr.ref_ratio_vect " << std::endl;
238 amrex::Print() <<
"********************************************************************************" << std::endl;
261 cons_names.emplace_back(
"tracer_" + std::to_string(
i));
285 amrex::Print() <<
"\nCoarse STEP " <<
step+1 <<
" starts ..." << std::endl;
302 amrex::Print() <<
"Coarse STEP " <<
step+1 <<
" ends." <<
" TIME = " <<
cur_time
303 <<
" DT = " <<
dt[0] << std::endl;
308 ParallelDescriptor::ReduceRealMax(
dEvolveTime,ParallelDescriptor::IOProcessorNumber());
309 amrex::Print() <<
"Timestep time = " <<
dEvolveTime <<
" seconds." <<
'\n';
316#ifdef AMREX_MEM_PROFILING
318 std::ostringstream
ss;
319 ss <<
"[STEP " <<
step+1 <<
"]";
320 MemProfiler::report(
ss.str());
377#ifdef REMORA_USE_PARTICLES
409 amrex::Print() <<
"REMORA InitData: driver-managed atm2ocn coupling enabled"
411 <<
" active_contract="
444#ifdef REMORA_USE_MOAB
467 FillPatch(
lev,
t_new[
lev], *
cons_new[
lev],
cons_new,
BCVars::cons_bc,
BdyVars::t, 0,
true,
false,0,0,
zero,*
cons_new[
lev]);
468 FillPatch(
lev,
t_new[
lev], *
xvel_new[
lev],
xvel_new,
xvel_bc(),
BdyVars::u, 0,
true,
false,0,0,
zero,*
xvel_new[
lev]);
469 FillPatch(
lev,
t_new[
lev], *
yvel_new[
lev],
yvel_new,
yvel_bc(),
BdyVars::v, 0,
true,
false,0,0,
zero,*
yvel_new[
lev]);
524 BL_PROFILE(
"REMORA::Construct_REMORAFillPatchers()");
525 amrex::Print() <<
":::Construct_REMORAFillPatchers " <<
lev << std::endl;
573 BL_PROFILE(
"REMORA::Define_REMORAFillPatchers()");
574 amrex::Print() <<
":::Define_REMORAFillPatchers " <<
lev << std::endl;
643#ifdef REMORA_USE_NETCDF
644 amrex::Print() <<
"Calling init_zeta_from_netcdf on level " <<
lev << std::endl;
646 amrex::Print() <<
"Sea surface height loaded from netcdf file \n " << std::endl;
649 amrex::Abort(
"Unknown IC_Type");
686#ifdef REMORA_USE_NETCDF
687 amrex::Print() <<
"Calling init_bathymetry_from_netcdf " << std::endl;
689 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
690 amrex::Print() <<
"Calling init_grid_vars_from_netcdf " << std::endl;
692 amrex::Print() <<
"Grid variables loaded from netcdf file \n " << std::endl;
695 amrex::Abort(
"Unknown IC_Type");
787 FillPatch(
lev,
t_new[
lev], *
cons_new[
lev],
cons_new,
BCVars::cons_bc,
BdyVars::t, 0,
true,
false,0,0,
zero,*
cons_new[
lev]);
788 FillPatch(
lev,
t_new[
lev], *
xvel_new[
lev],
xvel_new,
xvel_bc(),
BdyVars::u, 0,
true,
false,0,0,
zero,*
xvel_new[
lev]);
789 FillPatch(
lev,
t_new[
lev], *
yvel_new[
lev],
yvel_new,
yvel_bc(),
BdyVars::v, 0,
true,
false,0,0,
zero,*
yvel_new[
lev]);
803#ifdef REMORA_USE_NETCDF
806 amrex::Print() <<
"Calling init_coriolis_from_netcdf " << std::endl;
808 amrex::Print() <<
"Coriolis loaded from netcdf file \n" << std::endl;
815 Abort(
"Don't know this coriolis_type!");
834 Abort(
"Don't know this vertical mixing type");
846 for (
int n = 0; n <
NAT; n++) {
851 for (
int n = 0; n <
NAT; n++) {
866#ifdef REMORA_USE_NETCDF
868 amrex::Print() <<
"Calling init_masks_from_netcdf level " <<
lev << std::endl;
870 amrex::Print() <<
"Masks loaded from netcdf file \n " << std::endl;
896 for (
int l = 0;
l <
lev; ++
l) {
909 for (
int n = 0; n <
ncons; n++) {
942 for (
int n = 0; n <
ncons; n++) {
950 amrex::Gpu::LaunchSafeGuard
lsg(
true);
964 ParallelDescriptor::ReduceRealMin(
denom_min);
966 Abort(
"scaled_to_grid: found non-positive pm*pn (grid metrics must be > 0)");
986 ParallelDescriptor::ReduceRealMax(
grdmax);
988 Abort(
"scaled_to_grid: grdmax <= 0");
997 for (
int l = 0;
l <
lev; ++
l) {
1010 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
1017 const Box&
bx =
mfi.validbox();
1045 const Box&
bx =
mfi.validbox();
1072 amrex::Gpu::LaunchSafeGuard
lsg_diag(
true);
1135 if (ParallelDescriptor::IOProcessor() &&
lev == 0)
1137 Print() <<
"\nHorizontal mixing scaled by grid metric\n";
1140 Print() <<
"AMR scaling (linear) lev_scale = " <<
lev_scale <<
"\n";
1142 Print() <<
"visc2(all) min/max = "
1145 Print() <<
"visc2(wet,k=0) min/max = "
1148 Print() <<
"visc2(mask->0) min/max = "
1154 Abort(
"Don't know this horizontal mixing type");
1161 for (
int n = 0; n <
ncons; n++) {
1177#ifdef REMORA_USE_NETCDF
1201#ifdef REMORA_USE_NETCDF
1246 amrex::Abort(
"NetCDF bulk-flux forcing requires building with NetCDF");
1282 const std::unique_ptr<MultiFab>&
mf_lev) -> MultiFab&
1346#ifdef REMORA_USE_NETCDF
1352 amrex::Error(
"NetCDF climatology file name must be provided via input");
1378 amrex::Abort(
"Climatology file " +
fname +
" does not contain '" +
1381 "or turn that flag off.");
1392 amrex::Print() <<
"Calling init_bdry_from_netcdf at level " <<
lev << std::endl;
1394 amrex::Print() <<
"Boundary data loaded from netcdf file \n " << std::endl;
1401 amrex::Error(
"NetCDF forcing file name must be provided via input for surface momentum fluxes");
1420 amrex::Error(
"NetCDF forcing file name must be provided via input for bulk-flux atmospheric forcing");
1502 amrex::Error(
"NetCDF river file name must be provided via input for rivers");
1505 int nz =
dom.length(2);
1517 amrex::Abort(
"River file " +
fname +
" does not contain '" +
field +
1518 "', but river input is enabled for tracer '" +
1536 amrex::Print() <<
"Reading high resolution bathymetry and grid data" << std::endl;
1540 amrex::Print() <<
"Done reading in high resolution bathymetry and grid data" << std::endl;
1543 amrex::Print() <<
"Reading high resolution initial data" << std::endl;
1552 amrex::Print() <<
"Done reading in high resolution initial data" << std::endl;
1556 Abort(
"Not compiled with NetCDF, but remora.ic_type = netcdf reads initial and grid data from file");
1563 Abort(
"Not compiled with NetCDF, but selected boundary conditions require NetCDF");
1566 Abort(
"Not compiled with NetCDF, but using river sources requires NetCDF");
1593#ifdef REMORA_USE_NETCDF
1594 amrex::Print() <<
"Calling init_data_from_netcdf " << std::endl;
1598 amrex::Print() <<
"Initial data loaded from netcdf file \n " << std::endl;
1601 amrex::Abort(
"Unknown IC_Type");
1664 Abort(
"remora.max_step and max_step are both specified. Please use only one!");
1667 Abort(
"remora.stop_time and stop_time are both specified. Please use only one!");
1696#ifndef REMORA_USE_FENNEL_FORT
1698 amrex::Abort(
"remora.use_biology_cpp_answer = 0 selects the ROMS "
1699 "Fennel Fortran bridge, which is not compiled in. "
1700 "Rebuild with USE_FENNEL_FORT=TRUE (GNUmake) or "
1701 "-DREMORA_ENABLE_FENNEL_FORT=ON (CMake).");
1704#ifndef REMORA_USE_BIOLOGY_DIAG
1706 amrex::Abort(
"remora.biology_debug > 0 requests the Fennel parity "
1707 "diagnostics, which are not compiled in. Rebuild with "
1708 "USE_BIOLOGY_DIAG=TRUE (GNUmake) or "
1709 "-DREMORA_ENABLE_BIOLOGY_DIAG=ON (CMake).");
1723 amrex::Abort(
"remora.nscalar must be non-negative");
1734 amrex::Print() <<
"Carrying " <<
nscalar <<
" passive scalar(s) and " <<
nbio
1735 <<
" biology tracer(s), for " <<
ncons <<
" cell-centered components: ";
1756 if (
pp.contains(
"data_log")) {
1771 amrex::Abort(
"remora.file_min_digits must be non-negative");
1774 pp.queryAdd(
"cfl",
cfl);
1783 if (
pp.contains(
"fixed_fast_dt")) {
1784 amrex::Abort(
"remora.fixed_fast_dt has been removed. Set remora.ndtfast (the "
1785 "number of barotropic steps per baroclinic step) instead; it is what "
1786 "fixed_fast_dt was used to infer, as remora.fixed_dt / "
1787 "remora.fixed_fast_dt");
1793 if (
pp.contains(
"fixed_ndtfast_ratio")) {
1794 if (
pp.contains(
"ndtfast")) {
1795 amrex::Abort(
"remora.ndtfast and remora.fixed_ndtfast_ratio are both "
1796 "specified. Please use only remora.ndtfast");
1798 amrex::Print() <<
"WARNING: remora.fixed_ndtfast_ratio is deprecated. "
1799 <<
"Please use remora.ndtfast instead." << std::endl;
1801 pp.queryAdd(
"fixed_ndtfast_ratio",
ndtfast);
1811 amrex::Abort(
"remora.ndtfast must be a positive integer: it is the number of "
1812 "barotropic steps taken per baroclinic step");
1820 if (
pp.contains(
"use_barotropic")) {
1821 amrex::Abort(
"remora.use_barotropic has been removed. The barotropic (2D) mode is "
1822 "always active; please delete this line from your inputs file");
1846#ifdef REMORA_USE_NETCDF
1854 amrex::Abort(
"remora.chunk_history_file requires remora.steps_per_history_file > 0");
1860 amrex::Print() <<
"User selected plotfile_type = " <<
plotfile_type_str << std::endl;
1861 amrex::Abort(
"Dont know this plotfile_type");
1863#ifndef REMORA_USE_NETCDF
1866 amrex::Abort(
"Please compile with NetCDF in order to enable NetCDF plotfiles");
1870#ifdef REMORA_USE_NETCDF
1882 const std::string
nc_file_names = amrex::Concatenate(
"nc_init_file_",
lev,1);
1890 amrex::Error(
"Must have same number of netcdf files for grid info as for solution");
1909 if (
pp.contains(
"nc_frc_file")) {
1916 if (
pp.contains(
"nc_river_file")) {
1923 if (
pp.contains(
"nc_clim_his_file")) {
1978 amrex::Abort(
"hires_grid_level must be less than or equal to amr.max_level");
1981 amrex::Abort(
"hires_grid_level must be greater than 0; use -1 to specify grid data at level 0");
1985 amrex::Abort(
"hires_init_level must be less than or equal to amr.max_level");
1988 amrex::Abort(
"hires_init_level must be greater than 0; use -1 to specify initial data at level 0");
1990#ifdef REMORA_USE_PARTICLES
1999 amrex::Abort(
"Time substepping is not yet implemented. amr.do_substep must be 0");
2012 amrex::Abort(
"remora.biology_ic_type = netcdf requires remora.ic_type = netcdf: the biology "
2013 "initial data is read from the same files as the physical initial data, and no "
2014 "such file is given for analytic initial conditions. Use "
2015 "remora.biology_ic_type = analytic (or follow) instead.");
2018#ifndef REMORA_USE_NETCDF
2020 amrex::Abort(
"Please compile with NetCDF in order to use remora.ic_type = netcdf");
2031 amrex::Abort(
"Cannot do high-resolution initialization for analytic initial conditions. Not yet implemented");
2086 if (index_type[0]==0
and index_type[1]==0) {
2092 }
else if (index_type[0]==1
and index_type[1]==0) {
2098 }
else if (index_type[0]==0
and index_type[1]==1) {
2105 amrex::Abort(
"Unexpected nodality in average_down_with_grow_cells");
2107 Gpu::streamSynchronize();
constexpr amrex::Real bogus_large_value
constexpr amrex::Real one
constexpr amrex::Real fourth
constexpr amrex::Real zero
PlotfileType
plotfile format
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
bool QueryNetCDFHasVars(const std::string &fname, const amrex::Vector< std::string > &var_names)
Helper function for testing whether a file carries every named variable.
std::unique_ptr< ProblemBase > amrex_probinit(const amrex_real *problo, const amrex_real *probhi) AMREX_ATTRIBUTE_WEAK
Function to init the physical bounds of the domain and instantiate a Problem derived from ProblemBase...
A class to hold and interpolate time series data read from a NetCDF file.
static PlotfileType plotfile_type
Native or NetCDF plotfile output.
std::string nc_grid_file_hires
Grid file for high resolution bathymetry.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_EminusP
evaporation minus precipitation [kg/m^2/s], defined at rho-points
amrex::Vector< std::string > nc_riv_file
NetCDF river file(s)
void set_grid_vars_averaged_down(int lev)
Set pm/pn by averaging down from higher-resolution grid.
std::string riv_time_varname
Name of time field for river time.
int foextrap_periodic_bc() const noexcept
amrex::Vector< std::string > nc_clim_his_file
NetCDF climatology history file(s)
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_rv2d
v velocity RHS (2D, includes horizontal and vertical advection)
std::string nc_init_file_hires
Init file for high resolution.
int biology_debug_i
Target column i index for biology_debug = 1.
static amrex::Real fixed_dt
User specified fixed baroclinic time step.
amrex::Real last_plot_file_time
Simulation time when we last output a plotfile.
int zvel_bc() const noexcept
void init_full_domain_zeta_from_analytic()
Initialize high resolution initial sea surface height from analytic functions.
static bool plot_staggered_vels
Whether to write the staggered velocities (not averaged to cell centers)
void init_bathymetry_from_netcdf(int lev)
Bathymetry data initialization from NetCDF file.
void init_bcs()
Read in boundary parameters from input file and set up data structures.
int xvel_bc() const noexcept
void set_zeta_averaged_down(int lev)
Copy over zeta data that has been averaged down from high res.
void calculate_nodal_masks(int lev)
Calculate u-, v-, and psi-point masks based on rho-point masks after analytic initialization.
std::unique_ptr< NCTimeSeries > qair_data_from_file
Data container for specific humidity read from file.
static amrex::Real previousCPUTimeUsed
Accumulator variable for CPU time used thusfar.
amrex::Vector< std::string > cons_names
Names of scalars for plotfile output.
bool running_with_coupling_driver
True once REMORA has received forcing through the coupling driver.
amrex::Vector< std::unique_ptr< amrex::YAFluxRegister > > advflux_reg
array of flux registers for refluxing in multilevel
std::unique_ptr< NCTimeSeries > sustr_data_from_file
Data container for u-component surface momentum flux read from file.
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.
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 set2DPlotVariables(const std::string &pp_plot_var_names_2d)
amrex::Vector< REMORAFillPatcher > FPr_v
Vector over levels of FillPatchers for v (3D)
void init_biology_ic(int lev)
Initialize biology tracers from whichever source remora.biology_ic_type selects. Call after the physi...
void init_zeta_full_domain_from_netcdf()
Full-domain high res sea-surface height data initialization from NetCDF file.
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive tracer
static bool write_history_file
Whether to output NetCDF files as a single history file with several time steps.
void init_biology_ic_full_domain()
Full-domain counterpart of init_biology_ic, for the hires_init_level average-down path.
void stretch_transform(int lev)
Calculate vertical stretched coordinates.
std::unique_ptr< NCTimeSeries > rain_data_from_file
Data container for precipitation rate read from file.
REMORABiology::BiologyModel biology_model
Active biology package.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_vwind
Wind in the v direction, defined at rho-points.
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)
void Construct_REMORAFillPatchers(int lev)
Construct FillPatchers.
void init_grid_vars_from_netcdf(int lev)
Grid variable initialization from NetCDF file.
static int sum_interval
Diagnostic sum output interval in number of steps.
int history_count
Counter for which time index we are writing to in the netcdf history file.
amrex::Real stop_time
Whether max_step was set in the inputs; the default above is not a distinguishable sentinel.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_rain
precipitation rate [kg/m^2/s]
int do_substep
Whether to substep fine levels in time.
void Evolve()
Advance solution to final time.
std::string bdry_time_varname
Default name of time field for boundary data.
amrex::Real plotfile_fill_value
fill value for masked arrays in amrex plotfiles
void ReadCheckpointFile()
read checkpoint file from disk
int biology_debug
Biology diagnostic verbosity: 0 off, 1 target column, 2 all columns. See Source/Biology/Fortran/tag_m...
bool chunk_history_file
Whether to split the netcdf history file into fixed-length chunks.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_sustr
Surface stress in the u direction.
amrex::Real get_t_old(int lev) const
Accessor method for t_old to expose to outside classes.
int yvel_bc() const noexcept
std::unique_ptr< NCTimeSeries > longwave_down_data_from_file
Data container for downward longwave radiation flux read from file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_ru2d
u velocity RHS (2D, includes horizontal and vertical advection)
amrex::Vector< std::string > datalogname
amrex::Vector< amrex::MultiFab * > zvel_new
multilevel data container for current step's z velocities (largely unused; W stored separately)
void set_surface_state(int lev)
Initialize or calculate wind speed and other surface state vars from file or analytic.
void WriteAtIntermediateTime(int step, amrex::Real cur_time)
Write checkpoint and plotfiles at intermediate point of simulation, if needed.
void init_only(int lev, amrex::Real time)
Init (NOT restart or regrid)
void init_set_vmix(int lev)
Initialize vertical mixing coefficients from file or analytic.
std::unique_ptr< NCTimeSeries > v_clim_data_from_file
Data container for v-velocity climatology data read from file.
std::string clim_u_time_varname
Name of time field for u climatology data.
void set_grid_scale(int lev)
Set pm and pn arrays and x/y coords on level lev.
void set_coriolis(int lev)
Initialize Coriolis factor from file or analytic.
int foextrap_bc() const noexcept
amrex::Vector< REMORAFillPatcher > FPr_u
Vector over levels of FillPatchers for u (3D)
amrex::Vector< amrex::Vector< amrex::Box > > boxes_at_level
the boxes specified at each level by tagging criteria
static amrex::Vector< amrex::AMRErrorTag > ref_tags
Holds info for dynamically generated tagging criteria.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akt
Vertical diffusion coefficient (3D)
std::unique_ptr< NCTimeSeriesRiver > river_source_transportbar
Data container for vertically integrated momentum transport in rivers.
std::array< bool, AtmosState::NumTypes > driver_atmos_state_from_driver
provenance flags for driver-supplied atmospheric forcing lanes
std::string clim_ubar_time_varname
Name of time field for ubar climatology data.
std::unique_ptr< NCTimeSeries > u_clim_data_from_file
Data container for u-velocity climatology data read from file.
std::string check_file
Checkpoint file prefix.
static amrex::Real startCPUTime
Variable for CPU timing.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm_full_domain
horizontal scaling factor: 1 / dx (2D) on whole domain
amrex::Vector< amrex::MultiFab * > xvel_old
multilevel data container for last step's x velocities (u in ROMS)
amrex::Real start_time
Time of the start of the simulation, in seconds.
void init_data_from_netcdf(int lev)
Problem initialization from NetCDF file.
void init_masks_from_netcdf(int lev)
Mask data initialization from NetCDF file.
amrex::Vector< amrex::MultiFab * > yvel_new
multilevel data container for current step's y velocities (v in ROMS)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_uwind
Wind in the u direction, defined at rho-points.
static bool plot_nodal_data
Whether to write nodal data (Nu_nd) to plotfiles.
int regrid_int
how often each level regrids the higher levels of refinement (after a level advances that many time s...
amrex::Real check_int_time
Checkpoint output interval in seconds.
DriverAtmosForcingMode driver_atmos_forcing_mode
Active atmosphere-to-ocean forcing contract on the most recent driver apply.
void init_scalar_metadata()
Build runtime scalar names after nscalar is known.
int zeta_bc() const noexcept
void Define_REMORAFillPatchers(int lev)
Define FillPatchers.
amrex::Vector< amrex::IntVect > cum_ref_ratios
Cumulative refinement ratio between level 0 and level i.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_visc2_p
Harmonic viscosity defined on the psi points (corners of horizontal grid cells)
amrex::Real plot_int_time
Plotfile output interval in seconds.
amrex::Vector< int > num_files_at_level
how many netcdf input files specified at each level
amrex::Vector< REMORAFillPatcher > FPr_vbar
Vector over levels of FillPatchers for vbar (2D)
void AverageDownTo(int crse_lev)
more flexible version of AverageDown() that lets you average down across multiple levels
int steps_per_history_file
Time steps per netcdf history file. Must be > 0 if chunk_history_file.
void post_timestep(int nstep, amrex::Real time, amrex::Real dt_lev)
Called after every level 0 timestep.
int max_step
maximum number of steps
amrex::Vector< amrex::MultiFab * > zvel_old
multilevel data container for last step's z velocities (largely unused; W stored separately)
std::unique_ptr< NCTimeSeries > svstr_data_from_file
Data container for v-component surface momentum flux read from file.
amrex::Vector< std::string > nc_frc_file
NetCDF forcing file(s)
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.
int Bio_comp
First cons component of the biology block, i.e. Tracer_comp + nscalar. The state is laid out as temp,...
int last_check_file_step
Step when we last output a checkpoint file.
int bdy_zeta() const noexcept
void init_beta_plane_coriolis(int lev)
Calculate Coriolis parameters from beta plane parametrization.
std::string clim_vbar_time_varname
Name of time field for vbar climatology data.
amrex::Vector< int > nsubsteps
How many substeps on each level?
amrex::Vector< std::unique_ptr< REMORAPhysBCFunct > > physbcs
Vector (over level) of functors to apply physical boundary conditions.
void ComputeDt()
a wrapper for estTimeStep()
void fill_3d_masks(int lev)
Copy maskr to all z levels.
std::unique_ptr< NCTimeSeries > EminusP_data_from_file
Data container for evaporation minus precipitation read from file.
void FillCoarsePatch(int lev, amrex::Real time, amrex::MultiFab *mf_fine, amrex::MultiFab *mf_crse, const int bccomp, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const int n_not_fill=0, const int icomp_calc=0, const amrex::Real dt=zero, const amrex::MultiFab &mf_calc=amrex::MultiFab())
fill an entire multifab by interpolating from the coarser level
int plot_int
Plotfile output interval in iterations.
std::unique_ptr< NCTimeSeries > cloud_data_from_file
Data container for cloud cover fraction read from file.
int nbio
Number of biology tracers, set by the active biology model. Zero when no biology model is active.
void WriteAtFinalTime()
Write checkpoint and plotfiles at end of simulation.
void InitData()
Initialize multilevel data.
void set3DPlotVariables(const std::string &pp_plot_var_names_3d)
amrex::Vector< int > istep
which step?
void WriteCheckpointFile()
write checkpoint file to disk
std::string nc_clim_coeff_file
NetCDF climatology coefficient file.
void setRecordDataInfo(int i, const std::string &filename)
void set_analytic_vmix(int lev)
Set vertical mixing coefficients from analytic.
amrex::Vector< std::string > bdry_time_name_byvar
Name of time fields for boundary data.
static int file_min_digits
Minimum number of digits in plotfile name or chunked history file.
void init_riv_pos_from_netcdf(int lev)
static amrex::Vector< std::string > nc_bdry_file
NetCDF boundary data.
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_yvel_full_domain
multilevel data container for high res initial y velocities (v in ROMS)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_svstr
Surface stress in the v direction.
std::unique_ptr< NCTimeSeries > srflx_data_from_file
Data container for shortwave radiation flux read from file.
void set_zeta(int lev)
Initialize zeta from file or analytic.
static amrex::Real change_max
Fraction maximum change in subsequent time steps.
void init_zeta_from_netcdf(int lev)
Sea-surface height data initialization from NetCDF file.
void set_zeta_average(int lev)
Set Zt_avg1 to zeta.
void init_coriolis_from_netcdf(int lev)
Coriolis parameter data initialization from NetCDF file.
std::string pp_prefix
default prefix for input file parameters
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_h_full_domain
Bathymetry data on the whole domain at each potential level.
void set_bathymetry(int lev)
Initialize bathymetry from file or analytic.
amrex::Vector< amrex::MultiFab * > yvel_old
multilevel data container for last step's y velocities (v in ROMS)
std::unique_ptr< NCTimeSeries > ubar_clim_data_from_file
Data container for ubar climatology data read from file.
void init_full_domain_from_analytic()
Initialize high resolution initial problem data from analytic functions.
void init_data_full_domain_from_netcdf()
High resolution roblem initialization from NetCDF file.
amrex::Vector< REMORAFillPatcher > FPr_c
Vector over levels of FillPatchers for scalars.
int hires_init_level
Which level the high resolution initialization data is at.
amrex::Vector< std::string > clim_cons_time_varname
Vector over cons components of the name of the time field for that tracer's climatology data.
std::unique_ptr< NCTimeSeries > Tair_data_from_file
Data container for air temperature read from file.
int nscalar
Number of passive (dye) scalars carried in the state, beyond temperature and salinity....
std::string clim_v_time_varname
Name of time field for v climatology data.
amrex::Vector< REMORAFillPatcher > FPr_w
Vector over levels of FillPatchers for w.
void average_down_with_grow_cells(int lev, amrex::Vector< std::unique_ptr< amrex::MultiFab > > &mf)
Average down from level lev+1 to lev in mf, including grow cells.
std::unique_ptr< NCTimeSeries > Uwind_data_from_file
Data container for u-direction wind read from file.
std::unique_ptr< NCTimeSeries > Pair_data_from_file
Data container for air pressure read from file.
amrex::Vector< amrex::Real > t_new
new time at each level
void init_stretch_coeffs()
initialize and calculate stretch coefficients
void init_bdry_from_netcdf(int lev)
Boundary data initialization from NetCDF file.
static SolverChoice solverChoice
Container for algorithmic choices.
void set_masks(int lev)
Initialize land-sea masks from file or analytic.
void set_zeta_to_Ztavg(int lev, bool apply_eminusp=true)
Set zeta components to be equal to time-averaged Zt_avg1.
bool driver_uses_two_way_coupling
Driver-level direction flag copied in before InitData.
amrex::Vector< amrex::Vector< std::unique_ptr< NCTimeSeriesBoundary > > > boundary_series
Vector over BdyVars of boundary series data containers.
int cf_set_width
Width for fixing values at coarse-fine interface.
int biology_debug_j
Target column j index for biology_debug = 1.
void ReadParameters()
read in some parameters from inputs file
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_ru
u velocity RHS (3D, includes horizontal and vertical advection)
void sum_integrated_quantities(amrex::Real time)
Integrate conserved quantities for diagnostics.
static int total_nc_plot_file_step
static amrex::Vector< amrex::Vector< std::string > > nc_grid_file
NetCDF grid file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_longwave_down
Downward longwave radiation.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_zeta
free surface height (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_vbar
barotropic y velocity (2D)
void FillCoarsePatchPC(int lev, amrex::Real time, amrex::MultiFab *mf_fine, amrex::MultiFab *mf_crse, const int bccomp, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const int n_not_fill=0, const int icomp_calc=0, const amrex::Real dt=zero, const amrex::MultiFab &mf_calc=amrex::MultiFab())
fill an entire multifab by interpolating from the coarser level using the piecewise constant interpol...
bool expand_plotvars_to_unif_rr
whether plotfile variables should be expanded to a uniform refinement ratio
int plot_file_on_restart
Whether to output a plotfile on restart from checkpoint.
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)
amrex::Vector< amrex::MultiFab * > cons_old
multilevel data container for last step's scalar data: temperature, salinity, passive tracer
std::string frc_time_varname
Name of time field for forcing data.
amrex::Vector< REMORAFillPatcher > FPr_ubar
Vector over levels of FillPatchers for ubar (2D)
bool is_it_time_for_action(int nstep, amrex::Real time, amrex::Real dt, int action_interval, amrex::Real action_per)
Decide if it is time to take an action.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_cons_full_domain
multilevel data container for high res initial data: temperature, salinity, passive tracer
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())
Fill a new MultiFab by copying in phi from valid region and filling ghost cells.
std::unique_ptr< NCTimeSeries > Vwind_data_from_file
Data container for v-direction wind read from file.
static constexpr bool DriverUsesStateForcing(DriverAtmosForcingMode mode) noexcept
static int ndtfast
User specified, number of barotropic steps per baroclinic step.
void init_bathymetry_full_domain_from_netcdf()
Full domain high-res bathymetry data initialization from NetCDF file.
amrex::Vector< std::unique_ptr< NCTimeSeries > > cons_clim_data_from_file
Vector over cons components of climatology data read from file.
void set_hmixcoef(int lev)
Initialize horizontal mixing coefficients.
amrex::Vector< std::unique_ptr< NCTimeSeriesRiver > > river_source_cons
Vector of data containers for scalar data in rivers.
void timeStep(int lev, amrex::Real time, int iteration)
advance a level by dt, includes a recursive call for finer levels
std::unique_ptr< NCTimeSeriesRiver > river_source_transport
Data container for momentum transport in rivers.
void init_grid_vars_full_domain_from_netcdf()
Full domain high-res grid variable initialization from NetCDF file.
void AverageDown()
set covered coarse cells to be the average of overlying fine cells
amrex::Real netcdf_fill_value
fill value for masked arrays in netcdf output
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn_full_domain
horizontal scaling factor: 1 / dy (2D) on whole domain
void timeStepML(amrex::Real time, int iteration)
advance all levels by dt, loops over finer levels
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
amrex::Vector< std::unique_ptr< std::fstream > > datalog
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akv
Vertical viscosity coefficient (3D)
static amrex::Real cfl
CFL condition.
void append3DPlotVariables(const std::string &pp_plot_var_names_3d)
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.
void set_init_data_averaged_down(int lev)
Problem initialization from averaged-down high resolution data.
static int verbose
Verbosity level of output.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_cloud
cloud cover fraction [0-1], defined at rho-points
std::string plot_file_name
Plotfile prefix.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Zt_avg1
Average of the free surface, zeta (2D)
int check_int
Checkpoint output interval in iterations.
void set_smflux(int lev)
Initialize or calculate surface momentum flux from file or analytic.
void WritePlotFile(int istep)
main driver for writing AMReX plotfiles
std::string restart_chkfile
If set, restart from this checkpoint file.
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.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_rv
v velocity RHS (3D, includes horizontal and vertical advection)
int cf_width
Nudging width at coarse-fine interface.
static amrex::Vector< amrex::Vector< std::string > > nc_init_file
NetCDF initialization file.
int last_plot_file_step
Step when we last output a plotfile.
int use_biology_cpp_answer
Select the native C++ biology kernel (1) or the ROMS Fortran bridge oracle (0). Only meaningful when ...
amrex::Vector< amrex::Real > t_old
old time at each level
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_srflx
Shortwave radiation flux [W/m²], defined at rho-points.
amrex::Real last_check_file_time
Simulation time when we last output a checkpoint file.
void append2DPlotVariables(const std::string &pp_plot_var_names_2d)
void set_bathymetry_averaged_down(int lev)
Copy over bathymetry data that has been averaged down from high resolution input netcdf file.
amrex::Vector< amrex::Real > dt
time step at each level
static amrex::Real sum_per
Diagnostic sum output interval in time.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Pair
Air pressure [mb], defined at rho-points.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_qair
Specific humidity [kg/kg], defined at rho-points.
int hires_grid_level
Which level the high resolution bathymetry is at.
std::unique_ptr< NCTimeSeries > vbar_clim_data_from_file
Data container for vbar climatology data read from file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Tair
Air temperature [°C], defined at rho-points.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_diff2
Harmonic diffusivity for temperature / salinity.
REMORABiology::BiologyICType biology_ic_type
Source of the biology tracer initial condition, independent of remora.ic_type. Default follows ic_typ...
@ Pair
atmospheric pressure [Pa from driver, mb in REMORA]
@ Vwind
10-m meridional wind [m/s]
@ Qair
specific humidity [kg/kg]
@ SWrad
downward shortwave radiation [W/m^2]
@ LWrad
downward longwave radiation [W/m^2]
@ Uwind
10-m zonal wind [m/s]
@ Rain
precipitation rate [kg/m^2/s]
@ Cloud
cloud fraction [0-1]
@ Tair
air temperature [K from driver, degC in REMORA]
static constexpr int cons_bc
static constexpr int Temp_bc_comp
static constexpr int t
cons component Temp_comp
int NumTypes(int ncons) noexcept
int vbar(int ncons) noexcept
int cons(int icomp) noexcept
static constexpr int null
int zeta(int ncons) noexcept
int ubar(int ncons) noexcept
@ Vwind
10-m meridional wind [m/s]
@ Pair
atmospheric pressure [mb]
@ Uwind
10-m zonal wind [m/s]
@ LWrad
longwave radiation [W/m^2]
@ Tair
air temperature [degC]
@ Qair
specific humidity or relative humidity [kg/kg or fraction]
@ Cloud
cloud fraction [0-1]
@ SWrad
downward shortwave radiation [W/m^2]
@ Rain
precipitation rate [kg/m^2/s]
@ EminusP
evaporation minus precipitation [m/s]
Vector< std::string > tracer_names(BiologyModel model, FennelParameters const &fennel_parameters)
std::string biology_ic_type_name(BiologyICType type)
bool has_biology(BiologyModel model) noexcept
BiologyICType parse_biology_ic_type(const std::string &name)
BiologyModel parse_biology_model(const std::string &name)
std::string biology_model_name(BiologyModel model)
const char * buildInfoGetGitHash(int i)
void init_params(const std::string &remora_prefix)
amrex::Vector< amrex::Real > Akt_bak
HorizMixingType horiz_mixing_type
amrex::Vector< amrex::Real > tnu2
std::string longwave_netcdf_varname
amrex::Vector< int > do_rivers_cons
ScaledToGridAMRScaling scaled_to_grid_amr_scaling
bool boundary_from_netcdf
void init_params(int ncons, int nscalar, const amrex::Vector< std::string > &cons_names)
read in and initialize parameters
VertMixingType vert_mixing_type
std::array< BulkForcingType, BulkFlux::NumTypes > bulk_flux_type
amrex::Vector< int > do_cons_clim_nudg
CouplingType coupling_type