PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/base/iMbeddef.cc

Go to the documentation of this file.
00001 // Copyright (C) 2004-2011 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 #include "iceModel.hh"
00020 
00021 PetscErrorCode IceModel::allocate_bed_deformation() {
00022   PetscErrorCode ierr;
00023   string model = config.get_string("bed_deformation_model");
00024   set<string> choices;
00025 
00026   ierr = check_old_option_and_stop(grid.com, "-bed_def_iso", "-bed_def"); CHKERRQ(ierr);
00027   ierr = check_old_option_and_stop(grid.com, "-bed_def_lc",  "-bed_def"); CHKERRQ(ierr);
00028   
00029   choices.insert("none");
00030   choices.insert("iso");
00031 #if (PISM_HAVE_FFTW==1)
00032   choices.insert("lc");
00033 #endif
00034 
00035   ierr = PetscOptionsBegin(grid.com, "", "Bed deformation model", ""); CHKERRQ(ierr);
00036   {
00037     bool dummy;
00038     ierr = PISMOptionsList(grid.com, "-bed_def", "Specifies a bed deformation model.",
00039                          choices, model, model, dummy); CHKERRQ(ierr);
00040 
00041   }
00042   ierr = PetscOptionsEnd(); CHKERRQ(ierr);
00043 
00044   if (model == "none")
00045     return 0;
00046 
00047   if ((model == "iso") && (beddef == NULL)) {
00048     beddef = new PBPointwiseIsostasy(grid, config);
00049     return 0;
00050   }
00051 
00052 #if (PISM_HAVE_FFTW==1)
00053   if ((model == "lc") && (beddef == NULL)) {
00054     beddef = new PBLingleClark(grid, config);
00055     return 0;
00056   }
00057 #endif
00058 
00059   return 0;
00060 }
00061 
00062 PetscErrorCode IceModel::bed_def_step(bool &bed_changed) {
00063   PetscErrorCode  ierr;
00064 
00065   if (beddef == NULL) SETERRQ(1, "beddef == NULL");
00066 
00067   double bedDefIntervalYears = config.get("bed_def_interval_years");
00068 
00069   // This is a front end to the bed deformation update system.  It updates
00070   // no more often than bedDefIntervalYears.
00071 
00072   // If the bed elevations are not expired, exit cleanly.
00073   const PetscScalar dtBedDefYears = grid.year - last_bed_def_update;
00074   if (dtBedDefYears >= bedDefIntervalYears) {
00075 
00076     ierr = beddef->update(grid.year, dt); CHKERRQ(ierr);
00077 
00078     ierr = updateSurfaceElevationAndMask(); CHKERRQ(ierr);
00079 
00080     last_bed_def_update = grid.year;
00081     // Mark bed topography as "modified":
00082     vbed.inc_state_counter();
00083     // SIAFD::update() uses this to decide if we need to re-compute the
00084     // smoothed bed.
00085     bed_changed = true;
00086   } else
00087     bed_changed = false;
00088 
00089   return 0;
00090 }
00091 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines