|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
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 "SIAFD.hh" 00020 00021 void SIAFD::get_diagnostics(map<string, PISMDiagnostic*> &dict) { 00022 dict["diffusivity"] = new SIAFD_diffusivity(this, grid, *variables); 00023 dict["schoofs_theta"] = new SIAFD_schoofs_theta(this, grid, *variables); 00024 dict["thksmooth"] = new SIAFD_thksmooth(this, grid, *variables); 00025 dict["topgsmooth"] = new SIAFD_topgsmooth(this, grid, *variables); 00026 } 00027 00028 SIAFD_schoofs_theta::SIAFD_schoofs_theta(SIAFD *m, IceGrid &g, PISMVars &my_vars) 00029 : PISMDiag<SIAFD>(m, g, my_vars) { 00030 00031 // set metadata: 00032 vars[0].init_2d("schoofs_theta", grid); 00033 00034 set_attrs("multiplier 'theta' in Schoof's (2003) theory of bed roughness in SIA", "", 00035 "1", "", 0); 00036 vars[0].set("valid_min", 0); 00037 vars[0].set("valid_max", 1); 00038 } 00039 00040 PetscErrorCode SIAFD_schoofs_theta::compute(IceModelVec* &output) { 00041 PetscErrorCode ierr; 00042 IceModelVec2S *result, *surface; 00043 PetscInt WIDE_STENCIL = grid.max_stencil_width; 00044 00045 result = new IceModelVec2S; 00046 ierr = result->create(grid, "schoofs_theta", true, WIDE_STENCIL); CHKERRQ(ierr); 00047 ierr = result->set_metadata(vars[0], 0); CHKERRQ(ierr); 00048 00049 surface = dynamic_cast<IceModelVec2S*>(variables.get("surface_altitude")); 00050 if (surface == NULL) SETERRQ(1, "surface_altitude is not available"); 00051 00052 ierr = model->bed_smoother->get_theta(*surface, model->config.get("Glen_exponent"), 00053 WIDE_STENCIL, result); CHKERRQ(ierr); 00054 00055 output = result; 00056 return 0; 00057 } 00058 00059 00060 SIAFD_topgsmooth::SIAFD_topgsmooth(SIAFD *m, IceGrid &g, PISMVars &my_vars) 00061 : PISMDiag<SIAFD>(m, g, my_vars) { 00062 00063 // set metadata: 00064 vars[0].init_2d("topgsmooth", grid); 00065 set_attrs("smoothed bed elevation in Schoof's (2003) theory of bed roughness in SIA", 00066 "", "m", "m", 0); 00067 } 00068 00069 PetscErrorCode SIAFD_topgsmooth::compute(IceModelVec* &output) { 00070 PetscErrorCode ierr; 00071 IceModelVec2S *result; 00072 PetscInt WIDE_STENCIL = grid.max_stencil_width; 00073 00074 result = new IceModelVec2S; 00075 ierr = result->create(grid, "topgsmooth", true, WIDE_STENCIL); CHKERRQ(ierr); 00076 ierr = result->set_metadata(vars[0], 0); CHKERRQ(ierr); 00077 00078 ierr = result->copy_from(model->bed_smoother->topgsmooth); CHKERRQ(ierr); 00079 00080 output = result; 00081 return 0; 00082 } 00083 00084 SIAFD_thksmooth::SIAFD_thksmooth(SIAFD *m, IceGrid &g, PISMVars &my_vars) 00085 : PISMDiag<SIAFD>(m, g, my_vars) { 00086 00087 // set metadata: 00088 vars[0].init_2d("thksmooth", grid); 00089 set_attrs("thickness relative to smoothed bed elevation in Schoof's (2003) theory of bed roughness in SIA", 00090 "", "m", "m", 0); 00091 } 00092 00093 PetscErrorCode SIAFD_thksmooth::compute(IceModelVec* &output) { 00094 PetscErrorCode ierr; 00095 PetscInt WIDE_STENCIL = grid.max_stencil_width; 00096 IceModelVec2S *result, *surface, *thickness; 00097 IceModelVec2Int *mask; 00098 00099 result = new IceModelVec2S; 00100 ierr = result->create(grid, "thksmooth", true, WIDE_STENCIL); CHKERRQ(ierr); 00101 ierr = result->set_metadata(vars[0], 0); CHKERRQ(ierr); 00102 00103 surface = dynamic_cast<IceModelVec2S*>(variables.get("surface_altitude")); 00104 if (surface == NULL) SETERRQ(1, "surface_altitude is not available"); 00105 00106 thickness = dynamic_cast<IceModelVec2S*>(variables.get("land_ice_thickness")); 00107 if (thickness == NULL) SETERRQ(1, "land_ice_thickness is not available"); 00108 00109 mask = dynamic_cast<IceModelVec2Int*>(variables.get("mask")); 00110 if (mask == NULL) SETERRQ(1, "mask is not available"); 00111 00112 ierr = model->bed_smoother->get_smoothed_thk(*surface, *thickness, *mask, WIDE_STENCIL, 00113 result); CHKERRQ(ierr); 00114 00115 output = result; 00116 return 0; 00117 } 00118 00119 00120 00121 SIAFD_diffusivity::SIAFD_diffusivity(SIAFD *m, IceGrid &g, PISMVars &my_vars) 00122 : PISMDiag<SIAFD>(m, g, my_vars) { 00123 00124 // set metadata: 00125 vars[0].init_2d("diffusivity", grid); 00126 00127 set_attrs("diffusivity of SIA mass continuity equation", "", 00128 "m2 s-1", "m2 s-1", 0); 00129 } 00130 00131 PetscErrorCode SIAFD_diffusivity::compute(IceModelVec* &output) { 00132 PetscErrorCode ierr; 00133 IceModelVec2S *result; 00134 00135 result = new IceModelVec2S; 00136 ierr = result->create(grid, "diffusivity", false); CHKERRQ(ierr); 00137 ierr = result->set_metadata(vars[0], 0); CHKERRQ(ierr); 00138 00139 ierr = model->compute_diffusivity(*result); CHKERRQ(ierr); 00140 00141 output = result; 00142 return 0; 00143 }
1.7.3