19 #include "pism/coupler/atmosphere/ElevationChange.hh"
23 #include "pism/coupler/util/options.hh"
24 #include "pism/coupler/util/lapse_rates.hh"
25 #include "pism/util/io/io_helpers.hh"
26 #include "pism/geometry/Geometry.hh"
27 #include "pism/util/array/Forcing.hh"
30 namespace atmosphere {
34 m_surface(grid,
"ice_surface_elevation") {
47 auto method =
m_config->get_string(
"atmosphere.elevation_change.precipitation.method");
54 unsigned int buffer_size =
m_config->get_number(
"input.forcing.buffer_size");
66 .long_name(
"ice surface elevation")
68 .standard_name(
"surface_altitude");
81 " [using elevation-change-dependent adjustments of air temperature and precipitation]\n");
84 " air temperature lapse rate: %3.3f K per km\n",
89 " precipitation lapse rate: %3.3f (kg m-2 year-1) per km\n",
93 " precipitation scaling factor with temperature: %3.3f Kelvin-1\n"
94 " temperature lapse rate: %3.3f K per km\n",
134 for (
auto p =
m_grid->points(); p; p.next()) {
135 const int i = p.i(), j = p.j();
184 std::vector<double> reference_surface(
m_ts_times.size());
190 for (
unsigned int m = 0; m <
m_ts_times.size(); ++m) {
197 std::vector<double> reference_surface(N);
206 for (
unsigned int m = 0; m < N; ++m) {
213 for (
unsigned int m = 0; m < N; ++m) {
const units::System::Ptr m_sys
unit system used by this component
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
High-level PISM I/O class.
array::Scalar2 ice_surface_elevation
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void copy_from(const Array2D< T > &source)
virtual void end_access() const
Checks if an Array is allocated and calls DAVecRestoreArray.
virtual void begin_access() const
Checks if an Array is allocated and calls DAVecGetArray.
virtual void init_timeseries_impl(const std::vector< double > &ts) const
static std::shared_ptr< array::Scalar > allocate_temperature(std::shared_ptr< const Grid > grid)
std::shared_ptr< AtmosphereModel > m_input_model
static std::shared_ptr< array::Scalar > allocate_precipitation(std::shared_ptr< const Grid > grid)
std::vector< double > m_ts_times
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
const array::Scalar & precipitation_impl() const
std::shared_ptr< array::Forcing > m_reference_surface
const array::Scalar & air_temperature_impl() const
std::shared_ptr< array::Scalar > m_precipitation
double m_precip_temp_lapse_rate
void end_pointwise_access_impl() const
void init_impl(const Geometry &geometry)
double m_precip_exp_factor
ElevationChange(std::shared_ptr< const Grid > g, std::shared_ptr< AtmosphereModel > in)
std::shared_ptr< array::Scalar > m_temperature
double m_precip_lapse_rate
void begin_pointwise_access_impl() const
void temp_time_series_impl(int i, int j, std::vector< double > &result) const
void init_timeseries_impl(const std::vector< double > &ts) const
void update_impl(const Geometry &geometry, double t, double dt)
@ PISM_READONLY
open an existing file for reading only
double convert(System::Ptr system, double input, const std::string &spec1, const std::string &spec2)
Convert a quantity from unit1 to unit2.
void lapse_rate_correction(const array::Scalar &surface, const array::Scalar &reference_surface, double lapse_rate, array::Scalar &result)