PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
bootstrapping.cc
Go to the documentation of this file.
1 /* Copyright (C) 2016, 2017, 2023 PISM Authors
2  *
3  * This file is part of PISM.
4  *
5  * PISM is free software; you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation; either version 3 of the License, or (at your option) any later
8  * version.
9  *
10  * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with PISM; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include <algorithm> // for min
21 #include <cmath> // for sqrt, erf, M_PI
22 #include <memory> // for __shared_ptr_access
23 #include "pism/energy/bootstrapping.hh" // for ice_temperature_guess, ice...
24 #include "pism/util/EnthalpyConverter.hh" // for EnthalpyConverter, Enthalp...
25 
26 namespace pism {
27 namespace energy {
28 
30  double H, double z, double T_surface,
31  double G, double ice_k) {
32 
33  const double
34  depth = H - z,
35  d2 = depth * depth,
36  Tpmp = EC->melting_temperature(EC->pressure(depth));
37 
38  const double
39  beta = (4.0/21.0) * (G / (2.0 * ice_k * H * H * H)),
40  alpha = (G / (2.0 * H * ice_k)) - 2.0 * H * H * beta;
41 
42  return std::min(Tpmp, T_surface + alpha * d2 + beta * d2 * d2);
43 }
44 
45 double ice_temperature_guess_smb(EnthalpyConverter::Ptr EC, double H, double z, double T_surface,
46  double G, double ice_k, double K, double SMB) {
47  const double depth = H - z, Tpmp = EC->melting_temperature(EC->pressure(depth));
48 
49  if (SMB <= 0.0) {
50  // negative or zero surface mass balance: linear temperature profile
51  return std::min(Tpmp, G / ice_k * depth + T_surface);
52  }
53 
54  // positive surface mass balance
55  const double C0 = (G * sqrt(M_PI * H * K)) / (ice_k * sqrt(2.0 * SMB)),
56  gamma0 = sqrt(SMB * H / (2.0 * K));
57 
58  return std::min(Tpmp, T_surface + C0 * (erf(gamma0) - erf(gamma0 * z / H)));
59 }
60 
61 } // end of namespace energy
62 } // end of namespace pism
std::shared_ptr< EnthalpyConverter > Ptr
const double G
Definition: exactTestK.c:40
double min(const array::Scalar &input)
Finds minimum over all the values in an array::Scalar object. Ignores ghosts.
Definition: Scalar.cc:193
double ice_temperature_guess(EnthalpyConverter::Ptr EC, double H, double z, double T_surface, double G, double ice_k)
double ice_temperature_guess_smb(EnthalpyConverter::Ptr EC, double H, double z, double T_surface, double G, double ice_k, double K, double SMB)
static double K(double psi_x, double psi_y, double speed, double epsilon)
const double d2
Definition: ssafd_code.cc:1