Skip to content
Snippets Groups Projects
Commit c7383dce authored by Chichi Lalescu's avatar Chichi Lalescu
Browse files

fix symmetrize

I'd forgotten a multiplication with howmany
parent 3f3bc117
Branches
Tags
No related merge requests found
...@@ -278,18 +278,22 @@ void fluid_solver_base<R>::symmetrize(C *data, const int howmany) \ ...@@ -278,18 +278,22 @@ void fluid_solver_base<R>::symmetrize(C *data, const int howmany) \
-(*(buffer + howmany*(this->cd->sizes[1]-ii)+cc))[1]; \ -(*(buffer + howmany*(this->cd->sizes[1]-ii)+cc))[1]; \
} \ } \
for (cc = 0; cc < howmany; cc++) { \ for (cc = 0; cc < howmany; cc++) { \
(*((data + (this->cd->sizes[0] - yy - this->cd->starts[0])*this->cd->sizes[1]*this->cd->sizes[2] + cc)))[0] = (*(buffer + cc))[0]; \ (*((data + cc + howmany*(this->cd->sizes[0] - yy - this->cd->starts[0])*this->cd->sizes[1]*this->cd->sizes[2])))[0] = (*(buffer + cc))[0]; \
(*((data + (this->cd->sizes[0] - yy - this->cd->starts[0])*this->cd->sizes[1]*this->cd->sizes[2] + cc)))[1] = -(*(buffer + cc))[1]; \ (*((data + cc + howmany*(this->cd->sizes[0] - yy - this->cd->starts[0])*this->cd->sizes[1]*this->cd->sizes[2])))[1] = -(*(buffer + cc))[1]; \
} \ } \
} \ } \
} \ } \
FFTW(free)(buffer); \ FFTW(free)(buffer); \
delete mpistatus; \ delete mpistatus; \
/* put asymmetric data to 0 */\ /* put asymmetric data to 0 */\
if (this->cd->myrank == this->cd->rank[this->cd->sizes[0]/2]) \ /*if (this->cd->myrank == this->cd->rank[this->cd->sizes[0]/2]) \
{ \ { \
data[(this->cd->sizes[0]/2 - this->cd->starts[0])*this->sizes[1]] \ for (cc = 0; cc < howmany; cc++) \
} \ { \
data[cc + howmany*(this->cd->sizes[0]/2 - this->cd->starts[0])*this->cd->sizes[1]*this->cd->sizes[2]][0] = 0.0; \
data[cc + howmany*(this->cd->sizes[0]/2 - this->cd->starts[0])*this->cd->sizes[1]*this->cd->sizes[2]][1] = 0.0; \
} \
}*/ \
} \ } \
\ \
template<> \ template<> \
......
...@@ -260,17 +260,13 @@ if __name__ == '__main__': ...@@ -260,17 +260,13 @@ if __name__ == '__main__':
'test_rvorticity_i00000', 'test_rvorticity_i00000',
dtype = np.float32).reshape(opt.n, opt.n, opt.n, 3) dtype = np.float32).reshape(opt.n, opt.n, opt.n, 3)
tdata = Rdata.transpose(3, 0, 1, 2).copy() tdata = Rdata.transpose(3, 0, 1, 2).copy()
tdata.tofile('input_for_vortex')
dtype = pickle.load(open(opt.test_name + '_dtype.pickle')) dtype = pickle.load(open(opt.test_name + '_dtype.pickle'))
stats = np.fromfile('test_stats.bin', dtype = dtype) stats = np.fromfile('test_stats.bin', dtype = dtype)
stats_vortex = np.loadtxt('../vortex/sim_000000.log')
fig = plt.figure(figsize = (12,6)) fig = plt.figure(figsize = (12,6))
a = fig.add_subplot(121) a = fig.add_subplot(121)
a.plot(stats['t'], stats['energy']) a.plot(stats['t'], stats['energy'])
a.plot(stats_vortex[:, 2], stats_vortex[:, 3])
a = fig.add_subplot(122) a = fig.add_subplot(122)
a.plot(stats['t'], stats['enstrophy']) a.plot(stats['t'], stats['enstrophy'])
a.plot(stats_vortex[:, 2], stats_vortex[:, 9]/2)
fig.savefig('test.pdf', format = 'pdf') fig.savefig('test.pdf', format = 'pdf')
fig = plt.figure(figsize=(12, 12)) fig = plt.figure(figsize=(12, 12))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment