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/>.
25 Foam::thermoSingleLayer
28 Thermodynamic form of single-cell layer surface film model
30 Note: defining enthalpy as Cp(T - Tstd) - when using liquids from the
31 thermophysical library, their enthalpies are calculated similarly, where
37 \*---------------------------------------------------------------------------*/
39 #ifndef thermoSingleLayer_H
40 #define thermoSingleLayer_H
42 #include "kinematicSingleLayer.H"
43 #include "SLGThermo.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace regionModels
51 namespace surfaceFilmModels
54 // Forward declaration of classes
55 class heatTransferModel;
56 class phaseChangeModel;
57 class filmRadiationModel;
59 /*---------------------------------------------------------------------------*\
60 Class thermoSingleLayer Declaration
61 \*---------------------------------------------------------------------------*/
63 class thermoSingleLayer
65 public kinematicSingleLayer
69 // Private member functions
71 //- Disallow default bitwise copy construct
72 thermoSingleLayer(const thermoSingleLayer&);
74 //- Disallow default bitwise assignment
75 void operator=(const thermoSingleLayer&);
77 //- Return boundary types for sensible enthalpy field
78 wordList hsBoundaryTypes();
87 //- Reference to the SLGThermo
88 const SLGThermo& thermo_;
92 //- Id of component in thermo database
98 //- Specific heat capacity / [J/kg/K]
101 //- Thermal conductivity / [W/m/K]
102 volScalarField kappa_;
104 //- Temperature - mean / [K]
107 //- Temperature - surface / [K]
110 //- Temperature - wall / [K]
113 //- Sensible enthalpy / [J/kg]
117 // Transfer fields - to the primary region
119 //- Film mass evolved via phase change
120 volScalarField primaryMassPCTrans_;
122 //- Film energy evolved via phase change
123 volScalarField primaryEnergyPCTrans_;
126 // Source term fields
128 // Film region - registered to the film region mesh
129 // Note: need boundary value mapped from primary region, and then
130 // pushed into the patch internal field
132 //- Energy / [J/m2/s]
133 volScalarField hsSp_;
136 // Primary region - registered to the primary region mesh
137 // Internal use only - not read-in
139 //- Energy / [J/m2/s]
140 volScalarField hsSpPrimary_;
143 // Fields mapped from primary region - registered to the film region
144 // Note: need both boundary AND patch internal fields to be mapped
146 //- Temperature / [K]
147 volScalarField TPrimary_;
149 //- List of specie mass fractions / [0-1]
150 PtrList<volScalarField> YPrimary_;
155 //- Heat transfer coefficient bewteen film surface and primary
157 autoPtr<heatTransferModel> htcs_;
159 //- Heat transfer coefficient bewteen wall and film [W/m2/K]
160 autoPtr<heatTransferModel> htcw_;
163 autoPtr<phaseChangeModel> phaseChange_;
166 autoPtr<filmRadiationModel> radiation_;
170 // Protected member functions
172 //- Read control parameters from dictionary
175 //- Correct the thermo fields
176 virtual void correctThermoFields();
178 //- Correct sensible enthalpy for mapped temperature fields
179 virtual void correctHsForMappedT();
181 //- Correct the film surface and wall temperatures
182 virtual void updateSurfaceTemperatures();
184 //- Reset source term fields
185 virtual void resetPrimaryRegionSourceTerms();
187 //- Transfer thermo fields from the primary region to the film region
188 virtual void transferPrimaryRegionThermoFields();
190 //- Transfer source fields from the primary region to the film region
191 virtual void transferPrimaryRegionSourceFields();
193 //- Update the film sub-models
194 virtual void updateSubmodels();
196 //- Return the wall/surface heat transfer term for the enthalpy equation
197 virtual tmp<fvScalarMatrix> q(volScalarField& hs) const;
202 //- Solve energy equation
203 virtual void solveEnergy();
208 //- Runtime type information
209 TypeName("thermoSingleLayer");
214 //- Construct from components
217 const word& modelType,
219 const dimensionedVector& g,
220 const bool readFields = true
225 virtual ~thermoSingleLayer();
232 //- Return const reference to the SLGThermo object
233 inline const SLGThermo& thermo() const;
237 //- Return the Id of component in thermo database
238 inline label liquidId() const;
243 //- Return the film specific heat capacity [J/kg/K]
244 virtual const volScalarField& Cp() const;
246 //- Return the film thermal conductivity [W/m/K]
247 virtual const volScalarField& kappa() const;
249 //- Return the film mean temperature [K]
250 virtual const volScalarField& T() const;
252 //- Return the film surface temperature [K]
253 virtual const volScalarField& Ts() const;
255 //- Return the film wall temperature [K]
256 virtual const volScalarField& Tw() const;
258 //- Return the film sensible enthalpy [J/kg]
259 virtual const volScalarField& hs() const;
263 // Transfer fields - to the primary region
265 //- Return mass transfer source - Eulerian phase only
266 virtual tmp<volScalarField> primaryMassTrans() const;
271 //- Return sensible enthalpy as a function of temperature
273 inline tmp<scalarField> hs
275 const scalarField& T,
279 //- Return sensible enthalpy as a function of temperature
280 inline tmp<volScalarField> hs
282 const volScalarField& T
285 //- Return temperature as a function of sensible enthalpy
286 inline tmp<volScalarField> T
288 const volScalarField& hs
292 // Source fields (read/write access)
294 //- External hook to add sources to the film
295 virtual void addSources
297 const label patchI, // patchI on primary region
298 const label faceI, // faceI of patchI
299 const scalar massSource, // [kg]
300 const vector& momentumSource, // [kg.m/s] (tangential momentum)
301 const scalar pressureSource, // [kg.m/s] (normal momentum)
302 const scalar energySource // [J]
306 // Source term fields
310 //- Energy / [J/m2/s]
311 inline const volScalarField& hsSp() const;
316 //- Energy / [J/m2/s]
317 inline const volScalarField& hsSpPrimary() const;
320 // Fields mapped from the primary region
322 //- Temperature / [K]
323 inline const volScalarField& TPrimary() const;
325 //- Specie mass fractions / [0-1]
326 inline const PtrList<volScalarField>& YPrimary() const;
332 //- Return const access to the (surface) heat transfer model
333 inline const heatTransferModel& htcs() const;
335 //- Return const access to the (wall) heat transfer model
336 inline const heatTransferModel& htcw() const;
338 //- Return const access to the phase change model
339 inline const phaseChangeModel& phaseChange() const;
341 //- Return const access to the radiation model
342 inline const filmRadiationModel& radiation() const;
347 //- Pre-evolve film hook
348 virtual void preEvolveRegion();
350 //- Evolve the film equations
351 virtual void evolveRegion();
356 // Mapped into primary region
358 //- Return total mass source - Eulerian phase only
359 virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
361 //- Return mass source for specie i - Eulerian phase only
362 virtual tmp<DimensionedField<scalar, volMesh> > Srho
367 //- Return enthalpy source - Eulerian phase only
368 virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
373 //- Provide some feedback
374 virtual void info() const;
378 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
380 } // End namespace surfaceFilmModels
381 } // End namespace regionModels
382 } // End namespace Foam
384 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
386 #include "thermoSingleLayerI.H"
388 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
392 // ************************************************************************* //