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];
        Elstress[iT]=StressArray[1];
        
    np.savetxt('BundleTest/StresssLooseBundle'+str(nonLocal)+'.txt',Lamstress+Elstress);
    del allFibers;
    del fibDisc;
    del Dom;
    del TIntegrator;
예제 #2
0
np.random.seed(CLseed)
CLNet = KMCCrossLinkedNetwork(nFib,
                              N,
                              fibDisc.getNumUniform(),
                              Lf,
                              nCL,
                              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
예제 #3
0
        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
    Lamstress = np.zeros(numStress)
    Elstress = np.zeros(numStress)
    CLstress = np.zeros(numStress)

    NumFibsConnected = np.zeros((numSaves, nFib), dtype=np.int64)
예제 #4
0
            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)

            # Destruction and cleanup
            of.close();
            del Dom;
            del Ewald;
            del fibDisc;
            del allFibers;
예제 #5
0
        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)
CLNet.writeLinks(ofCL)
ofCL.close()

stopcount = int(tf / dt + 1e-10)
numSaves = stopcount // saveEvery + 1
                                  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)):
            print('Time %1.2E' % (float(iT) * dt))
            wr = 1
        maxX = TIntegrator.updateAllFibers(iT,
                                           dt,
                                           stopcount,
            allFibers.fillPointArrays()

            # Initialize Ewald for non-local velocities
            Ewald = GPUEwaldSplitter(allFibers.getaRPY() * eps * Lf, mu, xi,
                                     Dom, fibDisc._nptsDirect * nFib)

            # Initialize the temporal integrator
            TIntegrator = BackwardEuler(allFibers, FPimp=0)
            # Number of GMRES iterations for nonlocal solves
            # 1 = block diagonal solver
            # N > 1 = N-1 extra iterations of GMRES
            TIntegrator.setMaxIters(giters)
            TIntegrator.setLargeTol(1e-6)

            # Prepare the output file and write initial locations
            of = prepareOutFile('ThreeSheared/BE_Eps2RPYExLocsN' + 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)

            # Destruction and cleanup
            of.close()
            del Dom
            del Ewald
            del fibDisc
예제 #8
0
for omHz in omegasToDo:
    omega = 2 * pi * omHz
    if (omHz > 0):
        T = 1 / omHz
        # one period
        gam0 = maxStrain * omega  # strain amplitude
    else:
        gam0 = maxStrain
        T = 4
    # Set up simulation variables
    stressEvery = 1
    saveEvery = int(savedt / dt + 1e-10)
    print('Omega %f: stopping time %f, saveEvery %f, stressEvery %f' %
          (omHz, tf, saveEvery * dt, stressEvery * dt))
    # Run to steady state (no flow)
    of = prepareOutFile('DynamicRheo/Locs' + outFile)
    stopcount = int(tf / dt + 1e-10)
    numSaves = stopcount // saveEvery + 1
    numStress = stopcount // stressEvery
    Lamstress = np.zeros(numStress)
    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)