rotatingWallVelocityFvPatchVectorField.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 
28 #include "volFields.H"
29 #include "surfaceFields.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const fvPatch& p,
38 )
39 :
41  origin_(),
42  axis_(vector::zero),
43  omega_(0)
44 {}
45 
46 
49 (
51  const fvPatch& p,
53  const fvPatchFieldMapper& mapper
54 )
55 :
56  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
57  origin_(ptf.origin_),
58  axis_(ptf.axis_),
59  omega_(ptf.omega_, false)
60 {}
61 
62 
65 (
66  const fvPatch& p,
68  const dictionary& dict
69 )
70 :
72  origin_(dict.lookup("origin")),
73  axis_(dict.lookup("axis")),
74  omega_(DataEntry<scalar>::New("omega", dict))
75 {
76  if (dict.found("value"))
77  {
79  (
80  vectorField("value", dict, p.size())
81  );
82  }
83  else
84  {
85  // Evaluate the wall velocity
86  updateCoeffs();
87  }
88 }
89 
90 
93 (
95 )
96 :
98  origin_(rwvpvf.origin_),
99  axis_(rwvpvf.axis_),
100  omega_(rwvpvf.omega_, false)
101 {}
102 
103 
106 (
109 )
110 :
111  fixedValueFvPatchField<vector>(rwvpvf, iF),
112  origin_(rwvpvf.origin_),
113  axis_(rwvpvf.axis_),
114  omega_(rwvpvf.omega_, false)
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
121 {
122  if (updated())
123  {
124  return;
125  }
126 
127  const scalar t = this->db().time().timeOutputValue();
128  scalar om = omega_->value(t);
129 
130  // Calculate the rotating wall velocity from the specification of the motion
131  const vectorField Up
132  (
133  (-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
134  );
135 
136  // Remove the component of Up normal to the wall
137  // just in case it is not exactly circular
138  const vectorField n(patch().nf());
139  vectorField::operator=(Up - n*(n & Up));
140 
141  fixedValueFvPatchVectorField::updateCoeffs();
142 }
143 
144 
146 {
148  os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
149  os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
150  omega_->writeData(os);
151  writeEntry("value", os);
152 }
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 namespace Foam
158 {
160  (
163  );
164 }
165 
166 // ************************************************************************* //
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::rotatingWallVelocityFvPatchVectorField
This boundary condition provides a rotational velocity condition.
Definition: rotatingWallVelocityFvPatchVectorField.H:99
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
p
p
Definition: pEqn.H:62
Foam::rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
rotatingWallVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: rotatingWallVelocityFvPatchVectorField.C:35
Foam::rotatingWallVelocityFvPatchVectorField::origin_
vector origin_
Origin of the rotation.
Definition: rotatingWallVelocityFvPatchVectorField.H:106
surfaceFields.H
Foam::surfaceFields.
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
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
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
vectorField
volVectorField vectorField(fieldObject, mesh)
Foam::rotatingWallVelocityFvPatchVectorField::omega_
autoPtr< DataEntry< scalar > > omega_
Rotational speed.
Definition: rotatingWallVelocityFvPatchVectorField.H:112
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
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::Field::operator=
void operator=(const Field< Type > &)
Foam::rotatingWallVelocityFvPatchVectorField::axis_
vector axis_
Axis of the rotation.
Definition: rotatingWallVelocityFvPatchVectorField.H:109
Foam::Ostream::writeKeyword
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: rotatingWallVelocityFvPatchVectorField.C:120
rotatingWallVelocityFvPatchVectorField.H
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::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::rotatingWallVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: rotatingWallVelocityFvPatchVectorField.C:145