tsimpleP.py - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch) (HTM) git clone git://src.adamsgaard.dk/pism (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- tsimpleP.py (988B) --- 1 #!/usr/bin/env python3 2 3 # see src/verification/tests/simpleP.c 4 simpleP_c_result = """$ ./simpleP 5 Enter r (in km; 0 <= r <= TESTP_L = 22.5): 20.0 6 Results from Test P: 7 h = 180.0000 (m) Po = 16.0687800 (bar) |vb| = 46.26644 (m/year) 8 W_c = 0.58226741 (m) W = 0.67537710 (m) P = 2.0082437 (bar)""" 9 10 import numpy as np 11 from PISM import exactP 12 13 secpera = 31556926.0 14 EPS_ABS = 1.0e-12 15 EPS_REL = 1.0e-15 16 ode_method = 1 17 18 print("setting r = 20 km ...") 19 r = 20.0e3 20 21 # ierr = exactP(r*1000.0,&h,&magvb,&Wcrit,&W,&P,EPS_ABS[0],EPS_REL[0],1); 22 p = exactP([r], EPS_ABS, EPS_REL, ode_method) 23 h, magvb, Wcrit, W, P = p.h, p.magvb, p.Wcrit, p.W, p.P 24 25 j = 0 26 print("Results from Test P:") 27 print(" h = %.4f (m) Po = %.7f (bar) |vb| = %.5f (m/year)" 28 % (h[j], 910.0 * 9.81 * h[j] / 1.0e5, magvb[j] * secpera)) 29 print(" W_c = %.8f (m) W = %.8f (m) P = %.7f (bar)" 30 % (Wcrit[j], W[j], P[j] / 1.0e5)) 31 32 print("") 33 print("compare to SAVED simpleP.c result:") 34 print(simpleP_c_result)