fixedRhoFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  const fvPatch& p,
36  const DimensionedField<scalar, volMesh>& iF
37 )
38 :
39  fixedValueFvPatchScalarField(p, iF),
40  pName_("p"),
41  psiName_("thermo:psi")
42 {}
43 
44 
46 (
47  const fixedRhoFvPatchScalarField& ptf,
48  const fvPatch& p,
49  const DimensionedField<scalar, volMesh>& iF,
50  const fvPatchFieldMapper& mapper
51 )
52 :
53  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
54  pName_(ptf.pName_),
55  psiName_(ptf.psiName_)
56 {}
57 
58 
60 (
61  const fvPatch& p,
62  const DimensionedField<scalar, volMesh>& iF,
63  const dictionary& dict
64 )
65 :
66  fixedValueFvPatchScalarField(p, iF, dict),
67  pName_(dict.lookupOrDefault<word>("p", "p")),
68  psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi"))
69 {}
70 
71 
73 (
74  const fixedRhoFvPatchScalarField& frpsf,
75  const DimensionedField<scalar, volMesh>& iF
76 )
77 :
78  fixedValueFvPatchScalarField(frpsf, iF),
79  pName_(frpsf.pName_),
80  psiName_(frpsf.psiName_)
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
88  if (updated())
89  {
90  return;
91  }
92 
93  const fvPatchField<scalar>& psip =
94  patch().lookupPatchField<volScalarField, scalar>(psiName_);
95 
96  const fvPatchField<scalar>& pp =
97  patch().lookupPatchField<volScalarField, scalar>(pName_);
98 
99  operator==(psip*pp);
100 
101  fixedValueFvPatchScalarField::updateCoeffs();
102 }
103 
104 
105 void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
106 {
108 
109  writeEntryIfDifferent<word>(os, "p", "p", this->pName_);
110  writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
111  writeEntry(os, "value", *this);
112 }
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 namespace Foam
117 {
119  (
121  fixedRhoFvPatchScalarField
122  );
123 }
124 
125 // ************************************************************************* //
dictionary dict
bool updated() const
Return true if the boundary condition has already been updated.
Definition: fvPatchField.H:356
fixedRhoFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:280
Macros for easy insertion into run-time selection tables.
virtual void operator==(const fvPatchField< Type > &)
Definition: fvPatchField.C:461
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
fvPatchField< scalar > fvPatchScalarField
virtual void write(Ostream &) const
Write.
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:325
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
const GeometricField::Patch & lookupPatchField(const word &name, const GeometricField *=nullptr, const Type *=nullptr) const
Lookup and return the patchField of the named field from the.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
volScalarField & p
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.