1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 "fixedPressureCompressibleDensityFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "surfaceFields.H"
31 #include "volFields.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 fixedPressureCompressibleDensityFvPatchScalarField::
41 fixedPressureCompressibleDensityFvPatchScalarField
44 const DimensionedField<scalar, volMesh>& iF
47 fixedValueFvPatchField<scalar>(p, iF),
48 pName_("pNameIsUndefined")
52 fixedPressureCompressibleDensityFvPatchScalarField::
53 fixedPressureCompressibleDensityFvPatchScalarField
55 const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
57 const DimensionedField<scalar, volMesh>& iF,
58 const fvPatchFieldMapper& mapper
61 fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
66 fixedPressureCompressibleDensityFvPatchScalarField::
67 fixedPressureCompressibleDensityFvPatchScalarField
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),
90 fixedPressureCompressibleDensityFvPatchScalarField::
91 fixedPressureCompressibleDensityFvPatchScalarField
93 const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
94 const DimensionedField<scalar, volMesh>& iF
97 fixedValueFvPatchField<scalar>(ptf, iF),
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 void fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
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();
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
136 fvPatchField<scalar>::write(os);
137 os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl;
138 writeEntry("value", os);
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 fixedPressureCompressibleDensityFvPatchScalarField
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 } // End namespace Foam
155 // ************************************************************************* //