diff --git a/wetb/wind/turbulence/mann_parameters.py b/wetb/wind/turbulence/mann_parameters.py index 4e878fddec378a4fedb734166c14385d7c89c135..ad5bf5a93912dc4c87e72385f8f63a2223e2e5e7 100644 --- a/wetb/wind/turbulence/mann_parameters.py +++ b/wetb/wind/turbulence/mann_parameters.py @@ -216,7 +216,7 @@ def var2ae(variance, L, G, U, T=600, sample_frq=10, plt=False): frequency range [1/length, sample_frq] equal to the variance of u """ - k_low, k_high = 2 * np.pi / (U * np.array([T, 1 / sample_frq])) + k_low, k_high = 2 * np.pi / (U * np.array([T, 2 / sample_frq])) k1 = 10 ** (np.linspace(np.log10(k_low), np.log10(k_high), 1000)) def get_var(uu): @@ -237,7 +237,7 @@ def var2ae(variance, L, G, U, T=600, sample_frq=10, plt=False): def ae2ti(ae23, L, G, U, T=600, sample_frq=10): - k_low, k_high = 2 * np.pi / (U * np.array([T, 1 / sample_frq])) + k_low, k_high = 2 * np.pi / (U * np.array([T, 2 / sample_frq])) k1 = 10 ** (np.linspace(np.log10(k_low), np.log10(k_high), 1000)) uu = get_mann_model_spectra(ae23, L, G, k1)[0] diff --git a/wetb/wind/turbulence/tests/test_mann_parameters.py b/wetb/wind/turbulence/tests/test_mann_parameters.py index 179ecd39e3d2a4f713af172ef388ea64c2999199..c6c0a4794538973b3caf7194412bd31e1f2bed99 100644 --- a/wetb/wind/turbulence/tests/test_mann_parameters.py +++ b/wetb/wind/turbulence/tests/test_mann_parameters.py @@ -121,7 +121,7 @@ class TestMannTurbulence(unittest.TestCase): # should be independent of U dt = dx / U T = 16384 / U - self.assertAlmostEqual(var2ae(variance=u.var(), L=10, G=3.3, U=U, T=T, sample_frq=1 / dt), .15, delta=.021) + self.assertAlmostEqual(var2ae(variance=u.var(), L=10, G=3.3, U=U, T=T, sample_frq=1 / dt), .15, delta=.024) def test_var2ae_T(self): u = mann_turbulence.load(get_test_file("h2a8192_8_8_16384_32_32_0.15_10_3.3u.dat"), (8192, 8, 8)) @@ -134,7 +134,7 @@ class TestMannTurbulence(unittest.TestCase): u_ = u.T.reshape((u.T.shape * np.array([n, 1 / n])).astype(int)).T var = u_.var(0).mean() ae = var2ae(variance=var, L=10, G=3.3, U=U, T=dx * u_.shape[0] / U, sample_frq=1 / dt) - self.assertAlmostEqual(ae, .15, delta=.025) + self.assertAlmostEqual(ae, .15, delta=.027) def test_var2ae_dt(self): u = mann_turbulence.load(get_test_file("h2a16384_8_8_65536_32_32_0.15_40_4.0u.dat"), (16384, 8, 8)) @@ -149,9 +149,8 @@ class TestMannTurbulence(unittest.TestCase): u_ = u.reshape(u.shape[0] // n, n, u.shape[1]).mean(1) var = u_.var(0).mean() - ae = var2ae(variance=var, L=40, G=4, U=U, T=T, sample_frq=1 / (n * dx / U), plt=False) - #print(u_.shape, var, ae) - self.assertAlmostEqual(ae, .15, delta=.04) + ae = var2ae(variance=var, L=40, G=4, U=U, T=T, sample_frq=1 / (n * dx / U)) + self.assertAlmostEqual(ae, .15, delta=.041 + i / 100) def test_fit_ae2var(self): u = mann_turbulence.load(get_test_file("h2a8192_8_8_16384_32_32_0.15_10_3.3u.dat"), (8192, 8, 8))