initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / intermediate / clouds / Templates / ThermoCloud / ThermoCloud.C
blob0585629246ec074406f04a9d4a11c6ce077deb8c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "ThermoCloud.H"
28 #include "interpolationCellPoint.H"
29 #include "ThermoParcel.H"
31 #include "HeatTransferModel.H"
33 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
35 template<class ParcelType>
36 Foam::ThermoCloud<ParcelType>::ThermoCloud
38     const word& cloudName,
39     const volScalarField& rho,
40     const volVectorField& U,
41     const dimensionedVector& g,
42     basicThermo& thermo
45     KinematicCloud<ParcelType>
46     (
47         cloudName,
48         rho,
49         U,
50         thermo.mu(),
51         g
52     ),
53     thermoCloud(),
54     constProps_(this->particleProperties()),
55     carrierThermo_(thermo),
56     heatTransferModel_
57     (
58         HeatTransferModel<ThermoCloud<ParcelType> >::New
59         (
60             this->particleProperties(),
61             *this
62         )
63     ),
64     TIntegrator_
65     (
66         scalarIntegrationScheme::New
67         (
68             "T",
69             this->particleProperties().subDict("integrationSchemes")
70         )
71     ),
72     radiation_(this->particleProperties().lookup("radiation")),
73     hsTrans_
74     (
75         IOobject
76         (
77             this->name() + "hsTrans",
78             this->db().time().timeName(),
79             this->db(),
80             IOobject::NO_READ,
81             IOobject::NO_WRITE,
82             false
83         ),
84         this->mesh(),
85         dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0)
86     ),
87     hcTrans_
88     (
89         IOobject
90         (
91             this->name() + "hcTrans",
92             this->db().time().timeName(),
93             this->db(),
94             IOobject::NO_READ,
95             IOobject::NO_WRITE,
96             false
97         ),
98         this->mesh(),
99         dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0)
100     )
104 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
106 template<class ParcelType>
107 Foam::ThermoCloud<ParcelType>::~ThermoCloud()
111 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
113 template<class ParcelType>
114 void Foam::ThermoCloud<ParcelType>::checkParcelProperties
116     ParcelType& parcel,
117     const scalar lagrangianDt,
118     const bool fullyDescribed
121     KinematicCloud<ParcelType>::checkParcelProperties
122     (
123         parcel,
124         lagrangianDt,
125         fullyDescribed
126     );
128     if (!fullyDescribed)
129     {
130         parcel.T() = constProps_.T0();
131         parcel.cp() = constProps_.cp0();
132     }
136 template<class ParcelType>
137 void Foam::ThermoCloud<ParcelType>::resetSourceTerms()
139     KinematicCloud<ParcelType>::resetSourceTerms();
140     hsTrans_.field() = 0.0;
141     hcTrans_.field() = 0.0;
145 template<class ParcelType>
146 void Foam::ThermoCloud<ParcelType>::preEvolve()
148     KinematicCloud<ParcelType>::preEvolve();
152 template<class ParcelType>
153 void Foam::ThermoCloud<ParcelType>::postEvolve()
155     KinematicCloud<ParcelType>::postEvolve();
159 template<class ParcelType>
160 void Foam::ThermoCloud<ParcelType>::evolve()
162     preEvolve();
164     const volScalarField& T = carrierThermo_.T();
165     const volScalarField cp = carrierThermo_.Cp();
167     autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
168     (
169         this->interpolationSchemes(),
170         this->rho()
171     );
173     autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
174     (
175         this->interpolationSchemes(),
176         this->U()
177     );
179     autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
180     (
181         this->interpolationSchemes(),
182         this->mu()
183     );
185     autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
186     (
187         this->interpolationSchemes(),
188         T
189     );
191     autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
192     (
193         this->interpolationSchemes(),
194         cp
195     );
197     typename ParcelType::trackData td
198     (
199         *this,
200         constProps_,
201         rhoInterp(),
202         UInterp(),
203         muInterp(),
204         TInterp(),
205         cpInterp(),
206         this->g().value()
207     );
209     this->injection().inject(td);
211     if (this->coupled())
212     {
213         resetSourceTerms();
214     }
216     Cloud<ParcelType>::move(td);
218     postEvolve();
222 template<class ParcelType>
223 void Foam::ThermoCloud<ParcelType>::info() const
225     KinematicCloud<ParcelType>::info();
229 // ************************************************************************* //