1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 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
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
43 const DimensionedField<scalar, volMesh>& iF
46 fixedValueFvPatchScalarField(p, iF),
51 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
53 const gammaFixedPressureFvPatchScalarField& ptf,
55 const DimensionedField<scalar, volMesh>& iF,
56 const fvPatchFieldMapper& mapper
59 fixedValueFvPatchScalarField(ptf, p, iF, mapper),
64 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
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"))
76 fvPatchField<scalar>::operator=
78 scalarField("value", dict, p.size())
83 fvPatchField<scalar>::operator=(p_);
88 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
90 const gammaFixedPressureFvPatchScalarField& tppsf
93 fixedValueFvPatchScalarField(tppsf),
98 gammaFixedPressureFvPatchScalarField::gammaFixedPressureFvPatchScalarField
100 const gammaFixedPressureFvPatchScalarField& tppsf,
101 const DimensionedField<scalar, volMesh>& iF
104 fixedValueFvPatchScalarField(tppsf, iF),
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 void gammaFixedPressureFvPatchScalarField::autoMap
113 const fvPatchFieldMapper& m
116 scalarField::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()
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 // ************************************************************************* //