1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 fixedPressureCompressibleDensityFvPatchScalarField::
40 fixedPressureCompressibleDensityFvPatchScalarField
43 const DimensionedField<scalar, volMesh>& iF
46 fixedValueFvPatchField<scalar>(p, iF),
47 pName_("pNameIsUndefined")
51 fixedPressureCompressibleDensityFvPatchScalarField::
52 fixedPressureCompressibleDensityFvPatchScalarField
54 const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
56 const DimensionedField<scalar, volMesh>& iF,
57 const fvPatchFieldMapper& mapper
60 fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
65 fixedPressureCompressibleDensityFvPatchScalarField::
66 fixedPressureCompressibleDensityFvPatchScalarField
69 const DimensionedField<scalar, volMesh>& iF,
70 const dictionary& dict
73 fixedValueFvPatchField<scalar>(p, iF, dict),
74 pName_(dict.lookup("p"))
78 fixedPressureCompressibleDensityFvPatchScalarField::
79 fixedPressureCompressibleDensityFvPatchScalarField
81 const fixedPressureCompressibleDensityFvPatchScalarField& ptf
84 fixedValueFvPatchField<scalar>(ptf),
89 fixedPressureCompressibleDensityFvPatchScalarField::
90 fixedPressureCompressibleDensityFvPatchScalarField
92 const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
93 const DimensionedField<scalar, volMesh>& iF
96 fixedValueFvPatchField<scalar>(ptf, iF),
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 void fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
110 const fvPatchField<scalar>& pp =
111 lookupPatchField<volScalarField, scalar>(pName_);
113 const dictionary& thermoProps =
114 db().lookupObject<IOdictionary>("thermodynamicProperties");
116 const scalar rholSat =
117 dimensionedScalar(thermoProps.lookup("rholSat")).value();
120 dimensionedScalar(thermoProps.lookup("pSat")).value();
122 const scalar psil = dimensionedScalar(thermoProps.lookup("psil")).value();
124 operator==(rholSat + psil*(pp - pSat));
126 fixedValueFvPatchField<scalar>::updateCoeffs();
130 void fixedPressureCompressibleDensityFvPatchScalarField::write
135 fvPatchField<scalar>::write(os);
136 os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl;
137 writeEntry("value", os);
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 fixedPressureCompressibleDensityFvPatchScalarField
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 } // End namespace Foam
154 // ************************************************************************* //