Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / derived / fixedPressureCompressibleDensity / fixedPressureCompressibleDensityFvPatchScalarField.C
blobf7b42671c97d66ee214113823d15c6b49f4034a8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2011 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
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 "fixedPressureCompressibleDensityFvPatchScalarField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvPatchFieldMapper.H"
29 #include "surfaceFields.H"
30 #include "volFields.H"
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
35 fixedPressureCompressibleDensityFvPatchScalarField
37     const fvPatch& p,
38     const DimensionedField<scalar, volMesh>& iF
41     fixedValueFvPatchField<scalar>(p, iF),
42     pName_("p")
46 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
47 fixedPressureCompressibleDensityFvPatchScalarField
49     const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
50     const fvPatch& p,
51     const DimensionedField<scalar, volMesh>& iF,
52     const fvPatchFieldMapper& mapper
55     fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
56     pName_(ptf.pName_)
60 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
61 fixedPressureCompressibleDensityFvPatchScalarField
63     const fvPatch& p,
64     const DimensionedField<scalar, volMesh>& iF,
65     const dictionary& dict
68     fixedValueFvPatchField<scalar>(p, iF, dict),
69     pName_(dict.lookupOrDefault<word>("p", "p"))
73 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
74 fixedPressureCompressibleDensityFvPatchScalarField
76     const fixedPressureCompressibleDensityFvPatchScalarField& ptf
79     fixedValueFvPatchField<scalar>(ptf),
80     pName_(ptf.pName_)
84 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
85 fixedPressureCompressibleDensityFvPatchScalarField
87     const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
88     const DimensionedField<scalar, volMesh>& iF
91     fixedValueFvPatchField<scalar>(ptf, iF),
92     pName_(ptf.pName_)
96 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
98 void Foam::fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
100     if (updated())
101     {
102         return;
103     }
105     const fvPatchField<scalar>& pp =
106         patch().lookupPatchField<volScalarField, scalar>(pName_);
108     const dictionary& thermoProps =
109         db().lookupObject<IOdictionary>("thermodynamicProperties");
111     const scalar rholSat =
112         dimensionedScalar(thermoProps.lookup("rholSat")).value();
114     const scalar pSat =
115         dimensionedScalar(thermoProps.lookup("pSat")).value();
117     const scalar psil = dimensionedScalar(thermoProps.lookup("psil")).value();
119     operator==(rholSat + psil*(pp - pSat));
121     fixedValueFvPatchField<scalar>::updateCoeffs();
125 void Foam::fixedPressureCompressibleDensityFvPatchScalarField::write
127     Ostream& os
128 ) const
130     fvPatchField<scalar>::write(os);
131     writeEntryIfDifferent<word>(os, "p", "p", pName_);
132     writeEntry("value", os);
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 namespace Foam
140     makePatchTypeField
141     (
142         fvPatchScalarField,
143         fixedPressureCompressibleDensityFvPatchScalarField
144     );
147 // ************************************************************************* //