fixedRhoFvPatchScalarField.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-2012 OpenFOAM Foundation
9 Copyright (C) 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 "volFields.H"
33
34// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35
37(
38 const fvPatch& p,
39 const DimensionedField<scalar, volMesh>& iF
40)
41:
42 fixedValueFvPatchScalarField(p, iF),
43 pName_("p"),
44 psiName_("thermo:psi")
45{}
46
47
49(
50 const fixedRhoFvPatchScalarField& ptf,
51 const fvPatch& p,
52 const DimensionedField<scalar, volMesh>& iF,
53 const fvPatchFieldMapper& mapper
54)
55:
56 fixedValueFvPatchScalarField(ptf, p, iF, mapper),
57 pName_(ptf.pName_),
58 psiName_(ptf.psiName_)
59{}
60
61
63(
64 const fvPatch& p,
65 const DimensionedField<scalar, volMesh>& iF,
66 const dictionary& dict
67)
68:
69 fixedValueFvPatchScalarField(p, iF, dict),
70 pName_(dict.getOrDefault<word>("p", "p")),
71 psiName_(dict.getOrDefault<word>("psi", "thermo:psi"))
72{}
73
74
76(
77 const fixedRhoFvPatchScalarField& frpsf
78)
79:
80 fixedValueFvPatchScalarField(frpsf),
81 pName_(frpsf.pName_),
82 psiName_(frpsf.psiName_)
83{}
84
85
87(
88 const fixedRhoFvPatchScalarField& frpsf,
89 const DimensionedField<scalar, volMesh>& iF
90)
91:
92 fixedValueFvPatchScalarField(frpsf, iF),
93 pName_(frpsf.pName_),
94 psiName_(frpsf.psiName_)
95{}
96
97
98// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99
101{
102 if (updated())
103 {
104 return;
105 }
106
107 const fvPatchField<scalar>& psip =
108 patch().lookupPatchField<volScalarField, scalar>(psiName_);
109
110 const fvPatchField<scalar>& pp =
111 patch().lookupPatchField<volScalarField, scalar>(pName_);
112
113 operator==(psip*pp);
114
115 fixedValueFvPatchScalarField::updateCoeffs();
116}
117
118
120{
122
123 os.writeEntryIfDifferent<word>("p", "p", pName_);
124 os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
125 writeEntry("value", os);
126}
127
128// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129
130namespace Foam
131{
133 (
135 fixedRhoFvPatchScalarField
136 );
137}
138
139// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
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
Foam::fixedRhoFvPatchScalarField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual bool write()
Write the output fields.
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Definition: fvPatchField.H:676
const std::string patch
OpenFOAM patch number as a std::string.
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
fvPatchField< scalar > fvPatchScalarField
dictionary dict