Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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_(Zero),
45 axis_(Zero),
46 omega_(nullptr)
47{}
48
49
52(
53 const fvPatch& p,
55 const dictionary& dict
56)
57:
59 origin_(dict.get<vector>("origin")),
60 axis_(dict.get<vector>("axis")),
61 omega_(Function1<scalar>::New("omega", dict, &db()))
62{
63 if (!this->readValueEntry(dict))
64 {
65 // Evaluate the wall velocity
67 }
68}
69
70
73(
74 const rotatingWallVelocityFvPatchVectorField& ptf,
75 const fvPatch& p,
76 const DimensionedField<vector, volMesh>& iF,
77 const fvPatchFieldMapper& mapper
78)
79:
80 fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
81 origin_(ptf.origin_),
82 axis_(ptf.axis_),
83 omega_(ptf.omega_.clone())
84{}
85
86
89(
91)
92:
94 origin_(rwvpvf.origin_),
95 axis_(rwvpvf.axis_),
96 omega_(rwvpvf.omega_.clone())
97{}
98
99
102(
105)
106:
107 fixedValueFvPatchField<vector>(rwvpvf, iF),
108 origin_(rwvpvf.origin_),
109 axis_(rwvpvf.axis_),
110 omega_(rwvpvf.omega_.clone())
111{}
112
113
114// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115
117{
118 if (updated())
119 {
120 return;
121 }
122
123 const scalar t = this->db().time().timeOutputValue();
124 scalar om = omega_->value(t);
125
126 // Calculate the rotating wall velocity from the specification of the motion
127 const vectorField Up
128 (
129 (-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
130 );
131
132 // Remove the component of Up normal to the wall
133 // just in case it is not exactly circular
134 const vectorField n(patch().nf());
135 vectorField::operator=(Up - n*(n & Up));
136
137 fixedValueFvPatchVectorField::updateCoeffs();
138}
139
140
142{
144 os.writeEntry("origin", origin_);
145 os.writeEntry("axis", axis_);
146 omega_->writeData(os);
149
150
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153namespace Foam
154{
156 (
158 rotatingWallVelocityFvPatchVectorField
159 );
160}
161
162// ************************************************************************* //
label n
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void operator=(const Field< vector > &)
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition Function1.H:92
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
This boundary condition provides a rotational velocity condition.
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
rotatingWallVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
Namespace for OpenFOAM.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
Vector< scalar > vector
Definition vector.H:57
fvPatchField< vector > fvPatchVectorField
dictionary dict
Foam::surfaceFields.
optimisationManager & om
Definition createFields.H:6