inletOutletFaPatchField.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2020-2023 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 faPatch& p,
38 )
39 :
40  mixedFaPatchField<Type>(p, iF),
41  phiName_("phi")
42 {
43  this->refValue() = Zero;
44  this->refGrad() = Zero;
45  this->valueFraction() = 0.0;
46 }
47 
48 
49 template<class Type>
51 (
53  const faPatch& p,
55  const faPatchFieldMapper& mapper
56 )
57 :
58  mixedFaPatchField<Type>(ptf, p, iF, mapper),
59  phiName_(ptf.phiName_)
60 {}
61 
62 
63 template<class Type>
65 (
66  const faPatch& p,
68  const dictionary& dict
69 )
70 :
71  // No reading of refValue, refGradient, valueFraction entries
72  mixedFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
73  phiName_(dict.getOrDefault<word>("phi", "phi"))
74 {
75  // Require inletValue (MUST_READ)
76  this->refValue().assign("inletValue", 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 inletOutletFaPatchField<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() = neg(phip);
124 
126 }
127 
128 
129 template<class Type>
131 {
133  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
134  this->refValue().writeEntry("inletValue", os);
136 }
137 
138 
139 // ************************************************************************* //
dictionary dict
virtual void write(Ostream &os) const
Write.
Definition: faPatchField.C:253
virtual void write(Ostream &) const
Write.
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.
This boundary condition provides a generic outflow condition, with specified inflow for the case of r...
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: faPatchField.H:317
void extrapolateInternal()
Assign the patch field from the internal field.
Definition: faPatchField.C:60
dimensionedScalar neg(const dimensionedScalar &ds)
virtual Field< Type > & refValue()
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual scalarField & valueFraction()
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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
OBJstream os(runTime.globalPath()/outputName)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: faPatchField.C:234
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
inletOutletFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
const std::string patch
OpenFOAM patch number as a std::string.
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