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 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{
45 this->valueFraction() = 0.0;
46}
47
48
49template<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
63template<class Type>
65(
66 const faPatch& p,
68 const dictionary& dict
69)
70:
71 mixedFaPatchField<Type>(p, iF),
72 phiName_(dict.getOrDefault<word>("phi", "phi"))
73{
74 this->refValue() = Field<Type>("inletValue", dict, p.size());
75
76 if (dict.found("value"))
77 {
79 (
80 Field<Type>("value", dict, p.size())
81 );
82 }
83 else
84 {
86 }
87
89 this->valueFraction() = 0.0;
90}
91
92
93template<class Type>
95(
97)
98:
99 mixedFaPatchField<Type>(ptf),
100 phiName_(ptf.phiName_)
101{}
102
103
104template<class Type>
106(
109)
110:
111 mixedFaPatchField<Type>(ptf, iF),
112 phiName_(ptf.phiName_)
113{}
114
115
116// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117
118template<class Type>
120{
121 if (this->updated())
122 {
123 return;
124 }
125
126 const Field<scalar>& phip =
127 this->patch(). template lookupPatchField<edgeScalarField, scalar>
128 (
129 phiName_
130 );
131
132 this->valueFraction() = 1.0 - pos(phip);
133
135}
136
137
138template<class Type>
140{
142 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
143 this->refValue().writeEntry("inletValue", os);
144 this->writeEntry("value", os);
145}
146
147
148// ************************************************************************* //
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
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
A FieldMapper for finite-area patch fields.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: faPatchField.H:82
virtual void operator=(const UList< Type > &)
Definition: faPatchField.C:227
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
virtual bool write()
Write the output fields.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
virtual Field< Type > & refGrad()
virtual Field< Type > & refValue()
virtual scalarField & valueFraction()
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar pos(const dimensionedScalar &ds)
dictionary dict
A non-counting (dummy) refCount.
Definition: refCount.H:59