8#include <AMReX_buildInfo.H>
43#ifdef REMORA_USE_NETCDF
56amrex::Vector<std::string>
BCNames = {
"xlo",
"ylo",
"zlo",
"xhi",
"yhi",
"zhi"};
66 BL_PROFILE(
"REMORA::REMORA()");
67 if (ParallelDescriptor::IOProcessor()) {
70 const char* buildgithash = amrex::buildInfoGetBuildGitHash();
71 const char* buildgitname = amrex::buildInfoGetBuildGitName();
73 if (strlen(remora_hash) > 0) {
74 amrex::Print() <<
"\n"
75 <<
"REMORA git hash: " << remora_hash <<
"\n";
77 if (strlen(amrex_hash) > 0) {
78 amrex::Print() <<
"AMReX git hash: " << amrex_hash <<
"\n";
80 if (strlen(buildgithash) > 0) {
81 amrex::Print() << buildgitname <<
" git hash: " << buildgithash <<
"\n";
84 amrex::Print() <<
"\n";
97 int nlevs_max = max_level + 1;
99 istep.resize(nlevs_max, 0);
101 for (
int lev = 1; lev <= max_level; ++lev) {
107 t_new.resize(nlevs_max, 0.0_rt);
108 t_old.resize(nlevs_max, -1.e100_rt);
109 dt.resize(nlevs_max, 1.e100_rt);
127 for (
int lev = 0; lev < max_level; ++lev)
129 amrex::Print() <<
"Refinement ratio at level " << lev <<
" set to be " <<
130 ref_ratio[lev][0] <<
" " << ref_ratio[lev][1] <<
" " << ref_ratio[lev][2] << std::endl;
132 if (ref_ratio[lev][2] != 1)
134 amrex::Error(
"We don't allow refinement in the vertical -- make sure to set ref_ratio = 1 in z");
146 BL_PROFILE(
"REMORA::Evolve()");
147 Real cur_time =
t_new[0];
153 amrex::Print() <<
"\nCoarse STEP " << step+1 <<
" starts ..." << std::endl;
160 if (max_level == 0) {
169 amrex::Print() <<
"Coarse STEP " << step+1 <<
" ends." <<
" TIME = " << cur_time
170 <<
" DT = " <<
dt[0] << std::endl;
180#ifdef REMORA_USE_NETCDF
197#ifdef AMREX_MEM_PROFILING
199 std::ostringstream ss;
200 ss <<
"[STEP " << step+1 <<
"]";
201 MemProfiler::report(ss.str());
212#ifdef REMORA_USE_NETCDF
233 BL_PROFILE(
"REMORA::post_timestep()");
235#ifdef REMORA_USE_PARTICLES
236 particleData.Redistribute();
241 for (
int lev = finest_level-1; lev >= 0; lev--)
265 BL_PROFILE(
"REMORA::InitData()");
295#ifdef REMORA_USE_MOAB
301 for (
int lev = 1; lev <= finest_level; lev++)
303 advflux_reg[lev] =
new YAFluxRegister(grids[lev], grids[lev-1],
304 dmap[lev], dmap[lev-1],
305 geom[lev], geom[lev-1],
306 ref_ratio[lev-1], lev,
NCONS);
311 for (
int lev = 0; lev <= finest_level; ++lev)
318 FillPatch(lev,
t_new[lev], *
cons_new[lev],
cons_new,
BCVars::cons_bc,
BdyVars::t, 0,
true,
false,0,0,0.0,*
cons_new[lev]);
319 FillPatch(lev,
t_new[lev], *
xvel_new[lev],
xvel_new,
BCVars::xvel_bc,
BdyVars::u, 0,
true,
false,0,0,0.0,*
xvel_new[lev]);
320 FillPatch(lev,
t_new[lev], *
yvel_new[lev],
yvel_new,
BCVars::yvel_bc,
BdyVars::v, 0,
true,
false,0,0,0.0,*
yvel_new[lev]);
350#ifdef REMORA_USE_NETCDF
375 BL_PROFILE(
"REMORA::Construct_REMORAFillPatchers()");
376 amrex::Print() <<
":::Construct_REMORAFillPatchers " << lev << std::endl;
378 auto& ba_fine =
cons_new[lev ]->boxArray();
379 auto& ba_crse =
cons_new[lev-1]->boxArray();
380 auto& dm_fine =
cons_new[lev ]->DistributionMap();
381 auto& dm_crse =
cons_new[lev-1]->DistributionMap();
383 BoxList bl2d_fine = ba_fine.boxList();
384 for (
auto& b : bl2d_fine) {
387 BoxArray ba2d_fine(std::move(bl2d_fine));
389 BoxList bl2d_crse = ba_crse.boxList();
390 for (
auto& b : bl2d_crse) {
393 BoxArray ba2d_crse(std::move(bl2d_crse));
397 FPr_c.emplace_back(ba_fine, dm_fine, geom[lev] ,
398 ba_crse, dm_crse, geom[lev-1],
400 FPr_u.emplace_back(convert(ba_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
401 convert(ba_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
403 FPr_v.emplace_back(convert(ba_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
404 convert(ba_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
406 FPr_w.emplace_back(convert(ba_fine, IntVect(0,0,1)), dm_fine, geom[lev] ,
407 convert(ba_crse, IntVect(0,0,1)), dm_crse, geom[lev-1],
410 FPr_ubar.emplace_back(convert(ba2d_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
411 convert(ba2d_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
413 FPr_vbar.emplace_back(convert(ba2d_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
414 convert(ba2d_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
424 BL_PROFILE(
"REMORA::Define_REMORAFillPatchers()");
425 amrex::Print() <<
":::Define_REMORAFillPatchers " << lev << std::endl;
427 auto& ba_fine =
cons_new[lev ]->boxArray();
428 auto& ba_crse =
cons_new[lev-1]->boxArray();
429 auto& dm_fine =
cons_new[lev ]->DistributionMap();
430 auto& dm_crse =
cons_new[lev-1]->DistributionMap();
432 BoxList bl2d_fine = ba_fine.boxList();
433 for (
auto& b : bl2d_fine) {
436 BoxArray ba2d_fine(std::move(bl2d_fine));
438 BoxList bl2d_crse = ba_crse.boxList();
439 for (
auto& b : bl2d_crse) {
442 BoxArray ba2d_crse(std::move(bl2d_crse));
447 FPr_c[lev-1].Define(ba_fine, dm_fine, geom[lev] ,
448 ba_crse, dm_crse, geom[lev-1],
450 FPr_u[lev-1].Define(convert(ba_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
451 convert(ba_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
453 FPr_v[lev-1].Define(convert(ba_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
454 convert(ba_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
456 FPr_w[lev-1].Define(convert(ba_fine, IntVect(0,0,1)), dm_fine, geom[lev] ,
457 convert(ba_crse, IntVect(0,0,1)), dm_crse, geom[lev-1],
460 FPr_ubar[lev-1].Define(convert(ba2d_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
461 convert(ba2d_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
463 FPr_vbar[lev-1].Define(convert(ba2d_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
464 convert(ba2d_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
471 BL_PROFILE(
"REMORA::restart()");
484 BL_PROFILE(
"REMORA::set_zeta()");
488#ifdef REMORA_USE_NETCDF
490 amrex::Print() <<
"Calling init_zeta_from_netcdf on level " << lev << std::endl;
492 amrex::Print() <<
"Sea surface height loaded from netcdf file \n " << std::endl;
495 Abort(
"Don't know this ic_type!");
497 vec_zeta[lev]->FillBoundary(geom[lev].periodicity());
507 BL_PROFILE(
"REMORA::bathymetry()");
517#ifdef REMORA_USE_NETCDF
520 amrex::Print() <<
"Calling init_bathymetry_from_netcdf " << std::endl;
522 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
528 Abort(
"Don't know this ic_type!");
535 Real dummy_time = 0.0_rt;
545#ifdef REMORA_USE_NETCDF
547 amrex::Print() <<
"Calling init_bathymetry_from_netcdf level " << lev << std::endl;
549 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
552 Abort(
"Don't know this ic_type!");
565#ifdef REMORA_USE_NETCDF
568 amrex::Print() <<
"Calling init_bathymetry_from_netcdf " << std::endl;
570 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
576 Abort(
"Don't know this ic_type!");
583 amrex::Abort(
"Don't know this h init type");
592 BL_PROFILE(
"REMORA::set_coriolis()");
598#ifdef REMORA_USE_NETCDF
600 amrex::Print() <<
"Calling init_coriolis_from_netcdf " << std::endl;
602 amrex::Print() <<
"Coriolis loaded from netcdf file \n" << std::endl;
605 Abort(
"Don't know this coriolis_type!");
610 vec_fcor[lev]->EnforcePeriodicity(geom[lev].periodicity());
616 BL_PROFILE(
"REMORA::init_set_vmix()");
624 Abort(
"Don't know this vertical mixing type");
633 BL_PROFILE(
"REMORA::set_analytic_vmix()");
637 for (
int n=0; n<
NCONS;n++) {
648 BL_PROFILE(
"REMORA::set_hmixcoef()");
654 for (
int n=0; n<
NCONS; n++) {
658 Abort(
"Don't know this horizontal mixing type");
663 for (
int n=0; n<
NCONS; n++) {
674 BL_PROFILE(
"REMORA::init_flat_bathymetry()");
684 BL_PROFILE(
"REMORA::set_smflux()");
688#ifdef REMORA_USE_NETCDF
703 BL_PROFILE(
"REMORA::set_wind()");
707#ifdef REMORA_USE_NETCDF
726#ifdef REMORA_USE_NETCDF
727 amrex::Print() <<
"Calling init_masks_from_netcdf level " << lev << std::endl;
729 amrex::Print() <<
"Masks loaded from netcdf file \n " << std::endl;
741 BL_PROFILE(
"REMORA::init_only()");
743 t_old[lev] = time - 1.e200_rt;
754 vec_ru[lev]->setVal(0.0_rt);
755 vec_rv[lev]->setVal(0.0_rt);
765#ifdef REMORA_USE_NETCDF
771 amrex::Error(
"NetCDF climatology file name must be provided via input");
799 amrex::Print() <<
"Calling init_bdry_from_netcdf " << std::endl;
801 amrex::Print() <<
"Boundary data loaded from netcdf file \n " << std::endl;
807 amrex::Error(
"NetCDF forcing file name must be provided via input for winds");
815 amrex::Error(
"NetCDF forcing file name must be provided via input for surface momentum fluxes");
824 auto dom = geom[0].Domain();
825 int nz = dom.length(2);
848 Abort(
"Not compiled with NetCDF, but selected boundary conditions require NetCDF");
861#ifdef REMORA_USE_NETCDF
863 amrex::Print() <<
"Calling init_data_from_netcdf " << std::endl;
866 amrex::Print() <<
"Initial data loaded from netcdf file \n " << std::endl;
870 Abort(
"Need to specify ic_type");
882#ifdef REMORA_USE_NETCDF
884 amrex::Print() <<
"Calling init_data_from_netcdf on level " << lev << std::endl;
887 amrex::Print() <<
"Initial data loaded from netcdf file on level " << lev << std::endl;
891 Abort(
"Need to specify ic_type");
894 amrex::Abort(
"Need to specify T init procedure");
899 xvel_new[lev]->OverrideSync(geom[lev].periodicity());
900 yvel_new[lev]->OverrideSync(geom[lev].periodicity());
901 zvel_new[lev]->OverrideSync(geom[lev].periodicity());
920 BL_PROFILE(
"REMORA::ReadParameters()");
923 bool noprefix_max_step = pp.query(
"max_step",
max_step);
924 bool noprefix_stop_time = pp.query(
"stop_time",
stop_time);
925 bool remora_max_step = pp.query(
"remora.max_step",
max_step);
926 bool remora_stop_time = pp.query(
"remora.stop_time",
stop_time);
927 if (remora_max_step and noprefix_max_step) {
928 Abort(
"remora.max_step and max_step are both specified. Please use only one!");
930 if (remora_stop_time and noprefix_stop_time) {
931 Abort(
"remora.stop_time and stop_time are both specified. Please use only one!");
936 ParmParse pp_amr(
"amr");
949 if (pp.contains(
"data_log"))
951 int num_datalogs = pp.countval(
"data_log");
954 pp.queryarr(
"data_log",
datalogname,0,num_datalogs);
955 for (
int i = 0; i < num_datalogs; i++)
964 pp.query(
"sum_period" ,
sum_per);
968 amrex::Abort(
"remora.file_min_digits must be non-negative");
972 pp.query(
"cfl",
cfl);
985 amrex::Abort(
"Dt is over-specfied");
998 amrex::Abort(
"Time substepping is not yet implemented. amr.do_substep must be 0");
1022 std::string plotfile_type_str =
"amrex";
1023 pp.query(
"plotfile_type", plotfile_type_str);
1024 if (plotfile_type_str ==
"amrex") {
1026 }
else if (plotfile_type_str ==
"netcdf" || plotfile_type_str ==
"NetCDF") {
1028#ifdef REMORA_USE_NETCDF
1033 auto dom = geom[0].Domain();
1034 int nx = dom.length(0) + 2;
1035 int ny = dom.length(1) + 2;
1036 int nz = dom.length(2);
1040 / (nx * ny * 64.0_rt * (
NC3D*nz +
NC2D)));
1045 amrex::Warning(
"NetCDF output for a single timestep appears to exceed 2GB. NetCDF output may not work. See Documentation for information about tested MPICH versions.");
1051 Real est_hist_file_size =
NCH2D * nx * ny * 64.0_rt + nt_out * nx * ny * 64.0_rt * (
NC3D*nz +
NC2D);
1052 if (est_hist_file_size > 1.6e10) {
1053 amrex::Warning(
"WARNING: NetCDF history file may be larger than 2GB limit. Consider setting remora.chunk_history_file=true");
1057 Print() <<
"NetCDF history files will have " <<
steps_per_history_file <<
" steps per file." << std::endl;
1061 amrex::Print() <<
"User selected plotfile_type = " << plotfile_type_str << std::endl;
1062 amrex::Abort(
"Dont know this plotfile_type");
1064#ifndef REMORA_USE_NETCDF
1067 amrex::Abort(
"Please compile with NetCDF in order to enable NetCDF plotfiles");
1072#ifdef REMORA_USE_NETCDF
1078 for (
int lev = 0; lev <= max_level; lev++)
1080 const std::string nc_file_names = amrex::Concatenate(
"nc_init_file_",lev,1);
1081 const std::string nc_bathy_file_names = amrex::Concatenate(
"nc_grid_file_",lev,1);
1083 if (pp.contains(nc_file_names.c_str()))
1085 int num_files = pp.countval(nc_file_names.c_str());
1086 int num_bathy_files = pp.countval(nc_bathy_file_names.c_str());
1087 if (num_files != num_bathy_files) {
1088 amrex::Error(
"Must have same number of netcdf files for grid info as for solution");
1095 pp.queryarr(nc_file_names.c_str() ,
nc_init_file[lev] ,0,num_files);
1096 pp.queryarr(nc_bathy_file_names.c_str(),
nc_grid_file[lev],0,num_files);
1124#ifdef REMORA_USE_PARTICLES
1125 readTracersParams();
1135 BL_PROFILE(
"REMORA::AverageDown()");
1136 for (
int lev = finest_level-1; lev >= 0; --lev)
1148 BL_PROFILE(
"REMORA::AverageDownTo()");
1150 0,
cons_new[crse_lev]->nComp(), refRatio(crse_lev));
1152 0,
vec_zeta[crse_lev]->nComp(), refRatio(crse_lev));
1154 Array<MultiFab*,AMREX_SPACEDIM> faces_crse;
1155 Array<MultiFab*,AMREX_SPACEDIM> faces_fine;
1156 faces_crse[0] =
xvel_new[crse_lev];
1157 faces_crse[1] =
yvel_new[crse_lev];
1158 faces_crse[2] =
zvel_new[crse_lev];
1160 faces_fine[0] =
xvel_new[crse_lev+1];
1161 faces_fine[1] =
yvel_new[crse_lev+1];
1162 faces_fine[2] =
zvel_new[crse_lev+1];
1164 average_down_faces(GetArrOfConstPtrs(faces_fine), faces_crse,
1165 refRatio(crse_lev),geom[crse_lev]);
amrex::Vector< std::string > BCNames
PlotfileType
plotfile format
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.
void Initialize()
Read in time array from file and allocate data arrays.
void update_interpolated_to_time(amrex::Real time)
Calculate interpolated values at time, reading in data as necessary.
static PlotfileType plotfile_type
Native or NetCDF plotfile output.
NCTimeSeriesRiver * river_source_transportbar
Data container for vertically integrated momentum transport in rivers.
std::string riv_time_varname
Name of time field for river time.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_rv2d
v velocity RHS (2D, includes horizontal and vertical advection)
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.
amrex::Vector< NCTimeSeriesRiver * > river_source_cons
Vector of data containers for scalar data in rivers.
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.
void calculate_nodal_masks(int lev)
Calculate u-, v-, and psi-point masks based on rho-point masks after analytic initialization.
static amrex::Real previousCPUTimeUsed
Accumulator variable for CPU time used thusfar.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_fcor
coriolis factor (2D)
void init_gls_vmix(int lev, SolverChoice solver_choice)
Initialize GLS variables.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_hOfTheConfusingName
Bathymetry data (2D, positive valued, h in ROMS)
amrex::Vector< REMORAFillPatcher > FPr_v
Vector over levels of FillPatchers for v (3D)
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive scalar
static bool write_history_file
Whether to output NetCDF files as a single history file with several time steps.
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=amrex::Real(0.0), const amrex::MultiFab &mf_calc=amrex::MultiFab())
fill an entire multifab by interpolating from the coarser level
void stretch_transform(int lev)
Calculate vertical stretched coordinates.
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.
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
Time to stop.
int do_substep
Whether to substep fine levels in time.
NCTimeSeries * vbar_clim_data_from_file
Data container for vbar climatology data read from file.
void Evolve()
Advance solution to final time.
NCTimeSeries * Uwind_data_from_file
Data container for u-direction wind read from file.
std::string bdry_time_varname
Name of time field for boundary data.
void ReadCheckpointFile()
read checkpoint file from disk
bool chunk_history_file
Whether to chunk netcdf history file.
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.
NCTimeSeries * v_clim_data_from_file
Data container for v-velocity climatology data 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 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::string clim_u_time_varname
Name of time field for u climatology data.
void set_grid_scale(int lev)
Set pm and pn arrays on level lev. Only works if using analytic initialization.
void set_coriolis(int lev)
Initialize Coriolis factor from file or analytic.
amrex::Vector< REMORAFillPatcher > FPr_u
Vector over levels of FillPatchers for u (3D)
std::string clim_temp_time_varname
Name of time field for temperature climatology data.
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.
std::string nc_frc_file
NetCDF forcing file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akt
Vertical diffusion coefficient (3D)
std::string clim_ubar_time_varname
Name of time field for ubar climatology data.
void WriteNCPlotFile(int istep)
Write plotfile using NetCDF (wrapper)
std::string check_file
Checkpoint file prefix.
static amrex::Real startCPUTime
Variable for CPU timing.
void setPlotVariables(const std::string &pp_plot_var_names)
NCTimeSeries * u_clim_data_from_file
Data container for u-velocity climatology data read from file.
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.
NCTimeSeries * ubar_clim_data_from_file
Data container for ubar climatology data read from file.
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 amrex::Real fixed_fast_dt
User specified fixed barotropic time step.
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.
void init_bdry_from_netcdf()
Boundary data initialization from NetCDF file.
NCTimeSeries * sustr_data_from_file
Data container for u-component surface momentum flux read from file.
void Define_REMORAFillPatchers(int lev)
Define FillPatchers.
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
Number of time steps per netcdf 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)
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 last_check_file_step
Step when we last output a checkpoint file.
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()
int plot_int
Plotfile output interval in iterations.
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=true, const int n_not_fill=0, const int icomp_calc=0, const amrex::Real dt=amrex::Real(0.0), const amrex::MultiFab &mf_calc=amrex::MultiFab())
Fill a new MultiFab by copying in phi from valid region and filling ghost cells.
void InitData()
Initialize multilevel data.
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.
void init_flat_bathymetry(int lev)
Initialize flat bathymetry to value from problo.
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_svstr
Surface stress in the v direction.
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
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)
amrex::Vector< REMORAFillPatcher > FPr_c
Vector over levels of FillPatchers for scalars.
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.
amrex::Vector< amrex::YAFluxRegister * > advflux_reg
array of flux registers for refluxing in multilevel
std::string clim_salt_time_varname
Name of time field for salinity climatology data.
NCTimeSeries * Vwind_data_from_file
Data container for v-direction wind read from file.
amrex::Vector< amrex::Real > t_new
new time at each level
NCTimeSeriesRiver * river_source_transport
Data container for momentum transport in rivers.
void init_stretch_coeffs()
initialize and calculate stretch coefficients
NCTimeSeries * temp_clim_data_from_file
Data container for temperature climatology data read from file.
static SolverChoice solverChoice
Container for algorithmic choices.
void set_masks(int lev)
Initialize land-sea masks from file or analytic.
int cf_set_width
Width for fixing values at coarse-fine interface.
NCTimeSeries * salt_clim_data_from_file
Data container for salinity climatology data read from file.
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)
NCTimeSeries * svstr_data_from_file
Data container for v-component surface momentum flux read from file.
void sum_integrated_quantities(amrex::Real time)
Integrate conserved quantities for diagnostics.
static int total_nc_plot_file_step
static int plot_staggered_vels
Whether to write the staggered velocities (not averaged to cell centers)
static amrex::Vector< amrex::Vector< std::string > > nc_grid_file
NetCDF grid file.
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 set_zeta_to_Ztavg(int lev)
Set zeta components to be equal to time-averaged Zt_avg1.
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 scalar
std::string frc_time_varname
Name of time field for forcing data.
void set_wind(int lev)
Initialize or calculate wind speed from file or analytic.
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.
void appendPlotVariables(const std::string &pp_plot_var_names)
void set_hmixcoef(int lev)
Initialize horizontal mixing coefficients.
std::string nc_clim_his_file
NetCDF climatology history file.
void timeStep(int lev, amrex::Real time, int iteration)
advance a level by dt, includes a recursive call for finer levels
void AverageDown()
set covered coarse cells to be the average of overlying fine cells
static int fixed_ndtfast_ratio
User specified, number of barotropic steps per baroclinic step.
void timeStepML(amrex::Real time, int iteration)
advance all levels by dt, loops over finer levels
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.
static int verbose
Verbosity level of output.
std::string plot_file_name
Plotfile prefix.
int check_int
Checkpoint output interval in iterations.
void WritePlotFile()
main driver for writing AMReX plotfiles
void set_smflux(int lev)
Initialize or calculate surface momentum flux from file or analytic.
std::string restart_chkfile
If set, restart from this checkpoint file.
void init_clim_nudg_coeff(int lev)
Wrapper to initialize climatology nudging coefficient.
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.
amrex::Vector< amrex::Real > t_old
old time at each level
amrex::Real last_check_file_time
Simulation time when we last output a checkpoint 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_diff2
Harmonic diffusivity for temperature / salinity.
const char * buildInfoGetGitHash(int i)
HorizMixingType horiz_mixing_type
amrex::Vector< amrex::Real > tnu2
amrex::Vector< int > do_rivers_cons
void init_params()
read in and initialize parameters
bool boundary_from_netcdf
VertMixingType vert_mixing_type
CouplingType coupling_type