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-2015 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  centre_(pTraits<vector>::zero),
44  axis_(pTraits<vector>::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  centre_(ptf.centre_),
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  centre_(dict.lookup("centre")),
79  axis_(dict.lookup("axis")),
80  axialVelocity_(DataEntry<scalar>::New("axialVelocity", dict)),
81  radialVelocity_(DataEntry<scalar>::New("radialVelocity", dict)),
82  rpm_(DataEntry<scalar>::New("rpm", dict))
83 {}
84 
85 
88 (
90 )
91 :
93  centre_(ptf.centre_),
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  centre_(ptf.centre_),
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  vector hatAxis = axis_/mag(axis_);
132 
133  const vectorField r(patch().Cf() - centre_);
134  const vectorField d(r - (hatAxis & r)*hatAxis);
135 
136  tmp<vectorField> tangVel
137  (
138  (rpm*constant::mathematical::pi/30.0)*(hatAxis) ^ d
139  );
140 
141  operator==(tangVel + hatAxis*axialVelocity + radialVelocity*d/mag(d));
142 
144 }
145 
146 
148 {
150  os.writeKeyword("centre") << centre_ << 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::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
volFields.H
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:349
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
mathematicalConstants.H
p
p
Definition: pEqn.H:62
Foam::cylindricalInletVelocityFvPatchVectorField::radialVelocity_
autoPtr< DataEntry< scalar > > radialVelocity_
Radial velocity.
Definition: cylindricalInletVelocityFvPatchVectorField.H:132
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::operator==
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
Foam::cylindricalInletVelocityFvPatchVectorField::axialVelocity_
autoPtr< DataEntry< scalar > > axialVelocity_
Axial velocity.
Definition: cylindricalInletVelocityFvPatchVectorField.H:129
cylindricalInletVelocityFvPatchVectorField.H
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:79
Foam::cylindricalInletVelocityFvPatchVectorField::centre_
const vector centre_
Central point.
Definition: cylindricalInletVelocityFvPatchVectorField.H:123
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::cylindricalInletVelocityFvPatchVectorField::axis_
const vector axis_
Axis.
Definition: cylindricalInletVelocityFvPatchVectorField.H:126
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::cylindricalInletVelocityFvPatchVectorField::cylindricalInletVelocityFvPatchVectorField
cylindricalInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: cylindricalInletVelocityFvPatchVectorField.C:37
Foam::cylindricalInletVelocityFvPatchVectorField::rpm_
autoPtr< DataEntry< scalar > > rpm_
RPM.
Definition: cylindricalInletVelocityFvPatchVectorField.H:135
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::cylindricalInletVelocityFvPatchVectorField
This boundary condition describes an inlet vector boundary condition in cylindrical co-ordinates give...
Definition: cylindricalInletVelocityFvPatchVectorField.H:116
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::makePatchTypeField
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
Foam::fvPatchField< Type >::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:296
Foam::Vector< scalar >
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::Ostream::writeKeyword
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
Foam::constant::mathematical::pi
const scalar pi(M_PI)
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::DataEntry
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: DataEntry.H:52
Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: cylindricalInletVelocityFvPatchVectorField.C:119
Foam::cylindricalInletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: cylindricalInletVelocityFvPatchVectorField.C:147
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51