1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ThermoParcel.H"
27 #include "physicoChemicalConstants.H"
29 using namespace Foam::constant;
31 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
33 template<class ParcelType>
34 template<class TrackData>
35 void Foam::ThermoParcel<ParcelType>::setCellValues
42 ParcelType::setCellValues(td, dt, cellI);
44 tetIndices tetIs = this->currentTetIndices();
46 Cpc_ = td.CpInterp().interpolate(this->position(), tetIs);
48 Tc_ = td.TInterp().interpolate(this->position(), tetIs);
50 if (Tc_ < td.cloud().constProps().TMin())
56 "void Foam::ThermoParcel<ParcelType>::setCellValues"
62 ) << "Limiting observed temperature in cell " << cellI << " to "
63 << td.cloud().constProps().TMin() << nl << endl;
66 Tc_ = td.cloud().constProps().TMin();
71 template<class ParcelType>
72 template<class TrackData>
73 void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection
80 this->Uc_ += td.cloud().UTrans()[cellI]/this->massCell(cellI);
82 const scalar CpMean = td.CpInterp().psi()[cellI];
83 Tc_ += td.cloud().hsTrans()[cellI]/(CpMean*this->massCell(cellI));
85 if (Tc_ < td.cloud().constProps().TMin())
91 "void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection"
97 ) << "Limiting observed temperature in cell " << cellI << " to "
98 << td.cloud().constProps().TMin() << nl << endl;
101 Tc_ = td.cloud().constProps().TMin();
106 template<class ParcelType>
107 template<class TrackData>
108 void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
120 // Surface temperature using two thirds rule
121 Ts = (2.0*T + Tc_)/3.0;
123 if (Ts < td.cloud().constProps().TMin())
129 "void Foam::ThermoParcel<ParcelType>::calcSurfaceValues"
140 ) << "Limiting parcel surface temperature to "
141 << td.cloud().constProps().TMin() << nl << endl;
144 Ts = td.cloud().constProps().TMin();
147 // Assuming thermo props vary linearly with T for small dT
148 const scalar TRatio = Tc_/Ts;
150 rhos = this->rhoc_*TRatio;
152 tetIndices tetIs = this->currentTetIndices();
153 mus = td.muInterp().interpolate(this->position(), tetIs)/TRatio;
155 Pr = td.cloud().constProps().Pr();
156 Pr = max(ROOTVSMALL, Pr);
158 kappas = Cpc_*mus/Pr;
159 kappas = max(ROOTVSMALL, kappas);
163 template<class ParcelType>
164 template<class TrackData>
165 void Foam::ThermoParcel<ParcelType>::calc
172 // Define local properties at beginning of time step
173 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 const scalar np0 = this->nParticle_;
175 const scalar mass0 = this->mass();
178 // Calc surface values
179 // ~~~~~~~~~~~~~~~~~~~
180 scalar Ts, rhos, mus, Pr, kappas;
181 calcSurfaceValues(td, cellI, this->T_, Ts, rhos, mus, Pr, kappas);
184 scalar Re = this->Re(this->U_, this->d_, rhos, mus);
190 // Explicit momentum source for particle
191 vector Su = vector::zero;
193 // Linearised momentum source coefficient
196 // Momentum transfer from the particle to the carrier phase
197 vector dUTrans = vector::zero;
199 // Explicit enthalpy source for particle
202 // Linearised enthalpy source coefficient
205 // Sensible enthalpy transfer from the particle to the carrier phase
206 scalar dhsTrans = 0.0;
212 // Sum Ni*Cpi*Wi of emission species
215 // Calculate new particle temperature
217 this->calcHeatTransfer
235 // Calculate new particle velocity
237 this->calcVelocity(td, dt, cellI, Re, mus, mass0, Su, dUTrans, Spu);
240 // Accumulate carrier phase source terms
241 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242 if (td.cloud().solution().coupled())
244 // Update momentum transfer
245 td.cloud().UTrans()[cellI] += np0*dUTrans;
247 // Update momentum transfer coefficient
248 td.cloud().UCoeff()[cellI] += np0*Spu;
250 // Update sensible enthalpy transfer
251 td.cloud().hsTrans()[cellI] += np0*dhsTrans;
253 // Update sensible enthalpy coefficient
254 td.cloud().hsCoeff()[cellI] += np0*Sph;
259 template<class ParcelType>
260 template<class TrackData>
261 Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
275 if (!td.cloud().heatTransfer().active())
280 const scalar d = this->d();
281 const scalar rho = this->rho();
283 // Calc heat transfer coefficient
284 scalar htc = td.cloud().heatTransfer().htc(d, Re, Pr, kappa, NCpW);
286 if (mag(htc) < ROOTVSMALL && !td.cloud().radiation())
291 T_ + dt*Sh/(this->volume(d)*rho*Cp_),
292 td.cloud().constProps().TMin()
296 htc = max(htc, ROOTVSMALL);
297 const scalar As = this->areaS(d);
299 scalar ap = Tc_ + Sh/As/htc;
300 scalar bp = 6.0*(Sh/As + htc*(Tc_ - T_));
301 if (td.cloud().radiation())
303 tetIndices tetIs = this->currentTetIndices();
304 const scalar Gc = td.GInterp().interpolate(this->position(), tetIs);
305 const scalar sigma = physicoChemical::sigma.value();
306 const scalar epsilon = td.cloud().constProps().epsilon0();
308 ap = (ap + epsilon*Gc/(4.0*htc))/(1.0 + epsilon*sigma*pow3(T_)/htc);
309 bp += 6.0*(epsilon*(Gc/4.0 - sigma*pow4(T_)));
311 bp /= rho*d*Cp_*(ap - T_) + ROOTVSMALL;
313 // Integrate to find the new parcel temperature
314 IntegrationScheme<scalar>::integrationResult Tres =
315 td.cloud().TIntegrator().integrate(T_, dt, ap*bp, bp);
317 scalar Tnew = max(Tres.value(), td.cloud().constProps().TMin());
321 dhsTrans += Sph*(0.5*(T_ + Tnew) - Tc_);
327 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
329 template<class ParcelType>
330 Foam::ThermoParcel<ParcelType>::ThermoParcel
332 const ThermoParcel<ParcelType>& p
343 template<class ParcelType>
344 Foam::ThermoParcel<ParcelType>::ThermoParcel
346 const ThermoParcel<ParcelType>& p,
358 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
360 #include "ThermoParcelIO.C"
362 // ************************************************************************* //