// Copyright (C) 2010, 2011, 2012, 2013, 2014 Ed Bueler // // This file is part of PISM. // // PISM is free software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // PISM is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License // along with PISM; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA static char help[] = "\nBEDROUGH_TEST\n" " Simple testing program for Schoof (2003)-type bed smoothing and roughness-\n" " parameterization schemes. Allows comparison of computed theta to result\n" " from Matlab/Octave code exampletheta.m in src/base/bedroughplay. Also\n" " used in PISM software (regression) test.\n\n"; #include "PISMConfig.hh" #include #include #include "pism_options.hh" #include "IceGrid.hh" #include "iceModelVec.hh" #include "PISMBedSmoother.hh" int main(int argc, char *argv[]) { PetscErrorCode ierr; ierr = PetscInitialize(&argc, &argv, PETSC_NULL, help); CHKERRQ(ierr); MPI_Comm com = PETSC_COMM_WORLD; /* This explicit scoping forces destructors to be called before PetscFinalize() */ { PISMUnitSystem unit_system(NULL); PISMConfig config(com, "pism_config", unit_system), overrides(com, "pism_overrides", unit_system); ierr = init_config(com, config, overrides); CHKERRQ(ierr); IceGrid grid(com, config); grid.Mx = 81; grid.My = 81; grid.Lx = 1200e3; grid.Ly = grid.Lx; grid.compute_nprocs(); grid.compute_ownership_ranges(); ierr = grid.compute_horizontal_spacing(); CHKERRQ(ierr); ierr = grid.allocate(); CHKERRQ(ierr); PetscPrintf(grid.com,"PISMBedSmoother TEST\n"); bool show; ierr = PISMOptionsIsSet("-show", show); CHKERRQ(ierr); IceModelVec2S topg, usurf, theta; ierr = topg.create(grid, "topg", WITH_GHOSTS, 1); CHKERRQ(ierr); ierr = topg.set_attrs( "trybedrough_tool", "original topography", "m", "bedrock_altitude"); CHKERRQ(ierr); ierr = usurf.create(grid, "usurf", WITH_GHOSTS, 1); CHKERRQ(ierr); ierr = usurf.set_attrs( "trybedrough_tool", "ice surface elevation", "m", "surface_altitude"); CHKERRQ(ierr); ierr = theta.create(grid, "theta", WITH_GHOSTS, 1); CHKERRQ(ierr); ierr = theta.set_attrs( "trybedrough_tool", "coefficient theta in Schoof (2003) bed roughness parameterization", "", ""); CHKERRQ(ierr); // put in bed elevations, a la this Matlab: // topg0 = 400 * sin(2 * pi * xx / 600e3) + ... // 100 * sin(2 * pi * (xx + 1.5 * yy) / 40e3); ierr = topg.begin_access(); CHKERRQ(ierr); for (int i=grid.xs; i