modb = np.sqrt( (((2 / 3) * t11[i, j] - (1 / 3) * (t22[i, j] + t33[i, j]))**2 + 2 * t12[i, j]**2 + 2 * t13[i, j]**2 + ((2 / 3) * t22[i, j] - (1 / 3) * (t11[i, j] + t33[i, j]))**2 + 2 * t23[i, j]**2 + ((2 / 3) * t33[i, j] - (1 / 3) * (t11[i, j] + t22[i, j]))**2)) index1[i, j] = 1 - hpi * np.arccos(modm / modb) # index1[i,j] = modm/modb return Fil = sys.argv[1] N = sys.argv[2] nx, ny, nz, xDomainSize, yDomainSize, zDomainSize = readglobal( path="../../../") dtype = 'Float64' if os.path.getsize(Fil + 'P11_N' + N) == nx * ny * nz * 4: dtype = 'Float32' d11 = np.memmap(Fil + 'P11_N' + N, shape=(nx, ny, nz), order='F', dtype=dtype, mode='r') d12 = np.memmap(Fil + 'P12_N' + N, shape=(nx, ny, nz), order='F', dtype=dtype, mode='r') d13 = np.memmap(Fil + 'P13_N' + N,
#!/usr/bin/env python import numpy as np import sys import os from globalfile import readglobal import subprocess if os.path.exists('./global'): path='./' elif os.path.exists('../global'): path='../' elif os.path.exists('../../global'): path='../../' elif os.path.exists('../../../global'): path='../../../' elif os.path.exists('../../../../global'): path='../../../../' elif os.path.exists('../../../../../global'): path='../../../../../' nx,ny,nz,xDomainSize,yDomainSize,zDomainSize = readglobal(path=path) files = sys.argv[1:4] output = sys.argv[4:] subprocess.call(["truncate","-s",str(nx*ny*nz)]+output) subprocess.call(["vectordir",str(nx*ny*nz)]+files+output)
modt[:,:] = np.sqrt(((2/3)*t11-(1/3)*(t22+t33))**2 + 2*t12**2 + 2*t13**2 + ((2/3)*t22-(1/3)*(t11+t33))**2 + 2*t23**2 + ((2/3)*t33-(1/3)*(t11+t22))**2) # modt[:,:] = modt[:,:]/modt[:,:].max() return @jit(nogil=True) def tcalcmod2(t11,t12,t13,t22,t23,t33,modt): modt[:,:] = np.sqrt(t11**2 + 2*t12**2 + 2*t13**2 + t22**2 + 2*t23**2 + t33**2) # modt[:,:] = modt[:,:]/modt[:,:].max() return if len(sys.argv) == 3 : traceless = False Fil = sys.argv[1] N = sys.argv[2] nx,ny,nz,xDomainSize,yDomainSize,zDomainSize = readglobal("../../../") sizefile = os.path.getsize(Fil+'T11_N'+N) if sizefile == nx*ny*nz*8 : dtype='float64' elif sizefile == nx*ny*nz*4 : dtype='float32' t11 = np.memmap(Fil+'T11_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='r') t12 = np.memmap(Fil+'T12_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='r') t13 = np.memmap(Fil+'T13_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='r') t22 = np.memmap(Fil+'T22_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='r') t23 = np.memmap(Fil+'T23_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='r') t33 = np.memmap(Fil+'T33_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='r') modt = np.memmap(Fil+'modT_N'+N,shape=(nx,ny,nz),order='F',dtype=dtype,mode='w+')
action='store_true', help="Use normal distribution") group.add_argument('-u', '--uniform', action='store_true', help="Use uniform distribution") if os.path.exists('./global'): path = './' elif os.path.exists('../global'): path = '../' elif os.path.exists('../../global'): path = '../../' elif os.path.exists('../../../global'): path = '../../../' elif os.path.exists('../../../../global'): path = '../../../../' elif os.path.exists('../../../../../global'): path = '../../../../../' else: path = input('Please specify global file directory path: ') nx, ny, nz, xDomainSize, yDomainSize, zDomainSize = readglobal(path=path, tell=False) args = parser.parse_args() boxdim = 6 * 2 * zDomainSize * np.pi / nz for output in args.file: a = np.asfortranarray(np.random.normal(size=(nx, ny, nz))) filterbig(a, xDomainSize, yDomainSize, zDomainSize, boxdim, fil='G', dtype='float64') if args.uniform: