initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / thermophysicalModels / combustion / hhuCombustionThermo / hhuCombustionThermo.C
blobd5104e049b89b03cec7224de31aa521477fb7bc0
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 "hhuCombustionThermo.H"
28 #include "fvMesh.H"
29 #include "zeroGradientFvPatchFields.H"
30 #include "fixedUnburntEnthalpyFvPatchScalarField.H"
31 #include "gradientUnburntEnthalpyFvPatchScalarField.H"
32 #include "mixedUnburntEnthalpyFvPatchScalarField.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace Foam
39 /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
41 defineTypeNameAndDebug(hhuCombustionThermo, 0);
42 defineRunTimeSelectionTable(hhuCombustionThermo, fvMesh);
44 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
46 wordList hhuCombustionThermo::huBoundaryTypes()
48     const volScalarField::GeometricBoundaryField& tbf = Tu_.boundaryField();
50     wordList hbt = tbf.types();
52     forAll(tbf, patchi)
53     {
54         if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
55         {
56             hbt[patchi] = fixedUnburntEnthalpyFvPatchScalarField::typeName;
57         }
58         else if
59         (
60             isA<zeroGradientFvPatchScalarField>(tbf[patchi])
61          || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
62         )
63         {
64             hbt[patchi] = gradientUnburntEnthalpyFvPatchScalarField::typeName;
65         }
66         else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
67         {
68             hbt[patchi] = mixedUnburntEnthalpyFvPatchScalarField::typeName;
69         }
70     }
72     return hbt;
75 void hhuCombustionThermo::huBoundaryCorrection(volScalarField& hu)
77     volScalarField::GeometricBoundaryField& hbf = hu.boundaryField();
79     forAll(hbf, patchi)
80     {
81         if
82         (
83             isA<gradientUnburntEnthalpyFvPatchScalarField>(hbf[patchi])
84         )
85         {
86             refCast<gradientUnburntEnthalpyFvPatchScalarField>(hbf[patchi])
87                 .gradient() = hbf[patchi].fvPatchField::snGrad();
88         }
89         else if
90         (
91             isA<mixedUnburntEnthalpyFvPatchScalarField>(hbf[patchi])
92         )
93         {
94             refCast<mixedUnburntEnthalpyFvPatchScalarField>(hbf[patchi])
95                 .refGrad() = hbf[patchi].fvPatchField::snGrad();
96         }
97     }
101 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
103 hhuCombustionThermo::hhuCombustionThermo(const fvMesh& mesh)
105     hCombustionThermo(mesh),
107     Tu_
108     (
109         IOobject
110         (
111             "Tu",
112             mesh.time().timeName(),
113             mesh,
114             IOobject::MUST_READ,
115             IOobject::AUTO_WRITE
116         ),
117         mesh
118     ),
120     hu_
121     (
122         IOobject
123         (
124             "hu",
125             mesh.time().timeName(),
126             mesh,
127             IOobject::NO_READ,
128             IOobject::NO_WRITE
129         ),
130         mesh,
131         dimensionSet(0, 2, -2, 0, 0),
132         huBoundaryTypes()
133     )
137 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
139 hhuCombustionThermo::~hhuCombustionThermo()
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // ************************************************************************* //