Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TurTLE
TurTLE
Commits
70d2f4ec
Commit
70d2f4ec
authored
Jan 21, 2020
by
Lukas Bentkamp
Committed by
Cristian Lalescu
Jan 30, 2020
Browse files
comparing to analytic integral
parent
60d3ba85
Changes
1
Hide whitespace changes
Inline
Side-by-side
TurTLE/test/test_Gaussian_field.py
View file @
70d2f4ec
...
...
@@ -110,12 +110,12 @@ def plot_stuff(simname, total_energy = 1.):
print
(
'----------- k2-premultiplied spectrum -----------'
)
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
]
print
(
'Analytically: {}'
.
format
(
coeff
*
k2sum_analytic
))
print
(
'Analytically: {}'
.
format
(
k2sum_analytic
))
k2spec_trace
=
(
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'
][...,
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
()
return
None
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment