def test_delvigne_sweeney(): wind_speed = 10.0 T_w = PiersonMoskowitz.peak_wave_period(wind_speed) assert np.isclose(DelvigneSweeney.breaking_waves_frac(wind_speed, 10.0), 0.016) assert np.isclose(DelvigneSweeney.breaking_waves_frac(wind_speed, T_w), 0.0213333)
def peak_wave_period(self, time): ''' :param time: the time you want the wave data for :type time: datetime.datetime object :returns: peak wave period (s) ''' U = self.wind.get_value(time)[0] return PiersonMoskowitz.peak_wave_period(U)
def peak_wave_period(self, points, time): ''' :param time: the time you want the wave data for :type time: datetime.datetime object :returns: peak wave period (s) ''' U = self.get_wind_speed(points, time) # only need velocity return PiersonMoskowitz.peak_wave_period(U)
def calm_between_wave_breaks(self, model_time, time_step, time_spent_in_wc=0.0): wind_speed = max(.1, self.waves.wind.get_value(model_time)[0]) wave_period = PiersonMoskowitz.peak_wave_period(wind_speed) f_bw = DelvigneSweeney.breaking_waves_frac(wind_speed, wave_period) T_calm = DingFarmer.calm_between_wave_breaks(f_bw, wave_period) return np.clip(T_calm, 0.0, float(time_step) - time_spent_in_wc)
def water_column_time_fraction(self, points, model_time, water_phase_xfer_velocity): wave_height = self.waves.get_value(points, model_time)[0] wind_speed = np.clip(self.get_wind_speed(points, model_time), 0.01, None) wave_period = PiersonMoskowitz.peak_wave_period(wind_speed) f_bw = DelvigneSweeney.breaking_waves_frac(wind_speed, wave_period) return DingFarmer.water_column_time_fraction( f_bw, wave_period, wave_height, water_phase_xfer_velocity)
def water_column_time_fraction(self, model_time, water_phase_xfer_velocity): wave_height = self.waves.get_value(model_time)[0] wind_speed = max(.1, self.waves.wind.get_value(model_time)[0]) wave_period = PiersonMoskowitz.peak_wave_period(wind_speed) f_bw = DelvigneSweeney.breaking_waves_frac(wind_speed, wave_period) return DingFarmer.water_column_time_fraction(f_bw, wave_period, wave_height, water_phase_xfer_velocity)
def water_column_time_fraction(self, points, model_time, water_phase_xfer_velocity): wave_height = self.waves.get_value(points, model_time)[0] wind_speed = np.clip(self.get_wind_speed(points, model_time), 0.01, None) wave_period = PiersonMoskowitz.peak_wave_period(wind_speed) f_bw = DelvigneSweeney.breaking_waves_frac(wind_speed, wave_period) return DingFarmer.water_column_time_fraction(f_bw, wave_period, wave_height, water_phase_xfer_velocity)
def test_ding_farmer(): wind_speed = 10.0 # m/s rdelta = 200.0 # oil/water density difference (kg / m^3) droplet_diameter = 0.0002 # 200 microns wave_height = PiersonMoskowitz.significant_wave_height(wind_speed) wave_period = PiersonMoskowitz.peak_wave_period(wind_speed) f_bw = DelvigneSweeney.breaking_waves_frac(wind_speed, wave_period) k_w = Stokes.water_phase_xfer_velocity(rdelta, droplet_diameter) assert np.isclose(DingFarmer.calm_between_wave_breaks(0.5, 10), 15.0) assert np.isclose(DingFarmer.calm_between_wave_breaks(f_bw, wave_period), 347.8125) assert np.isclose(DingFarmer.refloat_time(wave_height, k_w), 386.0328) assert np.isclose( DingFarmer.water_column_time_fraction(f_bw, wave_period, wave_height, k_w), 1.0)
def test_ding_farmer(): wind_speed = 10.0 # m/s rdelta = 0.2 # oil/water density difference droplet_diameter = 0.0002 # 200 microns wave_height = PiersonMoskowitz.significant_wave_height(wind_speed) wave_period = PiersonMoskowitz.peak_wave_period(wind_speed) f_bw = DelvigneSweeney.breaking_waves_frac(wind_speed, wave_period) k_w = Stokes.water_phase_xfer_velocity(rdelta, droplet_diameter) assert np.isclose(DingFarmer.calm_between_wave_breaks(0.5, 10), 15.0) assert np.isclose(DingFarmer.calm_between_wave_breaks(f_bw, wave_period), 347.8125) assert np.isclose(DingFarmer.refloat_time(wave_height, k_w), 385.90177) assert np.isclose(DingFarmer.water_column_time_fraction(f_bw, wave_period, wave_height, k_w), 1.1095)
def test_pierson_moskowitz(): assert np.isclose(PiersonMoskowitz.significant_wave_height(10.0), 2.24337) assert np.isclose(PiersonMoskowitz.peak_wave_period(10.0), 7.5)