1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "rotatingWallVelocityFvPatchVectorField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
42 const DimensionedField<vector, volMesh>& iF
45 fixedValueFvPatchField<vector>(p, iF),
46 origin_(vector::zero),
52 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
54 const rotatingWallVelocityFvPatchVectorField& ptf,
56 const DimensionedField<vector, volMesh>& iF,
57 const fvPatchFieldMapper& mapper
60 fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
67 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
70 const DimensionedField<vector, volMesh>& iF,
71 const dictionary& dict
74 fixedValueFvPatchField<vector>(p, iF),
75 origin_(dict.lookup("origin")),
76 axis_(dict.lookup("axis")),
77 omega_(readScalar(dict.lookup("omega")))
79 // Evaluate the wall velocity
84 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
86 const rotatingWallVelocityFvPatchVectorField& pivpvf
89 fixedValueFvPatchField<vector>(pivpvf),
90 origin_(pivpvf.origin_),
96 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
98 const rotatingWallVelocityFvPatchVectorField& pivpvf,
99 const DimensionedField<vector, volMesh>& iF
102 fixedValueFvPatchField<vector>(pivpvf, iF),
103 origin_(pivpvf.origin_),
105 omega_(pivpvf.omega_)
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 void rotatingWallVelocityFvPatchVectorField::updateCoeffs()
118 // Calculate the rotating wall velocity from the specification of the motion
119 vectorField Up = (-omega_)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)));
121 // Remove the component of Up normal to the wall
122 // just in case it is not exactly circular
123 vectorField n = patch().nf();
124 vectorField::operator=(Up - n*(n & Up));
126 fixedValueFvPatchVectorField::updateCoeffs();
130 void rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const
132 fvPatchVectorField::write(os);
133 os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
134 os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
135 os.writeKeyword("omega") << omega_ << token::END_STATEMENT << nl;
136 writeEntry("value", os);
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 rotatingWallVelocityFvPatchVectorField
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace Foam
153 // ************************************************************************* //