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

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-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 <lagrangianIntermediate/ThermoParcel.H>
00027 #include <radiation/radiationConstants.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>::calcSurfaceValues
00083 (
00084     TrackData& td,
00085     const label cellI,
00086     const scalar T,
00087     scalar& Ts,
00088     scalar& rhos,
00089     scalar& mus,
00090     scalar& Pr,
00091     scalar& kappa
00092 ) const
00093 {
00094     // Surface temperature using two thirds rule
00095     Ts = (2.0*T + Tc_)/3.0;
00096 
00097     // Assuming thermo props vary linearly with T for small dT
00098     scalar factor = td.TInterp().interpolate(this->position(), cellI)/Ts;
00099     rhos = this->rhoc_*factor;
00100     mus = td.muInterp().interpolate(this->position(), cellI)/factor;
00101 
00102     Pr = td.constProps().Pr();
00103     kappa = cpc_*mus/Pr;
00104 }
00105 
00106 
00107 template<class ParcelType>
00108 template<class TrackData>
00109 void Foam::ThermoParcel<ParcelType>::calc
00110 (
00111     TrackData& td,
00112     const scalar dt,
00113     const label cellI
00114 )
00115 {
00116     // Define local properties at beginning of time step
00117     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00118     const scalar np0 = this->nParticle_;
00119     const scalar d0 = this->d_;
00120     const vector U0 = this->U_;
00121     const scalar rho0 = this->rho_;
00122     const scalar T0 = this->T_;
00123     const scalar cp0 = this->cp_;
00124     const scalar mass0 = this->mass();
00125 
00126 
00127     // Calc surface values
00128     // ~~~~~~~~~~~~~~~~~~~
00129     scalar Ts, rhos, mus, Pr, kappa;
00130     calcSurfaceValues(td, cellI, T0, Ts, rhos, mus, Pr, kappa);
00131 
00132     // Reynolds number
00133     scalar Re = this->Re(U0, d0, rhos, mus);
00134 
00135 
00136     // Sources
00137     // ~~~~~~~
00138 
00139     // Explicit momentum source for particle
00140     vector Su = vector::zero;
00141 
00142     // Momentum transfer from the particle to the carrier phase
00143     vector dUTrans = vector::zero;
00144 
00145     // Explicit enthalpy source for particle
00146     scalar Sh = 0.0;
00147 
00148     // Sensible enthalpy transfer from the particle to the carrier phase
00149     scalar dhsTrans = 0.0;
00150 
00151 
00152     // Heat transfer
00153     // ~~~~~~~~~~~~~
00154 
00155     // Sum Ni*Cpi*Wi of emission species
00156     scalar NCpW = 0.0;
00157 
00158     // Calculate new particle velocity
00159     scalar T1 =
00160         calcHeatTransfer
00161         (
00162             td,
00163             dt,
00164             cellI,
00165             Re,
00166             Pr,
00167             kappa,
00168             d0,
00169             rho0,
00170             T0,
00171             cp0,
00172             NCpW,
00173             Sh,
00174             dhsTrans
00175         );
00176 
00177 
00178     // Motion
00179     // ~~~~~~
00180 
00181     // Calculate new particle velocity
00182     vector U1 =
00183         this->calcVelocity
00184         (
00185             td,
00186             dt,
00187             cellI,
00188             Re,
00189             mus,
00190             d0,
00191             U0,
00192             rho0,
00193             mass0,
00194             Su,
00195             dUTrans
00196         );
00197 
00198 
00199     //  Accumulate carrier phase source terms
00200     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00201     if (td.cloud().coupled())
00202     {
00203         // Update momentum transfer
00204         td.cloud().UTrans()[cellI] += np0*dUTrans;
00205 
00206         // Update sensible enthalpy transfer
00207         td.cloud().hsTrans()[cellI] += np0*dhsTrans;
00208     }
00209 
00210     // Set new particle properties
00211     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
00212     this->U_ = U1;
00213     T_ = T1;
00214 }
00215 
00216 
00217 template<class ParcelType>
00218 template <class TrackData>
00219 Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
00220 (
00221     TrackData& td,
00222     const scalar dt,
00223     const label cellI,
00224     const scalar Re,
00225     const scalar Pr,
00226     const scalar kappa,
00227     const scalar d,
00228     const scalar rho,
00229     const scalar T,
00230     const scalar cp,
00231     const scalar NCpW,
00232     const scalar Sh,
00233     scalar& dhsTrans
00234 )
00235 {
00236     if (!td.cloud().heatTransfer().active())
00237     {
00238         return T;
00239     }
00240 
00241     // Calc heat transfer coefficient
00242     scalar htc = td.cloud().heatTransfer().htc(d, Re, Pr, kappa, NCpW);
00243 
00244     if (mag(htc) < ROOTVSMALL && !td.cloud().radiation())
00245     {
00246         return max(T + dt*Sh/(this->volume(d)*rho*cp), td.constProps().TMin());
00247     }
00248 
00249     const scalar As = this->areaS(d);
00250     scalar ap = Tc_ + Sh/As/htc;
00251     scalar bp = 6.0*(Sh/As + htc*(Tc_ - T));
00252     if (td.cloud().radiation())
00253     {
00254         const scalarField& G =
00255             td.cloud().mesh().objectRegistry::lookupObject<volScalarField>("G");
00256         const scalar Gc = G[cellI];
00257         const scalar sigma = radiation::sigmaSB.value();
00258         const scalar epsilon = td.constProps().epsilon0();
00259 
00260         ap = (ap + epsilon*Gc/(4.0*htc))/(1.0 + epsilon*sigma*pow3(T)/htc);
00261         bp += 6.0*(epsilon*(Gc/4.0 - sigma*pow4(T)));
00262     }
00263     bp /= rho*d*cp*(ap - T);
00264 
00265     // Integrate to find the new parcel temperature
00266     IntegrationScheme<scalar>::integrationResult Tres =
00267         td.cloud().TIntegrator().integrate(T, dt, ap, bp);
00268 
00269     scalar Tnew = max(Tres.value(), td.constProps().TMin());
00270 
00271     dhsTrans += dt*htc*As*(0.5*(T + Tnew) - Tc_);
00272 
00273     return Tnew;
00274 }
00275 
00276 
00277 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00278 
00279 template <class ParcelType>
00280 Foam::ThermoParcel<ParcelType>::ThermoParcel
00281 (
00282     const ThermoParcel<ParcelType>& p
00283 )
00284 :
00285     KinematicParcel<ParcelType>(p),
00286     T_(p.T_),
00287     cp_(p.cp_),
00288     Tc_(p.Tc_),
00289     cpc_(p.cpc_)
00290 {}
00291 
00292 
00293 // * * * * * * * * * * * * * * IOStream operators  * * * * * * * * * * * * * //
00294 
00295 #include "ThermoParcelIO.C"
00296 
00297 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines