OpenMPCD
AnalyticQuantities_SimpleFluid.py
1 import math
2 
3 def kineticContributionsToSRDKinematicShearViscosity(
4  meanParticleCountPerCell, kT, m,
5  mpcTimestep, srdAngle):
6  M = meanParticleCountPerCell
7 
8  factor1 = kT * mpcTimestep / (2 * m)
9  denominator1 = M - 1 + math.exp(-M)
10  denominator2 = 2 - math.cos(srdAngle) - math.cos(2 * srdAngle)
11  factor2 = 5 * M / (denominator1 * denominator2) - 1
12 
13  return factor1 * factor2;
14 
15 def collisionalContributionsToSRDKinematicShearViscosity(
16  linearCellSize, meanParticleCountPerCell, mpcTimestep, srdAngle):
17  """
18  Returns the collisional contribution to the kinematic shear viscosity in SRD,
19  according to table 1 in
20  Gompper, Ihle, Kroll, and Winkler:
21  "Multi-Particle Collision Dynamics: A Particle-Based Mesoscale Simulation Approach to the Hydrodynamics of Complex Fluids"
22  DOI: 10.1007/12_2008_5
23 
24  @param[in] linearCellSize The size of a collision cell. This is called "a" in the reference, and is usually 1.
25  @param[in] meanParticleCountPerCell The average number of MPC particles per collision cell.
26  @param[in] mpcTimestep The timestep for the MPC streaming step.
27  @param[in] srdAngle The rotation angle in SRD.
28  """
29  M = meanParticleCountPerCell
30 
31  factor1 = linearCellSize * linearCellSize / (6 * 3 * mpcTimestep);
32  factor2 = (M - 1 + math.exp(-M)) / M;
33  factor3 = 1 - math.cos(srdAngle);
34 
35  return factor1 * factor2 * factor3;
36 
37 def approximateSelfDiffusionCoefficient(
38  meanParticleCountPerCell, m,
39  kT, mpcTimestep, dimensions, srdAngle):
40  M = meanParticleCountPerCell
41 
42  factor1 = kT * mpcTimestep / (2.0 * m)
43  term2 = dimensions * M / ((1 - math.cos(srdAngle)) * (M - 1 + math.exp(-M)))
44 
45  return factor1 * (term2 - 1)