outletInletFaPatchField.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) 2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const faPatch& p,
37 )
38 :
39  mixedFaPatchField<Type>(p, iF),
40  phiName_("phi")
41 {
42  this->refValue() = *this;
43  this->refGrad() = Zero;
44  this->valueFraction() = 0;
45 }
46 
47 
48 template<class Type>
50 (
52  const faPatch& p,
54  const faPatchFieldMapper& mapper
55 )
56 :
57  mixedFaPatchField<Type>(ptf, p, iF, mapper),
58  phiName_(ptf.phiName_)
59 {}
60 
61 
62 template<class Type>
64 (
65  const faPatch& p,
67  const dictionary& dict
68 )
69 :
70  mixedFaPatchField<Type>(p, iF),
71  phiName_(dict.getOrDefault<word>("phi", "phi"))
72 {
74 
75  // Require outletValue (MUST_READ)
76  this->refValue().assign("outletValue", dict, p.size());
77  this->refGrad() = Zero;
78  this->valueFraction() = 0;
79 
80  if (!this->readValueEntry(dict))
81  {
83  }
84 }
85 
86 
87 template<class Type>
89 (
90  const outletInletFaPatchField<Type>& ptf
91 )
92 :
93  mixedFaPatchField<Type>(ptf),
94  phiName_(ptf.phiName_)
95 {}
96 
97 
98 template<class Type>
100 (
103 )
104 :
105  mixedFaPatchField<Type>(ptf, iF),
106  phiName_(ptf.phiName_)
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 
112 template<class Type>
114 {
115  if (this->updated())
116  {
117  return;
118  }
119 
120  const Field<scalar>& phip =
121  this->patch().template lookupPatchField<edgeScalarField>(phiName_);
122 
123  this->valueFraction() = pos0(phip);
124 
126 }
127 
128 
129 template<class Type>
131 {
133  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
134  this->refValue().writeEntry("outletValue", os);
136 }
137 
138 
139 // ************************************************************************* //
dictionary dict
virtual void write(Ostream &os) const
Write.
Definition: faPatchField.C:253
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
This boundary condition provides a base class for &#39;mixed&#39; type boundary conditions, i.e. conditions that mix fixed value and patch-normal gradient conditions.
virtual void readDict(const dictionary &dict)
Read dictionary entries.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: faPatchField.H:317
This boundary condition provides a generic inflow condition, with specified outflow for the case of r...
void extrapolateInternal()
Assign the patch field from the internal field.
Definition: faPatchField.C:60
virtual Field< Type > & refValue()
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual scalarField & valueFraction()
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
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
dimensionedScalar pos0(const dimensionedScalar &ds)
OBJstream os(runTime.globalPath()/outputName)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: faPatchField.C:234
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const std::string patch
OpenFOAM patch number as a std::string.
outletInletFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
volScalarField & p
A FieldMapper for finite-area patch fields.
virtual Field< Type > & refGrad()
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
Definition: faPatchField.C:30
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127