|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
00001 // Copyright (C) 2010, 2011 Constantine Khroulev and Ed Bueler 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 _SHALLOWSTRESSBALANCE_H_ 00020 #define _SHALLOWSTRESSBALANCE_H_ 00021 00022 #include "PISMComponent.hh" 00023 #include "iceModelVec.hh" 00024 #include "PISMVars.hh" 00025 #include "flowlaws.hh" 00026 #include "basal_resistance.hh" 00027 #include "enthalpyConverter.hh" 00028 00030 class ShallowStressBalance : public PISMComponent_Diag 00031 { 00032 public: 00033 ShallowStressBalance(IceGrid &g, IceBasalResistancePlasticLaw &b, 00034 IceFlowLaw &i, EnthalpyConverter &e, 00035 const NCConfigVariable &conf) 00036 : PISMComponent_Diag(g, conf), basal(b), ice(i), EC(e) 00037 { 00038 vel_bc = NULL; bc_locations = NULL; variables = NULL; 00039 max_u = max_v = 0.0; 00040 sea_level = 0; 00041 allocate(); 00042 } 00043 00044 virtual ~ShallowStressBalance() {} 00045 00046 // initialization and I/O: 00047 00048 virtual PetscErrorCode init(PISMVars &vars) 00049 { variables = &vars; return 0; } 00050 00051 virtual PetscErrorCode set_boundary_conditions(IceModelVec2Int &locations, 00052 IceModelVec2V &velocities) 00053 { 00054 vel_bc = &velocities; 00055 bc_locations = &locations; 00056 return 0; 00057 } 00058 00061 void set_sea_level_elevation(PetscReal new_sea_level) 00062 { sea_level = new_sea_level; } 00063 00064 // interface to the data provided by the stress balance object: 00065 00067 virtual PetscErrorCode get_advective_2d_velocity(IceModelVec2V* &result) 00068 { result = &velocity; return 0; } 00069 00071 virtual PetscErrorCode get_max_2d_velocity(PetscReal &u_max, PetscReal &v_max) 00072 { u_max = max_u; v_max = max_v; return 0; } 00073 00075 virtual PetscErrorCode get_basal_frictional_heating(IceModelVec2S* &result) 00076 { result = &basal_frictional_heating; return 0; } 00077 00078 virtual PetscErrorCode get_D2(IceModelVec2S* &result) 00079 { result = &D2; return 0; } 00080 00081 virtual PetscErrorCode compute_principal_strain_rates( 00082 IceModelVec2S &/*result_e1*/, IceModelVec2S &/*result_e2*/) 00083 { SETERRQ(1,"not implemented in base class"); return 0; } 00084 00085 // helpers: 00086 00088 virtual PetscErrorCode extend_the_grid(PetscInt /*old_Mz*/) 00089 { return 0; } 00091 virtual PetscErrorCode stdout_report(string &result) 00092 { result = ""; return 0; } 00093 00094 protected: 00095 virtual PetscErrorCode allocate(); 00096 00097 PetscReal sea_level; 00098 PISMVars *variables; 00099 IceBasalResistancePlasticLaw &basal; 00100 IceFlowLaw &ice; 00101 EnthalpyConverter &EC; 00102 00103 IceModelVec2V velocity, *vel_bc; 00104 IceModelVec2Int *bc_locations; 00105 IceModelVec2S basal_frictional_heating, D2; 00106 PetscReal max_u, max_v; 00107 }; 00108 00109 00111 00116 class SSB_Trivial : public ShallowStressBalance 00117 { 00118 public: 00119 SSB_Trivial(IceGrid &g, IceBasalResistancePlasticLaw &b, 00120 IceFlowLaw &i, EnthalpyConverter &e, 00121 const NCConfigVariable &conf) 00122 : ShallowStressBalance(g, b, i, e, conf) {} 00123 virtual ~SSB_Trivial() {} 00124 virtual PetscErrorCode update(bool fast); 00125 }; 00126 00127 #endif /* _SHALLOWSTRESSBALANCE_H_ */ 00128
1.7.3