swirlInletVelocityFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
33 (
34  const fvPatch& p,
36 )
37 :
39  origin_(Zero),
40  axis_(Zero),
41  axialVelocity_(),
42  radialVelocity_(),
43  tangentialVelocity_()
44 {}
45 
46 
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
56  origin_(dict.lookup("origin")),
57  axis_(dict.lookup("axis")),
58  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
59  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
60  tangentialVelocity_(Function1<scalar>::New("tangentialVelocity", dict))
61 {}
62 
63 
66 (
68  const fvPatch& p,
70  const fvPatchFieldMapper& mapper
71 )
72 :
73  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
74  origin_(ptf.origin_),
75  axis_(ptf.axis_),
76  axialVelocity_(ptf.axialVelocity_, false),
77  radialVelocity_(ptf.radialVelocity_, false),
78  tangentialVelocity_(ptf.tangentialVelocity_, false)
79 {}
80 
81 
84 (
87 )
88 :
90  origin_(ptf.origin_),
91  axis_(ptf.axis_),
92  axialVelocity_(ptf.axialVelocity_, false),
93  radialVelocity_(ptf.radialVelocity_, false),
94  tangentialVelocity_(ptf.tangentialVelocity_, false)
95 {}
96 
97 
98 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 
101 {
102  if (updated())
103  {
104  return;
105  }
106 
107  const vector axisHat = axis_/mag(axis_);
108 
109  // Radius vector in plane of rotation
110  vectorField r(patch().Cf() - origin_);
111  r -= (axisHat & r)*axisHat;
112  const scalarField magr(mag(r));
113  const vectorField rHat(r/magr);
114 
115  const scalarField axialVelocity(axialVelocity_->value(magr));
116  const scalarField radialVelocity(radialVelocity_->value(magr));
117  const scalarField tangentialVelocity(tangentialVelocity_->value(magr));
118 
119  operator==
120  (
121  axialVelocity*axisHat
122  + radialVelocity*rHat
123  + tangentialVelocity*(axisHat ^ rHat)
124  );
125 
127 }
128 
129 
131 {
133  writeEntry(os, "origin", origin_);
134  writeEntry(os, "axis", axis_);
135  writeEntry(os, axialVelocity_());
136  writeEntry(os, radialVelocity_());
137  writeEntry(os, tangentialVelocity_());
138  writeEntry(os, "value", *this);
139 }
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 namespace Foam
145 {
147  (
150  );
151 }
152 
153 
154 // ************************************************************************* //
Run-time selectable general function of one variable.
Definition: Function1.H:52
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
dictionary dict
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
swirlInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
This boundary condition describes an inlet vector boundary condition in swirl co-ordinates given a ce...
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:243
Macros for easy insertion into run-time selection tables.
Foam::fvPatchFieldMapper.
static const zero Zero
Definition: zero.H:97
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:216
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
volScalarField & p
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864