Commit 149020bb authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fix dkz/Lz options

parent b8bd79ea
...@@ -718,7 +718,7 @@ class DNS(_code): ...@@ -718,7 +718,7 @@ class DNS(_code):
opt.dkx = 2. / opt.Lx opt.dkx = 2. / opt.Lx
if type(opt.dky) == type(None): if type(opt.dky) == type(None):
opt.dky = 2. / opt.Ly opt.dky = 2. / opt.Ly
if type(opt.dkx) == type(None): if type(opt.dkz) == type(None):
opt.dkz = 2. / opt.Lz opt.dkz = 2. / opt.Lz
if type(opt.nx) == type(None): if type(opt.nx) == type(None):
opt.nx = opt.n opt.nx = opt.n
......
...@@ -31,14 +31,17 @@ def main(): ...@@ -31,14 +31,17 @@ def main():
energyk = c.statistics['energy(k)'] energyk = c.statistics['energy(k)']
nshell = c.get_data_file()['kspace/nshell'].value nshell = c.get_data_file()['kspace/nshell'].value
renergy = np.mean(c.statistics['renergy(t)']) renergy = np.mean(c.statistics['renergy(t)'])
print(renergy, np.trapz(energyk[:-2], c.statistics['kshell'][:-2])) print(renergy, np.sum(energyk[:-2]) * (c.parameters['dkx']*c.parameters['dky']*c.parameters['dkz']))
print(c.parameters['dkx'], c.parameters['dky'], c.parameters['dkz'])
f = plt.figure() f = plt.figure()
a = f.add_subplot(111) a = f.add_subplot(111)
a.plot(c.statistics['kshell'], energyk) a.plot(c.statistics['kshell'], energyk, label = 'unnormalized')
a.plot(c.statistics['kshell'], (energyk / nshell)*(4*np.pi*c.statistics['kshell']**2)) a.plot(c.statistics['kshell'], (energyk / nshell)*(4*np.pi*c.statistics['kshell']**2), label = 'normalized')
a.set_yscale('log') #a.set_yscale('log')
a.set_xscale('log') a.set_xscale('log')
a.legend(loc = 'best')
f.tight_layout()
f.savefig('spectrum.pdf') f.savefig('spectrum.pdf')
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