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-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
33 template<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 
45 template<class Type>
47 (
48  const fvPatch& p,
50 )
51 :
53  phiName_("phi"),
54  rhoName_("rho"),
55  uniformJump_(false),
56  nonDimensional_(false),
57  rpm_(0),
58  dm_(0)
59 {}
60 
61 
62 template<class Type>
64 (
65  const fvPatch& p,
67  const dictionary& dict
68 )
69 :
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_(0),
76  dm_(0)
77 {
78  if (nonDimensional_)
79  {
80  dict.readEntry("rpm", rpm_);
81  dict.readEntry("dm", dm_);
82  }
83 }
84 
85 
86 template<class Type>
88 (
89  const fanFvPatchField<Type>& ptf,
90  const fvPatch& p,
92  const fvPatchFieldMapper& mapper
93 )
94 :
95  uniformJumpFvPatchField<Type>(ptf, p, iF, mapper),
96  phiName_(ptf.phiName_),
97  rhoName_(ptf.rhoName_),
98  uniformJump_(ptf.uniformJump_),
99  nonDimensional_(ptf.nonDimensional_),
100  rpm_(ptf.rpm_),
101  dm_(ptf.dm_)
102 {}
103 
104 
105 template<class Type>
107 (
108  const fanFvPatchField<Type>& ptf
109 )
110 :
112  phiName_(ptf.phiName_),
113  rhoName_(ptf.rhoName_),
114  uniformJump_(ptf.uniformJump_),
115  nonDimensional_(ptf.nonDimensional_),
116  rpm_(ptf.rpm_),
117  dm_(ptf.dm_)
118 {}
119 
120 
121 template<class Type>
123 (
124  const fanFvPatchField<Type>& ptf,
126 )
127 :
129  phiName_(ptf.phiName_),
130  rhoName_(ptf.rhoName_),
131  uniformJump_(ptf.uniformJump_),
132  nonDimensional_(ptf.nonDimensional_),
133  rpm_(ptf.rpm_),
134  dm_(ptf.dm_)
135 {}
136 
137 
138 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
139 
140 template<class Type>
142 {
143  if (this->updated())
144  {
145  return;
146  }
147 
148  calcFanJump();
149 
150  // Call fixedJump variant - uniformJump will overwrite the jump value
152 }
153 
154 
155 template<class Type>
157 {
159  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
160  os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
161  os.writeEntryIfDifferent<bool>("uniformJump", false, uniformJump_);
162 
163  if (nonDimensional_)
164  {
165  os.writeEntry("nonDimensional", nonDimensional_);
166  os.writeEntry("rpm", rpm_);
167  os.writeEntry("dm", dm_);
168  }
169 }
170 
171 
172 // ************************************************************************* //
Foam::Ostream::writeEntryIfDifferent
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:244
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::uniformJumpFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base....
Definition: uniformJumpFvPatchField.H:102
Foam::fanFvPatchField::write
virtual void write(Ostream &os) const
Write.
Definition: fanFvPatchField.C:156
Foam::fixedJumpFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fixedJumpFvPatchField.H:98
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
fanFvPatchField.H
Foam::fanFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fanFvPatchField.H:173
Foam::fanFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fanFvPatchField.C:141
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fanFvPatchField::fanFvPatchField
fanFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: fanFvPatchField.C:47
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54