fixedPressureCompressibleDensityFvPatchScalarField.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011 OpenFOAM Foundation
9 Copyright (C) 2018-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
31#include "fvPatchFieldMapper.H"
32#include "surfaceFields.H"
33#include "volFields.H"
34
35// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36
37Foam::fixedPressureCompressibleDensityFvPatchScalarField::
38fixedPressureCompressibleDensityFvPatchScalarField
39(
40 const fvPatch& p,
42)
43:
44 fixedValueFvPatchField<scalar>(p, iF),
45 pName_("p")
46{}
47
48
49Foam::fixedPressureCompressibleDensityFvPatchScalarField::
50fixedPressureCompressibleDensityFvPatchScalarField
51(
53 const fvPatch& p,
55 const fvPatchFieldMapper& mapper
56)
57:
58 fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
59 pName_(ptf.pName_)
60{}
61
62
63Foam::fixedPressureCompressibleDensityFvPatchScalarField::
64fixedPressureCompressibleDensityFvPatchScalarField
65(
66 const fvPatch& p,
68 const dictionary& dict
69)
70:
71 fixedValueFvPatchField<scalar>(p, iF, dict),
72 pName_(dict.getOrDefault<word>("p", "p"))
73{}
74
75
76Foam::fixedPressureCompressibleDensityFvPatchScalarField::
77fixedPressureCompressibleDensityFvPatchScalarField
78(
80)
81:
82 fixedValueFvPatchField<scalar>(ptf),
83 pName_(ptf.pName_)
84{}
85
86
87Foam::fixedPressureCompressibleDensityFvPatchScalarField::
88fixedPressureCompressibleDensityFvPatchScalarField
89(
92)
93:
94 fixedValueFvPatchField<scalar>(ptf, iF),
95 pName_(ptf.pName_)
96{}
97
98
99// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100
102{
103 if (updated())
104 {
105 return;
106 }
107
108 const fvPatchField<scalar>& pp =
109 patch().lookupPatchField<volScalarField, scalar>(pName_);
110
111 const dictionary& thermoProps =
112 db().lookupObject<IOdictionary>("thermodynamicProperties");
113
114 const scalar rholSat = dimensionedScalar("rholSat", thermoProps).value();
115
116 const scalar pSat = dimensionedScalar("pSat", thermoProps).value();
117
118 const scalar psil = dimensionedScalar("psil", thermoProps).value();
119
120 operator==(rholSat + psil*(pp - pSat));
121
123}
124
125
127(
128 Ostream& os
129) const
130{
132 os.writeEntryIfDifferent<word>("p", "p", pName_);
133 writeEntry("value", os);
134}
135
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139namespace Foam
140{
142 (
145 );
146}
147
148// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:251
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const Type & value() const
Return const reference to value.
This boundary condition calculates a (liquid) compressible density as a function of pressure and flui...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Definition: fvPatchField.H:676
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dictionary dict
Foam::surfaceFields.