# 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)
    for iT in range(stopcount): 
        maxX, _, StressArray = TIntegrator.updateAllFibers(iT,dt,stopcount,Dom,Ewald,grav/Lf,write=1,outfile=of,stress=True);
        Lamstress[iT]=StressArray[0];
Esempio n. 2
0
    print('Name of the input file: ' + inFile)
    try:
        CLNet.setLinksFromFile('DynamicStress/DynamicSSLinks' + inFile,
                               'DynamicStress/DynSSFreeLinkBound' + inFile)
    except:
        print('Redirecting CL infile')
        CLNet.setLinksFromFile('DynamicRheo/Time60Links' + inFile,
                               'DynamicRheo/Time60FreeLinkBound' + inFile)

    print('Number of links initially %d' % CLNet._nDoubleBoundLinks)

    # Initialize the temporal integrator
    if (useBackwardEuler):
        TIntegrator = BackwardEuler(allFibers, CLNet)
    else:
        TIntegrator = CrankNicolson(allFibers, CLNet)
    TIntegrator.setMaxIters(nIts)
    TIntegrator.setLargeTol(LargeTol)

    # Prepare the output file and write initial locations
    of = prepareOutFile('DynamicRheo/Locs' + outFile)
    allFibers.writeFiberLocations(of)
    saveCurvaturesAndStrains(allFibers, CLNet, outFile, wora='w')
    ofCL = prepareOutFile('DynamicRheo/Step' + str(0) + 'Links' + outFile)
    CLNet.writeLinks(ofCL)
    ofCL.close()

    # Run to steady state (no flow)
    stopcount = int(tf / dt + 1e-10)
    numSaves = stopcount // saveEvery + 1
    numStress = stopcount // stressEvery
                                                    gam0,
                                                    Dom,
                                                    nThreads=4)

                        # Initialize the fiber list
                        fibList = [None] * nFib
                        allFibers.initFibList(fibList, Dom)
                        allFibers.fillPointArrays()
                        #of = prepareOutFile('PyLocs.txt');
                        #allFibers.writeFiberLocations(of);

                        # Initialize the temporal integrator
                        if (TemporalOrder == 1):
                            TIntegrator = BackwardEuler(allFibers, FPimp=ImpFP)
                        else:
                            TIntegrator = CrankNicolson(allFibers, FPimp=ImpFP)
                        TIntegrator.setMaxIters(giters)
                        TIntegrator.setLargeTol(1e-6)

                        # Compute the endtime and do the time loop
                        stopcount = int(tf / dt + 1e-10)
                        for iT in range(stopcount):
                            #print('Time %1.2E' %(float(iT)*dt));
                            maxX, _, _ = TIntegrator.updateAllFibers(iT,
                                                                     dt,
                                                                     stopcount,
                                                                     Dom,
                                                                     Ewald,
                                                                     gravity,
                                                                     write=0)
                            #print('Max x: %f' %maxX);
Esempio n. 4
0
                              Kspring,
                              rl,
                              konCL,
                              koffCL,
                              CLseed,
                              Dom,
                              fibDisc,
                              nThreads=4)
CLNet.updateNetwork(allFibers, Dom, 0.01)
ofCL = prepareOutFile('F' + str(nFib) + 'C' + str(nCL) + 'rl' + str(rl) +
                      '.txt')
CLNet.writeLinks(ofCL, allFibers.getUniformPoints(allFibers._ptsCheb), Dom)
#CLNet.setLinksFromFile('F'+str(nFib)+'C'+str(nCL)+'.txt',Dom);

# Initialize the temporal integrator
TIntegrator = CrankNicolson(allFibers, CLNet)
TIntegrator.setMaxIters(1)
# only 1 iteration since we do local drag

# Prepare the output file and write initial locations
of = prepareOutFile('PermanentLinkLocsF' + str(nFib) + 'C' + str(nCL) + 'rl' +
                    str(rl) + '.txt')
allFibers.writeFiberLocations(of)
saveCurvaturesAndStrains(nFib, nCL, allFibers, CLNet, rl, wora='w')

# Run to steady state
stopSS = int(tf / dt + 1e-10)
for iT in range(stopSS):
    wr = 0
    if ((iT % saveEvery) == (saveEvery - 1)):
        print('Time %1.2E' % (float(iT) * dt))
Esempio n. 5
0
            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
            TIntegrator.setMaxIters(giters);

            # Prepare the output file and write initial locations
            of = prepareOutFile('New2LocationsN' +str(N)+'G'+str(giters)+str(dt)+'.txt');
            allFibers.writeFiberLocations(of);

            # Time loop
            stopcount = int(tf/dt+1e-10);
            for iT in range(stopcount): 
                print('Time %f' %(float(iT)*dt));
                maxX = TIntegrator.updateAllFibers(iT,dt,stopcount,Dom,Ewald,gravity/Lf,of);
                print(maxX)
Esempio n. 6
0
    bindingSiteWidth=bindingSiteWidth,kT=kBt)
#Pairs, _ = CLNet.getPairsThatCanBind(allFibers,Dom);
#np.savetxt('PairsN'+str(fibDisc.getNumUniform())+'.txt',Pairs);
if (initFile is None):
    CLNet.updateNetwork(allFibers, Dom, 100.0 / min(
        konCL * Lf, konSecond * Lf, koffCL, koffSecond))  # just to load up CLs
else:
    CLNet.setLinksFromFile('DynamicStress/DynamicSSLinks' + initFile,
                           'DynamicStress/DynSSFreeLinkBound' + initFile)
print('Number of links initially %d' % CLNet._nDoubleBoundLinks)

# Initialize the temporal integrator
if (BrownianFluct or useBackwardEuler):
    TIntegrator = BackwardEuler(allFibers, CLNet, FPimp=ImplicitFinitePart)
else:
    TIntegrator = CrankNicolson(allFibers, CLNet, FPimp=ImplicitFinitePart)
TIntegrator.setMaxIters(nIts)
TIntegrator.setLargeTol(LargeTol)

# Prepare the output file and write initial network information
of = prepareOutFile('BundlingBehavior/Locs' + OutputFileName)
allFibers.writeFiberLocations(of)
saveCurvaturesAndStrains(nFib,
                         konCL,
                         allFibers,
                         CLNet,
                         rl,
                         OutputFileName,
                         wora='w')
ofCL = prepareOutFile('BundlingBehavior/Step' + str(0) + 'Links' +
                      OutputFileName)
                                  fibDisc.getNumUniform(),
                                  Lf,
                                  nCL,
                                  Kspring,
                                  rl,
                                  konCL,
                                  koffCL,
                                  CLseed,
                                  Dom,
                                  fibDisc,
                                  nThreads=4)
    CLNet.setLinksFromFile('NetworkSteadyStates/F' + str(nFib) + 'C' +
                           str(nCL) + '.txt')

    # Initialize the temporal integrator
    TIntegrator = CrankNicolson(allFibers, CLNet)
    TIntegrator.setMaxIters(nIts)

    # Prepare the output file and write initial locations
    of = prepareOutFile('Straining' + HydroStr + 'Om' + str(omHz) + 'LocsF' +
                        str(nFib) + 'C' + str(nCL) + 'REV.txt')
    allFibers.writeFiberLocations(of)
    #saveCurvaturesAndStrains(omHz,nFib,nCL,allFibers,CLNet,HydroStr,wora='w')

    stopcount = int(tf / dt + 1e-10)
    Lamstress = np.zeros(stopcount)
    Elstress = np.zeros(stopcount)
    CLstress = np.zeros(stopcount)
    for iT in range(stopcount):
        wr = 0
        if ((iT % saveEvery) == (saveEvery - 1)):
Esempio n. 8
0
                                        nonLocal,
                                        mu,
                                        omega,
                                        gam0,
                                        Dom,
                                        nThreads=4)

            # Initialize the fiber list
            fibList = [None] * nFib
            allFibers.initFibList(fibList, Dom)
            allFibers.fillPointArrays()
            #of = prepareOutFile('PyLocs.txt');
            #allFibers.writeFiberLocations(of);

            # Initialize the temporal integrator
            TIntegrator = CrankNicolson(allFibers)
            TIntegrator.setMaxIters(giters)

            # Compute the endtime and do the time loop
            stopcount = int(tf / dt + 1e-10)
            for iT in range(stopcount):
                print('Time %1.2E' % (float(iT) * dt))
                maxX = TIntegrator.updateAllFibers(iT,
                                                   dt,
                                                   stopcount,
                                                   Dom,
                                                   Ewald,
                                                   gravity,
                                                   write=0)
                print('Max x: %f' % maxX)
                if (maxX > 2 * Ld):