|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
00001 // Copyright (C) 2004-2007, 2010, 2011 Jed Brown and Ed Bueler 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 <petsc.h> 00020 #include "pism_const.hh" 00021 #include "flowlaws.hh" 00022 #include "NCVariable.hh" 00023 00024 static char help[] = 00025 "Show a table of flow results from the Goldsby-Kohlstedt law (HYBRIDICE),\n" 00026 " compared to results from Paterson-Budd (THERMOGLENICE).\n"; 00027 00028 int main(int argc, char *argv[]) { 00029 PetscErrorCode ierr; 00030 00031 MPI_Comm com; 00032 PetscMPIInt rank, size; 00033 00034 ierr = PetscInitialize(&argc, &argv, PETSC_NULL, help); CHKERRQ(ierr); 00035 00036 com = PETSC_COMM_WORLD; 00037 ierr = MPI_Comm_rank(com, &rank); CHKERRQ(ierr); 00038 ierr = MPI_Comm_size(com, &size); CHKERRQ(ierr); 00039 00040 /* This explicit scoping forces destructors to be called before PetscFinalize() */ 00041 { 00042 NCConfigVariable config, overrides; 00043 ierr = init_config(com, rank, config, overrides); CHKERRQ(ierr); 00044 00045 double T0=273.15, dT=10, p=2e7; 00046 double sigma[] = {1e4, 5e4, 1e5, 1.5e5}; 00047 // Ice constructors need a communicator and a prefix, since this is a serial code, the communicator should not be used 00048 // anyway so we should be okay just passing 0 for the communicator (note that the ABI for MPI_Comm is not defined, it 00049 // is typedef'd to int in MPICH and to an opaque pointer in OpenMPI, the constant 0 is implicitly cast to a pointer if 00050 // need be. 00051 ThermoGlenIce tglen(0,NULL,config); 00052 HybridIce hyb(0,NULL,config); 00053 GKparts pt; 00054 00055 printf("flowtable: [pressure = %10.2e in whole table]\n",p); 00056 printf(" (stress) (temp) = (flow)\n"); 00057 printf("THERMOGLENICE:\n"); 00058 for (int i=0; i<4; ++i) { 00059 for (int j=0; j<5; ++j) { 00060 double T = T0 - j*dT; 00061 printf("%10.2e %10.3f = %10.2e\n", sigma[i], T, tglen.flow_from_temp(sigma[i], T, p, 0)); 00062 } 00063 } 00064 00065 printf("HYBRIDICE: [after (flow) are four parts: (diff, basal, gbs, disl)]\n"); 00066 for (int i=0; i<4; ++i) { 00067 for (int j=0; j<5; ++j) { 00068 double T = T0 - j*dT; 00069 pt=hyb.flowParts(sigma[i], T, p); 00070 printf("%10.2e %10.3f = %10.2e = (%8.2e, %8.2e, %8.2e, %8.2e)\n", 00071 sigma[i], T, pt.eps_total,pt.eps_diff,pt.eps_basal,pt.eps_gbs,pt.eps_disl); 00072 } 00073 } 00074 00075 } // end explicit scope 00076 00077 ierr = PetscFinalize(); CHKERRQ(ierr); 00078 return 0; 00079 }
1.7.3