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-2016 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_(Zero),
43  omega_(0)
44 {}
45 
46 
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
56  origin_(dict.lookup("origin")),
57  axis_(dict.lookup("axis")),
58  omega_(Function1<scalar>::New("omega", dict))
59 {
60  if (dict.found("value"))
61  {
63  (
64  vectorField("value", dict, p.size())
65  );
66  }
67  else
68  {
69  // Evaluate the wall velocity
70  updateCoeffs();
71  }
72 }
73 
74 
77 (
79  const fvPatch& p,
81  const fvPatchFieldMapper& mapper
82 )
83 :
84  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
85  origin_(ptf.origin_),
86  axis_(ptf.axis_),
87  omega_(ptf.omega_, false)
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::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
rotatingWallVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
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
volVectorField vectorField(fieldObject, mesh)
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:362
Macros for easy insertion into run-time selection tables.
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
This boundary condition provides a rotational velocity condition.
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
void operator=(const Field< vector > &)
Definition: Field.C:764
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
dimensioned< scalar > mag(const dimensioned< Type > &)
label n
volScalarField & p
Namespace for OpenFOAM.