URI:
       tSeariseGreenland.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
       ---
       tSeariseGreenland.cc (5045B)
       ---
            1 // Copyright (C) 2008-2018 Ed Bueler, Constantine Khroulev, Ricarda Winkelmann,
            2 // Gudfinna Adalgeirsdottir and Andy Aschwanden
            3 //
            4 // This file is part of PISM.
            5 //
            6 // PISM is free software; you can redistribute it and/or modify it under the
            7 // terms of the GNU General Public License as published by the Free Software
            8 // Foundation; either version 3 of the License, or (at your option) any later
            9 // version.
           10 //
           11 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
           12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           13 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
           14 // details.
           15 //
           16 // You should have received a copy of the GNU General Public License
           17 // along with PISM; if not, write to the Free Software
           18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
           19 
           20 // Implementation of the atmosphere model using constant-in-time precipitation
           21 // and a cosine yearly cycle for near-surface air temperatures.
           22 
           23 // This includes the SeaRISE Greenland parameterization.
           24 
           25 #include "SeariseGreenland.hh"
           26 #include "pism/util/Vars.hh"
           27 #include "pism/util/IceGrid.hh"
           28 #include "pism/util/Time.hh"
           29 #include "pism/util/ConfigInterface.hh"
           30 
           31 #include "pism/util/error_handling.hh"
           32 #include "pism/util/MaxTimestep.hh"
           33 #include "pism/geometry/Geometry.hh"
           34 
           35 namespace pism {
           36 namespace atmosphere {
           37 
           38 ///// SeaRISEGreenland
           39 
           40 SeaRISEGreenland::SeaRISEGreenland(IceGrid::ConstPtr g)
           41   : YearlyCycle(g) {
           42   // empty
           43 }
           44 
           45 SeaRISEGreenland::~SeaRISEGreenland() {
           46 }
           47 
           48 void SeaRISEGreenland::init_impl(const Geometry &geometry) {
           49 
           50   m_log->message(2,
           51                  "* Initializing SeaRISE-Greenland atmosphere model based on the Fausto et al (2009)\n"
           52                  "  air temperature parameterization and using stored time-independent precipitation...\n");
           53 
           54   m_reference =
           55     "R. S. Fausto, A. P. Ahlstrom, D. V. As, C. E. Boggild, and S. J. Johnsen, 2009. "
           56     "A new present-day temperature parameterization for Greenland. J. Glaciol. 55 (189), 95-105.";
           57 
           58   auto precip_file = m_config->get_string("atmosphere.searise_greenland.file");
           59 
           60   if (not precip_file.empty()) {
           61     m_log->message(2,
           62                    "  * Reading precipitation from '%s'...\n",
           63                    precip_file.c_str());
           64 
           65     YearlyCycle::init_internal(precip_file,
           66                                true, /* do regrid */
           67                                0 /* start (irrelevant) */);
           68   } else {
           69     YearlyCycle::init_impl(geometry);
           70   }
           71 }
           72 
           73 void SeaRISEGreenland::precip_time_series_impl(int i, int j, std::vector<double> &result) const {
           74 
           75   for (unsigned int k = 0; k < m_ts_times.size(); k++) {
           76     result[k] = m_precipitation(i,j);
           77   }
           78 }
           79 
           80 MaxTimestep SeaRISEGreenland::max_timestep_impl(double t) const {
           81   (void) t;
           82   return MaxTimestep("atmosphere searise_greenland");
           83 }
           84 
           85 //! \brief Updates mean annual and mean summer (July) near-surface air temperatures.
           86 //! Note that the precipitation rate is time-independent and does not need
           87 //! to be updated.
           88 void SeaRISEGreenland::update_impl(const Geometry &geometry, double t, double dt) {
           89   (void) t;
           90   (void) dt;
           91 
           92   const double
           93     d_ma     = m_config->get_number("atmosphere.fausto_air_temp.d_ma"),      // K
           94     gamma_ma = m_config->get_number("atmosphere.fausto_air_temp.gamma_ma"),  // K m-1
           95     c_ma     = m_config->get_number("atmosphere.fausto_air_temp.c_ma"),      // K (degN)-1
           96     kappa_ma = m_config->get_number("atmosphere.fausto_air_temp.kappa_ma"),  // K (degW)-1
           97     d_mj     = m_config->get_number("atmosphere.fausto_air_temp.d_mj"),      // SAME UNITS as for _ma ...
           98     gamma_mj = m_config->get_number("atmosphere.fausto_air_temp.gamma_mj"),
           99     c_mj     = m_config->get_number("atmosphere.fausto_air_temp.c_mj"),
          100     kappa_mj = m_config->get_number("atmosphere.fausto_air_temp.kappa_mj");
          101 
          102 
          103   // initialize pointers to fields the parameterization depends on:
          104   const IceModelVec2S
          105     &h        = geometry.ice_surface_elevation,
          106     &lat_degN = geometry.latitude,
          107     &lon_degE = geometry.longitude;
          108 
          109   if (lat_degN.metadata().has_attribute("missing_at_bootstrap")) {
          110     throw RuntimeError(PISM_ERROR_LOCATION, "latitude variable was missing at bootstrap;\n"
          111                        "SeaRISE-Greenland atmosphere model depends on latitude and would return nonsense!");
          112   }
          113 
          114   if (lon_degE.metadata().has_attribute("missing_at_bootstrap")) {
          115     throw RuntimeError(PISM_ERROR_LOCATION, "longitude variable was missing at bootstrap;\n"
          116                        "SeaRISE-Greenland atmosphere model depends on longitude and would return nonsense!");
          117   }
          118 
          119   IceModelVec::AccessList list{&h, &lat_degN, &lon_degE, &m_air_temp_mean_annual, &m_air_temp_mean_summer};
          120 
          121   for (Points p(*m_grid); p; p.next()) {
          122     const int i = p.i(), j = p.j();
          123     m_air_temp_mean_annual(i,j) = d_ma + gamma_ma * h(i,j) + c_ma * lat_degN(i,j) + kappa_ma * (-lon_degE(i,j));
          124     m_air_temp_mean_summer(i,j)   = d_mj + gamma_mj * h(i,j) + c_mj * lat_degN(i,j) + kappa_mj * (-lon_degE(i,j));
          125   }
          126 }
          127 
          128 } // end of namespace atmosphere
          129 } // end of namespace pism