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-2017 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  while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
49  {
50  if (debug)
51  {
52  Info<< "Time = " << mesh().time().timeName()
53  << " trackTime = " << trackTime
54  << " steptFraction() = " << stepFraction() << endl;
55  }
56 
57 
58  const scalar sfrac = stepFraction();
59 
60  const scalar f = 1 - stepFraction();
61  trackToFace(f*trackTime*U_, f, td);
62 
63  const scalar dt = (stepFraction() - sfrac)*trackTime;
64 
65  const tetIndices tetIs = this->currentTetIndices();
66  scalar rhoc = td.rhoInterp().interpolate(this->coordinates(), tetIs);
67  vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs);
68  scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs);
69 
70  scalar rhop = td.cloud().rhop();
71  scalar magUr = mag(Uc - U_);
72 
73  scalar ReFunc = 1.0;
74  scalar Re = magUr*d_/nuc;
75 
76  if (Re > 0.01)
77  {
78  ReFunc += 0.15*pow(Re, 0.687);
79  }
80 
81  scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
82 
83  U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
84 
85  if (onBoundaryFace() && td.keepParticle)
86  {
87  if (isA<processorPolyPatch>(pbMesh[patch()]))
88  {
89  td.switchProcessor = true;
90  }
91  }
92  }
93 
94  return td.keepParticle;
95 }
96 
97 
99 (
100  const polyPatch&,
101  trackingData&,
102  const label,
103  const scalar,
104  const tetIndices&
105 )
106 {
107  return false;
108 }
109 
110 
112 (
113  const processorPolyPatch&,
114  trackingData& td
115 )
116 {
117  td.switchProcessor = true;
118 }
119 
120 
122 (
123  const wallPolyPatch& wpp,
124  trackingData& td,
125  const tetIndices& tetIs
126 )
127 {
128  vector nw = tetIs.faceTri(mesh()).normal();
129  nw /= mag(nw);
130 
131  scalar Un = U_ & nw;
132  vector Ut = U_ - Un*nw;
133 
134  if (Un > 0)
135  {
136  U_ -= (1.0 + td.cloud().e())*Un*nw;
137  }
138 
139  U_ -= td.cloud().mu()*Ut;
140 }
141 
142 
144 (
145  const polyPatch&,
146  trackingData& td
147 )
148 {
149  td.keepParticle = false;
150 }
151 
152 
154 {
156  U_ = transform(T, U_);
157 }
158 
159 
161 {
162  particle::transformProperties(separation);
163 }
164 
165 
167 {
168  return 0.5*d_;
169 }
170 
171 
172 // ************************************************************************* //
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:424
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
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
Definition: tetIndicesI.H:115
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
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:644
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:978
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Neighbour processor patch.
CloudType & cloud()
Return a reference to the cloud.
Definition: particle.H:138
dynamicFvMesh & mesh
Type interpolate(const cellPointWeight &cpw) const
Interpolate field for the given cellPointWeight.
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
bool move(trackingData &, const scalar)
Move.
Definition: solidParticle.C:38
const interpolationCellPoint< scalar > & rhoInterp() const
const interpolationCellPoint< scalar > & nuInterp() const
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:125
defineTemplateTypeNameAndDebug(IOPtrList< ensightPart >, 0)
vector normal() const
Return vector normal.
Definition: triangleI.H:103
Foam::polyBoundaryMesh.
const interpolationCellPoint< vector > & UInterp() const
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:86
labelList f(nPoints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
PtrList< coordinateSystem > coordinates(solidRegions.size())
messageStream Info
dimensioned< scalar > mag(const dimensioned< Type > &)
bool switchProcessor
Flag to switch processor.
Definition: particle.H:122
bool hitPatch(const polyPatch &, trackingData &td, const label patchi, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:99
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
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
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:477