PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/base/enthalpyConverter.hh

Go to the documentation of this file.
00001 // Copyright (C) 2009-2011 Andreas Aschwanden, Ed Bueler and Constantine Khroulev
00002 //
00003 // This file is part of PISM.
00004 //
00005 // PISM is free software; you can redistribute it and/or modify it under the
00006 // terms of the GNU General Public License as published by the Free Software
00007 // Foundation; either version 2 of the License, or (at your option) any later
00008 // version.
00009 //
00010 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013 // details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with PISM; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef __enthalpyConverter_hh
00020 #define __enthalpyConverter_hh
00021 
00022 #include "NCVariable.hh"
00023 
00025 
00055 class EnthalpyConverter {
00056 public:
00057   EnthalpyConverter(const NCConfigVariable &config);
00058   virtual ~EnthalpyConverter() {}
00059 
00060   virtual PetscErrorCode viewConstants(PetscViewer viewer) const;
00061 
00062   virtual double         getPressureFromDepth(double depth) const;
00063   virtual double         getMeltingTemp(double p) const;
00064   virtual double         getEnthalpyCTS(double p) const;
00065   virtual PetscErrorCode getEnthalpyInterval(double p, double &E_s, double &E_l) const;
00066   virtual double         getCTS(double E, double p) const;
00067 
00068   virtual bool           isTemperate(double E, double p) const;
00069   virtual bool           isLiquified(double E, double p) const;
00070 
00071   virtual PetscErrorCode getAbsTemp(double E, double p, double &T) const;
00072   virtual PetscErrorCode getPATemp(double E, double p, double &T_pa) const;
00073 
00074   virtual PetscErrorCode getWaterFraction(double E, double p, double &omega) const;
00075 
00076   virtual PetscErrorCode getEnth(double T, double omega, double p, double &E) const;
00077   virtual PetscErrorCode getEnthPermissive(double T, double omega, double p, double &E) const;
00078   virtual PetscErrorCode getEnthAtWaterFraction(double omega, double p, double &E) const;
00079 
00080 protected:
00081   double T_melting, L, c_i, rho_i, g, p_air, beta, T_tol;
00082   double T_0;
00083   bool   do_cold_ice_methods;
00084 };
00085 
00086 
00088 
00097 class ICMEnthalpyConverter : public EnthalpyConverter {
00098 public:
00099   ICMEnthalpyConverter(const NCConfigVariable &config) : EnthalpyConverter(config) {
00100     do_cold_ice_methods = true;
00101   }
00102 
00103   virtual ~ICMEnthalpyConverter() {}
00104 
00106   virtual double getMeltingTemp(double /*p*/) const {
00107     return T_melting; }
00108 
00110   virtual PetscErrorCode getAbsTemp(double E, double /*p*/,
00111                                     double &T) const {
00112     T = (E / c_i) + T_0;
00113     return 0; }
00114 
00116   virtual PetscErrorCode getWaterFraction(double /*E*/, double /*p*/,
00117                                           double &omega) const {
00118     omega = 0.0;
00119     return 0; }
00120 
00122   virtual PetscErrorCode getEnth(double T, double /*omega*/, double /*p*/, 
00123                                  double &E) const {
00124     E = c_i * (T - T_0);
00125     return 0; }
00126 
00128   virtual PetscErrorCode getEnthPermissive(double T, double /*omega*/, double /*p*/,
00129                                            double &E) const {
00130     E = c_i * (T - T_0);
00131     return 0; }
00132 
00134   virtual PetscErrorCode getEnthAtWaterFraction(double /*omega*/, double p,
00135                                                 double &E) const {
00136     E = getEnthalpyCTS(p);
00137     return 0; }
00138 
00140   virtual bool isTemperate(double /*E*/, double /*p*/) const {
00141     return false; }
00142 };
00143 
00144 
00145 #endif // __enthalpyConverter_hh
00146 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines