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 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 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::particle::TrackingData::keepParticle
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
Definition: particle.H:112
Foam::solidParticle::trackingData::g
const vector & g() const
Definition: solidParticleI.H:84
Foam::Re
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
Foam::particle::TrackingData::cloud
CloudType & cloud()
Return a reference to the cloud.
Definition: particle.H:125
nw
label nw
Definition: createFields.H:25
Foam::solidParticleCloud::e
scalar e() const
Definition: solidParticleCloudI.H:40
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::solidParticle::hitPatch
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:107
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
Foam::solidParticle::wallImpactDistance
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
Definition: solidParticle.C:174
Foam::solidParticle::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: solidParticle.C:161
Foam::solidParticle::trackingData::UInterp
const interpolationCellPoint< vector > & UInterp() const
Definition: solidParticleI.H:72
Foam::label
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
Foam::triangle::normal
vector normal() const
Return vector normal.
Definition: triangleI.H:116
Foam::tetIndices::faceTri
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
Definition: tetIndicesI.H:109
Foam::solidParticle::trackingData::nuInterp
const interpolationCellPoint< scalar > & nuInterp() const
Definition: solidParticleI.H:79
Foam::Info
messageStream Info
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::solidParticleCloud::mu
scalar mu() const
Definition: solidParticleCloudI.H:46
Foam::processorPolyPatch
Neighbour processor patch.
Definition: processorPolyPatch.H:55
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::cellPointWeight
Foam::cellPointWeight.
Definition: cellPointWeight.H:50
Foam::solidParticle::hitProcessorPatch
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:120
Foam::solidParticleCloud::rhop
scalar rhop() const
Definition: solidParticleCloudI.H:34
Foam::wallPolyPatch
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
Foam::interpolationCellPoint::interpolate
Type interpolate(const cellPointWeight &cpw) const
Interpolate field for the given cellPointWeight.
Definition: interpolationCellPointI.H:30
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::solidParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:78
Foam::particle::TrackingData::switchProcessor
bool switchProcessor
Flag to switch processor.
Definition: particle.H:109
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::solidParticle::U_
vector U_
Velocity of parcel.
Definition: solidParticle.H:70
T
const volScalarField & T
Definition: createFields.H:25
Foam::solidParticle::move
bool move(trackingData &, const scalar)
Move.
Definition: solidParticle.C:38
solidParticleCloud.H
Foam::particle::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:123
Foam::Vector< scalar >
Foam::solidParticle::hitWallPatch
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
Definition: solidParticle.C:130
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::solidParticle::trackingData::rhoInterp
const interpolationCellPoint< scalar > & rhoInterp() const
Definition: solidParticleI.H:65
Foam::defineTemplateTypeNameAndDebug
defineTemplateTypeNameAndDebug(IOPtrList< ensightPart >, 0)
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56