Exemple #1
0
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,
                                velocity)