def get_component_instance(self): # Create Radiation Prognostic radiation = RRTMGLongwave() # Create Convection Prognostic convection = EmanuelConvection() # Create a SimplePhysics Prognostic boundary_layer = TimeDifferencingWrapper(SimplePhysics()) return GFSDynamicalCore([radiation, convection, boundary_layer])
def test_various_init_parameters_emanuel(): with pytest.raises(ValueError) as excinfo: EmanuelConvection(convective_momentum_transfer_coefficient=2) assert 'Momentum transfer' in str(excinfo.value) with pytest.raises(ValueError) as excinfo: EmanuelConvection(downdraft_area_fraction=2) assert 'Downdraft' in str(excinfo.value) with pytest.raises(ValueError) as excinfo: EmanuelConvection(precipitation_fraction_outside_cloud=-3) assert 'Outside cloud' in str(excinfo.value) with pytest.raises(NotImplementedError) as excinfo: EmanuelConvection(number_of_tracers=2) assert 'additional tracers' in str(excinfo.value)
def get_component_instance(self, state_modification_func=lambda x: x): emanuel = EmanuelConvection() emanuel.current_time_step = timedelta(seconds=300) return emanuel
def get_component_instance(self): return GFSDynamicalCore([EmanuelConvection()])
def get_component_instance(self): emanuel = EmanuelConvection() return emanuel
ax.plot( net_flux.values.flatten(), state['air_pressure_on_interface_levels'].to_units( 'mbar').values.flatten(), '-o') ax.set_title('Net Flux') ax.axes.invert_yaxis() ax.set_xlabel('W/m^2') ax.grid() plt.tight_layout() monitor = PlotFunctionMonitor(plot_function) timestep = timedelta(minutes=5) convection = EmanuelConvection() radiation_sw = RRTMGShortwave() radiation_lw = RRTMGLongwave() slab = SlabSurface() simple_physics = SimplePhysics() store_quantities = [ 'air_temperature', 'air_pressure', 'specific_humidity', 'air_pressure_on_interface_levels', 'air_temperature_tendency_from_convection', 'air_temperature_tendency_from_longwave', 'air_temperature_tendency_from_shortwave' ] netcdf_monitor = NetCDFMonitor('rad_conv_eq.nc', store_names=store_quantities, write_on_store=True)
state['downwelling_shortwave_flux_in_air']) ax.plot( net_flux.values.flatten(), state['air_pressure_on_interface_levels'].to_units( 'mbar').values.flatten(), '-o') ax.set_title('Net Flux') ax.axes.invert_yaxis() ax.set_xlabel('W/m^2') ax.grid() plt.tight_layout() monitor = PlotFunctionMonitor(plot_function) timestep = timedelta(minutes=10) convection = EmanuelConvection() radiation_sw = RRTMGShortwave() radiation_lw = RRTMGLongwave() slab = SlabSurface() simple_physics = SimplePhysics() dry_convection = DryConvectiveAdjustment() state = get_default_state([ simple_physics, convection, dry_convection, radiation_lw, radiation_sw, slab ]) state['air_temperature'].values[:] = 290 state['surface_albedo_for_direct_shortwave'].values[:] = 0.4 state['surface_albedo_for_direct_near_infrared'].values[:] = 0.4 state['surface_albedo_for_diffuse_shortwave'].values[:] = 0.4