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-2018 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 (
51  const fvPatch& p,
53  const fvPatchFieldMapper& mapper
54 )
55 :
56  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
57  origin_(ptf.origin_),
58  axis_(ptf.axis_),
59  axialVelocity_(ptf.axialVelocity_, false),
60  radialVelocity_(ptf.radialVelocity_, false),
61  tangentialVelocity_(ptf.tangentialVelocity_, false)
62 {}
63 
64 
67 (
68  const fvPatch& p,
70  const dictionary& dict
71 )
72 :
74  origin_(dict.lookup("origin")),
75  axis_(dict.lookup("axis")),
76  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
77  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
78  tangentialVelocity_(Function1<scalar>::New("tangentialVelocity", dict))
79 {}
80 
81 
84 (
86 )
87 :
89  origin_(ptf.origin_),
90  axis_(ptf.axis_),
91  axialVelocity_(ptf.axialVelocity_, false),
92  radialVelocity_(ptf.radialVelocity_, false),
93  tangentialVelocity_(ptf.tangentialVelocity_, false)
94 {}
95 
96 
99 (
102 )
103 :
105  origin_(ptf.origin_),
106  axis_(ptf.axis_),
107  axialVelocity_(ptf.axialVelocity_, false),
108  radialVelocity_(ptf.radialVelocity_, false),
109  tangentialVelocity_(ptf.tangentialVelocity_, false)
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
116 {
117  if (updated())
118  {
119  return;
120  }
121 
122  const vector axisHat = axis_/mag(axis_);
123 
124  // Radius vector in plane of rotation
125  vectorField r(patch().Cf() - origin_);
126  r -= (axisHat & r)*axisHat;
127  const scalarField magr(mag(r));
128  const vectorField rHat(r/magr);
129 
130  const scalarField axialVelocity(axialVelocity_->value(magr));
131  const scalarField radialVelocity(radialVelocity_->value(magr));
132  const scalarField tangentialVelocity(tangentialVelocity_->value(magr));
133 
134  operator==
135  (
136  axialVelocity*axisHat
137  + radialVelocity*rHat
138  + tangentialVelocity*(axisHat ^ rHat)
139  );
140 
142 }
143 
144 
146 {
148  os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
149  os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
150  axialVelocity_->writeData(os);
151  radialVelocity_->writeData(os);
152  tangentialVelocity_->writeData(os);
153  writeEntry("value", os);
154 }
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 namespace Foam
160 {
162  (
165  );
166 }
167 
168 
169 // ************************************************************************* //
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
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:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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:362
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:53
static const char nl
Definition: Ostream.H:265
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:311
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:576