8#include <AMReX_buildInfo.H>
40#ifdef REMORA_USE_NETCDF
53amrex::Vector<std::string>
BCNames = {
"xlo",
"ylo",
"zlo",
"xhi",
"yhi",
"zhi"};
63 if (ParallelDescriptor::IOProcessor()) {
66 const char* buildgithash = amrex::buildInfoGetBuildGitHash();
67 const char* buildgitname = amrex::buildInfoGetBuildGitName();
69 if (strlen(remora_hash) > 0) {
70 amrex::Print() <<
"\n"
71 <<
"REMORA git hash: " << remora_hash <<
"\n";
73 if (strlen(amrex_hash) > 0) {
74 amrex::Print() <<
"AMReX git hash: " << amrex_hash <<
"\n";
76 if (strlen(buildgithash) > 0) {
77 amrex::Print() << buildgitname <<
" git hash: " << buildgithash <<
"\n";
80 amrex::Print() <<
"\n";
93 int nlevs_max = max_level + 1;
95 istep.resize(nlevs_max, 0);
97 for (
int lev = 1; lev <= max_level; ++lev) {
103 t_new.resize(nlevs_max, 0.0_rt);
104 t_old.resize(nlevs_max, -1.e100_rt);
105 dt.resize(nlevs_max, 1.e100_rt);
123 for (
int lev = 0; lev < max_level; ++lev)
125 amrex::Print() <<
"Refinement ratio at level " << lev <<
" set to be " <<
126 ref_ratio[lev][0] <<
" " << ref_ratio[lev][1] <<
" " << ref_ratio[lev][2] << std::endl;
128 if (ref_ratio[lev][2] != 1)
130 amrex::Error(
"We don't allow refinement in the vertical -- make sure to set ref_ratio = 1 in z");
142 Real cur_time =
t_new[0];
148 amrex::Print() <<
"\nCoarse STEP " << step+1 <<
" starts ..." << std::endl;
155 if (max_level == 0) {
164 amrex::Print() <<
"Coarse STEP " << step+1 <<
" ends." <<
" TIME = " << cur_time
165 <<
" DT = " <<
dt[0] << std::endl;
175#ifdef REMORA_USE_NETCDF
192#ifdef AMREX_MEM_PROFILING
194 std::ostringstream ss;
195 ss <<
"[STEP " << step+1 <<
"]";
196 MemProfiler::report(ss.str());
207#ifdef REMORA_USE_NETCDF
228 BL_PROFILE(
"REMORA::post_timestep()");
230#ifdef REMORA_USE_PARTICLES
231 particleData.Redistribute();
236 for (
int lev = finest_level-1; lev >= 0; lev--)
286#ifdef REMORA_USE_MOAB
292 for (
int lev = 1; lev <= finest_level; lev++)
294 advflux_reg[lev] =
new YAFluxRegister(grids[lev], grids[lev-1],
295 dmap[lev], dmap[lev-1],
296 geom[lev], geom[lev-1],
297 ref_ratio[lev-1], lev,
NCONS);
302 for (
int lev = 0; lev <= finest_level; ++lev)
309 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]);
310 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]);
311 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]);
341#ifdef REMORA_USE_NETCDF
366 amrex::Print() <<
":::Construct_REMORAFillPatchers " << lev << std::endl;
368 auto& ba_fine =
cons_new[lev ]->boxArray();
369 auto& ba_crse =
cons_new[lev-1]->boxArray();
370 auto& dm_fine =
cons_new[lev ]->DistributionMap();
371 auto& dm_crse =
cons_new[lev-1]->DistributionMap();
373 BoxList bl2d_fine = ba_fine.boxList();
374 for (
auto& b : bl2d_fine) {
377 BoxArray ba2d_fine(std::move(bl2d_fine));
379 BoxList bl2d_crse = ba_crse.boxList();
380 for (
auto& b : bl2d_crse) {
383 BoxArray ba2d_crse(std::move(bl2d_crse));
387 FPr_c.emplace_back(ba_fine, dm_fine, geom[lev] ,
388 ba_crse, dm_crse, geom[lev-1],
390 FPr_u.emplace_back(convert(ba_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
391 convert(ba_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
393 FPr_v.emplace_back(convert(ba_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
394 convert(ba_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
396 FPr_w.emplace_back(convert(ba_fine, IntVect(0,0,1)), dm_fine, geom[lev] ,
397 convert(ba_crse, IntVect(0,0,1)), dm_crse, geom[lev-1],
400 FPr_ubar.emplace_back(convert(ba2d_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
401 convert(ba2d_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
403 FPr_vbar.emplace_back(convert(ba2d_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
404 convert(ba2d_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
414 amrex::Print() <<
":::Define_REMORAFillPatchers " << lev << std::endl;
416 auto& ba_fine =
cons_new[lev ]->boxArray();
417 auto& ba_crse =
cons_new[lev-1]->boxArray();
418 auto& dm_fine =
cons_new[lev ]->DistributionMap();
419 auto& dm_crse =
cons_new[lev-1]->DistributionMap();
421 BoxList bl2d_fine = ba_fine.boxList();
422 for (
auto& b : bl2d_fine) {
425 BoxArray ba2d_fine(std::move(bl2d_fine));
427 BoxList bl2d_crse = ba_crse.boxList();
428 for (
auto& b : bl2d_crse) {
431 BoxArray ba2d_crse(std::move(bl2d_crse));
436 FPr_c[lev-1].Define(ba_fine, dm_fine, geom[lev] ,
437 ba_crse, dm_crse, geom[lev-1],
439 FPr_u[lev-1].Define(convert(ba_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
440 convert(ba_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
442 FPr_v[lev-1].Define(convert(ba_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
443 convert(ba_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
445 FPr_w[lev-1].Define(convert(ba_fine, IntVect(0,0,1)), dm_fine, geom[lev] ,
446 convert(ba_crse, IntVect(0,0,1)), dm_crse, geom[lev-1],
449 FPr_ubar[lev-1].Define(convert(ba2d_fine, IntVect(1,0,0)), dm_fine, geom[lev] ,
450 convert(ba2d_crse, IntVect(1,0,0)), dm_crse, geom[lev-1],
452 FPr_vbar[lev-1].Define(convert(ba2d_fine, IntVect(0,1,0)), dm_fine, geom[lev] ,
453 convert(ba2d_crse, IntVect(0,1,0)), dm_crse, geom[lev-1],
475#ifdef REMORA_USE_NETCDF
477 amrex::Print() <<
"Calling init_zeta_from_netcdf " << std::endl;
479 amrex::Print() <<
"Sea surface height loaded from netcdf file \n " << std::endl;
482 Abort(
"Don't know this ic_bc_type!");
484 vec_zeta[lev]->FillBoundary(geom[lev].periodicity());
500#ifdef REMORA_USE_NETCDF
502 amrex::Print() <<
"Calling init_bathymetry_from_netcdf " << std::endl;
504 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
507 Abort(
"Don't know this ic_bc_type!");
514 Real dummy_time = 0.0_rt;
521#ifdef REMORA_USE_NETCDF
523 amrex::Print() <<
"Calling init_bathymetry_from_netcdf " << std::endl;
525 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
528 Abort(
"Don't know this ic_bc_type!");
538#ifdef REMORA_USE_NETCDF
540 amrex::Print() <<
"Calling init_bathymetry_from_netcdf " << std::endl;
542 amrex::Print() <<
"Bathymetry loaded from netcdf file \n " << std::endl;
545 Abort(
"Don't know this ic_bc_type!");
552 amrex::Abort(
"Don't know this h init type");
566#ifdef REMORA_USE_NETCDF
568 amrex::Print() <<
"Calling init_coriolis_from_netcdf " << std::endl;
570 amrex::Print() <<
"Coriolis loaded from netcdf file \n" << std::endl;
573 Abort(
"Don't know this coriolis_type!");
578 vec_fcor[lev]->EnforcePeriodicity(geom[lev].periodicity());
591 Abort(
"Don't know this vertical mixing type");
603 for (
int n=0; n<
NCONS;n++) {
619 for (
int n=0; n<
NCONS; n++) {
623 Abort(
"Don't know this horizontal mixing type");
628 for (
int n=0; n<
NCONS; n++) {
642#ifdef REMORA_USE_NETCDF
660#ifdef REMORA_USE_NETCDF
677 t_old[lev] = time - 1.e200_rt;
688 vec_ru[lev]->setVal(0.0_rt);
689 vec_rv[lev]->setVal(0.0_rt);
694#ifdef REMORA_USE_NETCDF
696 amrex::Print() <<
"Calling init_masks_from_netcdf " << std::endl;
698 amrex::Print() <<
"Masks loaded from netcdf file \n " << std::endl;
700 amrex::Print() <<
"Calling init_bdry_from_netcdf " << std::endl;
702 amrex::Print() <<
"Boundary data loaded from netcdf file \n " << std::endl;
708 amrex::Error(
"NetCDF climatology file name must be provided via input");
737 amrex::Error(
"NetCDF forcing file name must be provided via input for winds");
745 amrex::Error(
"NetCDF forcing file name must be provided via input for surface momentum fluxes");
754 auto dom = geom[0].Domain();
755 int nz = dom.length(2);
790#ifdef REMORA_USE_NETCDF
792 amrex::Print() <<
"Calling init_data_from_netcdf " << std::endl;
795 amrex::Print() <<
"Initial data loaded from netcdf file \n " << std::endl;
799 Abort(
"Need to specify ic_bc_type");
811#ifdef REMORA_USE_NETCDF
813 amrex::Print() <<
"Calling init_data_from_netcdf " << std::endl;
816 amrex::Print() <<
"Initial data loaded from netcdf file \n " << std::endl;
820 Abort(
"Need to specify ic_bc_type");
823 amrex::Abort(
"Need to specify T init procedure");
828 xvel_new[lev]->OverrideSync(geom[lev].periodicity());
829 yvel_new[lev]->OverrideSync(geom[lev].periodicity());
830 zvel_new[lev]->OverrideSync(geom[lev].periodicity());
851 bool noprefix_max_step = pp.query(
"max_step",
max_step);
852 bool noprefix_stop_time = pp.query(
"stop_time",
stop_time);
853 bool remora_max_step = pp.query(
"remora.max_step",
max_step);
854 bool remora_stop_time = pp.query(
"remora.stop_time",
stop_time);
855 if (remora_max_step and noprefix_max_step) {
856 Abort(
"remora.max_step and max_step are both specified. Please use only one!");
858 if (remora_stop_time and noprefix_stop_time) {
859 Abort(
"remora.stop_time and stop_time are both specified. Please use only one!");
864 ParmParse pp_amr(
"amr");
877 if (pp.contains(
"data_log"))
879 int num_datalogs = pp.countval(
"data_log");
882 pp.queryarr(
"data_log",
datalogname,0,num_datalogs);
883 for (
int i = 0; i < num_datalogs; i++)
892 pp.query(
"sum_period" ,
sum_per);
896 amrex::Abort(
"remora.file_min_digits must be non-negative");
900 pp.query(
"cfl",
cfl);
913 amrex::Abort(
"Dt is over-specfied");
926 amrex::Abort(
"Time substepping is not yet implemented. amr.do_substep must be 0");
946 std::string plotfile_type_str =
"amrex";
947 pp.query(
"plotfile_type", plotfile_type_str);
948 if (plotfile_type_str ==
"amrex") {
950 }
else if (plotfile_type_str ==
"netcdf" || plotfile_type_str ==
"NetCDF") {
952#ifdef REMORA_USE_NETCDF
957 auto dom = geom[0].Domain();
958 int nx = dom.length(0) + 2;
959 int ny = dom.length(1) + 2;
960 int nz = dom.length(2);
964 / (nx * ny * 64.0_rt * (
NC3D*nz +
NC2D)));
969 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.");
975 Real est_hist_file_size =
NCH2D * nx * ny * 64.0_rt + nt_out * nx * ny * 64.0_rt * (
NC3D*nz +
NC2D);
976 if (est_hist_file_size > 1.6e10) {
977 amrex::Warning(
"WARNING: NetCDF history file may be larger than 2GB limit. Consider setting remora.chunk_history_file=true");
981 Print() <<
"NetCDF history files will have " <<
steps_per_history_file <<
" steps per file." << std::endl;
985 amrex::Print() <<
"User selected plotfile_type = " << plotfile_type_str << std::endl;
986 amrex::Abort(
"Dont know this plotfile_type");
988#ifndef REMORA_USE_NETCDF
991 amrex::Abort(
"Please compile with NetCDF in order to enable NetCDF plotfiles");
996#ifdef REMORA_USE_NETCDF
1002 for (
int lev = 0; lev <= max_level; lev++)
1004 const std::string nc_file_names = amrex::Concatenate(
"nc_init_file_",lev,1);
1005 const std::string nc_bathy_file_names = amrex::Concatenate(
"nc_grid_file_",lev,1);
1007 if (pp.contains(nc_file_names.c_str()))
1009 int num_files = pp.countval(nc_file_names.c_str());
1010 int num_bathy_files = pp.countval(nc_bathy_file_names.c_str());
1011 if (num_files != num_bathy_files) {
1012 amrex::Error(
"Must have same number of netcdf files for grid info as for solution");
1019 pp.queryarr(nc_file_names.c_str() ,
nc_init_file[lev] ,0,num_files);
1020 pp.queryarr(nc_bathy_file_names.c_str(),
nc_grid_file[lev],0,num_files);
1048#ifdef REMORA_USE_PARTICLES
1049 readTracersParams();
1059 for (
int lev = finest_level-1; lev >= 0; --lev)
1072 0,
cons_new[crse_lev]->nComp(), refRatio(crse_lev));
1074 0,
vec_zeta[crse_lev]->nComp(), refRatio(crse_lev));
1076 Array<MultiFab*,AMREX_SPACEDIM> faces_crse;
1077 Array<MultiFab*,AMREX_SPACEDIM> faces_fine;
1078 faces_crse[0] =
xvel_new[crse_lev];
1079 faces_crse[1] =
yvel_new[crse_lev];
1080 faces_crse[2] =
zvel_new[crse_lev];
1082 faces_fine[0] =
xvel_new[crse_lev+1];
1083 faces_fine[1] =
yvel_new[crse_lev+1];
1084 faces_fine[2] =
zvel_new[crse_lev+1];
1086 average_down_faces(GetArrOfConstPtrs(faces_fine), faces_crse,
1087 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.
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 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.
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.
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.
NCTimeSeries * temp_clim_data_from_file
Data container for temperature climatology data read from file.
static SolverChoice solverChoice
Container for algorithmic choices.
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 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 FillCoarsePatch(int lev, amrex::Real time, amrex::MultiFab *mf_fine, amrex::MultiFab *mf_crse, const int icomp=0, const bool fill_all=true)
fill an entire multifab by interpolating from the coarser level
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
VertMixingType vert_mixing_type
CouplingType coupling_type