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-2023 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  const dictionary& dict
37 )
38 :
40  origin_(dict.lookup("origin")),
41  axis_(dict.lookup("axis")),
42  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
43  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
44  tangentialVelocity_(Function1<scalar>::New("tangentialVelocity", dict))
45 {}
46 
47 
50 (
52  const fvPatch& p,
54  const fvPatchFieldMapper& mapper
55 )
56 :
57  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
58  origin_(ptf.origin_),
59  axis_(ptf.axis_),
60  axialVelocity_(ptf.axialVelocity_, false),
61  radialVelocity_(ptf.radialVelocity_, false),
62  tangentialVelocity_(ptf.tangentialVelocity_, false)
63 {}
64 
65 
68 (
71 )
72 :
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 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
85 {
86  if (updated())
87  {
88  return;
89  }
90 
91  const vector axisHat = axis_/mag(axis_);
92 
93  // Radius vector in plane of rotation
94  vectorField r(patch().Cf() - origin_);
95  r -= (axisHat & r)*axisHat;
96  const scalarField magr(mag(r));
97  const vectorField rHat(r/magr);
98 
99  const scalarField axialVelocity(axialVelocity_->value(magr));
100  const scalarField radialVelocity(radialVelocity_->value(magr));
101  const scalarField tangentialVelocity(tangentialVelocity_->value(magr));
102 
103  operator==
104  (
105  axialVelocity*axisHat
106  + radialVelocity*rHat
107  + tangentialVelocity*(axisHat ^ rHat)
108  );
109 
111 }
112 
113 
115 {
117  writeEntry(os, "origin", origin_);
118  writeEntry(os, "axis", axis_);
119  writeEntry(os, axialVelocity_());
120  writeEntry(os, radialVelocity_());
121  writeEntry(os, tangentialVelocity_());
122  writeEntry(os, "value", *this);
123 }
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 namespace Foam
129 {
131  (
134  );
135 }
136 
137 
138 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Run-time selectable general function of one variable.
Definition: Function1.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:231
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:204
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition describes an inlet vector boundary condition in swirl co-ordinates given a ce...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
swirlInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
Namespace for OpenFOAM.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p