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

KinematicCloudI.H

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 "fvmSup.H"
00028 
00029 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00030 
00031 template<class ParcelType>
00032 inline Foam::label Foam::KinematicCloud<ParcelType>::parcelTypeId() const
00033 {
00034     return parcelTypeId_;
00035 }
00036 
00037 
00038 template<class ParcelType>
00039 inline const Foam::fvMesh& Foam::KinematicCloud<ParcelType>::mesh() const
00040 {
00041     return mesh_;
00042 }
00043 
00044 
00045 template<class ParcelType>
00046 inline const Foam::IOdictionary&
00047 Foam::KinematicCloud<ParcelType>::particleProperties() const
00048 {
00049     return particleProperties_;
00050 }
00051 
00052 
00053 template<class ParcelType>
00054 inline const typename ParcelType::constantProperties&
00055 Foam::KinematicCloud<ParcelType>::constProps() const
00056 {
00057     return constProps_;
00058 }
00059 
00060 
00061 template<class ParcelType>
00062 inline const Foam::Switch Foam::KinematicCloud<ParcelType>::coupled() const
00063 {
00064     return coupled_;
00065 }
00066 
00067 
00068 template <class ParcelType>
00069 inline const Foam::Switch
00070 Foam::KinematicCloud<ParcelType>::cellValueSourceCorrection() const
00071 {
00072     return cellValueSourceCorrection_;
00073 }
00074 
00075 
00076 template<class ParcelType>
00077 inline const Foam::volScalarField&
00078 Foam::KinematicCloud<ParcelType>::rho() const
00079 {
00080     return rho_;
00081 }
00082 
00083 
00084 template<class ParcelType>
00085 inline const Foam::volVectorField& Foam::KinematicCloud<ParcelType>::U() const
00086 {
00087     return U_;
00088 }
00089 
00090 
00091 template<class ParcelType>
00092 inline const Foam::volScalarField& Foam::KinematicCloud<ParcelType>::mu() const
00093 {
00094     return mu_;
00095 }
00096 
00097 
00098 template<class ParcelType>
00099 inline const Foam::dimensionedVector&
00100 Foam::KinematicCloud<ParcelType>::g() const
00101 {
00102     return g_;
00103 }
00104 
00105 
00106 template<class ParcelType>
00107 inline const Foam::particleForces&
00108 Foam::KinematicCloud<ParcelType>::forces() const
00109 {
00110     return forces_;
00111 }
00112 
00113 
00114 template<class ParcelType>
00115 inline const Foam::dictionary&
00116 Foam::KinematicCloud<ParcelType>::interpolationSchemes() const
00117 {
00118     return interpolationSchemes_;
00119 }
00120 
00121 
00122 template<class ParcelType>
00123 inline const Foam::DispersionModel<Foam::KinematicCloud<ParcelType> >&
00124 Foam::KinematicCloud<ParcelType>::dispersion() const
00125 {
00126     return dispersionModel_;
00127 }
00128 
00129 
00130 template<class ParcelType>
00131 inline Foam::DispersionModel<Foam::KinematicCloud<ParcelType> >&
00132 Foam::KinematicCloud<ParcelType>::dispersion()
00133 {
00134     return dispersionModel_();
00135 }
00136 
00137 
00138 template<class ParcelType>
00139 inline const Foam::DragModel<Foam::KinematicCloud<ParcelType> >&
00140 Foam::KinematicCloud<ParcelType>::drag() const
00141 {
00142     return dragModel_;
00143 }
00144 
00145 
00146 template<class ParcelType>
00147 inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
00148 Foam::KinematicCloud<ParcelType>::injection() const
00149 {
00150     return injectionModel_;
00151 }
00152 
00153 
00154 template<class ParcelType>
00155 inline const Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >&
00156 Foam::KinematicCloud<ParcelType>::patchInteraction() const
00157 {
00158     return patchInteractionModel_;
00159 }
00160 
00161 
00162 template<class ParcelType>
00163 inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
00164 Foam::KinematicCloud<ParcelType>::injection()
00165 {
00166     return injectionModel_();
00167 }
00168 
00169 
00170 template<class ParcelType>
00171 inline Foam::PostProcessingModel<Foam::KinematicCloud<ParcelType> >&
00172 Foam::KinematicCloud<ParcelType>::postProcessing()
00173 {
00174     return postProcessingModel_();
00175 }
00176 
00177 
00178 template<class ParcelType>
00179 inline const Foam::vectorIntegrationScheme&
00180 Foam::KinematicCloud<ParcelType>::UIntegrator() const
00181 {
00182     return UIntegrator_;
00183 }
00184 
00185 
00186 template<class ParcelType>
00187 inline Foam::scalar Foam::KinematicCloud<ParcelType>::massInSystem() const
00188 {
00189     scalar sysMass = 0.0;
00190     forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
00191     {
00192          const ParcelType& p = iter();
00193          sysMass += p.mass()*p.nParticle();
00194     }
00195 
00196     return sysMass;
00197 }
00198 
00199 
00200 template<class ParcelType>
00201 inline Foam::Random& Foam::KinematicCloud<ParcelType>::rndGen()
00202 {
00203     return rndGen_;
00204 }
00205 
00206 
00207 template<class ParcelType>
00208 inline Foam::DimensionedField<Foam::vector, Foam::volMesh>&
00209 Foam::KinematicCloud<ParcelType>::UTrans()
00210 {
00211     return UTrans_;
00212 }
00213 
00214 
00215 template<class ParcelType>
00216 inline Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
00217 Foam::KinematicCloud<ParcelType>::SU() const
00218 {
00219     tmp<DimensionedField<vector, volMesh> > tSU
00220     (
00221         new DimensionedField<vector, volMesh>
00222         (
00223             IOobject
00224             (
00225                 this->name() + "SU",
00226                 this->db().time().timeName(),
00227                 this->mesh(),
00228                 IOobject::NO_READ,
00229                 IOobject::AUTO_WRITE
00230             ),
00231             this->mesh(),
00232             dimensionedVector
00233             (
00234                  "zero",
00235                  dimDensity*dimVelocity/dimTime,
00236                  vector::zero
00237             )
00238         )
00239     );
00240 
00241     vectorField& SU = tSU().field();
00242     SU = UTrans_/(mesh_.V()*this->db().time().deltaT());
00243 
00244     return tSU;
00245 }
00246 
00247 
00248 template<class ParcelType>
00249 inline const Foam::tmp<Foam::volScalarField>
00250 Foam::KinematicCloud<ParcelType>::theta() const
00251 {
00252     tmp<volScalarField> ttheta
00253     (
00254         new volScalarField
00255         (
00256             IOobject
00257             (
00258                 this->name() + "Theta",
00259                 this->db().time().timeName(),
00260                 this->db(),
00261                 IOobject::NO_READ,
00262                 IOobject::NO_WRITE,
00263                 false
00264             ),
00265             mesh_,
00266             dimensionedScalar("zero", dimless, 0.0)
00267         )
00268     );
00269 
00270     scalarField& theta = ttheta().internalField();
00271     forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
00272     {
00273         const ParcelType& p = iter();
00274         const label cellI = p.cell();
00275 
00276         theta[cellI] += p.nParticle()*p.volume();
00277     }
00278 
00279     theta /= mesh().V();
00280 
00281     return ttheta;
00282 }
00283 
00284 
00285 template<class ParcelType>
00286 inline const Foam::tmp<Foam::volScalarField>
00287 Foam::KinematicCloud<ParcelType>::alpha() const
00288 {
00289     tmp<volScalarField> talpha
00290     (
00291         new volScalarField
00292         (
00293             IOobject
00294             (
00295                 this->name() + "Alpha",
00296                 this->db().time().timeName(),
00297                 this->db(),
00298                 IOobject::NO_READ,
00299                 IOobject::NO_WRITE,
00300                 false
00301             ),
00302             mesh_,
00303             dimensionedScalar("zero", dimless, 0.0)
00304         )
00305     );
00306 
00307     scalarField& alpha = talpha().internalField();
00308     forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
00309     {
00310         const ParcelType& p = iter();
00311         const label cellI = p.cell();
00312 
00313         alpha[cellI] += p.nParticle()*p.mass();
00314     }
00315 
00316     alpha /= (mesh().V()*rho_);
00317 
00318     return talpha;
00319 }
00320 
00321 
00322 template<class ParcelType>
00323 inline const Foam::tmp<Foam::volScalarField>
00324 Foam::KinematicCloud<ParcelType>::rhoEff() const
00325 {
00326     tmp<volScalarField> trhoEff
00327     (
00328         new volScalarField
00329         (
00330             IOobject
00331             (
00332                 this->name() + "RhoEff",
00333                 this->db().time().timeName(),
00334                 this->db(),
00335                 IOobject::NO_READ,
00336                 IOobject::NO_WRITE,
00337                 false
00338             ),
00339             mesh_,
00340             dimensionedScalar("zero", dimDensity, 0.0)
00341         )
00342     );
00343 
00344     scalarField& rhoEff = trhoEff().internalField();
00345     forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
00346     {
00347         const ParcelType& p = iter();
00348         const label cellI = p.cell();
00349 
00350         rhoEff[cellI] += p.nParticle()*p.mass();
00351     }
00352 
00353     rhoEff /= mesh().V();
00354 
00355     return trhoEff;
00356 }
00357 
00358 
00359 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd