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);
    TIntegrator.setLargeTol(0.1);

    # Prepare the output file and write initial locations
    of = prepareOutFile('BundleTest/XLooseBundle'+str(nonLocal)+'.txt');
    allFibers.writeFiberLocations(of);
    stopcount = int(tf/dt+1e-10);
    Lamstress = np.zeros(stopcount);
    Elstress = np.zeros(stopcount);
    nLinks =np.zeros(stopcount)
Example #2
0
    # 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)
    fibList = [None] * nFib
    print('Loading from steady state')
    try:
        XFile = 'DynamicStress/DynamicSSLocs' + inFile
        XsFile = 'DynamicStress/DynamicSSTanVecs' + inFile
        allFibers.initFibList(fibList,
                              Dom,
                              pointsfileName=XFile,