python3 print function
This commit is contained in:
parent
f369a16d4b
commit
990d01ce9d
1 changed files with 19 additions and 20 deletions
|
|
@ -75,7 +75,6 @@ class CompactScheme:
|
||||||
else:
|
else:
|
||||||
for i in range(nz):
|
for i in range(nz):
|
||||||
xsrc[:] = src[i]
|
xsrc[:] = src[i]
|
||||||
print xsrc.shape
|
|
||||||
dst[i] = compact.dfnonp(self.hx, xsrc, 1)
|
dst[i] = compact.dfnonp(self.hx, xsrc, 1)
|
||||||
|
|
||||||
# return np.swapaxes(dst, 1, 2)
|
# return np.swapaxes(dst, 1, 2)
|
||||||
|
|
@ -142,23 +141,23 @@ def read_old_data (fname):
|
||||||
dummy = f1.read(dummy_len)
|
dummy = f1.read(dummy_len)
|
||||||
#dummy = f1.read(4)
|
#dummy = f1.read(4)
|
||||||
|
|
||||||
print t, nx, ny, nz
|
print (t, nx, ny, nz)
|
||||||
|
|
||||||
#raw_field = f1.read(4+bSize*5+4)[4:-4]
|
#raw_field = f1.read(4+bSize*5+4)[4:-4]
|
||||||
V = np.fromfile(f1, dtype=np.float64, count=(3*count)).reshape((3,nz,ny,nx))
|
V = np.fromfile(f1, dtype=np.float64, count=(3*count)).reshape((3,nz,ny,nx))
|
||||||
s = np.fromfile(f1, dtype=np.float64, count=(2*count)).reshape((nz,ny,nx,2))
|
s = np.fromfile(f1, dtype=np.float64, count=(2*count)).reshape((nz,ny,nx,2))
|
||||||
|
|
||||||
print V.order
|
print (V.order)
|
||||||
print s.order
|
print (s.order)
|
||||||
|
|
||||||
print V.shape
|
print (V.shape)
|
||||||
print s.shape
|
print (s.shape)
|
||||||
|
|
||||||
V.order="F"
|
V.order="F"
|
||||||
s.order="F"
|
s.order="F"
|
||||||
|
|
||||||
print V.shape
|
print (V.shape)
|
||||||
print s.shape
|
print (s.shape)
|
||||||
|
|
||||||
u = V[0]
|
u = V[0]
|
||||||
v = V[1]
|
v = V[1]
|
||||||
|
|
@ -192,17 +191,17 @@ def read_data (fname):
|
||||||
V = np.fromfile(f1, dtype=np.float64, count=(3*count)).reshape((3,nz,ny,nx))
|
V = np.fromfile(f1, dtype=np.float64, count=(3*count)).reshape((3,nz,ny,nx))
|
||||||
s = np.fromfile(f1, dtype=np.float64, count=(2*count)).reshape((2,nz,ny,nx))
|
s = np.fromfile(f1, dtype=np.float64, count=(2*count)).reshape((2,nz,ny,nx))
|
||||||
|
|
||||||
print V.order
|
print (V.order)
|
||||||
print s.order
|
print (s.order)
|
||||||
|
|
||||||
print V.shape
|
print (V.shape)
|
||||||
print s.shape
|
print (s.shape)
|
||||||
|
|
||||||
V.order="F"
|
V.order="F"
|
||||||
s.order="F"
|
s.order="F"
|
||||||
|
|
||||||
print V.shape
|
print (V.shape)
|
||||||
print s.shape
|
print (s.shape)
|
||||||
|
|
||||||
u = V[0]
|
u = V[0]
|
||||||
v = V[1]
|
v = V[1]
|
||||||
|
|
@ -222,7 +221,7 @@ def validate_trigonometric():
|
||||||
|
|
||||||
pi8 = np.arccos(-1.)
|
pi8 = np.arccos(-1.)
|
||||||
|
|
||||||
print pi8
|
print (pi8)
|
||||||
|
|
||||||
l_0 = 2.0
|
l_0 = 2.0
|
||||||
hyp=l_0*pi8/ny
|
hyp=l_0*pi8/ny
|
||||||
|
|
@ -257,12 +256,12 @@ def validate_trigonometric():
|
||||||
dydx[:] = cs.ddx(Y1)[:]
|
dydx[:] = cs.ddx(Y1)[:]
|
||||||
|
|
||||||
|
|
||||||
print dydx.min(), dydx.max()
|
print (dydx.min(), dydx.max())
|
||||||
print dydxtrue.min(), dydxtrue.max()
|
print (dydxtrue.min(), dydxtrue.max())
|
||||||
|
|
||||||
relerr = (dydx - dydxtrue) / dydxtrue
|
relerr = (dydx - dydxtrue) / dydxtrue
|
||||||
|
|
||||||
print np.nanmin(relerr), np.nanmax(relerr)
|
print (np.nanmin(relerr), np.nanmax(relerr))
|
||||||
|
|
||||||
# cs.verify_nonp_coef()
|
# cs.verify_nonp_coef()
|
||||||
|
|
||||||
|
|
@ -281,7 +280,7 @@ def test_dns_data():
|
||||||
|
|
||||||
y[:] = Y1[:]
|
y[:] = Y1[:]
|
||||||
|
|
||||||
print y.min(), y.max()
|
print (y.min(), y.max())
|
||||||
|
|
||||||
dydx = np.memmap("dyr", dtype=np.float64, mode="w+", shape=cs.shape)
|
dydx = np.memmap("dyr", dtype=np.float64, mode="w+", shape=cs.shape)
|
||||||
|
|
||||||
|
|
@ -289,7 +288,7 @@ def test_dns_data():
|
||||||
|
|
||||||
dydx.flush()
|
dydx.flush()
|
||||||
|
|
||||||
print dydx.min(), dydx.max()
|
print (dydx.min(), dydx.max())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue