Commit 70d2f4ec authored by Lukas Bentkamp's avatar Lukas Bentkamp Committed by Cristian Lalescu
Browse files

comparing to analytic integral

parent 60d3ba85
...@@ -110,12 +110,12 @@ def plot_stuff(simname, total_energy = 1.): ...@@ -110,12 +110,12 @@ def plot_stuff(simname, total_energy = 1.):
print('----------- k2-premultiplied spectrum -----------') print('----------- k2-premultiplied spectrum -----------')
k2func = lambda k, k_c=k_cutoff, s=slope : k**(2+s)*np.exp(-k/k_c) k2func = lambda k, k_c=k_cutoff, s=slope : k**(2+s)*np.exp(-k/k_c)
k2sum_analytic = quad(k2func, 0, k_cutoff*20)[0] k2sum_analytic = quad(k2func, 0, k_cutoff*20)[0]
print('Analytically: {}'.format(coeff*k2sum_analytic)) print('Analytically: {}'.format(k2sum_analytic))
k2spec_trace = ( k2spec_trace = (
df['statistics/spectra/k*velocity_k*velocity'][..., 0, 0] df['statistics/spectra/k*velocity_k*velocity'][..., 0, 0]
+ df['statistics/spectra/k*velocity_k*velocity'][..., 1, 1] + df['statistics/spectra/k*velocity_k*velocity'][..., 1, 1]
+ df['statistics/spectra/k*velocity_k*velocity'][..., 2, 2]) + df['statistics/spectra/k*velocity_k*velocity'][..., 2, 2])
print('Energy sum: {}'.format(np.sum(k2spec_trace*df['kspace/dk'][()])/2.)) print('Energy sum: {}'.format(np.sum(k2spec_trace*df['kspace/dk'][()])/2./coeff))
df.close() df.close()
return None return None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment