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

ReactingMultiphaseCloud_.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) 2008-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 "ReactingMultiphaseCloud_.H"
00027 
00028 #include <lagrangianIntermediate/DevolatilisationModel.H>
00029 #include <lagrangianIntermediate/SurfaceReactionModel.H>
00030 
00031 // * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
00032 
00033 template<class ParcelType>
00034 void Foam::ReactingMultiphaseCloud<ParcelType>::preEvolve()
00035 {
00036     ReactingCloud<ParcelType>::preEvolve();
00037 }
00038 
00039 
00040 template<class ParcelType>
00041 void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud()
00042 {
00043     const volScalarField& T = this->carrierThermo().T();
00044     const volScalarField cp = this->carrierThermo().Cp();
00045     const volScalarField& p = this->carrierThermo().p();
00046 
00047     autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
00048     (
00049         this->interpolationSchemes(),
00050         this->rho()
00051     );
00052 
00053     autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
00054     (
00055         this->interpolationSchemes(),
00056         this->U()
00057     );
00058 
00059     autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
00060     (
00061         this->interpolationSchemes(),
00062         this->mu()
00063     );
00064 
00065     autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
00066     (
00067         this->interpolationSchemes(),
00068         T
00069     );
00070 
00071     autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
00072     (
00073         this->interpolationSchemes(),
00074         cp
00075     );
00076 
00077     autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
00078     (
00079         this->interpolationSchemes(),
00080         p
00081     );
00082 
00083     typename ParcelType::trackData td
00084     (
00085         *this,
00086         constProps_,
00087         rhoInterp(),
00088         UInterp(),
00089         muInterp(),
00090         TInterp(),
00091         cpInterp(),
00092         pInterp(),
00093         this->g().value()
00094     );
00095 
00096     this->injection().inject(td);
00097 
00098     if (this->coupled())
00099     {
00100         resetSourceTerms();
00101     }
00102 
00103     Cloud<ParcelType>::move(td);
00104 }
00105 
00106 
00107 template<class ParcelType>
00108 void Foam::ReactingMultiphaseCloud<ParcelType>::postEvolve()
00109 {
00110     ReactingCloud<ParcelType>::postEvolve();
00111 }
00112 
00113 
00114 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00115 
00116 template<class ParcelType>
00117 Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
00118 (
00119     const word& cloudName,
00120     const volScalarField& rho,
00121     const volVectorField& U,
00122     const dimensionedVector& g,
00123     basicThermo& thermo,
00124     bool readFields
00125 )
00126 :
00127     ReactingCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
00128     reactingMultiphaseCloud(),
00129     constProps_(this->particleProperties()),
00130     devolatilisationModel_
00131     (
00132         DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >::New
00133         (
00134             this->particleProperties(),
00135             *this
00136         )
00137     ),
00138     surfaceReactionModel_
00139     (
00140         SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >::New
00141         (
00142             this->particleProperties(),
00143             *this
00144         )
00145     ),
00146     dMassDevolatilisation_(0.0)
00147 {
00148     if (readFields)
00149     {
00150         ParcelType::readFields(*this);
00151     }
00152 }
00153 
00154 
00155 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00156 
00157 template<class ParcelType>
00158 Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud()
00159 {}
00160 
00161 
00162 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00163 
00164 template<class ParcelType>
00165 void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
00166 (
00167     ParcelType& parcel,
00168     const scalar lagrangianDt,
00169     const bool fullyDescribed
00170 )
00171 {
00172     ReactingCloud<ParcelType>::checkParcelProperties
00173     (
00174         parcel,
00175         lagrangianDt,
00176         fullyDescribed
00177     );
00178 
00179     label idGas = this->composition().idGas();
00180     label idLiquid = this->composition().idLiquid();
00181     label idSolid = this->composition().idSolid();
00182 
00183     if (!fullyDescribed)
00184     {
00185         parcel.YGas() = this->composition().Y0(idGas);
00186         parcel.YLiquid() = this->composition().Y0(idLiquid);
00187         parcel.YSolid() = this->composition().Y0(idSolid);
00188     }
00189     else
00190     {
00191         this->checkSuppliedComposition
00192         (
00193             parcel.YGas(),
00194             this->composition().Y0(idGas),
00195             "YGas"
00196         );
00197         this->checkSuppliedComposition
00198         (
00199             parcel.YLiquid(),
00200             this->composition().Y0(idLiquid),
00201             "YLiquid"
00202         );
00203         this->checkSuppliedComposition
00204         (
00205             parcel.YSolid(),
00206             this->composition().Y0(idSolid),
00207             "YSolid"
00208         );
00209     }
00210 }
00211 
00212 
00213 template<class ParcelType>
00214 void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms()
00215 {
00216     ReactingCloud<ParcelType>::resetSourceTerms();
00217 }
00218 
00219 
00220 template<class ParcelType>
00221 void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
00222 {
00223     if (this->active())
00224     {
00225         preEvolve();
00226 
00227         evolveCloud();
00228 
00229         postEvolve();
00230 
00231         info();
00232         Info<< endl;
00233     }
00234 }
00235 
00236 
00237 template<class ParcelType>
00238 void Foam::ReactingMultiphaseCloud<ParcelType>::info() const
00239 {
00240     ReactingCloud<ParcelType>::info();
00241     Info<< "    Mass transfer devolatilisation  = "
00242         << returnReduce(dMassDevolatilisation_, sumOp<scalar>()) << nl;
00243     Info<< "    Mass transfer surface reaction  = "
00244         << returnReduce(dMassSurfaceReaction_, sumOp<scalar>()) << nl;
00245 }
00246 
00247 
00248 template<class ParcelType>
00249 void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassDevolatilisation
00250 (
00251     const scalar dMass
00252 )
00253 {
00254     dMassDevolatilisation_ += dMass;
00255 }
00256 
00257 
00258 template<class ParcelType>
00259 void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassSurfaceReaction
00260 (
00261     const scalar dMass
00262 )
00263 {
00264     dMassSurfaceReaction_ += dMass;
00265 }
00266 
00267 
00268 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines