示例#1
0
 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])
示例#2
0
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)
示例#3
0
 def get_component_instance(self, state_modification_func=lambda x: x):
     emanuel = EmanuelConvection()
     emanuel.current_time_step = timedelta(seconds=300)
     return emanuel
示例#4
0
 def get_component_instance(self):
     return GFSDynamicalCore([EmanuelConvection()])
示例#5
0
 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)
示例#7
0
                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