Exemple #1
0
def setup():
    global grid

    # "inputs" does not own its elements, so we need to make sure
    # these don't expire when setup() returns
    global basal_melt_rate, ice_thickness, inputs, surface_temp
    global climatic_mass_balance, basal_heat_flux, shelf_base_temp, cell_type
    global u, v, w, strain_heating3

    grid = create_dummy_grid()

    zero = PISM.IceModelVec2S(grid, "zero", PISM.WITHOUT_GHOSTS)
    zero.set(0.0)

    cell_type = PISM.IceModelVec2CellType(grid, "mask", PISM.WITHOUT_GHOSTS)
    cell_type.set(PISM.MASK_GROUNDED)

    basal_heat_flux = PISM.IceModelVec2S(grid, "bheatflx", PISM.WITHOUT_GHOSTS)
    basal_heat_flux.set(convert(10, "mW m-2", "W m-2"))

    ice_thickness = PISM.model.createIceThicknessVec(grid)
    ice_thickness.set(4000.0)
    # TemperatureModel needs ice_thickness to set enthalpy in restart(...)
    grid.variables().add(ice_thickness)

    shelf_base_temp = PISM.IceModelVec2S(grid, "shelfbtemp", PISM.WITHOUT_GHOSTS)
    shelf_base_temp.set(260.0)

    surface_temp = PISM.IceModelVec2S(grid, "surface_temp", PISM.WITHOUT_GHOSTS)
    surface_temp.set(260.0)

    strain_heating3 = PISM.IceModelVec3(grid, "sigma", PISM.WITHOUT_GHOSTS)

    u = PISM.IceModelVec3(grid, "u", PISM.WITHOUT_GHOSTS)

    v = PISM.IceModelVec3(grid, "v", PISM.WITHOUT_GHOSTS)

    w = PISM.IceModelVec3(grid, "w", PISM.WITHOUT_GHOSTS)

    ice_thickness.set(4000.0)
    u.set(0.0)
    v.set(0.0)
    w.set(0.0)

    basal_melt_rate = zero
    climatic_mass_balance = zero

    inputs = PISM.EnergyModelInputs()

    inputs.cell_type = cell_type
    inputs.basal_frictional_heating = zero
    inputs.basal_heat_flux = basal_heat_flux
    inputs.ice_thickness = ice_thickness
    inputs.surface_liquid_fraction = zero
    inputs.shelf_base_temp = shelf_base_temp
    inputs.surface_temp = surface_temp
    inputs.till_water_thickness = zero
    inputs.volumetric_heating_rate = strain_heating3
    inputs.u3 = u
    inputs.v3 = v
    inputs.w3 = w