1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "solidParticleCloud.H"
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0);
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 bool Foam::solidParticle::move
40 const scalar trackTime
43 td.switchProcessor = false;
44 td.keepParticle = true;
46 const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
48 scalar tEnd = (1.0 - stepFraction())*trackTime;
51 while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
55 Info<< "Time = " << mesh_.time().timeName()
56 << " trackTime = " << trackTime
58 << " steptFraction() = " << stepFraction() << endl;
61 // set the lagrangian time-step
62 scalar dt = min(dtMax, tEnd);
64 // remember which cell the parcel is in
65 // since this will change if a face is hit
68 dt *= trackToFace(position() + dt*U_, td);
71 stepFraction() = 1.0 - tEnd/trackTime;
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);
78 scalar rhop = td.cloud().rhop();
79 scalar magUr = mag(Uc - U_);
82 scalar Re = magUr*d_/nuc;
86 ReFunc += 0.15*pow(Re, 0.687);
89 scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
91 U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
93 if (onBoundary() && td.keepParticle)
95 if (isA<processorPolyPatch>(pbMesh[patch(face())]))
97 td.switchProcessor = true;
102 return td.keepParticle;
106 bool Foam::solidParticle::hitPatch
119 void Foam::solidParticle::hitProcessorPatch
121 const processorPolyPatch&,
125 td.switchProcessor = true;
129 void Foam::solidParticle::hitWallPatch
131 const wallPolyPatch& wpp,
133 const tetIndices& tetIs
136 vector nw = tetIs.faceTri(mesh_).normal();
140 vector Ut = U_ - Un*nw;
144 U_ -= (1.0 + td.cloud().e())*Un*nw;
147 U_ -= td.cloud().mu()*Ut;
151 void Foam::solidParticle::hitPatch
157 td.keepParticle = false;
161 void Foam::solidParticle::transformProperties (const tensor& T)
163 particle::transformProperties(T);
164 U_ = transform(T, U_);
168 void Foam::solidParticle::transformProperties(const vector& separation)
170 particle::transformProperties(separation);
174 Foam::scalar Foam::solidParticle::wallImpactDistance(const vector&) const
180 // ************************************************************************* //