initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / transportModels / interfaceProperties / gammaFixedPressure / gammaFixedPressureFvPatchScalarField.C
blobaa9637b99335bc819fbf74053c6e9d25db1ac8ff
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 "gammaFixedPressureFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
31 #include "surfaceFields.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
42     const fvPatch& p,
43     const DimensionedField<scalar, volMesh>& iF
46     fixedValueFvPatchScalarField(p, iF),
47     p_(p.size(), 0.0)
51 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
53     const gammaFixedPressureFvPatchScalarField& ptf,
54     const fvPatch& p,
55     const DimensionedField<scalar, volMesh>& iF,
56     const fvPatchFieldMapper& mapper
59     fixedValueFvPatchScalarField(ptf, p, iF, mapper),
60     p_(ptf.p_, mapper)
64 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
66     const fvPatch& p,
67     const DimensionedField<scalar, volMesh>& iF,
68     const dictionary& dict
71     fixedValueFvPatchScalarField(p, iF),
72     p_("p", dict, p.size())
74     if (dict.found("value"))
75     {
76         fvPatchField<scalar>::operator=
77         (
78             scalarField("value", dict, p.size())
79         );
80     }
81     else
82     {
83         fvPatchField<scalar>::operator=(p_);
84     }
88 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
90     const gammaFixedPressureFvPatchScalarField& tppsf
93     fixedValueFvPatchScalarField(tppsf),
94     p_(tppsf.p_)
98 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
100     const gammaFixedPressureFvPatchScalarField& tppsf,
101     const DimensionedField<scalar, volMesh>& iF
104     fixedValueFvPatchScalarField(tppsf, iF),
105     p_(tppsf.p_)
109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
111 void gammaFixedPressureFvPatchScalarField::autoMap
113     const fvPatchFieldMapper& m
116     scalarField::autoMap(m);
117     p_.autoMap(m);
121 void gammaFixedPressureFvPatchScalarField::rmap
123     const fvPatchScalarField& ptf,
124     const labelList& addr
127     fixedValueFvPatchScalarField::rmap(ptf, addr);
129     const gammaFixedPressureFvPatchScalarField& tiptf =
130         refCast<const gammaFixedPressureFvPatchScalarField>(ptf);
132     p_.rmap(tiptf.p_, addr);
136 void gammaFixedPressureFvPatchScalarField::updateCoeffs()
138     if (updated())
139     {
140         return;
141     }
143     const dictionary& environmentalProperties
144         = db().lookupObject<IOdictionary>("environmentalProperties");
146     dimensionedVector g(environmentalProperties.lookup("g"));
148     const fvPatchField<scalar>& rho =
149         patch().lookupPatchField<volScalarField, scalar>("rho");
151     operator==(p_ - rho*(g.value() & patch().Cf()));
153     fixedValueFvPatchScalarField::updateCoeffs();
157 void gammaFixedPressureFvPatchScalarField::write(Ostream& os) const
159     fvPatchScalarField::write(os);
160     p_.writeEntry("p", os);
161     writeEntry("value", os);
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 makePatchTypeField(fvPatchScalarField, gammaFixedPressureFvPatchScalarField);
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 } // End namespace Foam
173 // ************************************************************************* //