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

ThermoParcel.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 "ThermoParcel.H"
00028 
00029 // * * * * * * * * * * *  Protected Member Functions * * * * * * * * * * * * //
00030 
00031 template<class ParcelType>
00032 template<class TrackData>
00033 void Foam::ThermoParcel<ParcelType>::setCellValues
00034 (
00035     TrackData& td,
00036     const scalar dt,
00037     const label cellI
00038 )
00039 {
00040     KinematicParcel<ParcelType>::setCellValues(td, dt, cellI);
00041 
00042     cpc_ = td.cpInterp().interpolate(this->position(), cellI);
00043 
00044     Tc_ = td.TInterp().interpolate(this->position(), cellI);
00045 
00046     if (Tc_ < td.constProps().TMin())
00047     {
00048         WarningIn
00049         (
00050             "void Foam::ThermoParcel<ParcelType>::setCellValues"
00051             "("
00052                 "TrackData&, "
00053                 "const scalar, "
00054                 "const label"
00055             ")"
00056         )   << "Limiting observed temperature in cell " << cellI << " to "
00057             << td.constProps().TMin() <<  nl << endl;
00058 
00059         Tc_ = td.constProps().TMin();
00060     }
00061 }
00062 
00063 
00064 template<class ParcelType>
00065 template<class TrackData>
00066 void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection
00067 (
00068     TrackData& td,
00069     const scalar dt,
00070     const label cellI
00071 )
00072 {
00073     this->Uc_ += td.cloud().UTrans()[cellI]/this->massCell(cellI);
00074 
00075     scalar cpMean = td.cpInterp().psi()[cellI];
00076     Tc_ += td.cloud().hsTrans()[cellI]/(cpMean*this->massCell(cellI));
00077 }
00078 
00079 
00080 template<class ParcelType>
00081 template<class TrackData>
00082 void Foam::ThermoParcel<ParcelType>::calc
00083 (
00084     TrackData& td,
00085     const scalar dt,
00086     const label cellI
00087 )
00088 {
00089     // Define local properties at beginning of time step
00090     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00091     const scalar np0 = this->nParticle_;
00092     const scalar d0 = this->d_;
00093     const vector U0 = this->U_;
00094     const scalar rho0 = this->rho_;
00095     const scalar T0 = this->T_;
00096     const scalar cp0 = this->cp_;
00097     const scalar mass0 = this->mass();
00098 
00099     // Explicit momentum source for particle
00100     vector Su = vector::zero;
00101 
00102     // Momentum transfer from the particle to the carrier phase
00103     vector dUTrans = vector::zero;
00104 
00105     // Explicit enthalpy source for particle
00106     scalar Sh = 0.0;
00107 
00108     // Sensible enthalpy transfer from the particle to the carrier phase
00109     scalar dhsTrans = 0.0;
00110 
00111     // Heat transfer
00112     // ~~~~~~~~~~~~~
00113 
00114     // Calculate new particle velocity
00115     scalar T1 =
00116         calcHeatTransfer(td, dt, cellI, d0, U0, rho0, T0, cp0, Sh, dhsTrans);
00117 
00118 
00119     // Motion
00120     // ~~~~~~
00121 
00122     // Calculate new particle velocity
00123     vector U1 = calcVelocity(td, dt, cellI, d0, U0, rho0, mass0, Su, dUTrans);
00124 
00125 
00126     //  Accumulate carrier phase source terms
00127     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00128     if (td.cloud().coupled())
00129     {
00130         // Update momentum transfer
00131         td.cloud().UTrans()[cellI] += np0*dUTrans;
00132 
00133         // Update sensible enthalpy transfer
00134         td.cloud().hsTrans()[cellI] += np0*dhsTrans;
00135     }
00136 
00137     // Set new particle properties
00138     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
00139     this->U_ = U1;
00140     T_ = T1;
00141 }
00142 
00143 
00144 template<class ParcelType>
00145 template <class TrackData>
00146 Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
00147 (
00148     TrackData& td,
00149     const scalar dt,
00150     const label cellI,
00151     const scalar d,
00152     const vector& U,
00153     const scalar rho,
00154     const scalar T,
00155     const scalar cp,
00156     const scalar Sh,
00157     scalar& dhsTrans
00158 )
00159 {
00160     if (!td.cloud().heatTransfer().active())
00161     {
00162         return T;
00163     }
00164 
00165     // Calc heat transfer coefficient
00166     scalar htc = td.cloud().heatTransfer().h
00167     (
00168         d,
00169         U - this->Uc_,
00170         this->rhoc_,
00171         rho,
00172         cpc_,
00173         cp,
00174         this->muc_
00175     );
00176 
00177     const scalar As = this->areaS(d);
00178 
00179     if (mag(htc) < ROOTVSMALL && !td.cloud().radiation())
00180     {
00181         return  T + dt*Sh/(this->volume(d)*rho*cp);
00182     }
00183 
00184     scalar ap;
00185     scalar bp;
00186 
00187     if (td.cloud().radiation())
00188     {
00189         const scalarField& G =
00190             td.cloud().mesh().objectRegistry::lookupObject<volScalarField>("G");
00191         const scalar sigma = radiation::sigmaSB.value();
00192         const scalar epsilon = td.constProps().epsilon0();
00193 
00194         ap =
00195             (Sh/As + htc*Tc_ + epsilon*G[cellI]/4.0)
00196            /(htc + epsilon*sigma*pow3(T));
00197 
00198         bp =
00199             6.0
00200            *(Sh/As + htc*(Tc_ - T) + epsilon*(G[cellI]/4.0 - sigma*pow4(T)))
00201            /(rho*d*cp*(ap - T));
00202     }
00203     else
00204     {
00205         ap = Tc_ + Sh/As/htc;
00206         bp = 6.0*(Sh/As + htc*(Tc_ - T))/(rho*d*cp*(ap - T));
00207     }
00208 
00209     // Integrate to find the new parcel temperature
00210     IntegrationScheme<scalar>::integrationResult Tres =
00211         td.cloud().TIntegrator().integrate(T, dt, ap, bp);
00212 
00213     dhsTrans += dt*htc*As*(Tres.average() - Tc_);
00214 
00215     return Tres.value();
00216 }
00217 
00218 
00219 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00220 
00221 template <class ParcelType>
00222 Foam::ThermoParcel<ParcelType>::ThermoParcel
00223 (
00224     const ThermoParcel<ParcelType>& p
00225 )
00226 :
00227     KinematicParcel<ParcelType>(p),
00228     T_(p.T_),
00229     cp_(p.cp_),
00230     Tc_(p.Tc_),
00231     cpc_(p.cpc_)
00232 {}
00233 
00234 
00235 // * * * * * * * * * * * * * * IOStream operators  * * * * * * * * * * * * * //
00236 
00237 #include "ThermoParcelIO.C"
00238 
00239 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd