def __init__(self, layers, rho0=None, p0=None, gas_properties=None): self.layers = layers if gas_properties is None: self.gas_properties = ref_gas_properties.AtmosphericAir() else: self.gas_properties = gas_properties # create an instance of HydroststaticallyBalancedAtmosphere for # each layer self.layer_instances = {} # ground state z_min = 0.0 if rho0 is None: rho0 = 1.205 if p0 is None: p0 = 101325.0 for layer in self.layers: z_max = layer['z_max'] z = (z_min, z_max) layer_instance = HydrostaticallyBalancedAtmosphere( rho0=rho0, p0=p0, dTdz=layer['dTdz'], gas_properties=self.gas_properties, ) self.layer_instances[z] = layer_instance # calculate the start values of the next layer, remember that this # layer is offset. z_offset = z_max - z_min z_min = z_max rho0 = layer_instance.rho([z_offset]) p0 = layer_instance.p([z_offset])
def getStandardIsothermalAtmosphere(): gas_properties = ref_gas_properties.AtmosphericAir() rho0 = 1.205 p0 = 101325.0 dTdz = 0.0 # isothermal g = scipy.constants.g return HydrostaticallyBalancedAtmosphere(rho0=rho0, p0=p0, dTdz=dTdz, gas_properties=gas_properties, g=g)
def getConstantDensityAtmosphere(): gas_properties = ref_gas_properties.AtmosphericAir() rho0 = 1.205 p0 = 101325.0 g = scipy.constants.g dTdz = -g / gas_properties.R() return HydrostaticallyBalancedAtmosphere(rho0=rho0, p0=p0, dTdz=dTdz, gas_properties=gas_properties, g=g)
def getKleinIsentropicAtmosphere(): gas_properties = ref_gas_properties.AtmosphericAir() rho0 = 1.0 g = 10.0 T0 = 300.0 p0 = rho0 * gas_properties.R() * T0 dTdz = -g / gas_properties.cp() return HydrostaticallyBalancedAtmosphere(rho0=rho0, p0=p0, dTdz=dTdz, gas_properties=gas_properties, g=g)
def getIsentropicAtmosphere(theta0=300.0, g=9.81, p0=1.0e6): """ Generate an isentropic atmopsheric profile. """ gas_properties = ref_gas_properties.AtmosphericAir() T0 = theta0 rho0 = p0 / T0 * 1.0 / gas_properties.R() dTdz = -g / gas_properties.cp() return HydrostaticallyBalancedAtmosphere(rho0=rho0, p0=p0, dTdz=dTdz, gas_properties=gas_properties, g=g)
def __init__(self, dTdz_offset=1.0e-3): gas_properties = ref_gas_properties.AtmosphericAir() rho0 = 1.205 p0 = 101325.0 g = scipy.constants.g dTdz = -g / gas_properties.cp() + dTdz_offset super(NearIsentropic, self).__init__(rho0=rho0, p0=p0, dTdz=dTdz, gas_properties=gas_properties, g=g) self.dTdz_offset = dTdz_offset
def __init__(self): gas_properties = ref_gas_properties.AtmosphericAir() g = scipy.constants.g dTdz = -g / gas_properties.cp() rho0 = 1.205 p0 = 101325.0 layers = [] layers.append({ 'z_max': 2.0e3, 'dTdz': dTdz + 1.0e-3, }) layers.append({'z_max': np.finfo('f').max, 'dTdz': dTdz + 5.0e-3}) super(LayeredStable, self).__init__(layers=layers, rho0=rho0, p0=p0)
def __init__(self, cloud_base_height=None): self.cloud_base_height = cloud_base_height layers = [] dTdz_dry = -10.0e-3 # K/m dTdz_moist = -6.0e-3 # K/m RH0 = 0.70 if self.cloud_base_height is not None: layer_thickness_0 = self.cloud_base_height # m # TODO: This is completely arbitrary, the RH needs lowering that's # for sure, not sure how much at this point if cloud_base_height == 1600.: RH0 = 0.50 elif cloud_base_height == 1100.: RH0 = 0.59 else: raise NotImplementedError else: layer_thickness_0 = 800.0 # m RH_LCL = 0.90 dRHdz_0 = (RH_LCL - RH0) / layer_thickness_0 # %/m dRHdz_1 = -0.075e-3 # %/m layers.append({ 'z_max': layer_thickness_0, 'dTdz': dTdz_dry, 'dRHdz': dRHdz_0 }) layers.append({'z_max': 12800., 'dTdz': dTdz_moist, 'dRHdz': dRHdz_1}) layers.append({'z_max': np.finfo('f').max, 'dTdz': 0.0, 'dRHdz': 0.0}) T0 = 25.0 + 273.15 # [K], from Soong 1973 paper p0 = 101325.0 # [Pa], default value used, Soong 1973 doesn't give a value gas_properties = ref_gas_properties.AtmosphericAir() rho0 = p0 / T0 * 1.0 / gas_properties.R() super(Soong1973, self).__init__(layers=layers, RH0=RH0, RH_min=0.3, rho0=rho0, p0=p0)
def __init__(self, layers, RH0, RH_min=None, rho0=None, p0=None): self.layers = layers self.RH_min = RH_min self.RH0 = RH0 self.gas_properties = ref_gas_properties.AtmosphericAir() # create an instance of HydrostHydrostaticallyBalancedAtmosphere for # each layer self.layer_instances = {} # ground state z_min = 0.0 if rho0 is None: rho0 = 1.205 if p0 is None: p0 = 101325.0 RH0 = self.RH0 for layer in self.layers: z_max = layer['z_max'] z = (z_min, z_max) layer_instance = PseudoHydrostaticallyBalancedMoistAtmosphere( rho0=rho0, p0=p0, dTdz=layer['dTdz'], dRHdz=layer['dRHdz'], RH0=RH0, gas_properties=self.gas_properties, ) self.layer_instances[z] = layer_instance # calculate the start values of the next layer, remember that this # layer is offset. z_offset = z_max - z_min z_min = z_max rho0 = layer_instance.rho([z_offset]) p0 = layer_instance.p([z_offset]) RH0 = layer_instance.rel_humidity([z_offset])