def config(self, step): '''Generates a config file containing flags and parameters for a particular experiment and step. This takes care of flags and parameters that *cannot* be set using command-line options. (We try to use command-line options whenever we can.) ''' filename = "MISMIP_conf_%s_A%s.nc" % (self.experiment, step) nc = NC(filename, 'w', format="NETCDF3_CLASSIC") var = nc.createVariable("pism_overrides", 'i') attrs = {"is_dry_simulation": "no", "include_bmr_in_continuity": "no", "compute_surf_grad_inward_ssa": "no", "ice_softness": MISMIP.A(self.experiment, step), "ice_density": MISMIP.rho_i(), "sea_water_density": MISMIP.rho_w(), "bootstrapping_geothermal_flux_value_no_var": 0.0, "Glen_exponent": MISMIP.n(), "standard_gravity": MISMIP.g(), "ocean_sub_shelf_heat_flux_into_ice": 0.0, } if self.model != 1: attrs["bed_smoother_range"] = 0.0 for name, value in attrs.iteritems(): var.setncattr(name, value) nc.close() return filename
def config(self, step): '''Generates a config file containing flags and parameters for a particular experiment and step. This takes care of flags and parameters that *cannot* be set using command-line options. (We try to use command-line options whenever we can.) ''' filename = "MISMIP_conf_%s_A%s.nc" % (self.experiment, step) nc = NC(filename, 'w', format="NETCDF3_CLASSIC") var = nc.createVariable("pism_overrides", 'i') attrs = { "is_dry_simulation": "no", "include_bmr_in_continuity": "no", "compute_surf_grad_inward_ssa": "no", "ice_softness": MISMIP.A(self.experiment, step), "ice_density": MISMIP.rho_i(), "sea_water_density": MISMIP.rho_w(), "bootstrapping_geothermal_flux_value_no_var": 0.0, "Glen_exponent": MISMIP.n(), "standard_gravity": MISMIP.g(), "ocean_sub_shelf_heat_flux_into_ice": 0.0, "bed_smoother_range": 0.0, } for name, value in attrs.iteritems(): var.setncattr(name, value) nc.close() return filename
def config(self, step): '''Generates a config file containing flags and parameters for a particular experiment and step. This takes care of flags and parameters that *cannot* be set using command-line options. (We try to use command-line options whenever we can.) ''' filename = "MISMIP_conf_%s_A%s.nc" % (self.experiment, step) nc = NC(filename, 'w', format="NETCDF3_CLASSIC") var = nc.createVariable("pism_overrides", 'i') attrs = { "ocean.always_grounded": "no", "geometry.update.use_basal_melt_rate": "no", "stress_balance.ssa.compute_surface_gradient_inward": "no", "flow_law.isothermal_Glen.ice_softness": MISMIP.A(self.experiment, step), "constants.ice.density": MISMIP.rho_i(), "constants.sea_water.density": MISMIP.rho_w(), "bootstrapping.defaults.geothermal_flux": 0.0, "stress_balance.ssa.Glen_exponent": MISMIP.n(), "constants.standard_gravity": MISMIP.g(), "ocean.sub_shelf_heat_flux_into_ice": 0.0, } if self.model != 1: attrs["stress_balance.sia.bed_smoother.range"] = 0.0 for name, value in attrs.items(): var.setncattr(name, value) nc.close() return filename
def thickness(x, step, Q0, H0, calving_front=1750e3, perturbation='default'): # we expect x to have an odd number of grid points so that one of them is # at 0 if x.size % 2 != 1: raise ValueError("x has to have an odd number of points, got %d", x.size) dx = x[1] - x[0] A0 = MISMIP.A('1a', step) print(A0, A0**(-1.0 / 3.0)) B0 = A0**(-1.0 / MISMIP.n()) #C = (900.0*9.8/(4.0*B0)*(1.0-900.0/1000.0))**3.0 C = (MISMIP.rho_i() * MISMIP.g() / (4.0 * B0) * (1.0 - MISMIP.rho_i() / MISMIP.rho_w()))**MISMIP.n() thk = (4.0 * C * np.maximum(x - 100e3, eps) / Q0 + H0**(-4.0))**(-0.25) #thk = (x-100e3)*(-1e-4) + 800.0 thk[x < 100e3] = 800.0 thk[0] = 0.0 if perturbation == 'p1': #perturbation i thk[x > calving_front - 1 * dx] -= 50.0 elif perturbation == 'p2': #perutbation i-1 thk[x > calving_front - 2 * dx] -= 50.0 thk[x > calving_front - 1 * dx] += 50.0 elif perturbation == 'p3': #perutbation i-2 thk[x > calving_front - 3 * dx] -= 50.0 thk[x > calving_front - 2 * dx] += 50.0 #perutbation gli+1 #thk[ x > 100e3 + 0.5*dx ] -= 200.0 #thk[ x > 100e3+1.5*dx ] += 200.0 #perutbation gli+2 #thk[ x > 100e3 + 1.5*dx ] -= 200.0 #thk[ x > 100e3+2.5*dx ] += 200.0 thk[x > calving_front] = 0.0 return np.tile(thk, (3, 1))