Description
Description
This notebook simulates a dilute solution of nd = 5000 independent, non-interacting dumbbells (two beads joined by a nonlinear FENE spring) in a Newtonian solvent by Brownian dynamics. A uniaxial extensional flow is switched on suddenly and the start-up (transient) elongational viscosity is followed as a function of t/λ for = 10 and the four dimensionless elongation rates = 0.42, 0.83, 2.5 and 5.83. The overlay of the four runs reproduces Fig. 4 of Ref. 1 (p. 104). The flow and the material function are defined in Eqs. 22-24 of Ref. 1 (p. 103), where the figure is also discussed. The simulation method follows Section 2 and Section 3 of Ref. 1: spring force Eq. 1 (p. 97), Brownian-dynamics step Eq. 8 and diffusion coefficient Eq. 9 (p. 98), relaxation time Eq. 12 (p. 99), equilibrium length Eq. 13 and Kramers stress Eq. 15 (p. 100).
+
η
L
λ
ε
Model and numerical scheme
Model and numerical scheme
Every bead i moves according to dr_i = (u(r_i) + F_i) dt + Sqrt[2 dt] N(0,1) per Cartesian component (Euler step of Eq. 8 of Ref. 1, Ermak-McCammon algorithm, with bead friction 6 Pi eta_s a_b = 1 and kT = 1, so that D = kT/(6 Pi eta_s a_b) = 1, Eq. 9. F_i is the spring force and u the imposed uniaxial extensional flow u = (Gs*x, -Gs*y/2, -Gs*z/2): extension along x, compression along y and z. With Q = r2 - r1 and Q^2 the squared extension, the spring force on bead 1 is F = k Q/(1 - Q^2/CL) (FENE, Eq. 1 of Ref. 1 with K = k = 3 kT/L_eq^2 = 3 for L_eq = RL = 1) and on bead 2 it is -F. Here CL = L^2 = 100, i.e. a maximum extension = L/L_eq = 10, as in Fig. 4 of Ref. 1. The relaxation time is λ = SL = 1/(4 k) = 1/12 (Eq. 12 of Ref. 1 with friction 1), so = G*SL. If a dumbbell would exceed the maximum extension in a finite step, the Q^2 used in the force factor is reset to CL - 0.05 (a numerical safeguard that is not described in Ref. 1; the bead positions themselves are not modified).
L
λ
ε
Material function
Material function
(Eqs. 23-24 of Ref. 1, p. 103)The start-up elongational viscosity is (t, ) = (τ_zz - τ_xx)/ for extension along z (Eq. 23). In this notebook the extension is along x, so the same quantity is (τ_xx - τ_zz)/ (by symmetry τ yy = τ zz). The dumbbell (polymer) contribution is made dimensionless as = ( - 3 η s)/(3 n k T λ) (Eq. 24). With the Kramers expression for the stress (Eq. 15 of Ref. 1; kT = 1, n divided out by averaging over the dumbbells; the isotropic term n k T I cancels in the normal-stress difference) this gives = <Fx Qx - Fz Qz>/(3 ). The solvent viscosity is not included because only the spring stress is computed. In the code, Vis = <Fx Qx - Fz Qz>/() and the quantity plotted is Vis/3 (the 3 comes from Eq. 24). Time is shown as t/λ, where t is measured from the start of the flow.
+
η
ε
ε
ε
+
η
+
η
+
η
λ
ε
λ
ε
Structure of the notebook
Structure of the notebook
1) Parameters and random-number generator.
2) Check that the Brownian displacements have mean 0 and variance 2 dt.
3) init[]: random initial dumbbells.
4) step[Gs]: one time step in uniaxial extensional flow; it returns the stress-related averages.
5) Four start-up runs, one per curve of Fig. 4 of Ref. 1: run 1: G = 30 ( = 2.5, green, plot p1, nsteps = 9000, t/λ up to 10.8); run 2: G = 9.96 ( = 0.83, red, plot p2, nsteps = 8500, t/λ up to 10.2); run 3: G = 5.04 ( = 0.42, gray, plot p3, nsteps = 8500); run 4: G = 69.96 ( = 5.83, blue, plot p4, nsteps = 8500, all points plotted). Each run equilibrates for nequil = 500 steps at zero flow and then applies the extension suddenly. Each run overwrites res, Vis and tl, therefore the plot is stored (p1 ... p4) before the next run.
λ
ε
λ
ε
λ
ε
λ
ε
6) Show[p1, p2, p3, p4]: overlay of the four runs = Fig. 4 of Ref. 1 (p. 104). Each run takes nequil + nsteps = 9000-9500 steps for 5000 dumbbells.
Parameters
Parameters
nd = number of dumbbells (nb = 2 nd beads). Code use = 10 for the elongational runs and 5000 dumbbells to keep each run short. RL = 1 is the equilibrium (Hookean rms) dumbbell length L_eq, the unit of length; with kT = 1 and k = K = 3 kT/L_eq^2 = 3 (Eq. 13 of Ref. 1: L_eq^2 = 3 kT/K = 1). CL = L^2 = 100 is the maximum extension squared, i.e. = 10 in units of L_eq. SL is the relaxation time λ = 1/(4 k) = 1/12 (Eq. 12 of Ref. 1 with friction 1). G is the elongation rate in code units, so = G*SL: G = 5.04 → 0.42; G = 9.96 → 0.83; G = 30 → 2.5; G = 69.96 (about 70) → 5.83. Time step dt = 0.0001, i.e. dt/λ = 0.0012.
L
L
λ
ε
Number of dumbbells (nd) and number of beads (nb = 2×nd)
nd=5000;nb=2nd;(*RL=1=equilibrium(Hookeanrms)dumbbelllengthL_eq,theunitoflength(K=3kT/L_eq^2=k=3withkT=1,Eq.13ofRef.1);RV=half-sizeofthecubicboxfortheinitialbeadpositions(onlyQentersthedumbbelldynamics,soithasnoeffect);CL=L^2=100:maximumextensionsquared,i.e.L=10inunitsofL_eqasinFig.4ofRef.1(theshearnotebookusedCL=10);k=springconstantK*)RL=1;RV=10;CL=100;k=3;(*dt=timestepoftheEuler(Euler-Maruyama)scheme,Eq.8ofRef.1;dt/lambda=0.0012*)dt=0.0001;(*Numberofzero-flowequilibrationsteps(nequil);thenumberofproductionstepsnstepsissetseparatelyineachrunbelow*)nequil=500;(*zero-flowequilibration:nequil*dt=0.05=0.6lambda*)(*SL=lambda=1/(4k)=1/12,therelaxationtime(Eq.12ofRef.1withbeadfriction6Pieta_sa_b=1);solambda*edot=G*SLandthedimensionlesstimeist/lambda=t/SL*)SL=1/(4k);(*ra=random-numbergenerator(aneural-netlayerusedasafastvectorisedsampler):ra[]returns3nbindependentN(0,1)numbers,oneforeachcoordinateofeachbead;usedfortherandomtermofEq.8ofRef.1(D=kT/(6Pieta_sa_b)=1,Eq.9)*)ra=RandomArrayLayer[NormalDistribution[],"Output"->3nb];
Check of the Brownian displacements (variance should be 2 dt).
In[]:=
(*DrawonesetofBrowniandisplacementsSqrt[2dt]N(0,1)forallbeadcoordinates*)gdisp=Sqrt[2dt]ra[];(*Output:{numberofsamples,mean(shouldbe~0),variance,expectedvariance2dt}*){Length[gdisp],Mean[gdisp],Variance[gdisp],2dt}
Out[]=
{30000,-0.000114221,0.000200563,0.0002}
Initial position of the dumbbells: bead 1 at random in a box of half-size RV, bead 2 at distance RL in a random direction. Odd entries of xd,yd,zd are bead 1, even entries are bead 2.
init[]: (re)initialise the global bead coordinate lists xd, yd, zd (length nb = 2 nd) with a fresh random ensemble of dumbbells
init[]:=Module[{x1,y1,z1,cz,phi,sn},(*Bead1ofeverydumbbell:uniformrandompositioninthecube[-RV,RV]^3*)x1=RV(2RandomReal[{0,1},nd]-1);y1=RV(2RandomReal[{0,1},nd]-1);z1=RV(2RandomReal[{0,1},nd]-1);(*Randomdirectionontheunitsphere:cz=cos(theta)uniformin[-1,1],phiuniformin[0,2Pi),sn=sin(theta)*)cz=2RandomReal[{0,1},nd]-1;phi=2PiRandomReal[{0,1},nd];sn=Sqrt[1-cz^2];(*Interleavethebeads:oddentries=bead1,evenentries=bead2=bead1+RL*(unitvector),soeverydumbbellstartswithlengthRL*)xd=Riffle[x1,x1+RLsnCos[phi]];yd=Riffle[y1,y1+RLsnSin[phi]];zd=Riffle[z1,z1+RLcz];];
Step function. One Euler step (elongation rate Gs). Spring force on bead 1 is k Q/(1-Q^2/CL) (FENE, Eq. 1 of Ref. 1), on bead 2 the opposite. Bead velocity = imposed uniaxial extensional flow u = (Gs*x, -Gs*y/2, -Gs*z/2) (Eq. 22 of Ref. 1 with the extension axis along x) + spring force; plus a random displacement Sqrt[2 dt]*N(0,1) (Eq. 8). Returns the dumbbell averages {<Fx Qx>,<Fy Qy>,<Fz Qz>,<Fx Qy>}, i.e. components of the spring stress (Eq. 15); only <Fx Qx> and <Fz Qz> are used for the elongational viscosity.
step[Gs]: advance all dumbbells by one Euler step (Eq. 8 of Ref. 1) in uniaxial extensional flow u = (Gs*x, -Gs*y/2, -Gs*z/2): extension along x, compression along y and z. Eq. 22 of Ref. 1 has the extension along z, so the axes are relabelled (paper z -> x here). Gs = 0 gives a step without flow (equilibration)
step[Gs_]:=Module[{x1,x2,y1,y2,z1,z2,qx,qy,qz,d,f,fx,fy,fz,gd,gx,gy,gz,ux,uy,uz,cx},(*Unpackcoordinates:entries1;;-1;;2arebead1,entries2;;-1;;2arebead2ofeachdumbbell*)x1=xd[[1;;-1;;2]];x2=xd[[2;;-1;;2]];y1=yd[[1;;-1;;2]];y2=yd[[2;;-1;;2]];z1=zd[[1;;-1;;2]];z2=zd[[2;;-1;;2]];(*ConnectorvectorQ=r2-r1ofeverydumbbell*)qx=x2-x1;qy=y2-y1;qz=z2-z1;(*d=Q^2,thesquaredextensionofeverydumbbell*)d=qx^2+qy^2+qz^2;(*Safeguard(notdescribedinRef.1):whereQ^2exceedsCL(possibleafterafiniteEulerstep)resetittoCL-0.05sotheFENEforcestaysfiniteandpositive;onlythisforcefactorisaffected,thebeadpositionsarenotchanged*)d=Map[If[#>CL,CL-0.05,#]&,d];(*FENEspringcoefficientf=k/(1-Q^2/CL),i.e.Eq.1ofRef.1withK=k:theforceonbead1isf*Q(towardsbead2),theforceonbead2is-f*Q*)f=k/(1-d/CL);fx=fqx;fy=fqy;fz=fqz;(*BrowniandisplacementsSqrt[2dt]N(0,1)(randomtermofEq.8ofRef.1),storedas(x,y,z)triplets;thenextthreelinessplitthemintox,y,zparts(stride3)*)gd=Sqrt[2dt]ra[];gx=gd[[1;;-1;;3]];gy=gd[[2;;-1;;3]];gz=gd[[3;;-1;;3]];(*Beadvelocities:imposedextensionalflow(Gs*x,-0.5Gs*y,-0.5Gs*z)evaluatedateachbead(Eq.22ofRef.1,extensionaxisalongx)plusthespringforce(+onbead1,-onbead2);Rifflere-interleavesbead1andbead2*)ux=Riffle[Gsx1+fx,Gsx2-fx];uy=Riffle[-0.5Gsy1+fy,-0.5Gsy2+-fy];uz=Riffle[-0.5Gsz1+fz,-0.5Gsz2+-fz];(*EulerupdateofEq.8ofRef.1:r(t+dt)=r(t)+dt*velocity+Browniandisplacement*)xd=xd+dtux+gx;yd=yd+dtuy+gy;zd=zd+dtuz+gz;(*Re-centreeverydumbbellontheoriginaftertheupdate.Theflowislinear,soQ=r2-r1doesnotdependonthecentreofmass,butthecentreofmassisconvectedasExp[Gt](about10^25forG=70att/lambda=10)andQ=r2-r1isthendestroyedbydouble-precisionround-off(curve4ofFig.4collapsedtozerobeyondt/lambda=6).*)cx=(xd[[1;;-1;;2]]+xd[[2;;-1;;2]])/2;xd=xd-Riffle[cx,cx];cx=(yd[[1;;-1;;2]]+yd[[2;;-1;;2]])/2;yd=yd-Riffle[cx,cx];cx=(zd[[1;;-1;;2]]+zd[[2;;-1;;2]])/2;zd=zd-Riffle[cx,cx];(*Returnthedumbbellaverages{<FxQx>,<FyQy>,<FzQz>,<FxQy>}:springpartoftheKramersstress(Eq.15ofRef.1;kT=1,ndividedout),computedwiththeQandFofthestartofthestep*){Total[fxqx],Total[fyqy],Total[fzqz],Total[fxqy]}/nd];
Run 1. Equilibrate at zero flow, then apply the uniaxial extension suddenly (G = 30, = 2.5; one of the four curves of Fig. 4 of Ref. 1). Normalisation as in Eq. 24: = <Fx Qx - Fz Qz>/(3 ) (extension along x; Eq. 23 has (tau_zz - tau_xx) for extension along z).
λ
ε
+
η
λ
ε
Check: t/lambda reached in run 1 with nsteps = 9000 production steps: nsteps*dt/SL = 10.8
9000dt/SL
Out[]=
10.8
Run 1 (Fig. 4 of Ref. 1, curve lambda*edot = 2.5): elongation rate in code units G = 30, so lambda*edot = G*SL = 30/12 = 2.5
G=30;nsteps=9000;(*productionsteps:nsteps*dt/SL=9000*0.0001*12=10.8,i.e.t/lambdaupto10.8(Fig.4spanst/lambda=0.01toabout10)*)(*NormalisationfactorSNV=lambda*edot,thedenominatorofEq.24ofRef.1apartfromthefactor3(appliedwhenplotting,Vis/3);kT=1andnisdividedoutbyaveragingoverthedumbbells*)SNV=GSL;(*Newrandomensembleofdumbbells(randomorientation,lengthRL)*)init[];(*Equilibrateatzeroflowfornequilsteps(t=nequil*dt=0.05=0.6lambda)*)Do[step[0],{nequil}];(*Checkoftheequilibriumstate:meansquaredextension<Q^2>ofthedumbbells;itshouldbeclosetotheexactFENEequilibriumvalue3L^2/(b+5)=0.984forL^2=100,withb=KL^2/kT=300(0.857wasthevalueforL^2=10intheshearnotebook)*)Print["equilibrium <Q^2> (exact FENE value 0.984): ",Mean[(xd[[2;;-1;;2]]-xd[[1;;-1;;2]])^2+(yd[[2;;-1;;2]]-yd[[1;;-1;;2]])^2+(zd[[2;;-1;;2]]-zd[[1;;-1;;2]])^2]];(*Production:applytheuniaxialextensionsuddenly(start-upflow,Section3ofRef.1);res[[n]]={<FxQx>,<FyQy>,<FzQz>,<FxQy>}atstepn;nsteps=9000givest/lambdaupto10.8*)res=Table[step[G],{nsteps}];(*ElongationalviscosityVis=<FxQx-FzQz>/(lambda*edot):Eq.23ofRef.1,(tau_zz-tau_xx)/edot,withtheextensionalongxinsteadofz.TheplotsbelowshowVis/3=eta-hat-bar+ofEq.24*)Vis=(res[[All,1]]-res[[All,3]])/SNV;(*Dimensionlesstimet/lambdaafterthestartoftheflow(abscissaofFig.4)*)tl=Range[nsteps]dt/SL;
Run 1 plot: elongational viscosity eta-hat-bar+ = Vis/3 (Eq. 24 of Ref. 1) versus t/lambda on a log-log scale (green curve: G = 30, lambda*edot = 2.5). PlotRange limits t/lambda to 0.01 - 10, the abscissa range of Fig. 4. The plot is stored so that the four runs can be overlaid later (Fig. 4 of Ref. 1)
Check of run 1: lambda*edot = G*SL = 30/12 = 2.5
Run 2
Run 2
Run 2 (curve lambda*edot = 0.83): G = 9.96 gives lambda*edot = G*SL = 0.83
Check: t/lambda reached in run 2 with nsteps = 8500 production steps: 8500*dt/SL = 10.2
Run 2 (curve lambda*edot = 0.83, G = 9.96): same procedure as run 1: normalization, equilibration at zero flow, sudden extension, then elongational viscosity and t/lambda (results overwrite res, Vis, tl)
Run 2 plot: elongational viscosity eta-hat-bar+ = Vis/3 (Eq. 24 of Ref. 1) versus t/lambda on a log-log scale (red curve: G = 9.96, lambda*edot = 0.83). The plot is stored so that the four runs can be overlaid later (Fig. 4 of Ref. 1)
Run 3
Run 3
Run 3 (curve lambda*edot = 0.42): G = 5.04 gives lambda*edot = G*SL = 0.42
Check: t/lambda reached in run 3 (nsteps = 8500, inherited from run 2) = 10.2
Run 3 (curve lambda*edot = 0.42, G = 5.04): same procedure as run 1: normalization, equilibration at zero flow, sudden extension, then elongational viscosity and t/lambda (results overwrite res, Vis, tl)
Run 3 plot: elongational viscosity eta-hat-bar+ = Vis/3 (Eq. 24 of Ref. 1) versus t/lambda on a log-log scale (gray curve: G = 5.04, lambda*edot = 0.42). All points are plotted; n = 100 (t/lambda = 0.12) is no longer left out; Vis itself is not changed. The plot is stored so that the four runs can be overlaid later (Fig. 4 of Ref. 1)
Run 4
Run 4
Run 4 (curve lambda*edot = 5.83): G = 69.96 (about 70) gives lambda*edot = G*SL = 5.83
Time step, same value as in the parameter cell: dt/lambda = 0.0012
Check: t/lambda reached in run 4 (nsteps = 8500, inherited from run 2) = 10.2; all points plotted
Run 4 (curve lambda*edot = 5.83, G = 69.96): same procedure as run 1: normalization, equilibration at zero flow, sudden extension, then elongational viscosity and t/lambda (results overwrite res, Vis, tl)
Run 4 plot: elongational viscosity eta-hat-bar+ = Vis/3 (Eq. 24 of Ref. 1) versus t/lambda on a log-log scale (blue curve: G = 69.96, lambda*edot = 5.83). All 8500 points are kept, so the whole run is plotted. The plot is stored so that the four runs can be overlaid later (Fig. 4 of Ref. 1)
Check of lambda*edot = G*SL for the current G (run 4: 69.96/12 = 5.83). The output shown below (0.42) was produced earlier, when G was still 5.04; re-evaluate to refresh it
Overlay of the four runs = Fig. 4 of Ref. 1 (p. 104): transient elongational viscosity versus t/lambda for L = 10 and lambda*edot = 0.42 (gray), 0.83 (red), 2.5 (green), 5.83 (blue)
steady values for several lambda*gdot.
Steady-state averages (drop everything before t/lambda=5) and overshoot peak (15-point moving average).
Index of the first time step used in the steady-state averages: t/lambda >= 5, i.e. 5/(dt/SL) steps
steady[lg]: steady-state material functions for lambda*gdot = lg (Gl = lg/SL is the shear rate in code units); one full simulation per call
Run steady[] for lambda*gdot = 0.5, 1, 5.04, 9.96, 20, 30, 50, 60, 70, 80 (10 simulations, this is the slow cell); each row of fig3 is {lambda*gdot, eta}
Show fig3 as a table with column headings
Plot the steady-state eta versus lambda*gdot on a log-log plot (same quantities as Fig. 5 of Ref. 1)
Comparison with Ref . 1 (Binous and Phillips, JNNFM, 1999)
Overlay the simulation plot p on the figure of Ref. 1 (image IMG pasted above, drawn as Raster in Prolog) to compare the curves
References
References
[1] H. Binous and R. J. Phillips, “Dynamic Simulation of One and Two Particles Sedimenting in Viscoelastic Suspensions of FENE Dumbbells,” Journal of Non-Newtonian Fluid Mechanics, vol. 83, pp. 93-130, 1999. DOI: https://doi.org/10.1016/S0377-0257(98)00141-4 . Sections used: 2 (Method of simulation, pp. 96-100) and 3 (Rheological properties of dumbbell suspensions, pp. 100-105; Eqs. 22-24 and Fig. 4 on pp. 103-104).
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Brownian dynamics simulation of FENE dumbbells in start-up uniaxial extensional flow: transient elongational viscosity
by Housam Binous
Wolfram Community, STAFF PICKS, October 22, 2026
https://community.wolfram.com/t/28385
by Housam Binous
Wolfram Community, STAFF PICKS, October 22, 2026
https://community.wolfram.com/t/28385