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-------------------------------------------------------------------------------
11License
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
33template<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.0;
46}
47
48
49template<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
63template<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{
74 this->patchType() = dict.getOrDefault<word>("patchType", word::null);
75
76 this->refValue() = Field<Type>("outletValue", dict, p.size());
77
78 if (dict.found("value"))
79 {
81 (
82 Field<Type>("value", dict, p.size())
83 );
84 }
85 else
86 {
88 }
89
90 this->refGrad() = Zero;
91 this->valueFraction() = 0.0;
92}
93
94
95template<class Type>
97(
99)
100:
101 mixedFvPatchField<Type>(ptf),
102 phiName_(ptf.phiName_)
103{}
104
105
106template<class Type>
108(
111)
112:
113 mixedFvPatchField<Type>(ptf, iF),
114 phiName_(ptf.phiName_)
115{}
116
117
118// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119
120template<class Type>
122{
123 if (this->updated())
124 {
125 return;
126 }
127
128 const Field<scalar>& phip =
129 this->patch().template lookupPatchField<surfaceScalarField, scalar>
130 (
131 phiName_
132 );
133
134 this->valueFraction() = pos0(phip);
135
137}
138
139
140template<class Type>
142{
144 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
145 this->refValue().writeEntry("outletValue", os);
146 this->writeEntry("value", os);
147}
148
149
150// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
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:251
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:408
const word & patchType() const
Optional patch type.
Definition: fvPatchField.H:380
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a base class for 'mixed' type boundary conditions,...
virtual Field< Type > & refGrad()
virtual Field< Type > & refValue()
virtual scalarField & valueFraction()
This boundary condition provides a generic inflow condition, with specified outflow for the case of r...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from Foam::string.
Definition: word.H:68
static const word null
An empty word.
Definition: word.H:80
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar pos0(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
dictionary dict