cylindricalInletVelocityFvPatchVectorField.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) 2011-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 
27 #include "volFields.H"
29 #include "fvPatchFieldMapper.H"
30 #include "surfaceFields.H"
31 #include "mathematicalConstants.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
37 (
38  const fvPatch& p,
40 )
41 :
43  origin_(Zero),
44  axis_(Zero),
45  axialVelocity_(),
46  radialVelocity_(),
47  rpm_()
48 {}
49 
50 
53 (
54  const fvPatch& p,
56  const dictionary& dict
57 )
58 :
60  origin_(dict.lookup("origin")),
61  axis_(dict.lookup("axis")),
62  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
63  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
64  rpm_(Function1<scalar>::New("rpm", dict))
65 {}
66 
67 
70 (
72  const fvPatch& p,
74  const fvPatchFieldMapper& mapper
75 )
76 :
77  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
78  origin_(ptf.origin_),
79  axis_(ptf.axis_),
80  axialVelocity_(ptf.axialVelocity_, false),
81  radialVelocity_(ptf.radialVelocity_, false),
82  rpm_(ptf.rpm_, false)
83 {}
84 
85 
88 (
91 )
92 :
94  origin_(ptf.origin_),
95  axis_(ptf.axis_),
96  axialVelocity_(ptf.axialVelocity_, false),
97  radialVelocity_(ptf.radialVelocity_, false),
98  rpm_(ptf.rpm_, false)
99 {}
100 
101 
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 
105 {
106  if (updated())
107  {
108  return;
109  }
110 
111  const scalar t = this->db().time().timeOutputValue();
112  const scalar axialVelocity = axialVelocity_->value(t);
113  const scalar radialVelocity = radialVelocity_->value(t);
114  const scalar rpm = rpm_->value(t);
115 
116  const vector axisHat = axis_/mag(axis_);
117 
118  const vectorField r(patch().Cf() - origin_);
119  const vectorField d(r - (axisHat & r)*axisHat);
120 
121  tmp<vectorField> tangVel
122  (
123  (rpm*constant::mathematical::pi/30.0)*(axisHat) ^ d
124  );
125 
126  operator==(tangVel + axisHat*axialVelocity + radialVelocity*d/mag(d));
127 
129 }
130 
131 
133 {
135  writeEntry(os, "origin", origin_);
136  writeEntry(os, "axis", axis_);
137  writeEntry(os, axialVelocity_());
138  writeEntry(os, radialVelocity_());
139  writeEntry(os, rpm_());
140  writeEntry(os, "value", *this);
141 }
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 namespace Foam
147 {
149  (
152  );
153 }
154 
155 
156 // ************************************************************************* //
Foam::surfaceFields.
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
This boundary condition describes an inlet vector boundary condition in cylindrical co-ordinates give...
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
cylindricalInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:260
Macros for easy insertion into run-time selection tables.
virtual Type value(const scalar x) const =0
Return value as a function of scalar x.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
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.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:209
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
A class for managing temporary objects.
Definition: PtrList.H:53
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:844