initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / fixedPressureCompressibleDensity / fixedPressureCompressibleDensityFvPatchScalarField.C
blob0f01c960b00ee684bfa99b2b51eb0fb2e2c0aa16
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 "fixedPressureCompressibleDensityFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "surfaceFields.H"
31 #include "volFields.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 fixedPressureCompressibleDensityFvPatchScalarField::
41 fixedPressureCompressibleDensityFvPatchScalarField
43     const fvPatch& p,
44     const DimensionedField<scalar, volMesh>& iF
47     fixedValueFvPatchField<scalar>(p, iF),
48     pName_("pNameIsUndefined")
52 fixedPressureCompressibleDensityFvPatchScalarField::
53 fixedPressureCompressibleDensityFvPatchScalarField
55     const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
56     const fvPatch& p,
57     const DimensionedField<scalar, volMesh>& iF,
58     const fvPatchFieldMapper& mapper
61     fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
62     pName_(ptf.pName_)
66 fixedPressureCompressibleDensityFvPatchScalarField::
67 fixedPressureCompressibleDensityFvPatchScalarField
69     const fvPatch& p,
70     const DimensionedField<scalar, volMesh>& iF,
71     const dictionary& dict
74     fixedValueFvPatchField<scalar>(p, iF, dict),
75     pName_(dict.lookup("p"))
79 fixedPressureCompressibleDensityFvPatchScalarField::
80 fixedPressureCompressibleDensityFvPatchScalarField
82     const fixedPressureCompressibleDensityFvPatchScalarField& ptf
85     fixedValueFvPatchField<scalar>(ptf),
86     pName_(ptf.pName_)
90 fixedPressureCompressibleDensityFvPatchScalarField::
91 fixedPressureCompressibleDensityFvPatchScalarField
93     const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
94     const DimensionedField<scalar, volMesh>& iF
97     fixedValueFvPatchField<scalar>(ptf, iF),
98     pName_(ptf.pName_)
102 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
104 void fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
106     if (updated())
107     {
108         return;
109     }
111     const fvPatchField<scalar>& pp =
112         patch().lookupPatchField<volScalarField, scalar>(pName_);
114     const dictionary& thermoProps =
115         db().lookupObject<IOdictionary>("thermodynamicProperties");
117     const scalar rholSat =
118         dimensionedScalar(thermoProps.lookup("rholSat")).value();
120     const scalar pSat =
121         dimensionedScalar(thermoProps.lookup("pSat")).value();
123     const scalar psil = dimensionedScalar(thermoProps.lookup("psil")).value();
125     operator==(rholSat + psil*(pp - pSat));
127     fixedValueFvPatchField<scalar>::updateCoeffs();
131 void fixedPressureCompressibleDensityFvPatchScalarField::write
133     Ostream& os
134 ) const
136     fvPatchField<scalar>::write(os);
137     os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl;
138     writeEntry("value", os);
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 makePatchTypeField
146     fvPatchScalarField,
147     fixedPressureCompressibleDensityFvPatchScalarField
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 } // End namespace Foam
155 // ************************************************************************* //