From 59df9c68997f3b2e7a00a4bc3f062948174d2c52 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 29 Oct 2015 10:37:31 +0000 Subject: [PATCH] Script clean-up. Bernhard Gscheider --- bin/plotResCoupled.py | 17 ++++++++--------- bin/plotResidual.py | 13 ++++++------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bin/plotResCoupled.py b/bin/plotResCoupled.py index c1139afe2..3489775ff 100755 --- a/bin/plotResCoupled.py +++ b/bin/plotResCoupled.py @@ -59,16 +59,15 @@ for line in lines: outfile=open('residual.dat','w') #HJ need better way of combining lists -if iUp > 0: - for index in range(0,iUp): - outfile.write(str(tUp[index])+' '+str(Ux[index])+' '+str(Uy[index])+' '+str(Uz[index])+' '+str(p[index])+'\n') - -if ikepsilon > 0: - for index in range(0,ikepsilon): - outfile.write(str(tUp[index])+' '+str(Ux[index])+' '+str(Uy[index])+' '+str(Uz[index])+' '+str(p[index])+' '+str(k[index])+' '+str(epsilon[index])+'\n') if ikomega > 0: - for index in range(0,ikomega): - outfile.write(str(tUp[index])+' '+str(Ux[index])+' '+str(Uy[index])+' '+str(Uz[index])+' '+str(p[index])+' '+str(k[index])+' '+str(omega[index])+'\n') + for data in zip(tUp,Ux,Uy,Uz,p,k,omega): + outfile.write(' '.join([str(d) for d in data])+'\n') +elif ikepsilon > 0: + for data in zip(tUp,Ux,Uy,Uz,p,k,epsilon): + outfile.write(' '.join([str(d) for d in data])+'\n') +elif iUp > 0: + for data in zip(tUp,Ux,Uy,Uz,p): + outfile.write(' '.join([str(d) for d in data])+'\n') outfile.close() diff --git a/bin/plotResidual.py b/bin/plotResidual.py index 53d650415..22149b34e 100755 --- a/bin/plotResidual.py +++ b/bin/plotResidual.py @@ -64,16 +64,15 @@ for line in lines: outfile=open('residual.dat','w') -#HJ need better way of combining lists if iomega > 0: - for index in range(0,iomega): - outfile.write(str(tUp[index])+' '+str(Ux[index])+' '+str(Uy[index])+' '+str(Uz[index])+' '+str(p[index])+' '+str(k[index])+' '+str(omega[index])+'\n') + for data in zip(tUp,Ux,Uy,Uz,p,k,omega): + outfile.write(' '.join([str(d) for d in data])+'\n') elif iepsilon > 0: - for index in range(0,iepsilon): - outfile.write(str(tUp[index])+' '+str(Ux[index])+' '+str(Uy[index])+' '+str(Uz[index])+' '+str(p[index])+' '+str(k[index])+' '+str(epsilon[index])+'\n') + for data in zip(tUp,Ux,Uy,Uz,p,k,epsilon): + outfile.write(' '.join([str(d) for d in data])+'\n') elif iUp > 0: - for index in range(0,iUp): - outfile.write(str(tUp[index])+' '+str(Ux[index])+' '+str(Uy[index])+' '+str(Uz[index])+' '+str(p[index])+'\n') + for data in zip(tUp,Ux,Uy,Uz,p): + outfile.write(' '.join([str(d) for d in data])+'\n') outfile.close()