ttempSystem.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
 (HTM) git clone git://src.adamsgaard.dk/pism
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       ttempSystem.hh (3028B)
       ---
            1 // Copyright (C) 2009-2011, 2013, 2014, 2015, 2017 Ed Bueler
            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 #ifndef __tempSystem_hh
           20 #define __tempSystem_hh
           21 
           22 #include "pism/util/ColumnSystem.hh"
           23 #include "pism/util/pism_utilities.hh"
           24 #include "pism/util/Mask.hh"
           25 
           26 namespace pism {
           27 
           28 class IceModelVec3;
           29 
           30 namespace energy {
           31 //! Tridiagonal linear system for vertical column of temperature-based conservation of energy problem.
           32 /*!
           33   Call sequence like this:
           34   \code
           35   tempSystemCtx foo;
           36   foo.dx = ...  // set public constants
           37   foo.u = ...   // set public pointers
           38   foo.initAllColumns();
           39   for (j in ownership) {
           40   for (i in ownership) {
           41   ks = ...
           42   foo.setIndicesThisColumn(i,j,ks);
           43   [COMPUTE OTHER PARAMS]
           44   foo.setSchemeParamsThisColumn(mask,isMarginal,lambda);  
           45   foo.setSurfaceBoundaryValuesThisColumn(Ts);
           46   foo.setBasalBoundaryValuesThisColumn(Ghf,Tshelfbase,Rb);
           47   foo.solveThisColumn(x);
           48   }  
           49   }
           50   \endcode
           51 */
           52 class tempSystemCtx : public columnSystemCtx {
           53 public:
           54   tempSystemCtx(const std::vector<double>& storage_grid,
           55                 const std::string &prefix,
           56                 double dx, double dy, double dt,
           57                 const Config &config,
           58                 const IceModelVec3 &T3,
           59                 const IceModelVec3 &u3,
           60                 const IceModelVec3 &v3,
           61                 const IceModelVec3 &w3,
           62                 const IceModelVec3 &strain_heating3);
           63 
           64   void initThisColumn(int i, int j, bool is_marginal, MaskValue new_mask, double ice_thickness);
           65 
           66   void setSurfaceBoundaryValuesThisColumn(double my_Ts);
           67   void setBasalBoundaryValuesThisColumn(double my_G0, double my_Tshelfbase,
           68                                                   double my_Rb);
           69 
           70   void solveThisColumn(std::vector<double> &x);
           71 
           72   double lambda() {
           73     return m_lambda;
           74   }
           75 
           76   double w(int k) {
           77     return m_w[k];
           78   }
           79 protected:
           80   double m_ice_density, m_ice_c, m_ice_k;
           81   const IceModelVec3 &m_T3, &m_strain_heating3;
           82 
           83   std::vector<double>  m_T, m_strain_heating;
           84   std::vector<double> m_T_n, m_T_e, m_T_s, m_T_w;
           85 
           86   double m_lambda, m_Ts, m_G0, m_Tshelfbase, m_Rb;
           87   MaskValue    m_mask;
           88   bool        m_is_marginal;
           89   double m_nu,
           90     m_rho_c_I,
           91     m_iceK,
           92     m_iceR;
           93 private:
           94   bool
           95     m_surfBCsValid,
           96     m_basalBCsValid;
           97 
           98   double compute_lambda();
           99 };
          100 
          101 } // end of namespace energy
          102 } // end of namespace pism
          103 
          104 #endif  /* __tempSystem_hh */
          105