24#include "pism/coupler/atmosphere/PIK.hh"
26#include "pism/geometry/Geometry.hh"
27#include "pism/util/Config.hh"
28#include "pism/util/Grid.hh"
29#include "pism/util/MaxTimestep.hh"
30#include "pism/util/error_handling.hh"
31#include "pism/util/Logger.hh"
39 auto parameterization =
m_config->get_string(
"atmosphere.pik.parameterization");
41 std::map<std::string, Parameterization>
42 models = {{
"martin",
MARTIN},
49 if (models.find(parameterization) == models.end()) {
51 "invalid pik parameterization: %s",
52 parameterization.c_str());
61 "* Initializing PIK atmosphere model with air temperature parameterization based on \n"
62 " Huybrechts & De Wolde (1999) or multiple regression analysis of ERA INTERIM data...\n"
63 " Uses a time-independent precipitation field read from a file.");
67 auto precip_file =
m_config->get_string(
"atmosphere.pik.file");
69 if (not precip_file.empty()) {
81 " Parameterization based on: Huybrechts & De Wolde (1999).\n");
85 " Parameterization based on: multiple regression analysis of ERA INTERIM data.\n");
89 " Parameterization based on: multiple regression analysis of ERA INTERIM data with a sin(lat) dependence.\n");
93 " Parameterization based on: multiple regression analysis of ERA INTERIM data with a cos(lon) dependence.\n");
97 " Mean annual temperature: as in Martin et al (2011).\n"
98 " Mean summer temperature: anomaly to the parameterization used by Huybrechts & De Wolde (1999).\n");
103 " Mean annual temperature: as in Martin et al (2011).\n"
104 " No seasonal variation in air temperature.\n");
117 double gamma_a = surface_elevation < 1500.0 ? -0.005102 : -0.014285;
118 return 273.15 + 34.46 + gamma_a * surface_elevation - 0.68775 * latitude * (-1.0);
125 return 273.15 + 16.81 - 0.00692 * surface_elevation - 0.27937 * latitude * (-1.0);
133 auto grid = T_ma.
grid();
141 for (
auto p : grid->points()) {
142 const int i = p.i(), j = p.j();
153 auto grid = T_ma.
grid();
161 for (
auto p : grid->points()) {
162 const int i = p.i(), j = p.j();
164 T_ma(i, j) = 273.15 + 29.2 - 0.0082 * h(i, j) - 0.576 * lat(i, j) * (-1.0);
165 T_ms(i, j) = 273.15 + 16.5 - 0.0068 * h(i, j) - 0.248 * lat(i, j) * (-1.0);
173 auto grid = T_ma.
grid();
181 for (
auto p : grid->points()) {
182 const int i = p.i(), j = p.j();
184 T_ma(i, j) = 273.15 - 2.0 - 0.0082 * h(i, j) + 18.4 * (sin(3.1415 * lat(i, j) / 180.0) + 0.8910) / (1 - 0.8910);
185 T_ms(i, j) = 273.15 + 3.2 - 0.0067 * h(i, j) + 8.3 * (sin(3.1415 * lat(i, j) / 180.0) + 0.8910) / (1 - 0.8910);
193 auto grid = T_ma.
grid();
202 for (
auto p : grid->points()) {
203 const int i = p.i(), j = p.j();
205 double hmod = std::max(1000.0, h(i, j));
206 T_ma(i, j) = 273.15 + 37.49 - 0.0095 * hmod - 0.644 * lat(i, j) * (-1.0) + 2.146 * cos(3.1415 * (lon(i, j) + 110.0) / 180.0);
207 T_ms(i, j) = 273.15 + 15.74 - 0.0083 * hmod - 0.196 * lat(i, j) * (-1.0) + 0.225 * cos(3.1415 * (lon(i, j) + 110.0) / 180.0);
217 return 273.15 + 30 - 0.0075 * elevation - 0.68775 * latitude * (-1.0);
225 auto grid = T_ma.
grid();
233 for (
auto p : grid->points()) {
234 const int i = p.i(), j = p.j();
237 T_ms(i, j) = T_ma(i, j);
246 auto grid = T_ma.
grid();
254 for (
auto p : grid->points()) {
255 const int i = p.i(), j = p.j();
258 T_ma(i, j) = 273.15 + 30 - 0.0075 * h(i, j) - 0.68775 * lat(i, j) * (-1.0);
264 T_ms(i, j) = T_ma(i, j) + (TMS - TMA);
279 "latitude variable was missing at bootstrap;\n"
280 "PIK atmosphere model depends on latitude and would return nonsense!");
std::shared_ptr< const Config > m_config
configuration database used by this component
std::shared_ptr< const Logger > m_log
logger (for easy access)
array::Scalar2 ice_surface_elevation
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
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
std::shared_ptr< const Grid > grid() const
VariableMetadata & metadata(unsigned int N=0)
Returns a reference to the VariableMetadata object containing metadata for the compoment N.
MaxTimestep max_timestep_impl(double t) const
@ MARTIN_HUYBRECHTS_DEWOLDE
void update_impl(const Geometry &geometry, double t, double dt)
PIK(std::shared_ptr< const Grid > g)
void init_impl(const Geometry &geometry)
Reads in the precipitation data from the input file.
Parameterization m_parameterization
array::Scalar m_air_temp_mean_summer
void init_internal(const std::string &input_filename, bool regrid, unsigned int start)
Read precipitation data from a given file.
virtual void init_impl(const Geometry &geometry)
Reads in the precipitation data from the input file.
array::Scalar m_air_temp_mean_annual
#define PISM_ERROR_LOCATION
static void martin2011(const Geometry &geometry, array::Scalar &T_ma, array::Scalar &T_ms)
static void era_interim_sin(const Geometry &geometry, array::Scalar &T_ma, array::Scalar &T_ms)
static void martin_huybrechts_dewolde(const Geometry &geometry, array::Scalar &T_ma, array::Scalar &T_ms)
static void era_interim_lon(const Geometry &geometry, array::Scalar &T_ma, array::Scalar &T_ms)
static void era_interim(const Geometry &geometry, array::Scalar &T_ma, array::Scalar &T_ms)
static void huybrechts_dewolde(const Geometry &geometry, array::Scalar &T_ma, array::Scalar &T_ms)
static double huybrechts_dewolde_mean_summer(double surface_elevation, double latitude)
static double huybrechts_dewolde_mean_annual(double surface_elevation, double latitude)
static double martin2011_mean_annual(double elevation, double latitude)