def flowlaw_test(): ctx = PISM.context_from_options(PISM.PETSc.COMM_WORLD, "flowlaw_test") EC = ctx.enthalpy_converter() ff = PISM.FlowLawFactory("sia_", ctx.config(), EC) law = ff.create() TpaC = [-30, -5, 0, 0] depth = 2000 gs = 1e-3 omega = [0.0, 0.0, 0.0, 0.005] sigma = [1e4, 5e4, 1e5, 1.5e5] p = EC.pressure(depth) Tm = EC.melting_temperature(p) print "flow law: \"%s\"" % law.name() print "pressure = %9.3e Pa = (hydrostatic at depth %7.2f m)" % (p, depth) print "flowtable:" print " (dev stress) (abs temp) (liq frac) = (flow)" for i in range(4): for j in range(4): T = Tm + TpaC[j] E = EC.enthalpy(T, omega[j], p) flowcoeff = law.flow(sigma[i], E, p, gs) print " %10.2e %10.3f %9.3f = %10.6e" % (sigma[i], T, omega[j], flowcoeff)
def flowlaw_test(): data = {} data["arr"] = [ 3.91729503e-18, 6.42803396e-17, 1.05746828e-16, 1.05746828e-16, 9.79323757e-17, 1.60700849e-15, 2.64367070e-15, 2.64367070e-15, 3.91729503e-16, 6.42803396e-15, 1.05746828e-14, 1.05746828e-14, 8.81391381e-16, 1.44630764e-14, 2.37930363e-14, 2.37930363e-14 ] data["arrwarm"] = [ 1.59798478e-19, 1.04360343e-16, 3.30653997e-16, 3.30653997e-16, 3.99496194e-18, 2.60900856e-15, 8.26634991e-15, 8.26634991e-15, 1.59798478e-17, 1.04360343e-14, 3.30653997e-14, 3.30653997e-14, 3.59546574e-17, 2.34810771e-14, 7.43971492e-14, 7.43971492e-14 ] data["gk"] = [ 7.32439717e-17, 5.49629815e-15, 2.41713799e-14, 2.41713799e-14, 2.16360102e-16, 1.93446849e-14, 9.04428380e-14, 9.04428380e-14, 4.06191746e-16, 3.39770143e-14, 1.60574708e-13, 1.60574708e-13, 6.68976826e-16, 4.80704753e-14, 2.27816175e-13, 2.27816175e-13 ] data["gpbld"] = [ 4.65791754e-18, 1.45114704e-16, 4.54299921e-16, 8.66009225e-16, 1.16447938e-16, 3.62786761e-15, 1.13574980e-14, 2.16502306e-14, 4.65791754e-16, 1.45114704e-14, 4.54299921e-14, 8.66009225e-14, 1.04803145e-15, 3.26508084e-14, 1.02217482e-13, 1.94852076e-13 ] data["hooke"] = [ 5.26775897e-18, 2.12325906e-16, 5.32397091e-15, 5.32397091e-15, 1.31693974e-16, 5.30814764e-15, 1.33099273e-13, 1.33099273e-13, 5.26775897e-16, 2.12325906e-14, 5.32397091e-13, 5.32397091e-13, 1.18524577e-15, 4.77733287e-14, 1.19789346e-12, 1.19789346e-12 ] data["isothermal_glen"] = [ 3.16890000e-16, 3.16890000e-16, 3.16890000e-16, 3.16890000e-16, 7.92225000e-15, 7.92225000e-15, 7.92225000e-15, 7.92225000e-15, 3.16890000e-14, 3.16890000e-14, 3.16890000e-14, 3.16890000e-14, 7.13002500e-14, 7.13002500e-14, 7.13002500e-14, 7.13002500e-14 ] data["pb"] = [ 4.65791754e-18, 1.45114704e-16, 4.54299921e-16, 4.54299921e-16, 1.16447938e-16, 3.62786761e-15, 1.13574980e-14, 1.13574980e-14, 4.65791754e-16, 1.45114704e-14, 4.54299921e-14, 4.54299921e-14, 1.04803145e-15, 3.26508084e-14, 1.02217482e-13, 1.02217482e-13 ] data["gpbld3"] = [ 4.65791754e-18, 1.45114704e-16, 4.54299921e-16, 8.66009225e-16, 1.16447938e-16, 3.62786761e-15, 1.13574980e-14, 2.16502306e-14, 4.65791754e-16, 1.45114704e-14, 4.54299921e-14, 8.66009225e-14, 1.04803145e-15, 3.26508084e-14, 1.02217482e-13, 1.94852076e-13 ] ctx = PISM.context_from_options(PISM.PETSc.COMM_WORLD, "flowlaw_test") EC = ctx.enthalpy_converter() factory = PISM.FlowLawFactory("stress_balance.sia.", ctx.config(), EC) for flow_law_name, data in data.iteritems(): check_flow_law(factory, flow_law_name, EC, np.array(data))
def flowlaw_test(): data = {} data["arr"] = [ 3.91729503e-18, 6.42803396e-17, 1.05746828e-16, 1.05746828e-16, 9.79323757e-17, 1.60700849e-15, 2.64367070e-15, 2.64367070e-15, 3.91729503e-16, 6.42803396e-15, 1.05746828e-14, 1.05746828e-14, 8.81391381e-16, 1.44630764e-14, 2.37930363e-14, 2.37930363e-14 ] data["arrwarm"] = [ 1.59798478e-19, 1.04360343e-16, 3.30653997e-16, 3.30653997e-16, 3.99496194e-18, 2.60900856e-15, 8.26634991e-15, 8.26634991e-15, 1.59798478e-17, 1.04360343e-14, 3.30653997e-14, 3.30653997e-14, 3.59546574e-17, 2.34810771e-14, 7.43971492e-14, 7.43971492e-14 ] data["gk"] = [ 1.1636334595808724e-16, 6.217445758362754e-15, 2.5309103327753672e-14, 2.5309103327753672e-14, 2.5947947614616463e-16, 2.0065832524499375e-14, 9.158056141786197e-14, 9.158056141786197e-14, 4.493111202368685e-16, 3.469816186746473e-14, 1.6171243121742907e-13, 1.6171243121742907e-13, 7.12096200221403e-16, 4.879162291119208e-14, 2.2895389865988545e-13, 2.2895389865988545e-13 ] data["gpbld"] = [ 4.65791754e-18, 1.45114704e-16, 4.54299921e-16, 8.66009225e-16, 1.16447938e-16, 3.62786761e-15, 1.13574980e-14, 2.16502306e-14, 4.65791754e-16, 1.45114704e-14, 4.54299921e-14, 8.66009225e-14, 1.04803145e-15, 3.26508084e-14, 1.02217482e-13, 1.94852076e-13 ] data["hooke"] = [ 5.26775897e-18, 2.12325906e-16, 5.32397091e-15, 5.32397091e-15, 1.31693974e-16, 5.30814764e-15, 1.33099273e-13, 1.33099273e-13, 5.26775897e-16, 2.12325906e-14, 5.32397091e-13, 5.32397091e-13, 1.18524577e-15, 4.77733287e-14, 1.19789346e-12, 1.19789346e-12 ] data["isothermal_glen"] = [ 3.16890000e-16, 3.16890000e-16, 3.16890000e-16, 3.16890000e-16, 7.92225000e-15, 7.92225000e-15, 7.92225000e-15, 7.92225000e-15, 3.16890000e-14, 3.16890000e-14, 3.16890000e-14, 3.16890000e-14, 7.13002500e-14, 7.13002500e-14, 7.13002500e-14, 7.13002500e-14 ] data["pb"] = [ 4.65791754e-18, 1.45114704e-16, 4.54299921e-16, 4.54299921e-16, 1.16447938e-16, 3.62786761e-15, 1.13574980e-14, 1.13574980e-14, 4.65791754e-16, 1.45114704e-14, 4.54299921e-14, 4.54299921e-14, 1.04803145e-15, 3.26508084e-14, 1.02217482e-13, 1.02217482e-13 ] ctx = PISM.context_from_options(PISM.PETSc.COMM_WORLD, "flowlaw_test") EC = ctx.enthalpy_converter() factory = PISM.FlowLawFactory("stress_balance.sia.", ctx.config(), EC) for flow_law_name, data in data.items(): check_flow_law(factory, flow_law_name, EC, np.array(data))
ctx = PISM.Context() filename = ctx.config.get_string("input.file") # create the grid using the input file grid = PISM.IceGrid.FromFile(ctx.ctx, filename, ["thk"], PISM.CELL_CENTER) # initialize geometric data geometry = PISM.Geometry(grid) geometry.ice_thickness.regrid(filename) geometry.bed_elevation.regrid(filename) geometry.sea_level_elevation.set(0.0) geometry.ensure_consistency(0) # allocate the fracture density model flow_law = PISM.FlowLawFactory("stress_balance.ssa.", ctx.config, ctx.enthalpy_converter).create() fracture = PISM.FractureDensity(grid, flow_law) # initialize it using zero fracture age and density fracture.initialize() # read in the velocity field velocity = PISM.IceModelVec2V(grid, "_ssa_bc", PISM.WITHOUT_GHOSTS) velocity.set_attrs("", "x-component of the ice velocity", "m s-1", "m s-1", "", 0) velocity.set_attrs("", "y-component of the ice velocity", "m s-1", "m s-1", "", 1) velocity.regrid(filename) # find the longest time step we can take with this velocity field data = PISM.max_timestep_cfl_2d(geometry.ice_thickness, geometry.cell_type,