Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / transportModels / twoPhaseInterfaceProperties / alphaFixedPressure / alphaFixedPressureFvPatchScalarField.C
blob61bd4d09c10bc48cbb9d06c85689f908bdb2ca00
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "alphaFixedPressureFvPatchScalarField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
31 #include "uniformDimensionedFields.H"
33 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
35 Foam::alphaFixedPressureFvPatchScalarField::
36 alphaFixedPressureFvPatchScalarField
38     const fvPatch& p,
39     const DimensionedField<scalar, volMesh>& iF
42     fixedValueFvPatchScalarField(p, iF),
43     p_(p.size(), 0.0)
47 Foam::alphaFixedPressureFvPatchScalarField::
48 alphaFixedPressureFvPatchScalarField
50     const alphaFixedPressureFvPatchScalarField& ptf,
51     const fvPatch& p,
52     const DimensionedField<scalar, volMesh>& iF,
53     const fvPatchFieldMapper& mapper
56     fixedValueFvPatchScalarField(ptf, p, iF, mapper),
57     p_(ptf.p_, mapper)
61 Foam::alphaFixedPressureFvPatchScalarField::
62 alphaFixedPressureFvPatchScalarField
64     const fvPatch& p,
65     const DimensionedField<scalar, volMesh>& iF,
66     const dictionary& dict
69     fixedValueFvPatchScalarField(p, iF),
70     p_("p", dict, p.size())
72     if (dict.found("value"))
73     {
74         fvPatchField<scalar>::operator=
75         (
76             scalarField("value", dict, p.size())
77         );
78     }
79     else
80     {
81         fvPatchField<scalar>::operator=(p_);
82     }
86 Foam::alphaFixedPressureFvPatchScalarField::
87 alphaFixedPressureFvPatchScalarField
89     const alphaFixedPressureFvPatchScalarField& tppsf
92     fixedValueFvPatchScalarField(tppsf),
93     p_(tppsf.p_)
97 Foam::alphaFixedPressureFvPatchScalarField::
98 alphaFixedPressureFvPatchScalarField
100     const alphaFixedPressureFvPatchScalarField& tppsf,
101     const DimensionedField<scalar, volMesh>& iF
104     fixedValueFvPatchScalarField(tppsf, iF),
105     p_(tppsf.p_)
109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
111 void Foam::alphaFixedPressureFvPatchScalarField::autoMap
113     const fvPatchFieldMapper& m
116     scalarField::autoMap(m);
117     p_.autoMap(m);
121 void Foam::alphaFixedPressureFvPatchScalarField::rmap
123     const fvPatchScalarField& ptf,
124     const labelList& addr
127     fixedValueFvPatchScalarField::rmap(ptf, addr);
129     const alphaFixedPressureFvPatchScalarField& tiptf =
130         refCast<const alphaFixedPressureFvPatchScalarField>(ptf);
132     p_.rmap(tiptf.p_, addr);
136 void Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs()
138     if (updated())
139     {
140         return;
141     }
143     const uniformDimensionedVectorField& g =
144         db().lookupObject<uniformDimensionedVectorField>("g");
146     const fvPatchField<scalar>& rho =
147         patch().lookupPatchField<volScalarField, scalar>("rho");
149     operator==(p_ - rho*(g.value() & patch().Cf()));
151     fixedValueFvPatchScalarField::updateCoeffs();
155 void Foam::alphaFixedPressureFvPatchScalarField::write
157     Ostream& os
158 ) const
160     fvPatchScalarField::write(os);
161     p_.writeEntry("p", os);
162     writeEntry("value", os);
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 namespace Foam
170     makePatchTypeField
171     (
172         fvPatchScalarField,
173         alphaFixedPressureFvPatchScalarField
174     );
177 // ************************************************************************* //