1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2011 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
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
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
38 const DimensionedField<scalar, volMesh>& iF
41 fixedValueFvPatchField<scalar>(p, iF),
46 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
47 fixedPressureCompressibleDensityFvPatchScalarField
49 const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
51 const DimensionedField<scalar, volMesh>& iF,
52 const fvPatchFieldMapper& mapper
55 fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
60 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
61 fixedPressureCompressibleDensityFvPatchScalarField
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),
84 Foam::fixedPressureCompressibleDensityFvPatchScalarField::
85 fixedPressureCompressibleDensityFvPatchScalarField
87 const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
88 const DimensionedField<scalar, volMesh>& iF
91 fixedValueFvPatchField<scalar>(ptf, iF),
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 void Foam::fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
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();
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
130 fvPatchField<scalar>::write(os);
131 writeEntryIfDifferent<word>(os, "p", "p", pName_);
132 writeEntry("value", os);
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 fixedPressureCompressibleDensityFvPatchScalarField
147 // ************************************************************************* //