PairSpringSliderDashpot.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class CloudType>
32 (
33  scalar& RMin,
34  scalar& rhoMax,
35  scalar& UMagMax
36 ) const
37 {
38  RMin = vGreat;
39  rhoMax = -vGreat;
40  UMagMax = -vGreat;
41 
42  forAllConstIter(typename CloudType, this->owner(), iter)
43  {
44  const typename CloudType::parcelType& p = iter();
45 
46  // Finding minimum diameter to avoid excessive arithmetic
47 
48  scalar dEff = p.d();
49 
50  if (useEquivalentSize_)
51  {
52  dEff *= cbrt(p.nParticle()*volumeFactor_);
53  }
54 
55  RMin = min(dEff, RMin);
56 
57  rhoMax = max(p.rho(), rhoMax);
58 
59  UMagMax = max
60  (
61  mag(p.U()) + mag(p.omega())*dEff/2,
62  UMagMax
63  );
64  }
65 
66  // Transform the minimum diameter into minimum radius
67  // rMin = dMin/2
68  // then rMin into minimum R,
69  // 1/RMin = 1/rMin + 1/rMin,
70  // RMin = rMin/2 = dMin/4
71 
72  RMin /= 4.0;
73 
74  // Multiply by two to create the worst-case relative velocity
75 
76  UMagMax = 2*UMagMax;
77 }
78 
79 
80 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
81 
82 template<class CloudType>
84 (
85  const dictionary& dict,
86  CloudType& cloud
87 )
88 :
89  PairModel<CloudType>(dict, cloud, typeName),
90  Estar_(),
91  Gstar_(),
92  alpha_(this->coeffDict().template lookup<scalar>("alpha")),
93  b_(this->coeffDict().template lookup<scalar>("b")),
94  mu_(this->coeffDict().template lookup<scalar>("mu")),
95  cohesionEnergyDensity_
96  (
97  this->coeffDict().template lookup<scalar>("cohesionEnergyDensity")
98  ),
99  cohesion_(false),
100  collisionResolutionSteps_
101  (
102  this->coeffDict().template lookup<scalar>("collisionResolutionSteps")
103  ),
104  volumeFactor_(1.0),
105  useEquivalentSize_(Switch(this->coeffDict().lookup("useEquivalentSize")))
106 {
107  if (useEquivalentSize_)
108  {
109  volumeFactor_ =
110  this->coeffDict().template lookup<scalar>("volumeFactor");
111  }
112 
113  scalar nu = this->owner().constProps().poissonsRatio();
114 
115  scalar E = this->owner().constProps().youngsModulus();
116 
117  Estar_ = E/(2.0*(1.0 - sqr(nu)));
118 
119  scalar G = E/(2.0*(1.0 + nu));
120 
121  Gstar_ = G/(2.0*(2.0 - nu));
122 
123  cohesion_ = (mag(cohesionEnergyDensity_) > vSmall);
124 }
125 
126 
127 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
128 
129 template<class CloudType>
131 {}
132 
133 
134 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
135 
136 template<class CloudType>
138 {
139  return true;
140 }
141 
142 
143 template<class CloudType>
145 {
146  if (!(this->owner().size()))
147  {
148  return 1;
149  }
150 
151  scalar RMin;
152  scalar rhoMax;
153  scalar UMagMax;
154 
155  findMinMaxProperties(RMin, rhoMax, UMagMax);
156 
157  // Note: pi^(7/5)*(5/4)^(2/5) = 5.429675
158  scalar minCollisionDeltaT =
159  5.429675
160  *RMin
161  *pow(rhoMax/(Estar_*sqrt(UMagMax) + vSmall), 0.4)
162  /collisionResolutionSteps_;
163 
164  return ceil(this->owner().time().deltaTValue()/minCollisionDeltaT);
165 }
166 
167 
168 template<class CloudType>
170 (
171  typename CloudType::parcelType& pA,
172  typename CloudType::parcelType& pB
173 ) const
174 {
175  vector r_AB = (pA.position() - pB.position());
176 
177  scalar dAEff = pA.d();
178 
179  if (useEquivalentSize_)
180  {
181  dAEff *= cbrt(pA.nParticle()*volumeFactor_);
182  }
183 
184  scalar dBEff = pB.d();
185 
186  if (useEquivalentSize_)
187  {
188  dBEff *= cbrt(pB.nParticle()*volumeFactor_);
189  }
190 
191  scalar r_AB_mag = mag(r_AB);
192 
193  scalar normalOverlapMag = 0.5*(dAEff + dBEff) - r_AB_mag;
194 
195  if (normalOverlapMag > 0)
196  {
197  // Particles in collision
198 
199  vector rHat_AB = r_AB/(r_AB_mag + vSmall);
200 
201  vector U_AB = pA.U() - pB.U();
202 
203  // Effective radius
204  scalar R = 0.5*dAEff*dBEff/(dAEff + dBEff);
205 
206  // Effective mass
207  scalar M = pA.mass()*pB.mass()/(pA.mass() + pB.mass());
208 
209  scalar kN = (4.0/3.0)*sqrt(R)*Estar_;
210 
211  scalar etaN = alpha_*sqrt(M*kN)*pow025(normalOverlapMag);
212 
213  // Normal force
214  vector fN_AB =
215  rHat_AB
216  *(kN*pow(normalOverlapMag, b_) - etaN*(U_AB & rHat_AB));
217 
218  // Cohesion force, energy density multiplied by the area of
219  // particle-particle overlap
220  if (cohesion_)
221  {
222  fN_AB +=
223  -cohesionEnergyDensity_
224  *overlapArea(dAEff/2.0, dBEff/2.0, r_AB_mag)
225  *rHat_AB;
226  }
227 
228  pA.f() += fN_AB;
229  pB.f() += -fN_AB;
230 
231  vector USlip_AB =
232  U_AB - (U_AB & rHat_AB)*rHat_AB
233  - ((dAEff/2*pA.omega() + dBEff/2*pB.omega()) ^ rHat_AB);
234 
235  scalar deltaT = this->owner().mesh().time().deltaTValue();
236 
237  vector& tangentialOverlap_AB =
238  pA.collisionRecords().matchPairRecord
239  (
240  pB.origProc(),
241  pB.origId()
242  ).collisionData();
243 
244  vector& tangentialOverlap_BA =
245  pB.collisionRecords().matchPairRecord
246  (
247  pA.origProc(),
248  pA.origId()
249  ).collisionData();
250 
251  vector deltaTangentialOverlap_AB = USlip_AB*deltaT;
252 
253  tangentialOverlap_AB += deltaTangentialOverlap_AB;
254  tangentialOverlap_BA += -deltaTangentialOverlap_AB;
255 
256  scalar tangentialOverlapMag = mag(tangentialOverlap_AB);
257 
258  if (tangentialOverlapMag > vSmall)
259  {
260  scalar kT = 8.0*sqrt(R*normalOverlapMag)*Gstar_;
261 
262  scalar etaT = etaN;
263 
264  // Tangential force
265  vector fT_AB;
266 
267  if (kT*tangentialOverlapMag > mu_*mag(fN_AB))
268  {
269  // Tangential force greater than sliding friction,
270  // particle slips
271 
272  fT_AB = -mu_*mag(fN_AB)*USlip_AB/mag(USlip_AB);
273 
274  tangentialOverlap_AB = Zero;
275  tangentialOverlap_BA = Zero;
276  }
277  else
278  {
279  fT_AB = - kT*tangentialOverlap_AB - etaT*USlip_AB;
280  }
281 
282  pA.f() += fT_AB;
283  pB.f() += -fT_AB;
284 
285  pA.torque() += (dAEff/2*-rHat_AB) ^ fT_AB;
286  pB.torque() += (dBEff/2*rHat_AB) ^ -fT_AB;
287  }
288  }
289 }
290 
291 
292 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
DSMCCloud< dsmcParcel > CloudType
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
const dimensionedScalar G
Newtonian constant of gravitation.
Pair forces between particles colliding with a spring, slider, damper model.
PairSpringSliderDashpot(const dictionary &dict, CloudType &cloud)
Construct from dictionary.
virtual void evaluatePair(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const
Calculate the pair interaction between parcels.
stressControl lookup("compactNormalStress") >> compactNormalStress
virtual bool controlsTimestep() const
Whether the PairModel has a timestep limit that will.
dimensionedScalar cbrt(const dimensionedScalar &ds)
Templated pair interaction class.
Definition: PairCollision.H:48
static const zero Zero
Definition: zero.H:97
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
#define R(A, B, C, D, E, F, K, M)
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual ~PairSpringSliderDashpot()
Destructor.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
virtual label nSubCycles() const
For PairModels that control the timestep, calculate the.
#define M(I)