PISM, A Parallel Ice Sheet Model  stable v0.5
src/base/stressbalance/siafd_test.cc
Go to the documentation of this file.
00001 // Copyright (C) 2010, 2011, 2012 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   "\nSIAFD_TEST\n"
00021   "  Testing program for SIA, time-independent calculations separate from\n"
00022   "  IceModel. Uses verification test F. Also may be used in a PISM software"
00023   "(regression) test.\n\n";
00024 
00025 #include "pism_const.hh"
00026 #include "pism_options.hh"
00027 #include "iceModelVec.hh"
00028 #include "flowlaws.hh" // IceFlowLaw
00029 #include "PIO.hh"
00030 #include "NCVariable.hh"
00031 #include "PISMStressBalance.hh"
00032 #include "SIAFD.hh"
00033 #include "exactTestsFG.h"
00034 #include "basal_resistance.hh"
00035 #include "enthalpyConverter.hh"
00036 #include "SSB_Modifier.hh"
00037 #include "ShallowStressBalance.hh"
00038 #include "PISMVars.hh"
00039 
00040 PetscErrorCode computeSigmaErrors(const NCConfigVariable &config,
00041                                   IceModelVec3 &Sigma,
00042                                   IceModelVec2S &thickness,
00043                                   IceGrid &grid,
00044                                   PetscScalar &gmaxSigmaerr,
00045                                   PetscScalar &gavSigmaerr) {
00046 
00047   PetscErrorCode ierr;
00048   PetscScalar    maxSigerr = 0.0, avSigerr = 0.0, avcount = 0.0;
00049   PetscScalar    **H;
00050   const PetscInt Mz = grid.Mz;
00051   
00052   const PetscScalar LforFG = 750000; // m
00053 
00054   const PetscScalar
00055     ice_rho   = config.get("ice_density"),
00056     ice_c     = config.get("ice_specific_heat_capacity");
00057 
00058   PetscScalar   *dummy1, *dummy2, *dummy3, *dummy4, *Sigex;
00059   PetscScalar   junk0, junk1;
00060   
00061   Sigex = new PetscScalar[Mz];
00062   dummy1 = new PetscScalar[Mz];  dummy2 = new PetscScalar[Mz];
00063   dummy3 = new PetscScalar[Mz];  dummy4 = new PetscScalar[Mz];
00064 
00065   PetscScalar *Sig;
00066 
00067   ierr = thickness.get_array(H); CHKERRQ(ierr);
00068   ierr = Sigma.begin_access(); CHKERRQ(ierr);
00069   for (PetscInt i=grid.xs; i<grid.xs+grid.xm; i++) {
00070     for (PetscInt j=grid.ys; j<grid.ys+grid.ym; j++) {
00071       PetscScalar xx = grid.x[i], yy = grid.y[j],
00072         r = sqrt(PetscSqr(xx) + PetscSqr(yy));
00073       if ((r >= 1.0) && (r <= LforFG - 1.0)) {  // only evaluate error if inside sheet 
00074                                                 // and not at central singularity
00075         bothexact(0.0,r,&grid.zlevels[0],Mz,0.0,
00076                   &junk0,&junk1,dummy1,dummy2,dummy3,Sigex,dummy4);
00077 
00078         for (PetscInt k = 0; k < Mz; k++)
00079           Sigex[k] = Sigex[k] * ice_rho * ice_c; // scale exact Sigma to J/(s m^3)
00080         const PetscInt ks = grid.kBelowHeight(H[i][j]);
00081         ierr = Sigma.getInternalColumn(i,j,&Sig); CHKERRQ(ierr);
00082         for (PetscInt k = 0; k < ks; k++) {  // only eval error if below num surface
00083           const PetscScalar Sigerr = PetscAbs(Sig[k] - Sigex[k]);
00084           maxSigerr = PetscMax(maxSigerr,Sigerr);
00085           avcount += 1.0;
00086           avSigerr += Sigerr;
00087         }
00088       }
00089     }
00090   }
00091   ierr = thickness.end_access(); CHKERRQ(ierr);
00092   ierr = Sigma.end_access(); CHKERRQ(ierr);
00093 
00094   delete [] Sigex;
00095   delete [] dummy1;  delete [] dummy2;  delete [] dummy3;  delete [] dummy4;
00096   
00097   ierr = PISMGlobalMax(&maxSigerr, &gmaxSigmaerr, grid.com); CHKERRQ(ierr);
00098   ierr = PISMGlobalSum(&avSigerr, &gavSigmaerr, grid.com); CHKERRQ(ierr);
00099   PetscScalar  gavcount;
00100   ierr = PISMGlobalSum(&avcount, &gavcount, grid.com); CHKERRQ(ierr);
00101   gavSigmaerr = gavSigmaerr/PetscMax(gavcount,1.0);  // avoid div by zero
00102   return 0;
00103 }
00104 
00105 
00106 PetscErrorCode computeSurfaceVelocityErrors(IceGrid &grid,
00107                                             IceModelVec2S &vH,
00108                                             IceModelVec3 &u3,
00109                                             IceModelVec3 &v3,
00110                                             IceModelVec3 &w3,
00111                                             PetscScalar &gmaxUerr,
00112                                             PetscScalar &gavUerr,
00113                                             PetscScalar &gmaxWerr,
00114                                             PetscScalar &gavWerr) {
00115 
00116   PetscErrorCode ierr;
00117   PetscScalar    maxUerr = 0.0, maxWerr = 0.0, avUerr = 0.0, avWerr = 0.0;
00118   PetscScalar    **H;
00119 
00120   const PetscScalar LforFG = 750000; // m
00121 
00122   ierr = vH.get_array(H); CHKERRQ(ierr);
00123   ierr = u3.begin_access(); CHKERRQ(ierr);
00124   ierr = v3.begin_access(); CHKERRQ(ierr);
00125   ierr = w3.begin_access(); CHKERRQ(ierr);
00126   for (PetscInt i=grid.xs; i<grid.xs+grid.xm; i++) {
00127     for (PetscInt j=grid.ys; j<grid.ys+grid.ym; j++) {
00128       PetscScalar xx = grid.x[i], yy = grid.y[j],
00129         r = sqrt(PetscSqr(xx) + PetscSqr(yy));
00130       if ((r >= 1.0) && (r <= LforFG - 1.0)) {  // only evaluate error if inside sheet 
00131                                                 // and not at central singularity
00132         PetscScalar radialUex,wex;
00133         PetscScalar dummy0,dummy1,dummy2,dummy3,dummy4;
00134         bothexact(0.0,r,&(H[i][j]),1,0.0,
00135                   &dummy0,&dummy1,&dummy2,&radialUex,&wex,&dummy3,&dummy4);
00136 
00137         const PetscScalar uex = (xx/r) * radialUex;
00138         const PetscScalar vex = (yy/r) * radialUex;
00139         // note that because getValZ does linear interpolation and H[i][j] is not exactly at
00140         // a grid point, this causes nonzero errors even with option -eo
00141         const PetscScalar Uerr = sqrt(PetscSqr(u3.getValZ(i,j,H[i][j]) - uex)
00142                                       + PetscSqr(v3.getValZ(i,j,H[i][j]) - vex));
00143         maxUerr = PetscMax(maxUerr,Uerr);
00144         avUerr += Uerr;
00145         const PetscScalar Werr = PetscAbs(w3.getValZ(i,j,H[i][j]) - wex);
00146         maxWerr = PetscMax(maxWerr,Werr);
00147         avWerr += Werr;
00148       }
00149     }
00150   }
00151   ierr = vH.end_access(); CHKERRQ(ierr);
00152   ierr = u3.end_access(); CHKERRQ(ierr);
00153   ierr = v3.end_access(); CHKERRQ(ierr);
00154   ierr = w3.end_access(); CHKERRQ(ierr);
00155 
00156   ierr = PISMGlobalMax(&maxUerr, &gmaxUerr, grid.com); CHKERRQ(ierr);
00157   ierr = PISMGlobalMax(&maxWerr, &gmaxWerr, grid.com); CHKERRQ(ierr);
00158   ierr = PISMGlobalSum(&avUerr, &gavUerr, grid.com); CHKERRQ(ierr);
00159   gavUerr = gavUerr/(grid.Mx*grid.My);
00160   ierr = PISMGlobalSum(&avWerr, &gavWerr, grid.com); CHKERRQ(ierr);
00161   gavWerr = gavWerr/(grid.Mx*grid.My);
00162   return 0;
00163 }
00164 
00165 
00166 PetscErrorCode enthalpy_from_temperature_cold(EnthalpyConverter &EC,
00167                                               IceGrid &grid,
00168                                               IceModelVec2S &thickness,
00169                                               IceModelVec3 &temperature,
00170                                               IceModelVec3 &enthalpy) {
00171   PetscErrorCode ierr;
00172   
00173   ierr = temperature.begin_access(); CHKERRQ(ierr);
00174   ierr = enthalpy.begin_access(); CHKERRQ(ierr);
00175   ierr = thickness.begin_access(); CHKERRQ(ierr);
00176 
00177   PetscScalar *T_ij, *E_ij; // columns of these values
00178   for (PetscInt i=grid.xs; i<grid.xs+grid.xm; ++i) {
00179     for (PetscInt j=grid.ys; j<grid.ys+grid.ym; ++j) {
00180       ierr = temperature.getInternalColumn(i,j,&T_ij); CHKERRQ(ierr);
00181       ierr = enthalpy.getInternalColumn(i,j,&E_ij); CHKERRQ(ierr);
00182 
00183       for (PetscInt k=0; k<grid.Mz; ++k) {
00184         PetscReal depth = thickness(i,j) - grid.zlevels[k];
00185         ierr = EC.getEnthPermissive(T_ij[k], 0.0,
00186                                     EC.getPressureFromDepth(depth),
00187                                     E_ij[k]); CHKERRQ(ierr);
00188       }
00189 
00190     }
00191   }
00192 
00193   ierr = enthalpy.end_access(); CHKERRQ(ierr);
00194   ierr = temperature.end_access(); CHKERRQ(ierr);
00195   ierr = thickness.end_access(); CHKERRQ(ierr);
00196 
00197   ierr = enthalpy.beginGhostComm(); CHKERRQ(ierr);
00198   ierr = enthalpy.endGhostComm(); CHKERRQ(ierr);
00199   return 0;
00200 }
00201 
00202 
00204 PetscErrorCode setInitStateF(IceGrid &grid,
00205                              EnthalpyConverter &EC,
00206                              IceModelVec2S *bed,
00207                              IceModelVec2Int *mask,
00208                              IceModelVec2S *surface,
00209                              IceModelVec2S *thickness,
00210                              IceModelVec3 *enthalpy) {
00211   PetscErrorCode ierr;
00212   PetscInt        Mz=grid.Mz;
00213   PetscScalar     **H;
00214   PetscScalar     *dummy1, *dummy2, *dummy3, *dummy4, *dummy5;
00215 
00216   PetscReal ST = 1.67e-5,
00217     Tmin = 223.15,  // K
00218     LforFG = 750000; // m
00219 
00220   dummy1=new PetscScalar[Mz];  dummy2=new PetscScalar[Mz];
00221   dummy3=new PetscScalar[Mz];  dummy4=new PetscScalar[Mz];
00222   dummy5=new PetscScalar[Mz];
00223 
00224   ierr = bed->set(0); CHKERRQ(ierr);
00225   ierr = mask->set(MASK_GROUNDED); CHKERRQ(ierr);
00226 
00227   PetscScalar *T;
00228   T = new PetscScalar[grid.Mz];
00229 
00230   ierr = thickness->get_array(H); CHKERRQ(ierr);
00231   ierr = enthalpy->begin_access(); CHKERRQ(ierr);
00232 
00233   for (PetscInt i=grid.xs; i<grid.xs+grid.xm; ++i) {
00234     for (PetscInt j=grid.ys; j<grid.ys+grid.ym; ++j) {
00235       PetscScalar r = grid.radius(i,j),
00236         Ts = Tmin + ST * r;
00237       if (r > LforFG - 1.0) { // if (essentially) outside of sheet
00238         H[i][j] = 0.0;
00239         for (PetscInt k = 0; k < Mz; k++)
00240           T[k]=Ts;
00241       } else {
00242         r = PetscMax(r,1.0); // avoid singularity at origin
00243         bothexact(0.0,r,&grid.zlevels[0],Mz,0.0,
00244                   &H[i][j],dummy5,T,dummy1,dummy2,dummy3,dummy4);
00245       }
00246       ierr = enthalpy->setInternalColumn(i,j,T); CHKERRQ(ierr);
00247     }
00248   }
00249 
00250   ierr = thickness->end_access(); CHKERRQ(ierr);
00251   ierr =  enthalpy->end_access(); CHKERRQ(ierr);
00252 
00253   ierr = thickness->beginGhostComm(); CHKERRQ(ierr);
00254   ierr = thickness->endGhostComm(); CHKERRQ(ierr);
00255 
00256   ierr = thickness->copy_to(*surface); CHKERRQ(ierr);
00257 
00258   delete [] dummy1;  delete [] dummy2;  delete [] dummy3;  delete [] dummy4;
00259   delete [] T; delete [] dummy5;
00260 
00261   ierr = enthalpy_from_temperature_cold(EC, grid, *thickness,
00262                                         *enthalpy,
00263                                         *enthalpy); CHKERRQ(ierr);
00264 
00265   return 0;
00266 }
00267 
00268 PetscErrorCode reportErrors(const NCConfigVariable &config,
00269                             IceGrid &grid,
00270                             IceModelVec2S *thickness,
00271                             IceModelVec3 *u_sia, IceModelVec3 *v_sia,
00272                             IceModelVec3 *w_sia,
00273                             IceModelVec3 *Sigma
00274                             ) {
00275   PetscErrorCode ierr;
00276 
00277   // Sigma errors if appropriate; reported in 10^6 J/(s m^3)
00278   PetscScalar maxSigerr, avSigerr;
00279   ierr = computeSigmaErrors(config, *Sigma, *thickness,
00280                             grid,
00281                             maxSigerr, avSigerr); CHKERRQ(ierr);
00282 
00283   ierr = verbPrintf(1,grid.com, 
00284                     "Sigma     :      maxSig       avSig\n"); CHKERRQ(ierr);
00285   ierr = verbPrintf(1,grid.com, "           %12.6f%12.6f\n", 
00286                     maxSigerr*1.0e6, avSigerr*1.0e6); CHKERRQ(ierr);
00287 
00288   // surface velocity errors if exact values are available; reported in m/a
00289   PetscScalar maxUerr, avUerr, maxWerr, avWerr;
00290   ierr = computeSurfaceVelocityErrors(grid, *thickness,
00291                                       *u_sia,
00292                                       *v_sia,
00293                                       *w_sia,
00294                                       maxUerr, avUerr,
00295                                       maxWerr, avWerr); CHKERRQ(ierr);
00296 
00297   ierr = verbPrintf(1,grid.com, 
00298                     "surf vels :     maxUvec      avUvec        maxW         avW\n"); CHKERRQ(ierr);
00299   ierr = verbPrintf(1,grid.com, "           %12.6f%12.6f%12.6f%12.6f\n", 
00300                     convert(maxUerr, "m/s", "m/year"),
00301                     convert(avUerr, "m/s", "m/year"),
00302                     convert(maxWerr, "m/s", "m/year"),
00303                     convert(avWerr, "m/s", "m/year")); CHKERRQ(ierr);
00304 
00305   return 0;
00306 }
00307 
00308 
00309 int main(int argc, char *argv[]) {
00310   PetscErrorCode  ierr;
00311 
00312   MPI_Comm    com;  // won't be used except for rank,size
00313   PetscMPIInt rank, size;
00314 
00315   ierr = PetscInitialize(&argc, &argv, PETSC_NULL, help); CHKERRQ(ierr);
00316 
00317   com = PETSC_COMM_WORLD;
00318   ierr = MPI_Comm_rank(com, &rank); CHKERRQ(ierr);
00319   ierr = MPI_Comm_size(com, &size); CHKERRQ(ierr);
00320   
00321   /* This explicit scoping forces destructors to be called before PetscFinalize() */
00322   {  
00323     NCConfigVariable config, overrides;
00324     ierr = init_config(com, rank, config, overrides); CHKERRQ(ierr);
00325 
00326     config.set_flag("compute_grain_size_using_age", false);
00327 
00328     PetscBool usage_set, help_set;
00329     ierr = PetscOptionsHasName(PETSC_NULL, "-usage", &usage_set); CHKERRQ(ierr);
00330     ierr = PetscOptionsHasName(PETSC_NULL, "-help", &help_set); CHKERRQ(ierr);
00331     if ((usage_set==PETSC_TRUE) || (help_set==PETSC_TRUE)) {
00332       PetscPrintf(com,
00333                   "\n"
00334                   "usage of SIAFD_TEST:\n"
00335                   "  run siafd_test -Mx <number> -My <number> -Mz <number> -o foo.nc\n"
00336                   "\n");
00337     }
00338 
00339     IceGrid grid(com, rank, size, config);
00340 
00341     grid.Lx = grid.Ly = 900e3;
00342     grid.Lz = 4000;
00343     grid.Mx = grid.My = 61;
00344     grid.Mz = 61;
00345     
00346     string output_file = "siafd_test_F.nc";
00347     ierr = PetscOptionsBegin(grid.com, "", "SIAFD_TEST options", ""); CHKERRQ(ierr);
00348     {
00349       bool flag;
00350       ierr = PISMOptionsInt("-Mx", "Number of grid points in the X direction",
00351                             grid.Mx, flag); CHKERRQ(ierr);
00352       ierr = PISMOptionsInt("-My", "Number of grid points in the X direction",
00353                             grid.My, flag); CHKERRQ(ierr);
00354       ierr = PISMOptionsInt("-Mz", "Number of vertical grid levels",
00355                             grid.Mz, flag); CHKERRQ(ierr);
00356       ierr = PISMOptionsString("-o", "Set the output file name",
00357                                output_file, flag); CHKERRQ(ierr);
00358     }
00359     ierr = PetscOptionsEnd(); CHKERRQ(ierr);
00360 
00361     grid.compute_nprocs();
00362     grid.compute_ownership_ranges();
00363     ierr = grid.compute_vertical_levels(); CHKERRQ(ierr); 
00364     ierr = grid.compute_horizontal_spacing(); CHKERRQ(ierr);
00365     ierr = grid.createDA(); CHKERRQ(ierr);
00366 
00367     ierr = setVerbosityLevel(5); CHKERRQ(ierr);
00368     ierr = grid.printInfo(1); CHKERRQ(ierr);
00369     //ierr = grid.printVertLevels(1); CHKERRQ(ierr); 
00370 
00371     ICMEnthalpyConverter EC(config);
00372     ThermoGlenArrIce ice(grid.com, "", config, &EC);
00373 
00374     IceModelVec2S vh, vH, vbed;
00375     IceModelVec2Int vMask;
00376     IceModelVec3 enthalpy,
00377       age;                      // is not used (and need not be allocated)
00378     const PetscInt WIDE_STENCIL = grid.max_stencil_width;
00379 
00380     PISMVars vars;
00381 
00382     // ice upper surface elevation
00383     ierr = vh.create(grid, "usurf", true, WIDE_STENCIL); CHKERRQ(ierr);
00384     ierr = vh.set_attrs("diagnostic", "ice upper surface elevation",
00385           "m", "surface_altitude"); CHKERRQ(ierr);
00386     ierr = vars.add(vh); CHKERRQ(ierr);
00387 
00388     // land ice thickness
00389     ierr = vH.create(grid, "thk", true, WIDE_STENCIL); CHKERRQ(ierr);
00390     ierr = vH.set_attrs("model_state", "land ice thickness",
00391           "m", "land_ice_thickness"); CHKERRQ(ierr);
00392     ierr = vH.set_attr("valid_min", 0.0); CHKERRQ(ierr);
00393     ierr = vars.add(vH); CHKERRQ(ierr);
00394 
00395     // bedrock surface elevation
00396     ierr = vbed.create(grid, "topg", true, WIDE_STENCIL); CHKERRQ(ierr);
00397     ierr = vbed.set_attrs("model_state", "bedrock surface elevation",
00398           "m", "bedrock_altitude"); CHKERRQ(ierr);
00399     ierr = vars.add(vbed); CHKERRQ(ierr);
00400 
00401     // age of the ice; is not used here
00402     ierr = age.create(grid, "age", false); CHKERRQ(ierr);
00403     ierr = age.set_attrs("diagnostic", "age of the ice", "s", ""); CHKERRQ(ierr);
00404     ierr = age.set_glaciological_units("year"); CHKERRQ(ierr);
00405     age.write_in_glaciological_units = true;
00406     ierr = vars.add(age); CHKERRQ(ierr);
00407 
00408     // enthalpy in the ice
00409     ierr = enthalpy.create(grid, "enthalpy", true, WIDE_STENCIL); CHKERRQ(ierr);
00410     ierr = enthalpy.set_attrs("model_state",
00411                               "ice enthalpy (includes sensible heat, latent heat, pressure)",
00412                               "J kg-1", ""); CHKERRQ(ierr);
00413     ierr = vars.add(enthalpy); CHKERRQ(ierr);
00414 
00415     // grounded_dragging_floating integer mask
00416     ierr = vMask.create(grid, "mask", true, WIDE_STENCIL); CHKERRQ(ierr);
00417     ierr = vMask.set_attrs("model_state", "grounded_dragging_floating integer mask",
00418                          "", ""); CHKERRQ(ierr);
00419     vector<double> mask_values(4);
00420     mask_values[0] = MASK_ICE_FREE_BEDROCK;
00421     mask_values[1] = MASK_GROUNDED;
00422     mask_values[2] = MASK_FLOATING;
00423     mask_values[3] = MASK_ICE_FREE_OCEAN;
00424     ierr = vMask.set_attr("flag_values", mask_values); CHKERRQ(ierr);
00425     ierr = vMask.set_attr("flag_meanings",
00426                         "ice_free_bedrock grounded_ice floating_ice ice_free_ocean");
00427                   CHKERRQ(ierr);
00428     vMask.output_data_type = PISM_BYTE;
00429     ierr = vars.add(vMask); CHKERRQ(ierr);
00430 
00431     // This is never used (but it is a required argument of the
00432     // PISMStressBalance constructor).
00433     IceBasalResistancePlasticLaw basal(
00434            config.get("plastic_regularization", "1/year", "1/second"), 
00435            config.get_flag("do_pseudo_plastic_till"),
00436            config.get("pseudo_plastic_q"),
00437            config.get("pseudo_plastic_uthreshold", "m/year", "m/second"));
00438 
00439     // Create the SIA solver object:
00440 
00441     // We use SIA_Nonsliding and not SIAFD here because we need the z-component
00442     // of the ice velocity, which is computed using incompressibility of ice in
00443     // PISMStressBalance::compute_vertical_velocity().
00444     SIAFD *sia = new SIAFD(grid, EC, config);
00445     SSB_Trivial *trivial_stress_balance = new SSB_Trivial(grid, basal, EC, config);
00446 
00447     PISMStressBalance stress_balance(grid,
00448                                      trivial_stress_balance, sia,
00449                                      NULL, // no ocean model
00450                                      config);
00451 
00452     // fill the fields:
00453     ierr = setInitStateF(grid, EC,
00454                          &vbed, &vMask, &vh, &vH,
00455                          &enthalpy); CHKERRQ(ierr);
00456 
00457     // Allocate the SIA solver:
00458     ierr = stress_balance.init(vars); CHKERRQ(ierr);
00459 
00460     // Solve (fast==true means "no 3D update and no strain heating computation"):
00461     bool fast = false;
00462     ierr = stress_balance.update(fast); CHKERRQ(ierr); 
00463 
00464     // Report errors relative to the exact solution:
00465     IceModelVec3 *u_sia, *v_sia, *w_sia, *sigma;
00466     ierr = stress_balance.get_3d_velocity(u_sia, v_sia, w_sia); CHKERRQ(ierr); 
00467 
00468     ierr = stress_balance.get_volumetric_strain_heating(sigma); CHKERRQ(ierr); 
00469 
00470     ierr = reportErrors(config, grid,
00471                         &vH, u_sia, v_sia, w_sia, sigma); CHKERRQ(ierr);
00472 
00473     // Write results to an output file:
00474     PIO pio(grid.com, grid.rank, "netcdf3");
00475 
00476     ierr = pio.open(output_file, PISM_WRITE); CHKERRQ(ierr);
00477     ierr = pio.def_time(config.get_string("time_dimension_name"),
00478                         config.get_string("calendar"),
00479                         grid.time->CF_units()); CHKERRQ(ierr);
00480     ierr = pio.append_time(config.get_string("time_dimension_name"), 0.0);
00481     ierr = pio.close(); CHKERRQ(ierr);
00482 
00483     ierr = vh.write(output_file); CHKERRQ(ierr);
00484     ierr = vH.write(output_file); CHKERRQ(ierr);
00485     ierr = vMask.write(output_file); CHKERRQ(ierr);
00486     ierr = vbed.write(output_file); CHKERRQ(ierr);
00487     // ierr = enthalpy.write(output_file); CHKERRQ(ierr);
00488     ierr = u_sia->write(output_file); CHKERRQ(ierr);
00489     ierr = v_sia->write(output_file); CHKERRQ(ierr);
00490     ierr = w_sia->write(output_file); CHKERRQ(ierr);
00491     ierr = sigma->write(output_file); CHKERRQ(ierr);
00492   }
00493   ierr = PetscFinalize(); CHKERRQ(ierr);
00494   return 0;
00495 }
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines