Skip to content
Snippets Groups Projects
Commit f8c8d1f0 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

make stat plot prettier

parent cb401d09
No related branches found
No related tags found
No related merge requests found
...@@ -127,9 +127,6 @@ class NavierStokes(bfps.code): ...@@ -127,9 +127,6 @@ class NavierStokes(bfps.code):
strncpy(fs->forcing_type, forcing_type, 128); strncpy(fs->forcing_type, forcing_type, 128);
fs->iteration = iter0; fs->iteration = iter0;
fs->read('v', 'c'); fs->read('v', 'c');
fs->low_pass_Fourier(fs->cvorticity, 3, fs->kM);
//fs->force_divfree(fs->cvorticity);
fs->symmetrize(fs->cvorticity, 3);
if (myrank == 0) if (myrank == 0)
{ {
sprintf(fname, "%s_stats.bin", simname); sprintf(fname, "%s_stats.bin", simname);
...@@ -338,9 +335,9 @@ def test(opt): ...@@ -338,9 +335,9 @@ def test(opt):
c.parameters['ny'] = opt.n c.parameters['ny'] = opt.n
c.parameters['nz'] = opt.n c.parameters['nz'] = opt.n
c.parameters['nu'] = 5.5*opt.n**(-4./3) c.parameters['nu'] = 5.5*opt.n**(-4./3)
c.parameters['dt'] = 2e-3 c.parameters['dt'] = 5e-3
c.parameters['niter_todo'] = opt.nsteps c.parameters['niter_todo'] = opt.nsteps
c.parameters['famplitude'] = 0.0 c.parameters['famplitude'] = 1.
c.parameters['nparticles'] = 32 c.parameters['nparticles'] = 32
if opt.particles: if opt.particles:
c.add_particles() c.add_particles()
...@@ -369,11 +366,15 @@ def test(opt): ...@@ -369,11 +366,15 @@ def test(opt):
a.legend(loc = 'best') a.legend(loc = 'best')
a = fig.add_subplot(122) a = fig.add_subplot(122)
a.plot(stats['t'], stats['energy'], label = 'energy', color = (0, 0, 1)) a.plot(stats['t'], stats['energy'], label = 'energy', color = (0, 0, 1))
a.set_ylabel('energy') a.set_ylabel('energy', color = (0, 0, 1))
a.set_xlabel('$t$') a.set_xlabel('$t$')
for tt in a.get_yticklabels():
tt.set_color((0, 0, 1))
b = a.twinx() b = a.twinx()
b.plot(stats['t'], stats['enstrophy'], label = 'enstrophy', color = (1, 0, 0)) b.plot(stats['t'], stats['enstrophy'], label = 'enstrophy', color = (1, 0, 0))
b.set_ylabel('enstrophy') b.set_ylabel('enstrophy', color = (1, 0, 0))
for tt in b.get_yticklabels():
tt.set_color((1, 0, 0))
fig.savefig('stats.pdf', format = 'pdf') fig.savefig('stats.pdf', format = 'pdf')
# plot spectra # plot spectra
...@@ -385,9 +386,12 @@ def test(opt): ...@@ -385,9 +386,12 @@ def test(opt):
a.set_yscale('log') a.set_yscale('log')
a.set_title('velocity') a.set_title('velocity')
a = fig.add_subplot(122) a = fig.add_subplot(122)
for i in range(0, ensspec.shape[0]): for i in range(0, ensspec.shape[0], 64):
a.plot(k, ensspec[i]['val'], color = (i*1./ensspec.shape[0], 0, 1 - i*1./ensspec.shape[0])) a.plot(k, ensspec[i]['val'],
a.plot(k, k**2*enespec[i]['val'], color = (0, 1 - i*1./ensspec.shape[0], i*1./ensspec.shape[0])) color = (i*1./ensspec.shape[0], 0, 1 - i*1./ensspec.shape[0]))
a.plot(k, k**2*enespec[i]['val'],
color = (0, 1 - i*1./ensspec.shape[0], i*1./ensspec.shape[0]),
dashes = (2, 2))
a.set_xscale('log') a.set_xscale('log')
a.set_yscale('log') a.set_yscale('log')
a.set_title('vorticity') a.set_title('vorticity')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment