URI:
       tbootstrapping.cc - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
  HTML git clone git://src.adamsgaard.dk/pism
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
       tbootstrapping.cc (2144B)
       ---
            1 /* Copyright (C) 2016, 2017 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 <cmath>
           21 
           22 #include "pism/energy/bootstrapping.hh"
           23 
           24 namespace pism {
           25 namespace energy {
           26 
           27 double ice_temperature_guess(EnthalpyConverter::Ptr EC,
           28                              double H, double z, double T_surface,
           29                              double G, double ice_k) {
           30 
           31   const double
           32     depth = H - z,
           33     d2    = depth * depth,
           34     Tpmp  = EC->melting_temperature(EC->pressure(depth));
           35 
           36   const double
           37     beta = (4.0/21.0) * (G / (2.0 * ice_k * H * H * H)),
           38     alpha = (G / (2.0 * H * ice_k)) - 2.0 * H * H * beta;
           39 
           40   return std::min(Tpmp, T_surface + alpha * d2 + beta * d2 * d2);
           41 }
           42 
           43 double ice_temperature_guess_smb(EnthalpyConverter::Ptr EC,
           44                                  double H, double z, double T_surface,
           45                                  double G, double ice_k, double K, double SMB) {
           46   const double
           47     depth = H - z,
           48     Tpmp  = EC->melting_temperature(EC->pressure(depth));
           49 
           50   if (SMB <= 0.0) {
           51     // negative or zero surface mass balance: linear temperature profile
           52     return std::min(Tpmp, G / ice_k * depth + T_surface);
           53   } else {
           54     // positive surface mass balance
           55     const double
           56       C0     = (G * sqrt(M_PI * H * K)) / (ice_k * sqrt(2.0 * SMB)),
           57       gamma0 = sqrt(SMB * H / (2.0 * K));
           58 
           59     return std::min(Tpmp, T_surface + C0 * (erf(gamma0) - erf(gamma0 * z / H)));
           60   }
           61 }
           62 
           63 } // end of namespace energy
           64 } // end of namespace pism