FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

solidParticle.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <solidParticle/solidParticleCloud.H>
00027 
00028 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00029 
00030 bool Foam::solidParticle::move(solidParticle::trackData& td)
00031 {
00032     td.switchProcessor = false;
00033     td.keepParticle = true;
00034 
00035     const polyMesh& mesh = cloud().pMesh();
00036     const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
00037 
00038     scalar deltaT = mesh.time().deltaT().value();
00039     scalar tEnd = (1.0 - stepFraction())*deltaT;
00040     scalar dtMax = tEnd;
00041 
00042     while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
00043     {
00044         if (debug)
00045         {
00046             Info<< "Time = " << mesh.time().timeName()
00047                 << " deltaT = " << deltaT
00048                 << " tEnd = " << tEnd
00049                 << " steptFraction() = " << stepFraction() << endl;
00050         }
00051 
00052         // set the lagrangian time-step
00053         scalar dt = min(dtMax, tEnd);
00054 
00055         // remember which cell the parcel is in
00056         // since this will change if a face is hit
00057         label celli = cell();
00058 
00059         dt *= trackToFace(position() + dt*U_, td);
00060 
00061         tEnd -= dt;
00062         stepFraction() = 1.0 - tEnd/deltaT;
00063 
00064         cellPointWeight cpw(mesh, position(), celli, face());
00065         scalar rhoc = td.rhoInterp().interpolate(cpw);
00066         vector Uc = td.UInterp().interpolate(cpw);
00067         scalar nuc = td.nuInterp().interpolate(cpw);
00068 
00069         scalar rhop = td.spc().rhop();
00070         scalar magUr = mag(Uc - U_);
00071 
00072         scalar ReFunc = 1.0;
00073         scalar Re = magUr*d_/nuc;
00074 
00075         if (Re > 0.01)
00076         {
00077             ReFunc += 0.15*pow(Re, 0.687);
00078         }
00079 
00080         scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
00081 
00082         U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
00083 
00084         if (onBoundary() && td.keepParticle)
00085         {
00086             if (isA<processorPolyPatch>(pbMesh[patch(face())]))
00087             {
00088                 td.switchProcessor = true;
00089             }
00090         }
00091     }
00092 
00093     return td.keepParticle;
00094 }
00095 
00096 
00097 bool Foam::solidParticle::hitPatch
00098 (
00099     const polyPatch&,
00100     solidParticle::trackData&,
00101     const label
00102 )
00103 {
00104     return false;
00105 }
00106 
00107 
00108 bool Foam::solidParticle::hitPatch
00109 (
00110     const polyPatch&,
00111     int&,
00112     const label
00113 )
00114 {
00115     return false;
00116 }
00117 
00118 
00119 void Foam::solidParticle::hitProcessorPatch
00120 (
00121     const processorPolyPatch&,
00122     solidParticle::trackData& td
00123 )
00124 {
00125     td.switchProcessor = true;
00126 }
00127 
00128 
00129 void Foam::solidParticle::hitProcessorPatch
00130 (
00131     const processorPolyPatch&,
00132     int&
00133 )
00134 {}
00135 
00136 
00137 void Foam::solidParticle::hitWallPatch
00138 (
00139     const wallPolyPatch& wpp,
00140     solidParticle::trackData& td
00141 )
00142 {
00143     vector nw = wpp.faceAreas()[wpp.whichFace(face())];
00144     nw /= mag(nw);
00145 
00146     scalar Un = U_ & nw;
00147     vector Ut = U_ - Un*nw;
00148 
00149     if (Un > 0)
00150     {
00151         U_ -= (1.0 + td.spc().e())*Un*nw;
00152     }
00153 
00154     U_ -= td.spc().mu()*Ut;
00155 }
00156 
00157 
00158 void Foam::solidParticle::hitWallPatch
00159 (
00160     const wallPolyPatch&,
00161     int&
00162 )
00163 {}
00164 
00165 
00166 void Foam::solidParticle::hitPatch
00167 (
00168     const polyPatch&,
00169     solidParticle::trackData& td
00170 )
00171 {
00172     td.keepParticle = false;
00173 }
00174 
00175 
00176 void Foam::solidParticle::hitPatch
00177 (
00178     const polyPatch&,
00179     int&
00180 )
00181 {}
00182 
00183 
00184 void Foam::solidParticle::transformProperties (const tensor& T)
00185 {
00186     Particle<solidParticle>::transformProperties(T);
00187     U_ = transform(T, U_);
00188 }
00189 
00190 
00191 void Foam::solidParticle::transformProperties(const vector& separation)
00192 {
00193     Particle<solidParticle>::transformProperties(separation);
00194 }
00195 
00196 
00197 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines