1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "solidParticleCloud.H"
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 bool Foam::solidParticle::move(solidParticle::trackData& td)
33 td.switchProcessor = false;
34 td.keepParticle = true;
36 const polyMesh& mesh = cloud().pMesh();
37 const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
39 scalar deltaT = mesh.time().deltaT().value();
40 scalar tEnd = (1.0 - stepFraction())*deltaT;
43 while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
47 Info<< "Time = " << mesh.time().timeName()
48 << " deltaT = " << deltaT
50 << " steptFraction() = " << stepFraction() << endl;
53 // set the lagrangian time-step
54 scalar dt = min(dtMax, tEnd);
56 // remember which cell the parcel is in
57 // since this will change if a face is hit
60 dt *= trackToFace(position() + dt*U_, td);
63 stepFraction() = 1.0 - tEnd/deltaT;
65 cellPointWeight cpw(mesh, position(), celli, face());
66 scalar rhoc = td.rhoInterp().interpolate(cpw);
67 vector Uc = td.UInterp().interpolate(cpw);
68 scalar nuc = td.nuInterp().interpolate(cpw);
70 scalar rhop = td.spc().rhop();
71 scalar magUr = mag(Uc - U_);
74 scalar Re = magUr*d_/nuc;
78 ReFunc += 0.15*pow(Re, 0.687);
81 scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
83 U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
85 if (onBoundary() && td.keepParticle)
87 if (isType<processorPolyPatch>(pbMesh[patch(face())]))
89 td.switchProcessor = true;
94 return td.keepParticle;
98 bool Foam::solidParticle::hitPatch
101 solidParticle::trackData&,
109 bool Foam::solidParticle::hitPatch
120 void Foam::solidParticle::hitProcessorPatch
122 const processorPolyPatch&,
123 solidParticle::trackData& td
126 td.switchProcessor = true;
130 void Foam::solidParticle::hitProcessorPatch
132 const processorPolyPatch&,
138 void Foam::solidParticle::hitWallPatch
140 const wallPolyPatch& wpp,
141 solidParticle::trackData& td
144 vector nw = wpp.faceAreas()[wpp.whichFace(face())];
148 vector Ut = U_ - Un*nw;
152 U_ -= (1.0 + td.spc().e())*Un*nw;
155 U_ -= td.spc().mu()*Ut;
159 void Foam::solidParticle::hitWallPatch
161 const wallPolyPatch&,
167 void Foam::solidParticle::hitPatch
170 solidParticle::trackData& td
173 td.keepParticle = false;
177 void Foam::solidParticle::hitPatch
185 void Foam::solidParticle::transformProperties (const tensor& T)
187 Particle<solidParticle>::transformProperties(T);
188 U_ = transform(T, U_);
192 void Foam::solidParticle::transformProperties(const vector& separation)
194 Particle<solidParticle>::transformProperties(separation);
198 // ************************************************************************* //