Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
32template<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
48template<class Type>
50(
52 const faPatch& p,
54 const faPatchFieldMapper& mapper
55)
57 mixedFaPatchField<Type>(ptf, p, iF, mapper),
59{}
60
61
62template<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))
89(
90 const outletInletFaPatchField<Type>& ptf
91)
93 mixedFaPatchField<Type>(ptf),
95{}
96
97
98template<class Type>
100(
103)
104:
105 mixedFaPatchField<Type>(ptf, iF),
107{}
108
109
110// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111
112template<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
129template<class Type>
131{
133 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
134 this->refValue().writeEntry("outletValue", os);
136}
137
138
139// ************************************************************************* //
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.
bool updated() const noexcept
True if the boundary condition has already been updated.
const faPatch & patch() const noexcept
Return the patch.
A FieldMapper for finite-area patch fields.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void write(Ostream &os) const
Write.
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.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
This boundary condition provides a base class for 'mixed' type boundary conditions,...
mixedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
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 includes "value" entry.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
word phiName_
Name of flux field (default: phi).
outletInletFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
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