URI:
       tEnthalpyModel_Regional.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
       ---
       tEnthalpyModel_Regional.cc (4078B)
       ---
            1 /* Copyright (C) 2016, 2017, 2019 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 "EnthalpyModel_Regional.hh"
           21 
           22 namespace pism {
           23 namespace energy {
           24 
           25 EnthalpyModel_Regional::EnthalpyModel_Regional(IceGrid::ConstPtr grid,
           26                                                stressbalance::StressBalance *stress_balance)
           27   : EnthalpyModel(grid, stress_balance) {
           28   // Note that the name of this variable (bmr_stored) does not matter: it is
           29   // *never* read or written. We make a copy of basal_melt_rate_grounded instead.
           30   m_basal_melt_rate_stored.create(m_grid, "bmr_stored", WITHOUT_GHOSTS);
           31   m_basal_melt_rate_stored.set_attrs("internal",
           32                                      "time-independent basal melt rate in the no-model-strip",
           33                                      "m s-1", "m s-1", "", 0);
           34 }
           35 
           36 void EnthalpyModel_Regional::restart_impl(const File &input_file, int record) {
           37   EnthalpyModel::restart_impl(input_file, record);
           38 
           39   m_basal_melt_rate_stored.copy_from(m_basal_melt_rate);
           40 }
           41 
           42 void EnthalpyModel_Regional::bootstrap_impl(const File &input_file,
           43                                             const IceModelVec2S &ice_thickness,
           44                                             const IceModelVec2S &surface_temperature,
           45                                             const IceModelVec2S &climatic_mass_balance,
           46                                             const IceModelVec2S &basal_heat_flux) {
           47 
           48   EnthalpyModel::bootstrap_impl(input_file, ice_thickness, surface_temperature,
           49                                climatic_mass_balance, basal_heat_flux);
           50 
           51   m_basal_melt_rate_stored.copy_from(m_basal_melt_rate);
           52 }
           53 
           54 void EnthalpyModel_Regional::initialize_impl(const IceModelVec2S &basal_melt_rate,
           55                                              const IceModelVec2S &ice_thickness,
           56                                              const IceModelVec2S &surface_temperature,
           57                                              const IceModelVec2S &climatic_mass_balance,
           58                                              const IceModelVec2S &basal_heat_flux) {
           59 
           60   EnthalpyModel::initialize_impl(basal_melt_rate,
           61                                  ice_thickness,
           62                                  surface_temperature,
           63                                  climatic_mass_balance,
           64                                  basal_heat_flux);
           65 
           66   m_basal_melt_rate_stored.copy_from(m_basal_melt_rate);
           67 }
           68 
           69 
           70 void EnthalpyModel_Regional::update_impl(double t, double dt,
           71                                          const Inputs &inputs) {
           72 
           73   unsigned int Mz = m_grid->Mz();
           74 
           75   EnthalpyModel::update_impl(t, dt, inputs);
           76 
           77   const IceModelVec2Int &no_model_mask = *inputs.no_model_mask;
           78 
           79   // The update_impl() call above sets m_work; ghosts are communicated
           80   // later (in EnergyModel::update()).
           81   IceModelVec::AccessList list{&no_model_mask, &m_work, &m_ice_enthalpy,
           82       &m_basal_melt_rate, &m_basal_melt_rate_stored};
           83 
           84   for (Points p(*m_grid); p; p.next()) {
           85     const int i = p.i(), j = p.j();
           86 
           87     if (no_model_mask(i, j) > 0.5) {
           88       double *new_enthalpy = m_work.get_column(i, j);
           89       double *old_enthalpy = m_ice_enthalpy.get_column(i, j);
           90 
           91       // enthalpy
           92       for (unsigned int k = 0; k < Mz; ++k) {
           93         new_enthalpy[k] = old_enthalpy[k];
           94       }
           95 
           96       // basal melt rate
           97       m_basal_melt_rate(i, j) = m_basal_melt_rate_stored(i, j);
           98     }
           99   }
          100 }
          101 
          102 } // end of namespace energy
          103 } // end of namespace pism