N = 16; Eb = 0.07; dt = 1e-4;#[2.5e-3,1e-3,5e-4,2.5e-4]; # Max stable = 5e-3 omHz = 0; tf = 1#5/omHz; omega = 2*pi*omHz; gam0 = 0.1; for nonLocal in [0,3,4]: # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld,Ld,Ld); # Initialize fiber discretization NupsampleForDirect=128; fibDisc = ChebyshevDiscretization(Lf,eps,Eb,mu,N,deltaLocal=0.1,nptsUniform=40,NupsampleForDirect=NupsampleForDirect); fibList = makeFibBundle(nFib,N,fibDisc); # Initialize the master list of fibers allFibers = fiberCollection(nFib,10,fibDisc,nonLocal,mu,omega,gam0,Dom); #allFibers.initFibList(fibList,Dom,pointsfileName='StiffLocs'+str(seed+1)+'.txt',tanvecfileName='StiffTanVecs'+str(seed+1)+'.txt'); allFibers.initFibList(fibList,Dom); allFibers.fillPointArrays(); Ewald = GPUEwaldSplitter(allFibers.getaRPY()*eps*Lf,mu,xi*1.4*(fibDisc.getNumDirect()/N)**(1/3),Dom,NupsampleForDirect*nFib); # Initialize the temporal integrator TIntegrator = CrankNicolson(allFibers); if (nonLocal==3): nIts = 2; TIntegrator.setMaxIters(nIts);
nCyc = tf * omHz stressdt = T / numStressPerCycle # 50 times per cycle saveEvery = int(savedt / dt + 1e-10) stressEvery = int(stressdt / dt + 1e-10) print('Omega %f: stopping time %f, saveEvery %f, stressEvery %f' % (omHz, tf, saveEvery * dt, stressEvery * dt)) # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld, Ld, Ld) # Initialize fiber discretization fibDisc = ChebyshevDiscretization(Lf, eps, Eb, mu, N, deltaLocal=0.1, nptsUniform=Nuniformsites, NupsampleForDirect=NupsampleForDirect) # Initialize the master list of fibers allFibers = fiberCollection(nFib, turnovertime, fibDisc, nonLocal, mu, omega, gam0, Dom, nThreads=nThr)
# begin with 1 iteration done = 0 while (done == 0): print('Iterations %d' % giters) #try: np.random.seed(1) # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld, Ld, Ld) # Initialize fiber discretization fibDisc = ChebyshevDiscretization( Lf, eps, Eb, mu, N, deltaLocal=deltaLocal, trueRPYMobility=RPYMob, NupsampleForDirect=128) # Initialize Ewald for non-local velocities Ewald = GPUEwaldSplitter( np.exp(1.5) / 4 * eps * Lf, mu, xi, Dom, fibDisc._nptsDirect * nFib) # Initialize the master list of fibers allFibers = fiberCollection(nFib, 10, fibDisc, nonLocal,
# zero unbinding rate konCL = 1000 # cross linker binding rate koffCL = 1e-16 # cross linker unbinding rate np.random.seed(1) # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld, Ld, Ld) # Initialize Ewald for non-local velocities Ewald = EwaldSplitter(np.exp(1.5) / 4 * eps * Lf, mu, xi, Dom, N * nFib) # Initialize fiber discretization fibDisc = ChebyshevDiscretization(Lf, eps, Eb, mu, N, deltaLocal=0.1) # Initialize the master list of fibers allFibers = fiberCollection(nFib, fibDisc, nonLocal, mu, omega, gam0, Dom, nThreads=4) # Initialize the fiber list (straight fibers) fibList = [None] * nFib #print('Loading from steady state') #XFile = 'SSLocsF'+str(nFib)+'C'+str(nCL)+'REV.txt';
gravity = 0.0 # gravity on the fibers giters = 1; Ns = [32]; dts = [0.01]; for N in Ns: gits = [1]; if (N==16): gits=[1,2,4]; for giters in gits: for dt in dts: # Initialize the domain Dom = PeriodicShearedDomain(Ld,Ld,Ld); # Initialize fiber discretization fibDisc = ChebyshevDiscretization(Lf,eps,Eb,mu,N,deltaLocal=0.1,NupsampleForDirect=N,rigid=True); # Initialize the master list of fibers allFibers = fiberCollection(nFib,10,fibDisc,nonLocal,mu,omega,gam0,Dom); fibList = makeThreeSheared(Lf,N,fibDisc); allFibers.initFibList(fibList,Dom); allFibers.fillPointArrays(); # Initialize Ewald for non-local velocities Ewald = EwaldSplitter(allFibers.getaRPY()*eps*Lf,mu,xi,Dom,N*nFib); # Initialize the temporal integrator TIntegrator = CrankNicolson(allFibers); # Number of GMRES iterations for nonlocal solves # 1 = block diagonal solver # N > 1 = N-1 extra iterations of GMRES
copyInput.write('True RPY mob = ' + str(RPYMob) + '\n') copyInput.close() Input.close() except: raise ValueError( 'This file takes three command line arguments: the seed (for CL network),\ whether to do the finite part implicitly (0 or 1), and whether to use RPY mobility (0 or 1), in that order' ) saveEvery = int(savedt / dt + 1e-10) # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld, Ld, Ld) # Initialize fiber discretization fibDisc = ChebyshevDiscretization(Lf,eps,Eb,mu,N,deltaLocal=0.1,nptsUniform=Nuniformsites,\ NupsampleForDirect=NupsampleForDirect,rigid=rigidFibs,trueRPYMobility=RPYMob) # Initialize the master list of fibers allFibers = fiberCollection(nFib, turnovertime, fibDisc, nonLocal, mu, 1, 0, Dom, nThreads=nThr) # No flow, no nonlocal hydro (nothing to OMP parallelize) # Initialize Ewald for non-local velocities if (nonLocal == 0 or nonLocal == 4):
Elstress = np.zeros(numStress); CLstress = np.zeros(numStress); NumFibsConnected = np.zeros((numSaves,nFib),dtype=np.int64) labels = np.zeros((numSaves,nFib),dtype=np.int64) AllLocalAlignment = np.zeros((numSaves,nFib)) AvgTangentVectors = np.zeros((numSaves*nFib,3)); numLinksByFib = np.zeros((numSaves,nFib),dtype=np.int64); numBundlesSep = np.zeros(numSaves,dtype=np.int64) avgBundleAlignment_Sep = np.zeros(numSaves) # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld,Ld,Ld); # Initialize fiber discretization fibDisc = ChebyshevDiscretization(Lf,eps,Eb,mu,N,deltaLocal=0.1,nptsUniform=Nuniformsites,NupsampleForDirect=NupsampleForDirect); # Initialize the master list of fibers allFibers = fiberCollection(nFib,turnovertime,fibDisc,nonLocal,mu,omega,gam0,Dom,nThreads=nThr); # Initialize Ewald for non-local velocities if (nonLocal > 0 and nonLocal < 4): Ewald = GPUEwaldSplitter(allFibers.getaRPY()*eps*Lf,mu,xi*1.4*(fibDisc.getNumDirect()/N)**(1/3),Dom,NupsampleForDirect*nFib); else: # This is so it doesn't try to initialize a GPU code if there isn't a GPU Ewald = EwaldSplitter(allFibers.getaRPY()*eps*Lf,mu,xi*1.4*(fibDisc.getNumDirect()/N)**(1/3),Dom,NupsampleForDirect*nFib); # Initialize the fiber list (straight fibers) XFile = 'DynamicStress/DynamicSSLocs'+inFile; XsFile = 'DynamicStress/DynamicSSTanVecs'+inFile fibList = [None]*nFib; allFibers.initFibList(fibList,Dom,pointsfileName=XFile,tanvecfileName=XsFile);
# begin with 1 iteration done = 0 while (done == 0): print('Iterations %d' % giters) try: np.random.seed(1) # Initialize the domain and spatial database Dom = PeriodicShearedDomain(Ld, Ld, Ld) # Initialize Ewald for non-local velocities Ewald = EwaldSplitter( np.exp(1.5) / 4 * eps * Lf, mu, xi, Dom, N * nFib) # Initialize fiber discretization fibDisc = ChebyshevDiscretization(Lf, eps, Eb, mu, N, deltaLocal) # Initialize the master list of fibers allFibers = fiberCollection(nFib, fibDisc, nonLocal, mu, omega, gam0, Dom, nThreads=4) # Initialize the fiber list fibList = [None] * nFib allFibers.initFibList(fibList, Dom) allFibers.fillPointArrays()