PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/base/stressbalance/SSA_diagnostics.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 "SSA.hh"
00020 
00021 void SSA::get_diagnostics(map<string, PISMDiagnostic*> &dict) {
00022   dict["taud"] = new SSA_taud(this, grid, *variables);
00023 }
00024 
00025 SSA_taud::SSA_taud(SSA *m, IceGrid &g, PISMVars &my_vars)
00026   : PISMDiag<SSA>(m, g, my_vars) {
00027   
00028   dof = 2;
00029   vars.resize(dof);
00030   // set metadata:
00031   vars[0].init_2d("taud_x", grid);
00032   vars[1].init_2d("taud_y", grid);
00033   
00034   set_attrs("X-component of the driving shear stress at the base of ice", "",
00035             "Pa", "Pa", 0);
00036   set_attrs("Y-component of the driving shear stress at the base of ice", "",
00037             "Pa", "Pa", 1);
00038 }
00039 
00040 PetscErrorCode SSA_taud::compute(IceModelVec* &output) {
00041   PetscErrorCode ierr;
00042 
00043   IceModelVec2V *taud = new IceModelVec2V;
00044   ierr = taud->create(grid, "taud", false); CHKERRQ(ierr);
00045   ierr = taud->set_metadata(vars[0], 0); CHKERRQ(ierr); 
00046   ierr = taud->set_metadata(vars[1], 1); CHKERRQ(ierr); 
00047 
00048   ierr = taud->copy_from(model->taud); CHKERRQ(ierr);
00049 
00050   output = taud;
00051   return 0;
00052 }
00053 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines