|
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 // Implementation of the constant-in-time ocean model. 00021 00022 #include "PISMOcean.hh" 00023 00024 POConstant::POConstant(IceGrid &g, const NCConfigVariable &conf) 00025 : PISMOceanModel(g, conf) { 00026 00027 shelfbmassflux.init_2d("shelfbmassflux", g); 00028 shelfbmassflux.set_string("pism_intent", "climate_state"); 00029 shelfbmassflux.set_string("long_name", 00030 "ice mass flux from ice shelf base (positive flux is loss from ice shelf)"); 00031 shelfbmassflux.set_units("m s-1"); 00032 shelfbmassflux.set_glaciological_units("m year-1"); 00033 00034 shelfbtemp.init_2d("shelfbtemp", g); 00035 shelfbtemp.set_string("pism_intent", "climate_state"); 00036 shelfbtemp.set_string("long_name", 00037 "absolute temperature at ice shelf base"); 00038 shelfbtemp.set_units("Kelvin"); 00039 } 00040 00041 PetscErrorCode POConstant::init(PISMVars &vars) { 00042 PetscErrorCode ierr; 00043 00044 if (!config.get_flag("is_dry_simulation")) { 00045 ierr = verbPrintf(2, grid.com, "* Initializing the constant ocean model...\n"); CHKERRQ(ierr); 00046 } 00047 00048 ice_thickness = dynamic_cast<IceModelVec2S*>(vars.get("land_ice_thickness")); 00049 if (!ice_thickness) { SETERRQ(1, "ERROR: ice thickness is not available"); } 00050 00051 return 0; 00052 } 00053 00054 PetscErrorCode POConstant::sea_level_elevation(PetscReal &result) { 00055 result = sea_level; 00056 return 0; 00057 } 00058 00059 PetscErrorCode POConstant::shelf_base_temperature(IceModelVec2S &result) { 00060 PetscErrorCode ierr; 00061 00062 const PetscScalar T0 = config.get("water_melting_point_temperature"), // K 00063 beta_CC_grad = config.get("beta_CC") * config.get("ice_density") * config.get("standard_gravity"), // K m-1 00064 ice_rho = config.get("ice_density"), 00065 sea_water_rho = config.get("sea_water_density"); 00066 00067 PetscScalar **H; 00068 ierr = ice_thickness->get_array(H); CHKERRQ(ierr); 00069 ierr = result.begin_access(); CHKERRQ(ierr); 00070 for (PetscInt i=grid.xs; i<grid.xs+grid.xm; ++i) { 00071 for (PetscInt j=grid.ys; j<grid.ys+grid.ym; ++j) { 00072 const PetscScalar shelfbaseelev = - ( ice_rho / sea_water_rho ) * H[i][j]; // FIXME task #7297 00073 // temp is set to melting point at depth 00074 result(i,j) = T0 + beta_CC_grad * shelfbaseelev; // base elev negative here so is below T0 00075 } 00076 } 00077 ierr = ice_thickness->end_access(); CHKERRQ(ierr); 00078 ierr = result.end_access(); CHKERRQ(ierr); 00079 00080 return 0; 00081 } 00082 00084 PetscErrorCode POConstant::shelf_base_mass_flux(IceModelVec2S &result) { 00085 PetscErrorCode ierr; 00086 PetscReal L = config.get("water_latent_heat_fusion"), 00087 rho = config.get("ice_density"), 00088 // following has units: J m-2 s-1 / (J kg-1 * kg m-3) = m s-1 00089 meltrate = config.get("ocean_sub_shelf_heat_flux_into_ice") / (L * rho); // m s-1 00090 00091 ierr = result.set(meltrate); CHKERRQ(ierr); 00092 00093 return 0; 00094 } 00095 00096 void POConstant::add_vars_to_output(string keyword, set<string> &result) { 00097 if (keyword != "small") { 00098 result.insert("shelfbtemp"); 00099 result.insert("shelfbmassflux"); 00100 } 00101 } 00102 00103 PetscErrorCode POConstant::define_variables(set<string> vars, const NCTool &nc, 00104 nc_type nctype) { 00105 PetscErrorCode ierr; 00106 int varid; 00107 00108 if (set_contains(vars, "shelfbtemp")) { 00109 ierr = shelfbtemp.define(nc, varid, nctype, true); CHKERRQ(ierr); 00110 } 00111 00112 if (set_contains(vars, "shelfbmassflux")) { 00113 ierr = shelfbmassflux.define(nc, varid, nctype, true); CHKERRQ(ierr); 00114 } 00115 00116 return 0; 00117 } 00118 00119 PetscErrorCode POConstant::write_variables(set<string> vars, string filename) { 00120 PetscErrorCode ierr; 00121 IceModelVec2S tmp; 00122 00123 if (set_contains(vars, "shelfbtemp")) { 00124 if (!tmp.was_created()) { 00125 ierr = tmp.create(grid, "tmp", false); CHKERRQ(ierr); 00126 } 00127 00128 ierr = tmp.set_metadata(shelfbtemp, 0); CHKERRQ(ierr); 00129 ierr = shelf_base_temperature(tmp); CHKERRQ(ierr); 00130 ierr = tmp.write(filename.c_str()); CHKERRQ(ierr); 00131 } 00132 00133 if (set_contains(vars, "shelfbmassflux")) { 00134 if (!tmp.was_created()) { 00135 ierr = tmp.create(grid, "tmp", false); CHKERRQ(ierr); 00136 } 00137 00138 ierr = tmp.set_metadata(shelfbmassflux, 0); CHKERRQ(ierr); 00139 ierr = shelf_base_mass_flux(tmp); CHKERRQ(ierr); 00140 ierr = tmp.write(filename.c_str()); CHKERRQ(ierr); 00141 } 00142 00143 return 0; 00144 }
1.7.3