1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "ThermoParcel.H"
29 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
31 template<class ParcelType>
32 template<class TrackData>
33 void Foam::ThermoParcel<ParcelType>::setCellValues
40 KinematicParcel<ParcelType>::setCellValues(td, dt, cellI);
42 cpc_ = td.cpInterp().interpolate(this->position(), cellI);
44 Tc_ = td.TInterp().interpolate(this->position(), cellI);
46 if (Tc_ < td.constProps().TMin())
50 "void Foam::ThermoParcel<ParcelType>::setCellValues"
56 ) << "Limiting observed temperature in cell " << cellI << " to "
57 << td.constProps().TMin() << nl << endl;
59 Tc_ = td.constProps().TMin();
64 template<class ParcelType>
65 template<class TrackData>
66 void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection
73 this->Uc_ += td.cloud().UTrans()[cellI]/this->massCell(cellI);
75 scalar cpMean = td.cpInterp().psi()[cellI];
76 Tc_ += td.cloud().hsTrans()[cellI]/(cpMean*this->massCell(cellI));
80 template<class ParcelType>
81 template<class TrackData>
82 void Foam::ThermoParcel<ParcelType>::calc
89 // Define local properties at beginning of time step
90 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91 const scalar np0 = this->nParticle_;
92 const scalar d0 = this->d_;
93 const vector U0 = this->U_;
94 const scalar rho0 = this->rho_;
95 const scalar T0 = this->T_;
96 const scalar cp0 = this->cp_;
97 const scalar mass0 = this->mass();
99 // Explicit momentum source for particle
100 vector Su = vector::zero;
102 // Momentum transfer from the particle to the carrier phase
103 vector dUTrans = vector::zero;
105 // Explicit enthalpy source for particle
108 // Sensible enthalpy transfer from the particle to the carrier phase
109 scalar dhsTrans = 0.0;
114 // Calculate new particle velocity
116 calcHeatTransfer(td, dt, cellI, d0, U0, rho0, T0, cp0, Sh, dhsTrans);
122 // Calculate new particle velocity
123 vector U1 = calcVelocity(td, dt, cellI, d0, U0, rho0, mass0, Su, dUTrans);
126 // Accumulate carrier phase source terms
127 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128 if (td.cloud().coupled())
130 // Update momentum transfer
131 td.cloud().UTrans()[cellI] += np0*dUTrans;
133 // Update sensible enthalpy transfer
134 td.cloud().hsTrans()[cellI] += np0*dhsTrans;
137 // Set new particle properties
138 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
144 template<class ParcelType>
145 template <class TrackData>
146 Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
160 if (!td.cloud().heatTransfer().active())
165 // Calc heat transfer coefficient
166 scalar htc = td.cloud().heatTransfer().h
177 const scalar As = this->areaS(d);
179 if (mag(htc) < ROOTVSMALL && !td.cloud().radiation())
181 return T + dt*Sh/(this->volume(d)*rho*cp);
187 if (td.cloud().radiation())
189 const scalarField& G =
190 td.cloud().mesh().objectRegistry::lookupObject<volScalarField>("G");
191 const scalar sigma = radiation::sigmaSB.value();
192 const scalar epsilon = td.constProps().epsilon0();
195 (Sh/As + htc*Tc_ + epsilon*G[cellI]/4.0)
196 /(htc + epsilon*sigma*pow3(T));
200 *(Sh/As + htc*(Tc_ - T) + epsilon*(G[cellI]/4.0 - sigma*pow4(T)))
201 /(rho*d*cp*(ap - T));
205 ap = Tc_ + Sh/As/htc;
206 bp = 6.0*(Sh/As + htc*(Tc_ - T))/(rho*d*cp*(ap - T));
209 // Integrate to find the new parcel temperature
210 IntegrationScheme<scalar>::integrationResult Tres =
211 td.cloud().TIntegrator().integrate(T, dt, ap, bp);
213 dhsTrans += dt*htc*As*(Tres.average() - Tc_);
219 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
221 template <class ParcelType>
222 Foam::ThermoParcel<ParcelType>::ThermoParcel
224 const ThermoParcel<ParcelType>& p
227 KinematicParcel<ParcelType>(p),
235 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
237 #include "ThermoParcelIO.C"
239 // ************************************************************************* //