FreeFOAM The Cross-Platform CFD Toolkit
solidParticle.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
31 {
32  td.switchProcessor = false;
33  td.keepParticle = true;
34 
35  const polyMesh& mesh = cloud().pMesh();
36  const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
37 
38  scalar deltaT = mesh.time().deltaT().value();
39  scalar tEnd = (1.0 - stepFraction())*deltaT;
40  scalar dtMax = tEnd;
41 
42  while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
43  {
44  if (debug)
45  {
46  Info<< "Time = " << mesh.time().timeName()
47  << " deltaT = " << deltaT
48  << " tEnd = " << tEnd
49  << " steptFraction() = " << stepFraction() << endl;
50  }
51 
52  // set the lagrangian time-step
53  scalar dt = min(dtMax, tEnd);
54 
55  // remember which cell the parcel is in
56  // since this will change if a face is hit
57  label celli = cell();
58 
59  dt *= trackToFace(position() + dt*U_, td);
60 
61  tEnd -= dt;
62  stepFraction() = 1.0 - tEnd/deltaT;
63 
64  cellPointWeight cpw(mesh, position(), celli, face());
65  scalar rhoc = td.rhoInterp().interpolate(cpw);
66  vector Uc = td.UInterp().interpolate(cpw);
67  scalar nuc = td.nuInterp().interpolate(cpw);
68 
69  scalar rhop = td.spc().rhop();
70  scalar magUr = mag(Uc - U_);
71 
72  scalar ReFunc = 1.0;
73  scalar Re = magUr*d_/nuc;
74 
75  if (Re > 0.01)
76  {
77  ReFunc += 0.15*pow(Re, 0.687);
78  }
79 
80  scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
81 
82  U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
83 
84  if (onBoundary() && td.keepParticle)
85  {
86  if (isA<processorPolyPatch>(pbMesh[patch(face())]))
87  {
88  td.switchProcessor = true;
89  }
90  }
91  }
92 
93  return td.keepParticle;
94 }
95 
96 
98 (
99  const polyPatch&,
101  const label
102 )
103 {
104  return false;
105 }
106 
107 
109 (
110  const polyPatch&,
111  int&,
112  const label
113 )
114 {
115  return false;
116 }
117 
118 
120 (
121  const processorPolyPatch&,
123 )
124 {
125  td.switchProcessor = true;
126 }
127 
128 
130 (
131  const processorPolyPatch&,
132  int&
133 )
134 {}
135 
136 
138 (
139  const wallPolyPatch& wpp,
141 )
142 {
143  vector nw = wpp.faceAreas()[wpp.whichFace(face())];
144  nw /= mag(nw);
145 
146  scalar Un = U_ & nw;
147  vector Ut = U_ - Un*nw;
148 
149  if (Un > 0)
150  {
151  U_ -= (1.0 + td.spc().e())*Un*nw;
152  }
153 
154  U_ -= td.spc().mu()*Ut;
155 }
156 
157 
159 (
160  const wallPolyPatch&,
161  int&
162 )
163 {}
164 
165 
167 (
168  const polyPatch&,
170 )
171 {
172  td.keepParticle = false;
173 }
174 
175 
177 (
178  const polyPatch&,
179  int&
180 )
181 {}
182 
183 
185 {
187  U_ = transform(T, U_);
188 }
189 
190 
192 {
194 }
195 
196 
197 // ************************ vim: set sw=4 sts=4 et: ************************ //