swirlInletVelocityFvPatchVectorField.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) 2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const fvPatch& p,
38 )
39 :
41  origin_(Zero),
42  axis_(Zero),
43  axialVelocity_(),
44  radialVelocity_(),
45  tangentialVelocity_()
46 {}
47 
48 
51 (
53  const fvPatch& p,
55  const fvPatchFieldMapper& mapper
56 )
57 :
58  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
59  origin_(ptf.origin_),
60  axis_(ptf.axis_),
61  axialVelocity_(ptf.axialVelocity_.clone()),
62  radialVelocity_(ptf.radialVelocity_.clone()),
63  tangentialVelocity_(ptf.tangentialVelocity_.clone())
64 {}
65 
66 
69 (
70  const fvPatch& p,
72  const dictionary& dict
73 )
74 :
76  origin_(dict.lookup("origin")),
77  axis_(dict.lookup("axis")),
78  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
79  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
80  tangentialVelocity_(Function1<scalar>::New("tangentialVelocity", dict))
81 {}
82 
83 
86 (
88 )
89 :
91  origin_(ptf.origin_),
92  axis_(ptf.axis_),
93  axialVelocity_(ptf.axialVelocity_.clone()),
94  radialVelocity_(ptf.radialVelocity_.clone()),
95  tangentialVelocity_(ptf.tangentialVelocity_.clone())
96 {}
97 
98 
101 (
104 )
105 :
107  origin_(ptf.origin_),
108  axis_(ptf.axis_),
109  axialVelocity_(ptf.axialVelocity_.clone()),
110  radialVelocity_(ptf.radialVelocity_.clone()),
111  tangentialVelocity_(ptf.tangentialVelocity_.clone())
112 {}
113 
114 
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 
118 {
119  if (updated())
120  {
121  return;
122  }
123 
124  const vector axisHat = axis_/mag(axis_);
125 
126  // Radius vector in plane of rotation
127  vectorField r(patch().Cf() - origin_);
128  r -= (axisHat & r)*axisHat;
129  const scalarField magr(mag(r));
130  const vectorField rHat(r/magr);
131 
132  const scalarField axialVelocity(axialVelocity_->value(magr));
133  const scalarField radialVelocity(radialVelocity_->value(magr));
134  const scalarField tangentialVelocity(tangentialVelocity_->value(magr));
135 
136  operator==
137  (
138  axialVelocity*axisHat
139  + radialVelocity*rHat
140  + tangentialVelocity*(axisHat ^ rHat)
141  );
142 
144 }
145 
146 
148 {
150  os.writeEntry("origin", origin_);
151  os.writeEntry("axis", axis_);
152  axialVelocity_->writeData(os);
153  radialVelocity_->writeData(os);
154  tangentialVelocity_->writeData(os);
155  writeEntry("value", os);
156 }
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 namespace Foam
162 {
164  (
167  );
168 }
169 
170 
171 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:364
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::swirlInletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: swirlInletVelocityFvPatchVectorField.C:147
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:86
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
Foam::swirlInletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: swirlInletVelocityFvPatchVectorField.C:117
Foam::Field< vector >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::swirlInletVelocityFvPatchVectorField
This boundary condition describes an inlet vector boundary condition in swirl coordinates given a cen...
Definition: swirlInletVelocityFvPatchVectorField.H:117
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
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:313
Foam::swirlInletVelocityFvPatchVectorField::swirlInletVelocityFvPatchVectorField
swirlInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: swirlInletVelocityFvPatchVectorField.C:35
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
swirlInletVelocityFvPatchVectorField.H
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
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::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54