4#include <AMReX_MFIter.H>
5#include <AMReX_Print.H>
28constexpr int SSTIndex = 0;
34 Real cur_time =
t_new[0];
35 const int step =
istep[0];
93 if (state.empty() || state[SSTIndex] ==
nullptr) {
return; }
97 const int k_sfc =
cons_new[lev]->boxArray().minimalBox().bigEnd(2);
101 BoxList bl2d =
cons_new[lev]->boxArray().boxList();
102 for (
auto& b : bl2d) { b.setRange(2, 0); }
103 BoxArray ba2d(std::move(bl2d));
104 MultiFab tmp(ba2d,
cons_new[lev]->DistributionMap(), 1, 0);
106 for (MFIter mfi(*
cons_new[lev]); mfi.isValid(); ++mfi) {
107 auto const& c =
cons_new[lev]->const_array(mfi);
108 auto t = tmp.array(mfi);
109 Box bx = makeSlab(mfi.validbox(), 2, k_sfc);
110 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int) {
112 t(i, j, 0) = c(i, j, k_sfc,
Temp_comp) + 273.15_rt;
115 state[SSTIndex]->ParallelCopy(tmp, 0, 0, 1);
145 if (finest_level < 0) {
return; }
151 vec_uwind[0]->FillBoundary(geom[0].periodicity());
158 vec_vwind[0]->FillBoundary(geom[0].periodicity());
168 vec_Pair[0]->FillBoundary(geom[0].periodicity());
177 vec_qair[0]->FillBoundary(geom[0].periodicity());
186 vec_Tair[0]->plus(-273.15_rt, 0, 1);
187 vec_Tair[0]->FillBoundary(geom[0].periodicity());
196 vec_cloud[0]->FillBoundary(geom[0].periodicity());
203 vec_rain[0]->FillBoundary(geom[0].periodicity());
210 vec_srflx[0]->FillBoundary(geom[0].periodicity());
void PackSurfaceState(amrex::Vector< amrex::MultiFab * > &state, amrex::Real time)
Extracts SST from the 3D conservative state for the atmospheric driver.
amrex::Real last_plot_file_time
Simulation time when we last output a plotfile.
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive tracer
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_vwind
Wind in the v direction, defined at rho-points.
int history_count
Counter for which time index we are writing to in the netcdf history file.
amrex::Real stop_time
Time to stop.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_rain
precipitation rate [kg/m^2/s]
amrex::Real EvolveOneStep(amrex::Real time, amrex::Real dt_request)
std::array< bool, AtmosState::NumTypes > driver_atmos_state_from_driver
provenance flags for driver-supplied atmospheric forcing lanes
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_uwind
Wind in the u direction, defined at rho-points.
amrex::Real check_int_time
Checkpoint output interval in seconds.
amrex::Real plot_int_time
Plotfile output interval in seconds.
void post_timestep(int nstep, amrex::Real time, amrex::Real dt_lev)
Called after every level 0 timestep.
int last_check_file_step
Step when we last output a checkpoint file.
void ComputeDt()
a wrapper for estTimeStep()
int plot_int
Plotfile output interval in iterations.
amrex::Vector< int > istep
which step?
void WriteCheckpointFile()
write checkpoint file to disk
amrex::Vector< amrex::Real > t_new
new time at each level
void ApplyAtmosphericStates(const amrex::Vector< amrex::MultiFab * > &states, amrex::Real time)
Receives atmospheric states from the driver and applies unit conversions.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_longwave_down
Downward longwave radiation.
void timeStep(int lev, amrex::Real time, int iteration)
advance a level by dt, includes a recursive call for finer levels
void timeStepML(amrex::Real time, int iteration)
advance all levels by dt, loops over finer levels
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_cloud
cloud cover fraction [0-1], defined at rho-points
int check_int
Checkpoint output interval in iterations.
void WritePlotFile(int istep)
main driver for writing AMReX plotfiles
int last_plot_file_step
Step when we last output a plotfile.
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.
amrex::Vector< amrex::Real > dt
time step at each level
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.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Tair
Air temperature [°C], defined at rho-points.
@ 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]