Beispiel #1
0
def test_evaporation_no_wind():
    evap = Evaporation(Water(), wind=constant_wind(0., 0))
    (sc, time_step) = weathering_data_arrays(evap.array_types, evap.water)[:2]

    model_time = (sc.spills[0].release_time + timedelta(seconds=time_step))

    evap.prepare_for_model_run(sc)
    evap.prepare_for_model_step(sc, time_step, model_time)
    evap.weather_elements(sc, time_step, model_time)
    for spill in sc.spills:
        mask = sc.get_spill_mask(spill)
        assert np.all(sc['evap_decay_constant'][mask, :] < 0.0)
Beispiel #2
0
def test_evaporation_no_wind():
    evap = Evaporation(Water(), wind=constant_wind(0., 0))
    (sc, time_step) = weathering_data_arrays(evap.array_types, evap.water)[:2]

    model_time = (sc.spills[0].get('release_time') +
                  timedelta(seconds=time_step))

    evap.prepare_for_model_run(sc)
    evap.prepare_for_model_step(sc, time_step, model_time)
    evap.weather_elements(sc, time_step, model_time)
    for spill in sc.spills:
        mask = sc.get_spill_mask(spill)
        assert np.all(sc['evap_decay_constant'][mask, :] < 0.0)
Beispiel #3
0
def test_evaporation(oil, temp, num_elems, on):
    '''
    still working on tests ..
    '''
    et = floating(substance=oil)
    time_step = 15. * 60

    evap = Evaporation(Water(), wind=constant_wind(1., 0))
    evap.on = on

    sc = weathering_data_arrays(evap.array_types, evap.water, time_step, et)[0]

    model_time = (sc.spills[0].get('release_time') +
                  timedelta(seconds=time_step))

    evap.prepare_for_model_run(sc)
    evap.prepare_for_model_step(sc, time_step, model_time)
    init_mass = sc['mass_components'].copy()
    evap.weather_elements(sc, time_step, model_time)

    if on:
        assert np.all(sc['frac_lost'] > 0) and np.all(sc['frac_lost'] < 1.0)

        # all elements experience the same evaporation
        assert np.all(sc['frac_lost'][0] == sc['frac_lost'])

    for spill in sc.spills:
        mask = sc.get_spill_mask(spill)
        if on:
            assert np.all(sc['evap_decay_constant'][mask, :] < 0.0)
        else:
            assert np.all(sc['evap_decay_constant'][mask, :] == 0.0)

    print '\nevap_decay_const', sc['evap_decay_constant']
    print 'frac_lost', sc['frac_lost']

    if on:
        assert sc.mass_balance['evaporated'] > 0.0
        print 'total evaporated', sc.mass_balance['evaporated']
    else:
        assert 'evaporated' not in sc.mass_balance
        assert np.all(sc['mass_components'] == init_mass)
Beispiel #4
0
def test_evaporation(oil, temp, num_elems, on):
    '''
    still working on tests ..
    '''
    et = floating(substance=oil)
    time_step = 15. * 60

    evap = Evaporation(Water(), wind=constant_wind(1., 0))
    evap.on = on

    sc = weathering_data_arrays(evap.array_types, evap.water, time_step, et)[0]

    model_time = (sc.spills[0].release_time +
                  timedelta(seconds=time_step))

    evap.prepare_for_model_run(sc)
    evap.prepare_for_model_step(sc, time_step, model_time)
    init_mass = sc['mass_components'].copy()
    evap.weather_elements(sc, time_step, model_time)

    if on:
        assert np.all(sc['frac_lost'] > 0) and np.all(sc['frac_lost'] < 1.0)

        # all elements experience the same evaporation
        assert np.all(sc['frac_lost'][0] == sc['frac_lost'])

    for spill in sc.spills:
        mask = sc.get_spill_mask(spill)
        if on:
            assert np.all(sc['evap_decay_constant'][mask, :] < 0.0)
        else:
            assert np.all(sc['evap_decay_constant'][mask, :] == 0.0)

    print '\nevap_decay_const', sc['evap_decay_constant']
    print 'frac_lost', sc['frac_lost']

    if on:
        assert sc.mass_balance['evaporated'] > 0.0
        print 'total evaporated', sc.mass_balance['evaporated']
    else:
        assert 'evaporated' not in sc.mass_balance
        assert np.all(sc['mass_components'] == init_mass)