PISM, A Parallel Ice Sheet Model  stable v0.5
src/verif/tests/simpleK.c
Go to the documentation of this file.
00001 /*
00002    Copyright (C) 2007--2008 Ed Bueler
00003   
00004    This file is part of PISM.
00005   
00006    PISM is free software; you can redistribute it and/or modify it under the
00007    terms of the GNU General Public License as published by the Free Software
00008    Foundation; either version 2 of the License, or (at your option) any later
00009    version.
00010   
00011    PISM is distributed in the hope that it will be useful, but WITHOUT ANY
00012    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00014    details.
00015   
00016    You should have received a copy of the GNU General Public License
00017    along with PISM; if not, write to the Free Software
00018    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 */
00020 
00021 /*  STANDARD DIALOGUEs:
00022 
00023 $ ./simpleK 
00024 Enter t in years:
00025 0
00026 Enter z in m (0 < z < 3000 for ice and -1000 < z < 0 for bedrock):
00027 0
00028 Results from Test K:
00029      T =   260.70501 (K) =   -12.44499 (deg C)   [absolute temperature]
00030      F =     0.03068 (W m-2)                     [upward heat flux]
00031 
00032 $ ./simpleK 
00033 Enter t in years:
00034 133465
00035 Enter z in m (0 < z < 3000 for ice and -1000 < z < 0 for bedrock):
00036 0
00037 Results from Test K:
00038      T =   270.55200 (K) =    -2.59800 (deg C)   [absolute temperature]
00039      F =     0.03637 (W m-2)                     [upward heat flux]
00040 
00041 $ ./simpleK 
00042 Enter t in years:
00043 1e9
00044 Enter z in m (0 < z < 3000 for ice and -1000 < z < 0 for bedrock):
00045 0
00046 Results from Test K:
00047      T =   283.15000 (K) =    10.00000 (deg C)   [absolute temperature]
00048      F =     0.04200 (W m-2)                     [upward heat flux]
00049 
00050 */
00051 
00052 #include <stdio.h>
00053 #include "exactTestK.h"
00054 
00055 int main() {
00056 
00057   double       z, t, TT, FF;
00058   int          scanret;
00059   const double secpera=31556926.0;  /* seconds per year; 365.2422 days */
00060   const double H0 = 3000.0, B0 = -1000.0; 
00061 
00062   /* call to compute alpha_k:  */ 
00063   /* print_alpha_k(30); */
00064  
00065   printf("Enter t in years:\n");
00066   scanret = scanf("%lf",&t);
00067   if (scanret != 1) {
00068     printf("... input error; exiting\n"); 
00069     return 1;
00070   }
00071   printf("Enter z in m (0 < z < %4.0f for ice and %5.0f < z < 0 for bedrock):\n",
00072          H0,B0);
00073   scanret = scanf("%lf",&z);
00074   if (scanret != 1) {
00075     printf("... input error; exiting\n"); 
00076     return 1;
00077   }
00078 
00079   if (t >= 0) {
00080     exactK(t * secpera, z, &TT, &FF, 0);    /* bedrock and ice have different material properties */
00081   } else {
00082     exactK(- t * secpera, z, &TT, &FF, 1);  /* dumb trick to help test:  use negative t values to choose
00083                                           bedrock material constants equal to those of ice */
00084   }
00085 
00086   printf("Results from Test K:\n");
00087   printf("     T = %11.5f (K) = %11.5f (deg C)   [absolute temperature]\n",TT,TT - 273.15);
00088   printf("     F = %11.5f (W m-2)                     [upward heat flux]\n",FF);
00089 
00090   return 0;
00091 }
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines