Merge /u/wyldckat/foam-extend32/ branch master into master
[foam-extend-3.2.git] / src / lagrangian / solidParticle / solidParticle.C
blobdd6e34cf7a6eef6b1847d216113eef4792f2dc0d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "solidParticleCloud.H"
28 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
30 bool Foam::solidParticle::move(solidParticle::trackData& td)
32     td.switchProcessor = false;
33     td.keepParticle = true;
35     const polyMesh& mesh = cloud().pMesh();
36     const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
38     scalar deltaT = mesh.time().deltaT().value();
39     scalar tEnd = (1.0 - stepFraction())*deltaT;
40     scalar dtMax = tEnd;
42     while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
43     {
44         if (debug)
45         {
46             Info<< "Time = " << mesh.time().timeName()
47                 << " deltaT = " << deltaT
48                 << " tEnd = " << tEnd
49                 << " steptFraction() = " << stepFraction() << endl;
50         }
52         // set the lagrangian time-step
53         scalar dt = min(dtMax, tEnd);
55         // remember which cell the parcel is in
56         // since this will change if a face is hit
57         label celli = cell();
59         dt *= trackToFace(position() + dt*U_, td);
61         tEnd -= dt;
62         stepFraction() = 1.0 - tEnd/deltaT;
64         cellPointWeight cpw(mesh, position(), celli, face());
65         scalar rhoc = td.rhoInterp().interpolate(cpw);
66         vector Uc = td.UInterp().interpolate(cpw);
67         scalar nuc = td.nuInterp().interpolate(cpw);
69         scalar rhop = td.spc().rhop();
70         scalar magUr = mag(Uc - U_);
72         scalar ReFunc = 1.0;
73         scalar Re = magUr*d_/nuc;
75         if (Re > 0.01)
76         {
77             ReFunc += 0.15*pow(Re, 0.687);
78         }
80         scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
82         U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
84         if (onBoundary() && td.keepParticle)
85         {
86             // Bug fix.  HJ, 25/Aug/2010
87             if (face() > -1)
88             {
89                 if (isType<processorPolyPatch>(pbMesh[patch(face())]))
90                 {
91                     td.switchProcessor = true;
92                 }
93             }
94         }
95     }
97     return td.keepParticle;
101 bool Foam::solidParticle::hitPatch
103     const polyPatch&,
104     solidParticle::trackData&,
105     const label
108     return false;
112 bool Foam::solidParticle::hitPatch
114     const polyPatch&,
115     int&,
116     const label
119     return false;
123 void Foam::solidParticle::hitProcessorPatch
125     const processorPolyPatch&,
126     solidParticle::trackData& td
129     td.switchProcessor = true;
133 void Foam::solidParticle::hitProcessorPatch
135     const processorPolyPatch&,
136     int&
141 void Foam::solidParticle::hitWallPatch
143     const wallPolyPatch& wpp,
144     solidParticle::trackData& td
147     vector nw = wpp.faceAreas()[wpp.whichFace(face())];
148     nw /= mag(nw);
150     scalar Un = U_ & nw;
151     vector Ut = U_ - Un*nw;
153     if (Un > 0)
154     {
155         U_ -= (1.0 + td.spc().e())*Un*nw;
156     }
158     U_ -= td.spc().mu()*Ut;
162 void Foam::solidParticle::hitWallPatch
164     const wallPolyPatch&,
165     int&
170 void Foam::solidParticle::hitPatch
172     const polyPatch&,
173     solidParticle::trackData& td
176     td.keepParticle = false;
180 void Foam::solidParticle::hitPatch
182     const polyPatch&,
183     int&
188 void Foam::solidParticle::transformProperties(const tensor& T)
190     Particle<solidParticle>::transformProperties(T);
191     U_ = transform(T, U_);
195 void Foam::solidParticle::transformProperties(const vector& separation)
197     Particle<solidParticle>::transformProperties(separation);
201 // ************************************************************************* //