19 #include "pism/coupler/atmosphere/Delta_P.hh"
21 #include "pism/util/ConfigInterface.hh"
22 #include "pism/util/ScalarForcing.hh"
23 #include "pism/coupler/util/options.hh"
24 #include "pism/util/array/Forcing.hh"
27 namespace atmosphere {
29 Delta_P::Delta_P(std::shared_ptr<const Grid> grid, std::shared_ptr<AtmosphereModel> in)
33 prefix =
"atmosphere.delta_P",
34 variable_name =
"delta_P",
35 long_name =
"precipitation offsets",
36 units =
"kg m-2 second-1",
37 external_units =
"kg m-2 year-1";
46 bool scalar = input.
dimensions(variable_name).size() == 1;
52 units, external_units,
55 auto buffer_size =
m_config->get_number(
"input.forcing.buffer_size");
61 static_cast<unsigned int>(buffer_size),
67 .output_units(external_units);
77 "* Initializing precipitation forcing using scalar offsets...\n");
92 for (
unsigned int k = 0;
k < ts.size(); ++
k) {
135 for (
auto p =
m_grid->points(); p; p.next()) {
136 const int i = p.i(), j = p.j();
138 P(i, j) += delta(i, j);
158 for (
size_t k = 0;
k < result.size(); ++
k) {
std::shared_ptr< const Grid > grid() const
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
const std::shared_ptr< const Grid > m_grid
grid used by this component
std::vector< std::string > dimensions(const std::string &variable_name) const
High-level PISM I/O class.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
virtual void init_timeseries_impl(const std::vector< double > &ts) const
std::shared_ptr< AtmosphereModel > m_input_model
static std::shared_ptr< array::Scalar > allocate_precipitation(std::shared_ptr< const Grid > grid)
A purely virtual class defining the interface of a PISM Atmosphere Model.
void precip_time_series_impl(int i, int j, std::vector< double > &result) const
void init_timeseries_impl(const std::vector< double > &ts) const
const array::Scalar & precipitation_impl() const
void end_pointwise_access_impl() const
void init_impl(const Geometry &geometry)
void begin_pointwise_access_impl() const
std::shared_ptr< ScalarForcing > m_1d_offsets
std::vector< double > m_offset_values
std::shared_ptr< array::Forcing > m_2d_offsets
void update_impl(const Geometry &geometry, double t, double dt)
Delta_P(std::shared_ptr< const Grid > g, std::shared_ptr< AtmosphereModel > in)
std::shared_ptr< array::Scalar > m_precipitation
@ PISM_READONLY
open an existing file for reading only