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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
31 #include "volFields.H"
32 #include "surfaceFields.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
38 (
39  const fvPatch& p,
41 )
42 :
44  origin_(),
45  axis_(Zero),
46  omega_(nullptr)
47 {}
48 
49 
52 (
53  const fvPatch& p,
55  const dictionary& dict
56 )
57 :
58  fixedValueFvPatchField<vector>(p, iF, dict, false),
59  origin_(dict.lookup("origin")),
60  axis_(dict.lookup("axis")),
61  omega_(Function1<scalar>::New("omega", dict, &db()))
62 {
63  if (dict.found("value"))
64  {
66  (
67  vectorField("value", dict, p.size())
68  );
69  }
70  else
71  {
72  // Evaluate the wall velocity
74  }
75 }
76 
77 
80 (
81  const rotatingWallVelocityFvPatchVectorField& ptf,
82  const fvPatch& p,
83  const DimensionedField<vector, volMesh>& iF,
84  const fvPatchFieldMapper& mapper
85 )
86 :
87  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
88  origin_(ptf.origin_),
89  axis_(ptf.axis_),
90  omega_(ptf.omega_.clone())
91 {}
92 
93 
96 (
98 )
99 :
101  origin_(rwvpvf.origin_),
102  axis_(rwvpvf.axis_),
103  omega_(rwvpvf.omega_.clone())
104 {}
105 
106 
109 (
112 )
113 :
114  fixedValueFvPatchField<vector>(rwvpvf, iF),
115  origin_(rwvpvf.origin_),
116  axis_(rwvpvf.axis_),
117  omega_(rwvpvf.omega_.clone())
118 {}
119 
120 
121 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 
124 {
125  if (updated())
126  {
127  return;
128  }
129 
130  const scalar t = this->db().time().timeOutputValue();
131  scalar om = omega_->value(t);
132 
133  // Calculate the rotating wall velocity from the specification of the motion
134  const vectorField Up
135  (
136  (-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
137  );
138 
139  // Remove the component of Up normal to the wall
140  // just in case it is not exactly circular
141  const vectorField n(patch().nf());
142  vectorField::operator=(Up - n*(n & Up));
143 
144  fixedValueFvPatchVectorField::updateCoeffs();
145 }
146 
147 
149 {
151  os.writeEntry("origin", origin_);
152  os.writeEntry("axis", axis_);
153  omega_->writeData(os);
154  writeEntry("value", os);
155 }
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 namespace Foam
161 {
163  (
165  rotatingWallVelocityFvPatchVectorField
166  );
167 }
168 
169 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:47
volFields.H
Foam::fvPatchField::write
virtual void write(Ostream &) const
Definition: fvPatchField.C:377
Foam::rotatingWallVelocityFvPatchVectorField
This boundary condition provides a rotational velocity condition.
Definition: rotatingWallVelocityFvPatchVectorField.H:95
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Definition: zero.H:131
Foam::rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
rotatingWallVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Definition: rotatingWallVelocityFvPatchVectorField.C:31
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: propellerInfo.H:287
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:76
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:48
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field
Generic templated field type.
Definition: Field.H:59
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::radiation::lookup
Lookup type of boundary radiation properties.
Definition: lookup.H:57
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:119
om
optimisationManager & om
Definition: createFields.H:6
os
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Definition: atmBoundaryLayer.C:26
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:47
Foam::Field::operator=
void operator=(const Field< Type > &)
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Definition: DimensionedFieldReuseFunctions.H:100
Foam::fvPatchVectorField
fvPatchField< vector > fvPatchVectorField
Definition: fvPatchFieldsFwd.H:36
Foam::foamVersion::patch
const std::string patch
Foam::Vector< scalar >
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Definition: rotatingWallVelocityFvPatchVectorField.C:116
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Definition: Ostream.H:232
rotatingWallVelocityFvPatchVectorField.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:41
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
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:50
Foam::rotatingWallVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Definition: rotatingWallVelocityFvPatchVectorField.C:141