Commit 60d3ba85 authored by Lukas Bentkamp's avatar Lukas Bentkamp Committed by Cristian Lalescu
Browse files

testing Gaussian field on cluster

parent 9953edec
......@@ -5,7 +5,7 @@ from scipy import trapz
from scipy.stats import norm
from scipy.integrate import quad
import h5py
import sys
import sys, os
import time
import TurTLE
......@@ -17,7 +17,6 @@ except:
plt = None
def main():
c = TEST()
# size of grid
n = 1024
slope = -5./3.
......@@ -29,23 +28,27 @@ def main():
rseed = int(time.time())
simname = 'Gaussianity_test'
opt = c.launch(
['Gauss_field_test',
'--nx', str(n),
'--ny', str(n),
'--nz', str(n),
'--simname', simname,
'--np', '4',
'--ntpp', '1',
'--wd', './',
'--histogram_bins', str(bin_no),
'--max_velocity_estimate', '8.',
'--spectrum_slope', str(slope),
'--spectrum_k_cutoff', str(k_cutoff),
'--spectrum_coefficient', str(coeff),
'--field_random_seed', str(rseed)] +
sys.argv[1:])
plot_stuff(c.simname, total_energy = total_energy)
if not os.path.exists(simname+'.h5'):
c = TEST()
opt = c.launch(
['Gauss_field_test',
'--nx', str(n),
'--ny', str(n),
'--nz', str(n),
'--simname', simname,
'--np', '4',
'--environment', 'short',
'--minutes', '60',
'--ntpp', '1',
'--wd', './',
'--histogram_bins', str(bin_no),
'--max_velocity_estimate', '8.',
'--spectrum_slope', str(slope),
'--spectrum_k_cutoff', str(k_cutoff),
'--spectrum_coefficient', str(coeff),
'--field_random_seed', str(rseed)] +
sys.argv[1:])
plot_stuff(simname, total_energy = total_energy)
return None
def plot_stuff(simname, total_energy = 1.):
......@@ -107,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(k2sum_analytic))
print('Analytically: {}'.format(coeff*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'][()])))
print('Energy sum: {}'.format(np.sum(k2spec_trace*df['kspace/dk'][()])/2.))
df.close()
return None
......
Markdown is supported
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