Initial release of the new fireFoam solver and ancillary libraries.
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / basic / derivedFvPatchFields / gradientEnthalpy / gradientEnthalpyFvPatchScalarField.C
blobcb9b74020f5dfd19281b241eb24e5662fe9ba7d3
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 "gradientEnthalpyFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
31 #include "basicThermo.H"
33 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
35 Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
37     const fvPatch& p,
38     const DimensionedField<scalar, volMesh>& iF
41     fixedGradientFvPatchScalarField(p, iF)
45 Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
47     const gradientEnthalpyFvPatchScalarField& ptf,
48     const fvPatch& p,
49     const DimensionedField<scalar, volMesh>& iF,
50     const fvPatchFieldMapper& mapper
53     fixedGradientFvPatchScalarField(ptf, p, iF, mapper)
57 Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
59     const fvPatch& p,
60     const DimensionedField<scalar, volMesh>& iF,
61     const dictionary& dict
64     fixedGradientFvPatchScalarField(p, iF, dict)
68 Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
70     const gradientEnthalpyFvPatchScalarField& tppsf
73     fixedGradientFvPatchScalarField(tppsf)
77 Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
79     const gradientEnthalpyFvPatchScalarField& tppsf,
80     const DimensionedField<scalar, volMesh>& iF
83     fixedGradientFvPatchScalarField(tppsf, iF)
87 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
89 void Foam::gradientEnthalpyFvPatchScalarField::updateCoeffs()
91     if (updated())
92     {
93         return;
94     }
96     const basicThermo& thermo = db().lookupObject<basicThermo>
97     (
98         "thermophysicalProperties"
99     );
101     const label patchi = patch().index();
103     fvPatchScalarField& Tw =
104         const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]);
106     Tw.evaluate();
108     if (dimensionedInternalField().name() == "h")
109     {
110         gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad()
111         + patch().deltaCoeffs()*
112         (
113             thermo.h(Tw, patchi)
114           - thermo.h(Tw, patch().faceCells())
115         );
116     }
117     else
118     {
119         gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad()
120         + patch().deltaCoeffs()*
121         (
122             thermo.hs(Tw, patchi)
123           - thermo.hs(Tw, patch().faceCells())
124         );
125     }
127     fixedGradientFvPatchScalarField::updateCoeffs();
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 namespace Foam
135     makePatchTypeField
136     (
137         fvPatchScalarField,
138         gradientEnthalpyFvPatchScalarField
139     );
143 // ************************************************************************* //