PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/base/stressbalance/SSA.hh

Go to the documentation of this file.
00001 // Copyright (C) 2004--2011 Jed Brown, 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 _SSA_H_
00020 #define _SSA_H_
00021 
00022 #include "ShallowStressBalance.hh"
00023 #include "PISMDiagnostic.hh"
00024 
00026 
00051 class SSAStrengthExtension {
00052 public:
00053   SSAStrengthExtension(const NCConfigVariable &c) : config(c) {
00054     min_thickness = config.get("min_thickness_strength_extension_ssa");
00055     constant_nu = config.get("constant_nu_strength_extension_ssa");
00056   }
00057 
00058   virtual ~SSAStrengthExtension() {}
00059 
00061 
00062   virtual PetscErrorCode set_notional_strength(PetscReal my_nuH) {
00063      if (my_nuH <= 0.0) SETERRQ(1,"nuH must be positive");
00064      constant_nu = my_nuH / min_thickness;
00065      return 0;
00066   }
00067 
00069 
00070   virtual PetscErrorCode set_min_thickness(PetscReal my_min_thickness) {
00071      if (my_min_thickness <= 0.0) SETERRQ(1,"min_thickness must be positive");
00072      PetscReal nuH = constant_nu * min_thickness;
00073      min_thickness = my_min_thickness;
00074      constant_nu = nuH / min_thickness;
00075      return 0;
00076   }
00077 
00079   virtual PetscReal get_notional_strength() const {
00080     return constant_nu * min_thickness;
00081   }
00082 
00084   virtual PetscReal get_min_thickness() const { return min_thickness; }
00085 
00086 private:
00087   const NCConfigVariable &config;
00088   PetscReal  min_thickness, constant_nu;
00089 };
00090 
00093 
00098 class SSA;
00099 typedef SSA * (*SSAFactory)(IceGrid &, IceBasalResistancePlasticLaw &, 
00100               IceFlowLaw &, EnthalpyConverter &, const NCConfigVariable &);
00101 
00102 
00104 
00133 class SSA : public ShallowStressBalance
00134 {
00135   friend class SSA_taud;
00136 public:
00137   SSA(IceGrid &g, IceBasalResistancePlasticLaw &b, IceFlowLaw &i, EnthalpyConverter &e,
00138         const NCConfigVariable &c);
00139 
00140   SSAStrengthExtension *strength_extension;
00141 
00142   virtual ~SSA() { 
00143     PetscErrorCode ierr = deallocate();
00144     if (ierr != 0) {
00145       PetscPrintf(grid.com, "FATAL ERROR: SSAFD de-allocation failed.\n");
00146       PISMEnd();
00147     }
00148     delete strength_extension;
00149   }
00150 
00151   virtual PetscErrorCode init(PISMVars &vars);
00152 
00153   virtual PetscErrorCode update(bool fast);
00154 
00155   virtual PetscErrorCode set_initial_guess(IceModelVec2V &guess);
00156 
00157   virtual PetscErrorCode stdout_report(string &result);
00158 
00159   virtual void add_vars_to_output(string keyword, set<string> &result);
00160   virtual PetscErrorCode define_variables(set<string> vars, const NCTool &nc, nc_type nctype);
00161   virtual PetscErrorCode write_variables(set<string> vars, string filename);
00162 
00164   virtual void get_diagnostics(map<string, PISMDiagnostic*> &dict);
00165 
00166   using ShallowStressBalance::compute_principal_strain_rates;
00167   virtual PetscErrorCode compute_principal_strain_rates(
00168                 IceModelVec2S &result_e1, IceModelVec2S &result_e2);
00169 
00170 protected:
00171   virtual PetscErrorCode allocate();
00172 
00173   virtual PetscErrorCode deallocate();
00174 
00175   virtual PetscErrorCode solve()  = 0;
00176 
00177   virtual PetscErrorCode compute_driving_stress(IceModelVec2V &taud);
00178 
00179   virtual PetscErrorCode compute_basal_frictional_heating(IceModelVec2S &result);
00180 
00181   virtual PetscErrorCode compute_D2(IceModelVec2S &result);
00182 
00183   virtual PetscErrorCode compute_maximum_velocity();
00184 
00185   IceModelVec2Int *mask;
00186   IceModelVec2S *thickness, *tauc, *surface, *bed;
00187   IceModelVec2V taud, velocity_old;
00188   IceModelVec3 *enthalpy;
00189 
00190   string stdout_ssa;
00191 
00192   // objects used by the SSA solver (internally)
00193   DA  SSADA;                    // dof=2 DA (grid.da2 has dof=1)
00194   Vec SSAX;  // global vector for solution
00195 
00196   // profiling
00197   int event_ssa;
00198 };
00199 
00201 class SSA_taud : public PISMDiag<SSA>
00202 {
00203 public:
00204   SSA_taud(SSA *m, IceGrid &g, PISMVars &my_vars);
00205   PetscErrorCode compute(IceModelVec* &result);
00206 };
00207 
00208 #endif /* _SSA_H_ */
00209 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines