PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/earth/PBPointwiseIsostasy.cc

Go to the documentation of this file.
00001 // Copyright (C) 2010, 2011 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 "PISMBedDef.hh"
00020 
00021 PBPointwiseIsostasy::PBPointwiseIsostasy(IceGrid &g, const NCConfigVariable &conf)
00022   : PISMBedDef(g, conf) {
00023   PetscErrorCode ierr;
00024 
00025   ierr = allocate();
00026   if (ierr != 0) {
00027     PetscPrintf(grid.com, "PBPointwiseIsostasy::PBPointwiseIsostasy(...): allocate() failed\n");
00028     PISMEnd();
00029   }
00030 
00031 }
00032 
00033 PetscErrorCode PBPointwiseIsostasy::allocate() {
00034   PetscErrorCode ierr;
00035   PetscInt WIDE_STENCIL = grid.max_stencil_width;
00036 
00037   ierr = thk_last.create(grid, "thk_last", true, WIDE_STENCIL); CHKERRQ(ierr);
00038 
00039   return 0;
00040 }
00041 
00042 PetscErrorCode PBPointwiseIsostasy::init(PISMVars &vars) {
00043   PetscErrorCode ierr;
00044 
00045   ierr = PISMBedDef::init(vars); CHKERRQ(ierr);
00046 
00047   ierr = verbPrintf(2, grid.com,
00048                     "* Initializing the pointwise isostasy bed deformation model...\n"); CHKERRQ(ierr);
00049 
00050   ierr = thk->copy_to(thk_last);   CHKERRQ(ierr);
00051   ierr = topg->copy_to(topg_last); CHKERRQ(ierr);
00052 
00053   return 0;
00054 }
00055 
00057 PetscErrorCode PBPointwiseIsostasy::update(PetscReal t_years, PetscReal dt_years) {
00058   PetscErrorCode ierr;
00059 
00060   if ((fabs(t_years - t)   < 1e-12) &&
00061       (fabs(dt_years - dt) < 1e-12))
00062     return 0;
00063 
00064   t  = t_years;
00065   dt = dt_years;
00066 
00067   // Check if it's time to update:
00068   PetscScalar dt_beddef = t_years - t_beddef_last;
00069   if (dt_beddef < config.get("bed_def_interval_years"))
00070     return 0;
00071 
00072   t_beddef_last = t_years;
00073 
00074   const PetscScalar lithosphere_density = config.get("lithosphere_density"),
00075     ice_density = config.get("ice_density"),
00076     f = ice_density / lithosphere_density;
00077 
00079 
00081   ierr = topg_last.add(-f, *thk, *topg); CHKERRQ(ierr);
00083   ierr = topg->add(f, thk_last); CHKERRQ(ierr);
00085 
00087   ierr = compute_uplift(dt_beddef); CHKERRQ(ierr);
00088 
00089   ierr =  thk->copy_to(thk_last);  CHKERRQ(ierr);
00090   ierr = topg->copy_to(topg_last); CHKERRQ(ierr);
00091 
00092   return 0;
00093 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines