cylindricalInletVelocityFvPatchVectorField.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 | Copyright (C) 2011-2017 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 (
55  const fvPatch& p,
57  const fvPatchFieldMapper& mapper
58 )
59 :
60  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
61  origin_(ptf.origin_),
62  axis_(ptf.axis_),
63  axialVelocity_(ptf.axialVelocity_, false),
64  radialVelocity_(ptf.radialVelocity_, false),
65  rpm_(ptf.rpm_, false)
66 {}
67 
68 
71 (
72  const fvPatch& p,
74  const dictionary& dict
75 )
76 :
78  origin_(dict.lookup("origin")),
79  axis_(dict.lookup("axis")),
80  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
81  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
82  rpm_(Function1<scalar>::New("rpm", dict))
83 {}
84 
85 
88 (
90 )
91 :
93  origin_(ptf.origin_),
94  axis_(ptf.axis_),
95  axialVelocity_(ptf.axialVelocity_, false),
96  radialVelocity_(ptf.radialVelocity_, false),
97  rpm_(ptf.rpm_, false)
98 {}
99 
100 
103 (
106 )
107 :
109  origin_(ptf.origin_),
110  axis_(ptf.axis_),
111  axialVelocity_(ptf.axialVelocity_, false),
112  radialVelocity_(ptf.radialVelocity_, false),
113  rpm_(ptf.rpm_, false)
114 {}
115 
116 
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 
120 {
121  if (updated())
122  {
123  return;
124  }
125 
126  const scalar t = this->db().time().timeOutputValue();
127  const scalar axialVelocity = axialVelocity_->value(t);
128  const scalar radialVelocity = radialVelocity_->value(t);
129  const scalar rpm = rpm_->value(t);
130 
131  const vector axisHat = axis_/mag(axis_);
132 
133  const vectorField r(patch().Cf() - origin_);
134  const vectorField d(r - (axisHat & r)*axisHat);
135 
136  tmp<vectorField> tangVel
137  (
138  (rpm*constant::mathematical::pi/30.0)*(axisHat) ^ d
139  );
140 
141  operator==(tangVel + axisHat*axialVelocity + radialVelocity*d/mag(d));
142 
144 }
145 
146 
148 {
150  os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
151  os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
152  axialVelocity_->writeData(os);
153  radialVelocity_->writeData(os);
154  rpm_->writeData(os);
155  writeEntry("value", os);
156 }
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 namespace Foam
162 {
164  (
167  );
168 }
169 
170 
171 // ************************************************************************* //
Foam::surfaceFields.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:53
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:137
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:61
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:362
Macros for easy insertion into run-time selection tables.
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Foam::fvPatchFieldMapper.
static const zero Zero
Definition: zero.H:91
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:262
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.
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
A class for managing temporary objects.
Definition: PtrList.H:53
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