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) 2011-2016 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 
26 #include "solidParticleCloud.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0);
33 }
34 
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 
38 (
39  trackingData& td,
40  const scalar trackTime
41 )
42 {
43  td.switchProcessor = false;
44  td.keepParticle = true;
45 
46  const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
47 
48  scalar tEnd = (1.0 - stepFraction())*trackTime;
49  scalar dtMax = tEnd;
50 
51  while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
52  {
53  if (debug)
54  {
55  Info<< "Time = " << mesh_.time().timeName()
56  << " trackTime = " << trackTime
57  << " tEnd = " << tEnd
58  << " steptFraction() = " << stepFraction() << endl;
59  }
60 
61  // set the lagrangian time-step
62  scalar dt = min(dtMax, tEnd);
63 
64  // remember which cell the parcel is in
65  // since this will change if a face is hit
66  label celli = cell();
67 
68  dt *= trackToFace(position() + dt*U_, td);
69 
70  tEnd -= dt;
71  stepFraction() = 1.0 - tEnd/trackTime;
72 
73  cellPointWeight cpw(mesh_, position(), celli, face());
74  scalar rhoc = td.rhoInterp().interpolate(cpw);
75  vector Uc = td.UInterp().interpolate(cpw);
76  scalar nuc = td.nuInterp().interpolate(cpw);
77 
78  scalar rhop = td.cloud().rhop();
79  scalar magUr = mag(Uc - U_);
80 
81  scalar ReFunc = 1.0;
82  scalar Re = magUr*d_/nuc;
83 
84  if (Re > 0.01)
85  {
86  ReFunc += 0.15*pow(Re, 0.687);
87  }
88 
89  scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
90 
91  U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
92 
93  if (onBoundary() && td.keepParticle)
94  {
95  if (isA<processorPolyPatch>(pbMesh[patch(face())]))
96  {
97  td.switchProcessor = true;
98  }
99  }
100  }
101 
102  return td.keepParticle;
103 }
104 
105 
107 (
108  const polyPatch&,
109  trackingData&,
110  const label,
111  const scalar,
112  const tetIndices&
113 )
114 {
115  return false;
116 }
117 
118 
120 (
121  const processorPolyPatch&,
122  trackingData& td
123 )
124 {
125  td.switchProcessor = true;
126 }
127 
128 
130 (
131  const wallPolyPatch& wpp,
132  trackingData& td,
133  const tetIndices& tetIs
134 )
135 {
136  vector nw = tetIs.faceTri(mesh_).normal();
137  nw /= mag(nw);
138 
139  scalar Un = U_ & nw;
140  vector Ut = U_ - Un*nw;
141 
142  if (Un > 0)
143  {
144  U_ -= (1.0 + td.cloud().e())*Un*nw;
145  }
146 
147  U_ -= td.cloud().mu()*Ut;
148 }
149 
150 
152 (
153  const polyPatch&,
154  trackingData& td
155 )
156 {
157  td.keepParticle = false;
158 }
159 
160 
162 {
164  U_ = transform(T, U_);
165 }
166 
167 
169 {
170  particle::transformProperties(separation);
171 }
172 
173 
175 {
176  return 0.5*d_;
177 }
178 
179 
180 // ************************************************************************* //
const interpolationCellPoint< vector > & UInterp() const
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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
Definition: tetIndicesI.H:109
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:123
const interpolationCellPoint< scalar > & rhoInterp() const
Neighbour processor patch.
CloudType & cloud()
Return a reference to the cloud.
Definition: particle.H:125
const vector & g() const
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
bool move(trackingData &, const scalar)
Move.
Definition: solidParticle.C:38
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
Definition: particle.H:112
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
defineTemplateTypeNameAndDebug(IOPtrList< ensightPart >, 0)
Foam::polyBoundaryMesh.
Type interpolate(const cellPointWeight &cpw) const
Interpolate field for the given cellPointWeight.
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:86
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
messageStream Info
dimensioned< scalar > mag(const dimensioned< Type > &)
bool switchProcessor
Flag to switch processor.
Definition: particle.H:109
bool hitPatch(const polyPatch &, trackingData &td, const label patchi, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
const interpolationCellPoint< scalar > & nuInterp() const
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Foam::cellPointWeight.
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
label nw
Definition: createFields.H:25
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
vector normal() const
Return vector normal.
Definition: triangleI.H:103