OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "solidParticleCloud.H"
00028 
00029 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00030 
00031 bool Foam::solidParticle::move(solidParticle::trackData& td)
00032 {
00033     td.switchProcessor = false;
00034     td.keepParticle = true;
00035 
00036     const polyMesh& mesh = cloud().pMesh();
00037     const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
00038 
00039     scalar deltaT = mesh.time().deltaT().value();
00040     scalar tEnd = (1.0 - stepFraction())*deltaT;
00041     scalar dtMax = tEnd;
00042 
00043     while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
00044     {
00045         if (debug)
00046         {
00047             Info<< "Time = " << mesh.time().timeName()
00048                 << " deltaT = " << deltaT
00049                 << " tEnd = " << tEnd
00050                 << " steptFraction() = " << stepFraction() << endl;
00051         }
00052 
00053         // set the lagrangian time-step
00054         scalar dt = min(dtMax, tEnd);
00055 
00056         // remember which cell the parcel is in
00057         // since this will change if a face is hit
00058         label celli = cell();
00059 
00060         dt *= trackToFace(position() + dt*U_, td);
00061 
00062         tEnd -= dt;
00063         stepFraction() = 1.0 - tEnd/deltaT;
00064 
00065         cellPointWeight cpw(mesh, position(), celli, face());
00066         scalar rhoc = td.rhoInterp().interpolate(cpw);
00067         vector Uc = td.UInterp().interpolate(cpw);
00068         scalar nuc = td.nuInterp().interpolate(cpw);
00069 
00070         scalar rhop = td.spc().rhop();
00071         scalar magUr = mag(Uc - U_);
00072 
00073         scalar ReFunc = 1.0;
00074         scalar Re = magUr*d_/nuc;
00075 
00076         if (Re > 0.01)
00077         {
00078             ReFunc += 0.15*pow(Re, 0.687);
00079         }
00080 
00081         scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
00082 
00083         U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
00084 
00085         if (onBoundary() && td.keepParticle)
00086         {
00087             if (isType<processorPolyPatch>(pbMesh[patch(face())]))
00088             {
00089                 td.switchProcessor = true;
00090             }
00091         }
00092     }
00093 
00094     return td.keepParticle;
00095 }
00096 
00097 
00098 bool Foam::solidParticle::hitPatch
00099 (
00100     const polyPatch&,
00101     solidParticle::trackData&,
00102     const label
00103 )
00104 {
00105     return false;
00106 }
00107 
00108 
00109 bool Foam::solidParticle::hitPatch
00110 (
00111     const polyPatch&,
00112     int&,
00113     const label
00114 )
00115 {
00116     return false;
00117 }
00118 
00119 
00120 void Foam::solidParticle::hitProcessorPatch
00121 (
00122     const processorPolyPatch&,
00123     solidParticle::trackData& td
00124 )
00125 {
00126     td.switchProcessor = true;
00127 }
00128 
00129 
00130 void Foam::solidParticle::hitProcessorPatch
00131 (
00132     const processorPolyPatch&,
00133     int&
00134 )
00135 {}
00136 
00137 
00138 void Foam::solidParticle::hitWallPatch
00139 (
00140     const wallPolyPatch& wpp,
00141     solidParticle::trackData& td
00142 )
00143 {
00144     vector nw = wpp.faceAreas()[wpp.whichFace(face())];
00145     nw /= mag(nw);
00146 
00147     scalar Un = U_ & nw;
00148     vector Ut = U_ - Un*nw;
00149 
00150     if (Un > 0)
00151     {
00152         U_ -= (1.0 + td.spc().e())*Un*nw;
00153     }
00154 
00155     U_ -= td.spc().mu()*Ut;
00156 }
00157 
00158 
00159 void Foam::solidParticle::hitWallPatch
00160 (
00161     const wallPolyPatch&,
00162     int&
00163 )
00164 {}
00165 
00166 
00167 void Foam::solidParticle::hitPatch
00168 (
00169     const polyPatch&,
00170     solidParticle::trackData& td
00171 )
00172 {
00173     td.keepParticle = false;
00174 }
00175 
00176 
00177 void Foam::solidParticle::hitPatch
00178 (
00179     const polyPatch&,
00180     int&
00181 )
00182 {}
00183 
00184 
00185 void Foam::solidParticle::transformProperties (const tensor& T)
00186 {
00187     Particle<solidParticle>::transformProperties(T);
00188     U_ = transform(T, U_);
00189 }
00190 
00191 
00192 void Foam::solidParticle::transformProperties(const vector& separation)
00193 {
00194     Particle<solidParticle>::transformProperties(separation);
00195 }
00196 
00197 
00198 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd