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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "volFields.H"
31 #include "surfaceFields.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
37 (
38  const fvPatch& p,
40 )
41 :
43  origin_(),
44  axis_(Zero),
45  omega_(nullptr)
46 {}
47 
48 
51 (
52  const fvPatch& p,
54  const dictionary& dict
55 )
56 :
58  origin_(dict.lookup("origin")),
59  axis_(dict.lookup("axis")),
60  omega_(Function1<scalar>::New("omega", dict))
61 {
62  if (dict.found("value"))
63  {
65  (
66  vectorField("value", dict, p.size())
67  );
68  }
69  else
70  {
71  // Evaluate the wall velocity
72  updateCoeffs();
73  }
74 }
75 
76 
79 (
81  const fvPatch& p,
83  const fvPatchFieldMapper& mapper
84 )
85 :
86  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
87  origin_(ptf.origin_),
88  axis_(ptf.axis_),
89  omega_(ptf.omega_.clone())
90 {}
91 
92 
95 (
97 )
98 :
100  origin_(rwvpvf.origin_),
101  axis_(rwvpvf.axis_),
102  omega_(rwvpvf.omega_.clone())
103 {}
104 
105 
108 (
111 )
112 :
113  fixedValueFvPatchField<vector>(rwvpvf, iF),
114  origin_(rwvpvf.origin_),
115  axis_(rwvpvf.axis_),
116  omega_(rwvpvf.omega_.clone())
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
123 {
124  if (updated())
125  {
126  return;
127  }
128 
129  const scalar t = this->db().time().timeOutputValue();
130  scalar om = omega_->value(t);
131 
132  // Calculate the rotating wall velocity from the specification of the motion
133  const vectorField Up
134  (
135  (-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
136  );
137 
138  // Remove the component of Up normal to the wall
139  // just in case it is not exactly circular
140  const vectorField n(patch().nf());
141  vectorField::operator=(Up - n*(n & Up));
142 
143  fixedValueFvPatchVectorField::updateCoeffs();
144 }
145 
146 
148 {
150  os.writeEntry("origin", origin_);
151  os.writeEntry("axis", axis_);
152  omega_->writeData(os);
153  writeEntry("value", os);
154 }
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 namespace Foam
160 {
162  (
165  );
166 }
167 
168 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
volFields.H
Foam::fvPatchField< vector >::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:364
Foam::rotatingWallVelocityFvPatchVectorField
This boundary condition provides a rotational velocity condition.
Definition: rotatingWallVelocityFvPatchVectorField.H:99
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
rotatingWallVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: rotatingWallVelocityFvPatchVectorField.C:37
surfaceFields.H
Foam::surfaceFields.
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:86
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field< vector >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
om
optimisationManager & om
Definition: createFields.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Field< vector >::operator=
void operator=(const Field< vector > &)
Copy assignment.
Definition: Field.C:647
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: rotatingWallVelocityFvPatchVectorField.C:122
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
rotatingWallVelocityFvPatchVectorField.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::rotatingWallVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: rotatingWallVelocityFvPatchVectorField.C:147