initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / solidParticle / solidParticle.C
blobe77b9cf8a2f94ac4fd8736e217b9b0ebb9de3874
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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;
41     scalar dtMax = tEnd;
43     while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
44     {
45         if (debug)
46         {
47             Info<< "Time = " << mesh.time().timeName()
48                 << " deltaT = " << deltaT
49                 << " tEnd = " << tEnd
50                 << " steptFraction() = " << stepFraction() << endl;
51         }
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
58         label celli = cell();
60         dt *= trackToFace(position() + dt*U_, td);
62         tEnd -= dt;
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_);
73         scalar ReFunc = 1.0;
74         scalar Re = magUr*d_/nuc;
76         if (Re > 0.01)
77         {
78             ReFunc += 0.15*pow(Re, 0.687);
79         }
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)
86         {
87             if (isType<processorPolyPatch>(pbMesh[patch(face())]))
88             {
89                 td.switchProcessor = true;
90             }
91         }
92     }
94     return td.keepParticle;
98 bool Foam::solidParticle::hitPatch
100     const polyPatch&,
101     solidParticle::trackData&,
102     const label
105     return false;
109 bool Foam::solidParticle::hitPatch
111     const polyPatch&,
112     int&,
113     const label
116     return false;
120 void Foam::solidParticle::hitProcessorPatch
122     const processorPolyPatch&,
123     solidParticle::trackData& td
126     td.switchProcessor = true;
130 void Foam::solidParticle::hitProcessorPatch
132     const processorPolyPatch&,
133     int&
138 void Foam::solidParticle::hitWallPatch
140     const wallPolyPatch& wpp,
141     solidParticle::trackData& td
144     vector nw = wpp.faceAreas()[wpp.whichFace(face())];
145     nw /= mag(nw);
147     scalar Un = U_ & nw;
148     vector Ut = U_ - Un*nw;
150     if (Un > 0)
151     {
152         U_ -= (1.0 + td.spc().e())*Un*nw;
153     }
155     U_ -= td.spc().mu()*Ut;
159 void Foam::solidParticle::hitWallPatch
161     const wallPolyPatch&,
162     int&
167 void Foam::solidParticle::hitPatch
169     const polyPatch&,
170     solidParticle::trackData& td
173     td.keepParticle = false;
177 void Foam::solidParticle::hitPatch
179     const polyPatch&,
180     int&
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 // ************************************************************************* //