outletInletFvPatchField.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-2017 OpenFOAM Foundation
9  Copyright (C) 2017-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 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const fvPatch& p,
38 )
39 :
40  mixedFvPatchField<Type>(p, iF),
41  phiName_("phi")
42 {
43  this->refValue() = *this;
44  this->refGrad() = Zero;
45  this->valueFraction() = 0;
46 }
47 
48 
49 template<class Type>
51 (
53  const fvPatch& p,
55  const fvPatchFieldMapper& mapper
56 )
57 :
58  mixedFvPatchField<Type>(ptf, p, iF, mapper),
59  phiName_(ptf.phiName_)
60 {}
61 
62 
63 template<class Type>
65 (
66  const fvPatch& p,
68  const dictionary& dict
69 )
70 :
71  mixedFvPatchField<Type>(p, iF),
72  phiName_(dict.getOrDefault<word>("phi", "phi"))
73 {
75 
76  // Require outletValue (MUST_READ)
77  this->refValue().assign("outletValue", dict, p.size());
78  this->refGrad() = Zero;
79  this->valueFraction() = 0;
80 
81  if (!this->readValueEntry(dict))
82  {
84  }
85 }
86 
87 
88 template<class Type>
90 (
91  const outletInletFvPatchField<Type>& ptf
92 )
93 :
94  mixedFvPatchField<Type>(ptf),
95  phiName_(ptf.phiName_)
96 {}
97 
98 
99 template<class Type>
101 (
104 )
105 :
106  mixedFvPatchField<Type>(ptf, iF),
107  phiName_(ptf.phiName_)
108 {}
109 
110 
111 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112 
113 template<class Type>
115 {
116  if (this->updated())
117  {
118  return;
119  }
120 
121  const Field<scalar>& phip =
122  this->patch().template lookupPatchField<surfaceScalarField>(phiName_);
123 
124  this->valueFraction() = pos0(phip);
125 
127 }
128 
129 
130 template<class Type>
132 {
134  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
135  this->refValue().writeEntry("outletValue", os);
137 }
138 
139 
140 // ************************************************************************* //
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
Definition: fvPatchField.C:32
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
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.
void extrapolateInternal()
Assign the patch field from the internal field.
Definition: fvPatchField.C:62
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
virtual void readDict(const dictionary &dict)
Read dictionary entries.
virtual Field< Type > & refValue()
outletInletFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual scalarField & valueFraction()
A FieldMapper for finite-volume patch fields.
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)
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:309
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.
volScalarField & p
virtual Field< Type > & refGrad()
This boundary condition provides a generic inflow condition, with specified outflow for the case of r...
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127