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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "solidParticleCloud.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
35 }
36 
37 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 
40 (
42  trackingData& td,
43  const scalar trackTime
44 )
45 {
46  td.switchProcessor = false;
47  td.keepParticle = true;
48 
49  while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
50  {
51  if (debug)
52  {
53  Pout<< "Time = " << mesh().time().timeName()
54  << " trackTime = " << trackTime
55  << " steptFraction() = " << stepFraction() << endl;
56  }
57 
58 
59  const scalar sfrac = stepFraction();
60 
61  const scalar f = 1 - stepFraction();
62  trackToAndHitFace(f*trackTime*U_, f, cloud, td);
63 
64  const scalar dt = (stepFraction() - sfrac)*trackTime;
65 
66  const tetIndices tetIs = this->currentTetIndices();
67  scalar rhoc = td.rhoInterp().interpolate(this->coordinates(), tetIs);
68  vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs);
69  scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs);
70 
71  scalar rhop = cloud.rhop();
72  scalar magUr = mag(Uc - U_);
73 
74  scalar ReFunc = 1.0;
75  scalar Re = magUr*d_/nuc;
76 
77  if (Re > 0.01)
78  {
79  ReFunc += 0.15*pow(Re, 0.687);
80  }
81 
82  scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
83 
84  U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
85  }
86 
87  return td.keepParticle;
88 }
89 
90 
92 {
93  return false;
94 }
95 
96 
98 (
101 )
102 {
103  td.switchProcessor = true;
104 }
105 
106 
108 {
109  const vector nw = normal();
110 
111  scalar Un = U_ & nw;
112  vector Ut = U_ - Un*nw;
113 
114  if (Un > 0)
115  {
116  U_ -= (1.0 + cloud.e())*Un*nw;
117  }
118 
119  U_ -= cloud.mu()*Ut;
120 }
121 
122 
124 {
126  U_ = transform(T, U_);
127 }
128 
129 
130 void Foam::solidParticle::transformProperties(const vector& separation)
131 {
132  particle::transformProperties(separation);
133 }
134 
135 
136 // ************************************************************************* //
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:116
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
bool hitPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:84
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:1060
bool switchProcessor
Flag to switch processor.
Definition: particle.H:104
const Time & time() const noexcept
Return time registry.
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:53
tetIndices currentTetIndices() const noexcept
Return indices of the current tet that the particle occupies.
Definition: particleI.H:236
A Cloud of solid particles.
Vector< scalar > vector
Definition: vector.H:57
scalar stepFraction() const noexcept
Return the fraction of time-step completed.
Definition: particleI.H:170
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition: Time.C:714
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:84
int debug
Static debugging option.
defineTemplateTypeNameAndDebug(faScalarMatrix, 0)
labelList f(nPoints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
scalarField Re(const UList< complex > &cmplx)
Extract real component.
Definition: complexField.C:207
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void hitProcessorPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:91
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:110
scalar rhop() const noexcept
bool move(solidParticleCloud &, trackingData &, const scalar)
Move.
Definition: solidParticle.C:33
void trackToAndHitFace(const vector &direction, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Tensor of scalars, i.e. Tensor<scalar>.
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Namespace for OpenFOAM.