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  Copyright (C) 2021 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 
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
39 )
40 :
42  origin_(Zero),
43  axis_(Zero),
44  axialVelocity_(),
45  radialVelocity_(),
46  tangentialVelocity_()
47 {}
48 
49 
52 (
54  const fvPatch& p,
56  const fvPatchFieldMapper& mapper
57 )
58 :
59  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
60  origin_(ptf.origin_),
61  axis_(ptf.axis_),
62  axialVelocity_(ptf.axialVelocity_.clone()),
63  radialVelocity_(ptf.radialVelocity_.clone()),
64  tangentialVelocity_(ptf.tangentialVelocity_.clone())
65 {}
66 
67 
70 (
71  const fvPatch& p,
73  const dictionary& dict
74 )
75 :
77  origin_(dict.lookup("origin")),
78  axis_(dict.lookup("axis")),
79  axialVelocity_(Function1<scalar>::New("axialVelocity", dict, &db())),
80  radialVelocity_
81  (
82  Function1<scalar>::New("radialVelocity", dict, &db())
83  ),
84  tangentialVelocity_
85  (
86  Function1<scalar>::New("tangentialVelocity", dict, &db())
87  )
88 {}
89 
90 
93 (
95 )
96 :
98  origin_(ptf.origin_),
99  axis_(ptf.axis_),
100  axialVelocity_(ptf.axialVelocity_.clone()),
101  radialVelocity_(ptf.radialVelocity_.clone()),
102  tangentialVelocity_(ptf.tangentialVelocity_.clone())
103 {}
104 
105 
108 (
111 )
112 :
113  fixedValueFvPatchField<vector>(ptf, iF),
114  origin_(ptf.origin_),
115  axis_(ptf.axis_),
116  axialVelocity_(ptf.axialVelocity_.clone()),
117  radialVelocity_(ptf.radialVelocity_.clone()),
118  tangentialVelocity_(ptf.tangentialVelocity_.clone())
119 {}
120 
121 
122 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
123 
125 {
126  if (updated())
127  {
128  return;
129  }
130 
131  const vector axisHat = axis_/mag(axis_);
132 
133  // Radius vector in plane of rotation
134  vectorField r(patch().Cf() - origin_);
135  r -= (axisHat & r)*axisHat;
136  const scalarField magr(mag(r));
137  const vectorField rHat(r/magr);
138 
139  const scalarField axialVelocity(axialVelocity_->value(magr));
140  const scalarField radialVelocity(radialVelocity_->value(magr));
141  const scalarField tangentialVelocity(tangentialVelocity_->value(magr));
142 
143  operator==
144  (
145  axialVelocity*axisHat
146  + radialVelocity*rHat
147  + tangentialVelocity*(axisHat ^ rHat)
148  );
149 
151 }
152 
153 
155 {
157  os.writeEntry("origin", origin_);
158  os.writeEntry("axis", axis_);
159  axialVelocity_->writeData(os);
160  radialVelocity_->writeData(os);
161  tangentialVelocity_->writeData(os);
162  writeEntry("value", os);
163 }
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 namespace Foam
169 {
171  (
173  swirlInletVelocityFvPatchVectorField
174  );
175 }
176 
177 
178 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:47
Foam::fvPatchField::write
virtual void write(Ostream &) const
Definition: fvPatchField.C:377
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:46
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Definition: zero.H:131
Foam::swirlInletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
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: propellerInfo.H:287
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:76
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:48
Foam::swirlInletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Definition: swirlInletVelocityFvPatchVectorField.C:117
Foam::Field
Generic templated field type.
Definition: Field.H:59
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::swirlInletVelocityFvPatchVectorField
This boundary condition describes an inlet vector boundary condition in swirl coordinates given a cen...
Definition: swirlInletVelocityFvPatchVectorField.H:113
Foam::radiation::lookup
Lookup type of boundary radiation properties.
Definition: lookup.H:57
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:119
os
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Definition: atmBoundaryLayer.C:26
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:47
Foam::fvPatchField< Type >::updateCoeffs
virtual void updateCoeffs()
Definition: fvPatchField.C:314
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Definition: DimensionedFieldReuseFunctions.H:100
Foam::swirlInletVelocityFvPatchVectorField::swirlInletVelocityFvPatchVectorField
swirlInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Definition: swirlInletVelocityFvPatchVectorField.C:29
Foam::fvPatchVectorField
fvPatchField< vector > fvPatchVectorField
Definition: fvPatchFieldsFwd.H:36
Foam::foamVersion::patch
const std::string patch
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)
Definition: Ostream.H:232
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:41
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
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:50