Skip to content
Snippets Groups Projects
Commit 22668f04 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

fix nyquist frequency in mann_parameters.var2ae and mann_parameters.ae2ti. The...

parent 7ac398d1
No related branches found
No related tags found
1 merge request!216fix nyquist frequency in mann_parameters.var2ae and mann_parameters.ae2ti. The...
Pipeline #45292 failed
......@@ -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]
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment