ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / lagrangian / solidParticle / solidParticle.C
blobe1dad93d020e66c914d47cb95c9a8e8019706f10
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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 * * * * * * * * * * * * * //
30 namespace Foam
32     defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0);
35 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
37 bool Foam::solidParticle::move
39     trackingData& td,
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;
49     scalar dtMax = tEnd;
51     while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
52     {
53         if (debug)
54         {
55             Info<< "Time = " << mesh_.time().timeName()
56                 << " trackTime = " << trackTime
57                 << " tEnd = " << tEnd
58                 << " steptFraction() = " << stepFraction() << endl;
59         }
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
66         label cellI = cell();
68         dt *= trackToFace(position() + dt*U_, td);
70         tEnd -= dt;
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_);
81         scalar ReFunc = 1.0;
82         scalar Re = magUr*d_/nuc;
84         if (Re > 0.01)
85         {
86             ReFunc += 0.15*pow(Re, 0.687);
87         }
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)
94         {
95             if (isA<processorPolyPatch>(pbMesh[patch(face())]))
96             {
97                 td.switchProcessor = true;
98             }
99         }
100     }
102     return td.keepParticle;
106 bool Foam::solidParticle::hitPatch
108     const polyPatch&,
109     trackingData&,
110     const label,
111     const scalar,
112     const tetIndices&
115     return false;
119 void Foam::solidParticle::hitProcessorPatch
121     const processorPolyPatch&,
122     trackingData& td
125     td.switchProcessor = true;
129 void Foam::solidParticle::hitWallPatch
131     const wallPolyPatch& wpp,
132     trackingData& td,
133     const tetIndices& tetIs
136     vector nw = tetIs.faceTri(mesh_).normal();
137     nw /= mag(nw);
139     scalar Un = U_ & nw;
140     vector Ut = U_ - Un*nw;
142     if (Un > 0)
143     {
144         U_ -= (1.0 + td.cloud().e())*Un*nw;
145     }
147     U_ -= td.cloud().mu()*Ut;
151 void Foam::solidParticle::hitPatch
153     const polyPatch&,
154     trackingData& td
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
176     return 0.5*d_;
180 // ************************************************************************* //