fanFvPatchField.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-2015 OpenFOAM Foundation
9 Copyright (C) 2017-2021 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
29#include "fanFvPatchField.H"
30
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33template<class Type>
35{
36 if (this->cyclicPatch().owner())
37 {
38 this->jump_ = this->jumpTable_->value(this->db().time().value());
39 }
40}
41
42
43// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44
45template<class Type>
47(
48 const fvPatch& p,
50)
51:
52 uniformJumpFvPatchField<Type>(p, iF),
53 phiName_("phi"),
54 rhoName_("rho"),
55 uniformJump_(false),
56 nonDimensional_(false),
57 rpm_(nullptr),
58 dm_(nullptr)
59{}
60
61
62template<class Type>
64(
65 const fvPatch& p,
67 const dictionary& dict
68)
69:
70 uniformJumpFvPatchField<Type>(p, iF, dict, false), // Pass no valueRequired
71 phiName_(dict.getOrDefault<word>("phi", "phi")),
72 rhoName_(dict.getOrDefault<word>("rho", "rho")),
73 uniformJump_(dict.getOrDefault("uniformJump", false)),
74 nonDimensional_(dict.getOrDefault("nonDimensional", false)),
75 rpm_(nullptr),
76 dm_(nullptr)
77{
78 // Note that we've not read jumpTable_ etc
79 if (nonDimensional_)
80 {
81 rpm_.reset(Function1<scalar>::New("rpm", dict, &this->db()));
82 dm_.reset(Function1<scalar>::New("dm", dict, &this->db()));
83 }
84
85 if (this->cyclicPatch().owner())
86 {
87 this->jumpTable_ = Function1<Type>::New("jumpTable", dict, &this->db());
88 }
89
90 if (dict.found("value"))
91 {
93 (
94 Field<Type>("value", dict, p.size())
95 );
96 }
97 else
98 {
100 }
101}
102
103
104template<class Type>
106(
107 const fanFvPatchField<Type>& rhs,
108 const fvPatch& p,
110 const fvPatchFieldMapper& mapper
111)
112:
113 uniformJumpFvPatchField<Type>(rhs, p, iF, mapper),
114 phiName_(rhs.phiName_),
115 rhoName_(rhs.rhoName_),
116 uniformJump_(rhs.uniformJump_),
117 nonDimensional_(rhs.nonDimensional_),
118 rpm_(rhs.rpm_.clone()),
119 dm_(rhs.dm_.clone())
120{}
121
122
123template<class Type>
125(
126 const fanFvPatchField<Type>& rhs
127)
128:
129 uniformJumpFvPatchField<Type>(rhs),
130 phiName_(rhs.phiName_),
131 rhoName_(rhs.rhoName_),
132 uniformJump_(rhs.uniformJump_),
133 nonDimensional_(rhs.nonDimensional_),
134 rpm_(rhs.rpm_.clone()),
135 dm_(rhs.dm_.clone())
136{}
137
138
139template<class Type>
141(
142 const fanFvPatchField<Type>& rhs,
144)
145:
146 uniformJumpFvPatchField<Type>(rhs, iF),
147 phiName_(rhs.phiName_),
148 rhoName_(rhs.rhoName_),
149 uniformJump_(rhs.uniformJump_),
150 nonDimensional_(rhs.nonDimensional_),
151 rpm_(rhs.rpm_.clone()),
152 dm_(rhs.dm_.clone())
153{}
154
155
156// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
157
158template<class Type>
160{
161 if (this->updated())
162 {
163 return;
164 }
165
166 calcFanJump();
167
168 // Call fixedJump variant - uniformJump will overwrite the jump value
170}
171
172
173template<class Type>
175{
177 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
178 os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
179
180 if (uniformJump_)
181 {
182 os.writeEntry("uniformJump", "true");
183 }
184
185 if (nonDimensional_)
186 {
187 os.writeEntry("nonDimensional", "true");
188 rpm_->writeData(os);
189 dm_->writeData(os);
190 }
191}
192
193
194// ************************************************************************* //
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
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:96
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
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
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
const cyclicFvPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
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
This boundary condition provides a jump condition, using the cyclic condition as a base.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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
const objectRegistry & db() const
Return local objectRegistry.
Definition: fvPatchField.C:210
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a jump condition, using the cyclic condition as a base....
autoPtr< Function1< Type > > jumpTable_
The "jump" table.
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
dictionary dict