Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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 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
49template<class Type>
51(
53 const faPatch& p,
55 const faPatchFieldMapper& mapper
56)
58 mixedFaPatchField<Type>(ptf, p, iF, mapper),
60{}
61
62
63template<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))
89(
90 const inletOutletFaPatchField<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() = neg(phip);
124
126}
127
128
129template<class Type>
131{
133 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
134 this->refValue().writeEntry("inletValue", 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
void assign(const entry &e, const label len)
Assign from a primitive dictionary entry with the following behaviour:
Definition Field.C:206
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
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
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 generic outflow condition, with specified inflow for the case of r...
virtual void write(Ostream &) const
Write includes "value" entry.
inletOutletFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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()
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar neg(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dictionary dict