24 #include "pism/coupler/atmosphere/PIK.hh"
26 #include "pism/geometry/Geometry.hh"
27 #include "pism/util/ConfigInterface.hh"
28 #include "pism/util/Grid.hh"
29 #include "pism/util/MaxTimestep.hh"
30 #include "pism/util/error_handling.hh"
33 namespace atmosphere {
38 auto parameterization =
m_config->get_string(
"atmosphere.pik.parameterization");
40 std::map<std::string, Parameterization>
41 models = {{
"martin",
MARTIN},
48 if (models.find(parameterization) == models.end()) {
50 "invalid pik parameterization: %s",
51 parameterization.c_str());
60 "* Initializing PIK atmosphere model with air temperature parameterization based on \n"
61 " Huybrechts & De Wolde (1999) or multiple regression analysis of ERA INTERIM data...\n"
62 " Uses a time-independent precipitation field read from a file.");
66 auto precip_file =
m_config->get_string(
"atmosphere.pik.file");
68 if (not precip_file.empty()) {
80 " Parameterization based on: Huybrechts & De Wolde (1999).\n");
84 " Parameterization based on: multiple regression analysis of ERA INTERIM data.\n");
88 " Parameterization based on: multiple regression analysis of ERA INTERIM data with a sin(lat) dependence.\n");
92 " Parameterization based on: multiple regression analysis of ERA INTERIM data with a cos(lon) dependence.\n");
96 " Mean annual temperature: as in Martin et al (2011).\n"
97 " Mean summer temperature: anomaly to the parameterization used by Huybrechts & De Wolde (1999).\n");
102 " Mean annual temperature: as in Martin et al (2011).\n"
103 " No seasonal variation in air temperature.\n");
116 double gamma_a = surface_elevation < 1500.0 ? -0.005102 : -0.014285;
117 return 273.15 + 34.46 + gamma_a * surface_elevation - 0.68775 * latitude * (-1.0);
124 return 273.15 + 16.81 - 0.00692 * surface_elevation - 0.27937 * latitude * (-1.0);
132 auto grid = T_ma.
grid();
140 for (
auto p = grid->points(); p; p.next()) {
141 const int i = p.i(), j = p.j();
152 auto grid = T_ma.
grid();
160 for (
auto p = grid->points(); p; p.next()) {
161 const int i = p.i(), j = p.j();
163 T_ma(i, j) = 273.15 + 29.2 - 0.0082 * h(i, j) - 0.576 * lat(i, j) * (-1.0);
164 T_ms(i, j) = 273.15 + 16.5 - 0.0068 * h(i, j) - 0.248 * lat(i, j) * (-1.0);
172 auto grid = T_ma.
grid();
180 for (
auto p = grid->points(); p; p.next()) {
181 const int i = p.i(), j = p.j();
183 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);
184 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);
192 auto grid = T_ma.
grid();
201 for (
auto p = grid->points(); p; p.next()) {
202 const int i = p.i(), j = p.j();
204 double hmod =
std::max(1000.0, h(i, j));
205 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);
206 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);
216 return 273.15 + 30 - 0.0075 * elevation - 0.68775 * latitude * (-1.0);
224 auto grid = T_ma.
grid();
232 for (
auto p = grid->points(); p; p.next()) {
233 const int i = p.i(), j = p.j();
236 T_ms(i, j) = T_ma(i, j);
245 auto grid = T_ma.
grid();
253 for (
auto p = grid->points(); p; p.next()) {
254 const int i = p.i(), j = p.j();
257 T_ma(i, j) = 273.15 + 30 - 0.0075 * h(i, j) - 0.68775 * lat(i, j) * (-1.0);
263 T_ms(i, j) = T_ma(i, j) + (TMS - TMA);
278 "latitude variable was missing at bootstrap;\n"
279 "PIK atmosphere model depends on latitude and would return nonsense!");
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr 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
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata 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
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
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)