|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
00001 // Copyright (C) 2008-2011 Ed Bueler, Constantine Khroulev, Ricarda Winkelmann, 00002 // Gudfinna Adalgeirsdottir and Andy Aschwanden 00003 // 00004 // This file is part of PISM. 00005 // 00006 // PISM is free software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the Free Software 00008 // Foundation; either version 2 of the License, or (at your option) any later 00009 // version. 00010 // 00011 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY 00012 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00014 // details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with PISM; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 00020 #ifndef __PISMOceanModel_hh 00021 #define __PISMOceanModel_hh 00022 00023 #include "PISMComponent.hh" 00024 #include "iceModelVec.hh" 00025 #include "Timeseries.hh" 00026 00028 class PISMOceanModel : public PISMComponent_TS { 00029 public: 00030 PISMOceanModel(IceGrid &g, const NCConfigVariable &conf) 00031 : PISMComponent_TS(g, conf) 00032 { 00033 sea_level = 0; 00034 } 00035 virtual ~PISMOceanModel() {}; 00036 virtual PetscErrorCode sea_level_elevation(PetscReal &result) = 0; 00037 virtual PetscErrorCode shelf_base_temperature(IceModelVec2S &result) = 0; 00038 virtual PetscErrorCode shelf_base_mass_flux(IceModelVec2S &result) = 0; 00039 protected: 00040 PetscReal sea_level; 00041 }; 00042 00046 class POConstant : public PISMOceanModel { 00047 public: 00048 POConstant(IceGrid &g, const NCConfigVariable &conf); 00049 virtual ~POConstant() {} 00050 virtual PetscErrorCode init(PISMVars &vars); 00051 00052 virtual PetscErrorCode update(PetscReal t_years, PetscReal dt_years) 00053 { t = t_years; dt = dt_years; return 0; } // do nothing 00054 00055 virtual PetscErrorCode sea_level_elevation(PetscReal &result); 00056 virtual PetscErrorCode shelf_base_temperature(IceModelVec2S &result); 00057 virtual PetscErrorCode shelf_base_mass_flux(IceModelVec2S &result); 00058 00059 virtual void add_vars_to_output(string keyword, set<string> &result); 00060 virtual PetscErrorCode define_variables(set<string> vars, const NCTool &nc, 00061 nc_type nctype); 00062 virtual PetscErrorCode write_variables(set<string> vars, string filename); 00063 protected: 00064 IceModelVec2S *ice_thickness; // is not owned by this class 00065 NCSpatialVariable shelfbmassflux, shelfbtemp; 00066 }; 00067 00069 00072 class POConstantPIK : public PISMOceanModel { 00073 public: 00074 POConstantPIK(IceGrid &g, const NCConfigVariable &conf); 00075 virtual ~POConstantPIK() {} 00076 virtual PetscErrorCode init(PISMVars &vars); 00077 virtual PetscErrorCode update(PetscReal t_years, PetscReal dt_years) 00078 { t = t_years; dt = dt_years; return 0; } // do nothing 00079 virtual PetscErrorCode sea_level_elevation(PetscReal &result); 00080 virtual PetscErrorCode shelf_base_temperature(IceModelVec2S &result); 00081 virtual PetscErrorCode shelf_base_mass_flux(IceModelVec2S &result); 00082 00083 virtual void add_vars_to_output(string keyword, set<string> &result); 00084 virtual PetscErrorCode define_variables(set<string> vars, const NCTool &nc, 00085 nc_type nctype); 00086 virtual PetscErrorCode write_variables(set<string> vars, string filename); 00087 protected: 00088 IceModelVec2S *ice_thickness; // is not owned by this class 00089 NCSpatialVariable shelfbmassflux, shelfbtemp; 00090 }; 00091 00092 class POModifier : public Modifier<PISMOceanModel> 00093 { 00094 public: 00095 POModifier(IceGrid &g, const NCConfigVariable &conf, PISMOceanModel* in) 00096 : Modifier<PISMOceanModel>(g, conf, in) {} 00097 virtual ~POModifier() {} 00098 00099 virtual PetscErrorCode sea_level_elevation(PetscReal &result) 00100 { 00101 PetscErrorCode ierr = input_model->sea_level_elevation(result); CHKERRQ(ierr); 00102 return 0; 00103 } 00104 00105 virtual PetscErrorCode shelf_base_temperature(IceModelVec2S &result) 00106 { 00107 PetscErrorCode ierr = input_model->shelf_base_temperature(result); CHKERRQ(ierr); 00108 return 0; 00109 } 00110 00111 virtual PetscErrorCode shelf_base_mass_flux(IceModelVec2S &result) 00112 { 00113 PetscErrorCode ierr = input_model->shelf_base_mass_flux(result); CHKERRQ(ierr); 00114 return 0; 00115 } 00116 00117 }; 00118 00119 00120 #endif // __PISMOceanModel_hh
1.7.3