19 #include "pism/coupler/atmosphere/Frac_P.hh"
21 #include "pism/util/ConfigInterface.hh"
22 #include "pism/util/ScalarForcing.hh"
23 #include "pism/util/io/File.hh"
24 #include "pism/coupler/util/options.hh"
25 #include "pism/util/array/Forcing.hh"
28 namespace atmosphere {
30 Frac_P::Frac_P(std::shared_ptr<const Grid> grid, std::shared_ptr<AtmosphereModel> in)
34 prefix =
"atmosphere.frac_P",
35 variable_name =
"frac_P",
36 long_name =
"precipitation multiplier, pure fraction",
46 bool scalar = input.
dimensions(variable_name).size() == 1;
55 unsigned int buffer_size =
m_config->get_number(
"input.forcing.buffer_size");
64 m_2d_scaling->metadata().long_name(long_name).units(units);
73 m_log->message(2,
"* Initializing precipitation forcing using scalar multipliers...\n");
87 for (
unsigned int k = 0;
k < ts.size(); ++
k) {
130 for (
auto p =
m_grid->points(); p; p.next()) {
131 const int i = p.i(), j = p.j();
153 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.
2D time-dependent inputs (for climate forcing, etc)
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.
Frac_P(std::shared_ptr< const Grid > g, std::shared_ptr< AtmosphereModel > in)
std::shared_ptr< array::Forcing > m_2d_scaling
void precip_time_series_impl(int i, int j, std::vector< double > &values) const
void begin_pointwise_access_impl() const
void update_impl(const Geometry &geometry, double t, double dt)
std::shared_ptr< ScalarForcing > m_1d_scaling
void init_impl(const Geometry &geometry)
std::vector< double > m_scaling_values
const array::Scalar & precipitation_impl() const
void init_timeseries_impl(const std::vector< double > &ts) const
void end_pointwise_access_impl() const
std::shared_ptr< array::Scalar > m_precipitation
@ PISM_READONLY
open an existing file for reading only
static double S(unsigned n)