|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
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 _PISMYIELDSTRESS_H_ 00020 #define _PISMYIELDSTRESS_H_ 00021 00022 #include "PISMComponent.hh" 00023 #include "iceModelVec.hh" 00024 00026 struct BWPparams { 00027 bool usebmr, 00028 usethkeff; 00029 PetscReal bmr_scale, 00030 thkeff_reduce, 00031 thkeff_H_high, 00032 thkeff_H_low, 00033 ice_density, 00034 standard_gravity; 00035 }; 00036 00038 class PISMYieldStress : public PISMComponent_TS 00039 { 00040 public: 00041 PISMYieldStress(IceGrid &g, const NCConfigVariable &conf) 00042 : PISMComponent_TS(g, conf) {} 00043 00044 virtual ~PISMYieldStress() {} 00045 00046 virtual PetscErrorCode basal_material_yield_stress(IceModelVec2S &result) = 0; 00047 }; 00048 00050 class PISMDefaultYieldStress : public PISMYieldStress 00051 { 00052 friend class PYS_bwp; 00053 public: 00054 PISMDefaultYieldStress(IceGrid &g, const NCConfigVariable &conf) 00055 : PISMYieldStress(g, conf) 00056 { 00057 sliding_scale = -1.0; 00058 basal_water_thickness = NULL; 00059 basal_melt_rate = NULL; 00060 ice_thickness = NULL; 00061 bed_topography = NULL; 00062 mask = NULL; 00063 00064 if (allocate() != 0) { 00065 PetscPrintf(grid.com, "PISM ERROR: memory allocation failed in PISMYieldStress constructor.\n"); 00066 PISMEnd(); 00067 } 00068 00069 p.usebmr = config.get_flag("bmr_enhance_basal_water_pressure"); 00070 p.usethkeff = config.get_flag("thk_eff_basal_water_pressure"); 00071 p.bmr_scale = config.get("bmr_enhance_scale"); 00072 p.thkeff_reduce = config.get("thk_eff_reduced"); 00073 p.thkeff_H_high = config.get("thk_eff_H_high"); 00074 p.thkeff_H_low = config.get("thk_eff_H_low"); 00075 p.ice_density = config.get("ice_density"); 00076 p.standard_gravity = config.get("standard_gravity"); 00077 } 00078 00079 virtual ~PISMDefaultYieldStress() {} 00080 00081 virtual PetscErrorCode init(PISMVars &vars); 00082 00083 virtual void add_vars_to_output(string keyword, set<string> &result); 00084 00085 virtual void get_diagnostics(map<string, PISMDiagnostic*> &dict); 00086 00087 virtual PetscErrorCode define_variables(set<string> vars, const NCTool &nc, 00088 nc_type nctype); 00089 00090 virtual PetscErrorCode write_variables(set<string> vars, string filename); 00091 00092 virtual PetscErrorCode update(PetscReal t_years, PetscReal dt_years); 00093 00094 virtual PetscErrorCode basal_material_yield_stress(IceModelVec2S &result); 00095 protected: 00096 PetscReal sliding_scale; 00097 IceModelVec2S till_phi; 00098 IceModelVec2S *basal_water_thickness, *basal_melt_rate, *ice_thickness, 00099 *bed_topography; 00100 IceModelVec2Int *mask; 00101 BWPparams p; 00102 PISMVars *variables; 00103 00104 virtual PetscErrorCode allocate(); 00105 virtual PetscErrorCode topg_to_phi(); 00106 virtual PetscErrorCode regrid(); 00107 virtual PetscScalar basal_water_pressure(PetscScalar thk, PetscScalar bwat, 00108 PetscScalar bmr, PetscScalar frac, 00109 PetscScalar hmelt_max); 00110 }; 00111 00112 class PISMConstantYieldStress : public PISMYieldStress 00113 { 00114 public: 00115 PISMConstantYieldStress(IceGrid &g, const NCConfigVariable &conf) 00116 : PISMYieldStress(g, conf) 00117 { 00118 if (allocate() != 0) { 00119 PetscPrintf(grid.com, "PISM ERROR: memory allocation failed in PISMConstantYieldStress constructor.\n"); 00120 PISMEnd(); 00121 } 00122 } 00123 virtual ~PISMConstantYieldStress() {} 00124 00125 virtual PetscErrorCode init(PISMVars &vars); 00126 00127 virtual void add_vars_to_output(string keyword, set<string> &result); 00128 00129 virtual PetscErrorCode define_variables(set<string> vars, const NCTool &nc, 00130 nc_type nctype); 00131 00132 virtual PetscErrorCode write_variables(set<string> vars, string filename); 00133 00134 virtual PetscErrorCode update(PetscReal t_years, PetscReal dt_years); 00135 00136 virtual PetscErrorCode basal_material_yield_stress(IceModelVec2S &result); 00137 protected: 00138 IceModelVec2S tauc; 00139 virtual PetscErrorCode allocate(); 00140 virtual PetscErrorCode regrid(); 00141 }; 00142 00144 class PYS_bwp : public PISMDiag<PISMDefaultYieldStress> 00145 { 00146 public: 00147 PYS_bwp(PISMDefaultYieldStress *m, IceGrid &g, PISMVars &my_vars); 00148 virtual PetscErrorCode compute(IceModelVec* &result); 00149 }; 00150 00151 #endif /* _PISMYIELDSTRESS_H_ */
1.7.3