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 -------------------------------------------------------------------------------
11 License
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 auto& psip = patch().lookupPatchField<volScalarField>(psiName_);
108  const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
109 
110  operator==(psip*pp);
111 
112  fixedValueFvPatchScalarField::updateCoeffs();
113 }
114 
115 
116 void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
117 {
119  os.writeEntryIfDifferent<word>("p", "p", pName_);
120  os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
122 }
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 namespace Foam
127 {
129  (
131  fixedRhoFvPatchScalarField
132  );
133 }
134 
135 // ************************************************************************* //
dictionary dict
fixedRhoFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: fvPatchField.H:375
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:372
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
fvPatchField< scalar > fvPatchScalarField
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:336
virtual void write(Ostream &) const
Write.
OBJstream os(runTime.globalPath()/outputName)
const std::string patch
OpenFOAM patch number as a std::string.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
volScalarField & p
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.