|
PISM, A Parallel Ice Sheet Model
stable v0.5
|
00001 /* 00002 Copyright (C) 2004-2007 Jed Brown and 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 DIALOGUE: 00022 00023 $ ./simpleABCD 00024 Enter t and r separated by space (or newline) 00025 (in yrs and km, resp.; e.g. 15000 500): 00026 15000 500 00027 Results: 00028 Test A Test B Test C Test D 00029 H = 2362.8962 (m) H = 1878.2858 (m) H = 2386.8463 (m) H = 2310.3543 (m) 00030 M = 0.30000 (m/a) M = 0.00000 (m/a) M = 0.79562 (m/a) M = 0.24969 (m/a) 00031 00032 */ 00033 00034 #include <stdio.h> 00035 #include "exactTestsABCDE.h" 00036 00037 int main() { 00038 00039 const double SperA=31556926.0; /* seconds per year; 365.2422 days */ 00040 00041 double year, r, 00042 HA, MA, HB, MB, HC, MC, HD, MD; 00043 int scanret; 00044 00045 printf("Enter t and r separated by space (or newline)\n"); 00046 printf(" (in yrs and km, resp.; e.g. 15000 500):\n"); 00047 scanret = scanf("%lf",&year); 00048 if (scanret != 1) { 00049 printf("... input error; exiting\n"); 00050 return 1; 00051 } 00052 scanret = scanf("%lf",&r); 00053 if (scanret != 1) { 00054 printf("... input error; exiting\n"); 00055 return 1; 00056 } 00057 00058 /* evaluate tests */ 00059 exactA(r*1000.0, &HA, &MA); 00060 exactB(year*SperA, r*1000.0, &HB, &MB); 00061 exactC(year*SperA, r*1000.0, &HC, &MC); 00062 exactD(year*SperA, r*1000.0, &HD, &MD); 00063 00064 printf("Results:\n"); 00065 printf(" Test A Test B "); 00066 printf(" Test C Test D\n"); 00067 printf(" H = %9.4f (m) H = %9.4f (m) H = %9.4f (m) ", 00068 HA,HB,HC); 00069 printf("H = %9.4f (m)\n",HD); 00070 printf(" M = %8.5f (m/a) M = %8.5f (m/a) M = %8.5f (m/a) ", 00071 MA*SperA,MB*SperA,MC*SperA); 00072 printf("M = %8.5f (m/a)\n\n",MD*SperA); 00073 00074 return 0; 00075 }
1.7.5.1