Loading...
Searching...
No Matches
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;
46}
47
48
49template<class Type>
51(
53 const fvPatch& p,
55 const fvPatchFieldMapper& mapper
56)
58 mixedFvPatchField<Type>(ptf, p, iF, mapper),
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{
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))
90(
91 const outletInletFvPatchField<Type>& ptf
92)
94 mixedFvPatchField<Type>(ptf),
96{}
97
98
99template<class Type>
101(
104)
105:
106 mixedFvPatchField<Type>(ptf, iF),
108{}
109
110
111// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112
113template<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
130template<class Type>
132{
134 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
135 this->refValue().writeEntry("outletValue", os);
137}
138
139
140// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
virtual void readDict(const dictionary &dict)
Read dictionary entries.
const fvPatch & patch() const noexcept
Return the patch.
bool updated() const noexcept
True if the boundary condition has already been updated.
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
void extrapolateInternal()
Assign the patch field from the internal field.
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,...
mixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
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 write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
word phiName_
Name of flux field (default: phi).
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:66
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar pos0(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dictionary dict