Apr-24-2019, 10:06 AM
Good Morning,
I am trying to study the correlations between different field quantities in turbulent flows. I have written a code which computes everything that I need and it writes the 2D cross-correlations to a data file in 'ascii' format. The structure of the file goes like this:
Any kind of help will be appreciated.
Thank you so much.
Have a nice day.
I am trying to study the correlations between different field quantities in turbulent flows. I have written a code which computes everything that I need and it writes the 2D cross-correlations to a data file in 'ascii' format. The structure of the file goes like this:
# write correlation coefficient in ascii file dz = z - (z[-1]-z[0])/2.0 rdth= (th- (th[-1]-th[0])/2.0) * r[k] fnam = 'piCorr2dBoxF'+'{:08d}'.format(iFirst)+'to'+'{:08d}'.format(iLast)+'nt'+'{:04d}'.format(nt)+'.dat' print('-------------------------------------------------------------------------') print('Writing cross-correlation to file', fnam) f = open(fnam, 'w') f.write('# Two-dimensional two-point cross-correlations\n') f.write('# For all three velocity components (u_r, u_th, u_z) with eFlux\n') f.write("# At wall-normal location r = %f -> y+ = %f\n" % (r[k], (1-r[k])*180.4)) f.write('# Python post-processing on data set nsPipe/pipe0002 generated in a DNS using nsPipe\n') f.write('# Temporal (ensemble) averaging over %d samples\n' % (nt)) f.write("# First snapshot: %08d\n" % (iFirst)) f.write("# Last snapshot: %08d\n" % (iLast)) f.write("# 01st column: axial separation dz in units of pipe radii (R)\n") f.write("# 02nd column: azimuthal separation rdth in units of pipe radii (R)\n") f.write("# 03rd column: u_rPi correlation in units of RMS\n") f.write("# 04th column: u_thPi correlation in units of RMS\n") f.write("# 05th column: u_zPi correlation in units of RMS\n") for i in range(nth-1): for j in range(nz-1): f.write("%23.16e %23.16e %23.16e %23.16e %23.16e\n" % (rdth[i], dz[j], acr[i,j], acth[i,j], acz[i,j]) ) f.close()I want to generate some 2D plots and for that, I'm writing a new script. The problem is that I don't know how to read this file.
Any kind of help will be appreciated.
Thank you so much.
Have a nice day.