|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
00001 // Copyright (C) 2004-2011 Jed Brown, Ed Bueler and 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 static char help[] = 00020 "Ice sheet driver for EISMINT II, MISMIP, and other constant climate, simplified geometry\n" 00021 "intercomparison simulations.\n"; 00022 00023 #include <cstring> 00024 #include <petsc.h> 00025 #include "grid.hh" 00026 #include "iceModel.hh" 00027 #include "eismint/iceEISModel.hh" 00028 #include "eismint/icePSTexModel.hh" 00029 #include "ismip/iceMISMIPModel.hh" 00030 00031 #include "coupler/PISMSurface.hh" 00032 #include "coupler/PISMOcean.hh" 00033 00034 int main(int argc, char *argv[]) { 00035 PetscErrorCode ierr; 00036 00037 MPI_Comm com; 00038 PetscMPIInt rank, size; 00039 00040 ierr = PetscInitialize(&argc, &argv, PETSC_NULL, help); CHKERRQ(ierr); 00041 00042 com = PETSC_COMM_WORLD; 00043 ierr = MPI_Comm_rank(com, &rank); CHKERRQ(ierr); 00044 ierr = MPI_Comm_size(com, &size); CHKERRQ(ierr); 00045 00046 /* This explicit scoping forces destructors to be called before PetscFinalize() */ 00047 { 00048 ierr = verbosityLevelFromOptions(); CHKERRQ(ierr); 00049 00050 ierr = verbPrintf(2,com, "PISMS %s (simplified geometry mode)\n", 00051 PISM_Revision); CHKERRQ(ierr); 00052 ierr = stop_on_version_option(); CHKERRQ(ierr); 00053 00054 vector<string> required; 00055 required.clear(); // no actually required options; "-eisII A" is default 00056 ierr = show_usage_check_req_opts(com, "pisms", required, 00057 " pisms [-eisII x|-pst -xxx|-mismip N] [OTHER PISM & PETSc OPTIONS]\n" 00058 "where major option chooses type of simplified experiment:\n" 00059 " -eisII x choose EISMINT II experiment (x = A|B|C|D|E|F|G|H|I|J|K|L)\n" 00060 " -mismip Nx choose MISMIP experiment (Nx = 1a|1b|2a|2b|3a|3b)\n" 00061 " -pst -xxx choose plastic till ice stream experiment; see Bueler & Brown (2009);\n" 00062 " (-xxx = -P0A|-P0I|-P1|-P2|-P3|-P4)\n" 00063 "notes:\n" 00064 " -pdd not allowed (because PISMConstAtmosCoupler is always used)\n" 00065 ); CHKERRQ(ierr); 00066 00067 NCConfigVariable config, overrides; 00068 ierr = init_config(com, rank, config, overrides); CHKERRQ(ierr); 00069 00070 bool EISIIchosen, PSTexchosen, MISMIPchosen; 00071 /* This option determines the single character name of EISMINT II experiments: 00072 "-eisII F", for example. */ 00073 ierr = PISMOptionsIsSet("-eisII", EISIIchosen); CHKERRQ(ierr); 00074 /* This option chooses Plastic till ice Stream with Thermocoupling experiment. */ 00075 ierr = PISMOptionsIsSet("-pst", PSTexchosen); CHKERRQ(ierr); 00076 /* This option chooses MISMIP; "-mismip N" is experiment N in MISMIP; N=1,2,3 */ 00077 ierr = PISMOptionsIsSet("-mismip", MISMIPchosen); CHKERRQ(ierr); 00078 00079 int choiceSum = (int) EISIIchosen + (int) PSTexchosen + (int) MISMIPchosen; 00080 if (choiceSum > 1) { 00081 ierr = PetscPrintf(com, 00082 "PISM ERROR: pisms called with more than one simplified geometry experiment chosen\n"); 00083 CHKERRQ(ierr); 00084 PISMEnd(); 00085 } 00086 00087 // actually construct the IceModel 00088 IceGrid g(com, rank, size, config); 00089 00090 // Initialize boundary models (climate will always come from 00091 // intercomparison formulas): 00092 PISMSurfaceModel *surface = new PSDummy(g, config); 00093 PISMOceanModel *ocean = new POConstant(g, config); 00094 00095 IceModel *m; 00096 if (PSTexchosen == PETSC_TRUE) { 00097 m = new IcePSTexModel(g, config, overrides); 00098 } else if (MISMIPchosen == PETSC_TRUE) { 00099 m = new IceMISMIPModel(g, config, overrides); 00100 } else { 00101 m = new IceEISModel(g, config, overrides); 00102 } 00103 00104 m->attach_surface_model(surface); 00105 m->attach_ocean_model(ocean); 00106 ierr = m->setExecName("pisms"); CHKERRQ(ierr); 00107 00108 ierr = m->init(); CHKERRQ(ierr); 00109 00110 ierr = m->run(); CHKERRQ(ierr); 00111 00112 ierr = verbPrintf(2,com, "... done with run \n"); CHKERRQ(ierr); 00113 ierr = m->writeFiles("simp_exper.nc"); CHKERRQ(ierr); 00114 00115 if (MISMIPchosen == PETSC_TRUE) { 00116 IceMISMIPModel* mMISMIP = dynamic_cast<IceMISMIPModel*>(m); 00117 if (!mMISMIP) { SETERRQ(4, "PISMS: mismip write files ... how did I get here?"); } 00118 ierr = mMISMIP->writeMISMIPFinalFiles(); CHKERRQ(ierr); 00119 } 00120 00121 delete m; 00122 } 00123 00124 ierr = PetscFinalize(); CHKERRQ(ierr); 00125 return 0; 00126 } 00127
1.7.3