def _initPhysics(self): config = self.modeldata.config config.set_boolean("do_pseudo_plastic_till", False) enthalpyconverter = PISM.EnthalpyConverter(config) config.set_string("ssa_flow_law", "isothermal_glen") self.modeldata.setPhysics(enthalpyconverter)
def _initPhysics(self): config = self.modeldata.config config.set_flag("basal_resistance.pseudo_plastic.enabled", False) enthalpyconverter = PISM.EnthalpyConverter(config) config.set_string("stress_balance.ssa.flow_law", "isothermal_glen") self.modeldata.setPhysics(enthalpyconverter)
def initPhysics(self): secpera = PISM.secpera self.ice = PISM.CustomGlenIce(self.grid.com,"",config) self.ice.setHardness(DEFAULT_CONSTANT_HARDNESS_FOR_SSA); self.basal = PISM.IceBasalResistancePlasticLaw( config.get("plastic_regularization") / secpera, config.get_flag("do_pseudo_plastic_till"), config.get("pseudo_plastic_q"), config.get("pseudo_plastic_uthreshold") / secpera) self.basal.printInfo(1,self.grid.com) self.enthalpyconverter = PISM.EnthalpyConverter(config)
def initPhysics(self): config = self.config self.basal = PISM.IceBasalResistancePlasticLaw( config.get("plastic_regularization") / PISM.secpera, config.get_flag("do_pseudo_plastic_till"), config.get("pseudo_plastic_q"), config.get("pseudo_plastic_uthreshold") / PISM.secpera) self.ice = PISM.CustomGlenIce(self.grid.com, "", config) self.enthalpyconverter = PISM.EnthalpyConverter(config)
def _initPhysics(self): config = self.config config.set_number("flow_law.isothermal_Glen.ice_softness", pow(1.9e8, -config.get_number("stress_balance.ssa.Glen_exponent"))) config.set_flag("stress_balance.ssa.compute_surface_gradient_inward", False) config.set_flag("stress_balance.calving_front_stress_bc", True) config.set_string("stress_balance.ssa.flow_law", "isothermal_glen") enthalpyconverter = PISM.EnthalpyConverter(config) self.modeldata.setPhysics(enthalpyconverter)
def _initPhysics(self): config = self.config config.set_boolean("do_pseudo_plastic_till", False) # irrelevant enthalpyconverter = PISM.EnthalpyConverter(config) config.set_string("ssa_flow_law", "isothermal_glen") config.set_double("ice_softness", pow(3.7e8, -config.get_double("Glen_exponent"))) self.modeldata.setPhysics(enthalpyconverter)
def _initPhysics(self): config = self.config #// Enthalpy converter is irrelevant for this test. enthalpyconverter = PISM.EnthalpyConverter(config) #// Use constant hardness config.set_string("ssa_flow_law", "isothermal_glen") config.set_double("ice_softness", pow(B0, -glen_n)) config.set_double("Glen_exponent", glen_n) self.modeldata.setPhysics(enthalpyconverter)
def _initPhysics(self): config = self.config config.set_flag("basal_resistance.pseudo_plastic.enabled", False) # irrelevant enthalpyconverter = PISM.EnthalpyConverter(config) config.set_string("stress_balance.ssa.flow_law", "isothermal_glen") config.set_number("flow_law.isothermal_Glen.ice_softness", pow( B_schoof, -config.get_number("stress_balance.ssa.Glen_exponent"))) self.modeldata.setPhysics(enthalpyconverter)
def _initPhysics(self): """Override of :meth:`SSARun._initPhysics` that sets the physics based on command-line flags.""" config = self.config enthalpyconverter = PISM.EnthalpyConverter(config) if PISM.OptionBool("-ssa_glen", "SSA flow law Glen exponent"): config.set_string("stress_balance.ssa.flow_law", "isothermal_glen") config.scalar_from_option("flow_law.isothermal_Glen.ice_softness", "ice_softness") else: config.set_string("stress_balance.ssa.flow_law", "gpbld") self.modeldata.setPhysics(enthalpyconverter)
def initPhysics(self): config = self.config linear_q = 1. self.basal = PISM.IceBasalResistancePlasticLaw( config.get("plastic_regularization") / PISM.secpera, True, # do not force pure plastic linear_q, config.get("pseudo_plastic_uthreshold") / PISM.secpera) # The following are irrelevant because we force linear rheology # and don't use the enthalpyconverter self.ice = PISM.CustomGlenIce(self.grid.com, "", config) self.enthalpyconverter = PISM.EnthalpyConverter(config)
def _initPhysics(self): config = self.config config.set_boolean("compute_surf_grad_inward_ssa", True) config.set_boolean("calving_front_stress_boundary_condition", True) config.set_boolean("do_pseudo_plastic_till", False) enthalpyconverter = PISM.EnthalpyConverter(config) config.set_string("ssa_flow_law", "isothermal_glen") config.set_double("ice_softness", pow(1.9e8, -config.get_double("ssa_Glen_exponent"))) self.modeldata.setPhysics(enthalpyconverter)
def initPhysics(self): config = self.config do_pseudo_plastic = True plastic_q = 0. self.basal = PISM.IceBasalResistancePlasticLaw( config.get("plastic_regularization") / PISM.secpera, do_pseudo_plastic, plastic_q, config.get("pseudo_plastic_uthreshold") / PISM.secpera) self.ice = PISM.CustomGlenIce(self.grid.com, "", config) self.ice.setHardness(B_schoof) # irrelevant self.enthalpyconverter = PISM.EnthalpyConverter(config)
def _initSSACoefficients(self): self._allocStdSSACoefficients() self._allocateBCs() vecs = self.modeldata.vecs vecs.tauc.set(0.0) # irrelevant vecs.bedrock_altitude.set(-1000.0) # assures shelf is floating EC = PISM.EnthalpyConverter(PISM.Context().config) enth0 = EC.enthalpy(273.15, 0.01, 0) # 0.01 water fraction vecs.enthalpy.set(enth0) grid = self.grid thickness = vecs.land_ice_thickness surface = vecs.surface_altitude bc_mask = vecs.bc_mask vel_bc = vecs.vel_bc ice_mask = vecs.mask ocean_rho = self.config.get_number("constants.sea_water.density") ice_rho = self.config.get_number("constants.ice.density") x_min = grid.x(0) with PISM.vec.Access( comm=[thickness, surface, bc_mask, vel_bc, ice_mask]): for (i, j) in grid.points(): x = grid.x(i) if i != grid.Mx() - 1: thickness[i, j] = H_exact(x - x_min) ice_mask[i, j] = PISM.MASK_FLOATING else: thickness[i, j] = 0 ice_mask[i, j] = PISM.MASK_ICE_FREE_OCEAN surface[i, j] = (1.0 - ice_rho / ocean_rho) * thickness[i, j] if i == 0: bc_mask[i, j] = 1 vel_bc[i, j].u = V0 vel_bc[i, j].v = 0. else: bc_mask[i, j] = 0 vel_bc[i, j].u = 0. vel_bc[i, j].v = 0.
def initPhysics(self): config = self.config #// The following is irrelevant because tauc=0 linear_q = 1. self.basal = PISM.IceBasalResistancePlasticLaw( config.get("plastic_regularization") / PISM.secpera, True, #// do not force a pure-plastic law linear_q, config.get("pseudo_plastic_uthreshold") / PISM.secpera) #// Use constant hardness self.ice = PISM.CustomGlenIce(self.grid.com, "", config) self.ice.setHardness(B0) self.ice.setExponent(glen_n) #// Enthalpy converter is irrelevant for this test. self.enthalpyconverter = PISM.EnthalpyConverter(config)
def sia_test(): "Test the PISM.sia module" ctx = PISM.Context() params = PISM.GridParameters(ctx.config) params.Lx = 1e5 params.Ly = 1e5 params.Lz = 1000 params.Mx = 100 params.My = 100 params.Mz = 11 params.registration = PISM.CELL_CORNER params.periodicity = PISM.NOT_PERIODIC params.ownership_ranges_from_options(ctx.size) grid = PISM.IceGrid(ctx.ctx, params) enthalpyconverter = PISM.EnthalpyConverter(ctx.config) mask = PISM.model.createIceMaskVec(grid) mask.set(PISM.MASK_GROUNDED) thk = PISM.model.createIceThicknessVec(grid) thk.set(1000.0) surface = PISM.model.createIceSurfaceVec(grid) surface.set(1000.0) bed = PISM.model.createBedrockElevationVec(grid) bed.set(0.0) enthalpy = PISM.model.createEnthalpyVec(grid) enthalpy.set(enthalpyconverter.enthalpy(270.0, 0.0, 0.0)) modeldata = PISM.model.ModelData(grid) modeldata.setPhysics(enthalpyconverter) vecs = grid.variables() fields = [thk, surface, mask, bed, enthalpy] for field in fields: vecs.add(field) vel_sia = PISM.sia.computeSIASurfaceVelocities(modeldata)
def initPhysics(self): config = self.config self.basal = PISM.IceBasalResistancePlasticLaw( config.get("plastic_regularization") / PISM.secpera, config.get_flag("do_pseudo_plastic_till"), config.get("pseudo_plastic_q"), config.get("pseudo_plastic_uthreshold") / PISM.secpera) if PISM.optionsIsSet("-ssa_glen"): self.ice = PISM.CustomGlenIce(self.grid.com, "", config) B_schoof = 3.7e8 # Pa s^{1/3}; hardness self.ice.setHardness(B_schoof) else: self.ice = PISM.GPBLDIce(self.grid.com, "", config) self.ice.setFromOptions() self.enthalpyconverter = PISM.EnthalpyConverter(config) if PISM.getVerbosityLevel() > 3: self.enthalpyconverter.viewConstants(PETSc.Viewer.STDOUT())
def _initSSACoefficients(self): self._allocStdSSACoefficients() self._allocateBCs() vecs = self.modeldata.vecs vecs.tauc.set(0.0) # irrelevant for test J # ensures that the ice is floating (max. thickness if 770 m) vecs.bedrock_altitude.set(-1000.0) vecs.mask.set(PISM.MASK_FLOATING) vecs.bc_mask.set(0) # No dirichlet data. EC = PISM.EnthalpyConverter(PISM.Context().config) enth0 = EC.enthalpy(273.15, 0.01, 0) # 0.01 water fraction vecs.enthalpy.set(enth0) ocean_rho = self.config.get_number("constants.sea_water.density") ice_rho = self.config.get_number("constants.ice.density") # The PISM.vec.Access object ensures that we call beginAccess for each # variable in 'vars', and that endAccess is called for each one on exiting # the 'with' block. with PISM.vec.Access(comm=[ vecs.land_ice_thickness, vecs.surface_altitude, vecs.bc_mask, vecs.vel_bc ]): grid = self.grid for (i, j) in grid.points(): p = PISM.exactJ(grid.x(i), grid.y(j)) vecs.land_ice_thickness[i, j] = p.H vecs.surface_altitude[i, j] = ( 1.0 - ice_rho / ocean_rho) * p.H # // FIXME task #7297 # special case at center point (Dirichlet BC) if (i == grid.Mx() // 2) and (j == grid.My() // 2): vecs.bc_mask[i, j] = 1 vecs.vel_bc[i, j] = [p.u, p.v]
def pism_context_test(): "Test creating and using a C++-level Context" com = PISM.PETSc.COMM_WORLD system = PISM.UnitSystem("") logger = PISM.Logger(com, 2) config = PISM.DefaultConfig(com, "pism_config", "-config", system) config.init_with_default(logger) EC = PISM.EnthalpyConverter(config) time = PISM.Time(config, "360_day", system) ctx = PISM.cpp.Context(com, system, config, EC, time, logger, "greenland") print(ctx.com().Get_size()) print(ctx.config().get_number("constants.standard_gravity")) print(ctx.enthalpy_converter().L(273.15)) print(ctx.time().current()) print(PISM.convert(ctx.unit_system(), 1, "km", "m")) print(ctx.prefix())
Mz = 21 sea_level = 0 # m sea level elevation H0 = 60. # ice thickness at cliff alpha = 0.008 # constant surface slope Lext = 15e3 # width of strip beyond cliff Lstream_x = 50e3 Lstream_y = 30e3 Hext = 0. # m ice thickeness beyond the cliff tauc_hi = 2e6 # Pa tauc_lo = 1e4 # Pa tauc_free_bedrock = 0 # Will get set later EC = PISM.EnthalpyConverter(PISM.Context().config) enth0 = EC.enthalpy(273.15, 0.01, 0) # 0.01 water fraction bed0 = 0 def geometry(x, y): x0 = -Lx + Lext if x < x0: return (0, Hext) return (0, H0 + alpha * (x - x0)) def stream_tauc(x, y): x0 = -Lx + Lext if x < x0: return tauc_free_bedrock
vecs.tauc_prior.set(design_prior_const) else: vecs.tauc_prior.copy_from(modeldata.vecs.tauc) vecs.tauc_prior.scale(design_prior_scale) tauc_true = modeldata.vecs.tauc tauc_true.metadata(0).set_name('tauc_true') tauc_true.set_attrs( "diagnostic", "value of basal yield stress used to generate synthetic SSA velocities", "Pa", "Pa", "", 0) vecs.markForWriting(tauc_true) elif design_var == 'hardav': # Generate a prior guess for hardav EC = PISM.EnthalpyConverter(config) ice_factory = PISM.IceFlowLawFactory(grid.com, "stress_balance.ssa.", config, EC) ice_factory.removeType(PISM.ICE_GOLDSBY_KOHLSTEDT) ice_factory.setType(config.get_string("stress_balance.ssa.flow_law")) ice_factory.setFromOptions() flow_law = ice_factory.create() averaged_hardness_vec(flow_law, vecs.land_ice_thickness, vecs.enthalpy, vecs.hardav) if design_prior_const is not None: vecs.hardav_prior.set(design_prior_const) else: vecs.hardav_prior.copy_from(vecs.hardav) vecs.hardav_prior.scale(hardav_prior_scale)
import PISM import numpy as np config = PISM.Context().config # list of converters converters = { "Default": PISM.EnthalpyConverter(config), "Glint2 (Kirchhoff)": PISM.KirchhoffEnthalpyConverter(config), "verification (cold)": PISM.ColdEnthalpyConverter(config), "linear-in-temp C(T)": PISM.varcEnthalpyConverter(config) } def try_all_converters(test): print "" for name, converter in converters.items(): print "Testing '%s' converter..." % name, test(name, converter) print "done" def reversibility_test(): "Converting from (E, P) to (T, omega, P)" def run(name, EC): # for a fixed pressure... H = 1000.0 P = EC.pressure(H) # cold ice