24 #include "pism/coupler/ocean/Cache.hh"
25 #include "pism/util/Grid.hh"
26 #include "pism/util/MaxTimestep.hh"
27 #include "pism/util/Time.hh"
28 #include "pism/util/error_handling.hh"
33 Cache::Cache(std::shared_ptr<const Grid>
g, std::shared_ptr<OceanModel> in)
45 "ocean.cache.update_interval has to be strictly positive (got %f)",
60 "* Initializing the 'caching' ocean model modifier...\n");
70 double time_resolution =
m_config->get_number(
"time_stepping.resolution",
"seconds");
77 update_dt = one_year_from_now - t;
79 assert(update_dt > 0.0);
97 double time_resolution =
m_config->get_number(
"time_stepping.resolution",
"seconds");
101 if (dt < time_resolution) {
112 if (input_max_timestep.
finite()) {
113 return std::min(input_max_timestep, cache_dt);
const Time & time() const
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
bool finite() const
Convert to bool to check if a time step restriction is "active".
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
double increment_date(double T, double years) const
double convert_time_interval(double T, const std::string &units) const
Convert time interval from seconds to given units. Handle 'years' using the year length corresponding...
double current() const
Current time, in seconds.
double m_update_interval_years
void update_impl(const Geometry &geometry, double my_t, double my_dt)
const array::Scalar & shelf_base_temperature_impl() const
MaxTimestep max_timestep_impl(double t) const
std::shared_ptr< array::Scalar > m_shelf_base_mass_flux
void init_impl(const Geometry &geometry)
const array::Scalar & shelf_base_mass_flux_impl() const
double m_next_update_time
std::shared_ptr< array::Scalar > m_shelf_base_temperature
Cache(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > in)
const array::Scalar & average_water_column_pressure_impl() const
std::shared_ptr< OceanModel > m_input_model
std::shared_ptr< array::Scalar > m_water_column_pressure
static std::shared_ptr< array::Scalar > allocate_shelf_base_temperature(std::shared_ptr< const Grid > g)
static std::shared_ptr< array::Scalar > allocate_shelf_base_mass_flux(std::shared_ptr< const Grid > g)
static std::shared_ptr< array::Scalar > allocate_water_column_pressure(std::shared_ptr< const Grid > g)
A very rudimentary PISM ocean model.
#define PISM_ERROR_LOCATION
double min(const array::Scalar &input)
Finds minimum over all the values in an array::Scalar object. Ignores ghosts.
bool ocean(int M)
An ocean cell (floating ice or ice-free).