1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "rotatingWallVelocityFvPatchVectorField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "volFields.H"
29 #include "surfaceFields.H"
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 Foam::rotatingWallVelocityFvPatchVectorField::
34 rotatingWallVelocityFvPatchVectorField
37 const DimensionedField<vector, volMesh>& iF
40 fixedValueFvPatchField<vector>(p, iF),
41 origin_(vector::zero),
47 Foam::rotatingWallVelocityFvPatchVectorField::
48 rotatingWallVelocityFvPatchVectorField
50 const rotatingWallVelocityFvPatchVectorField& ptf,
52 const DimensionedField<vector, volMesh>& iF,
53 const fvPatchFieldMapper& mapper
56 fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
63 Foam::rotatingWallVelocityFvPatchVectorField::
64 rotatingWallVelocityFvPatchVectorField
67 const DimensionedField<vector, volMesh>& iF,
68 const dictionary& dict
71 fixedValueFvPatchField<vector>(p, iF),
72 origin_(dict.lookup("origin")),
73 axis_(dict.lookup("axis")),
74 omega_(readScalar(dict.lookup("omega")))
76 // Evaluate the wall velocity
81 Foam::rotatingWallVelocityFvPatchVectorField::
82 rotatingWallVelocityFvPatchVectorField
84 const rotatingWallVelocityFvPatchVectorField& pivpvf
87 fixedValueFvPatchField<vector>(pivpvf),
88 origin_(pivpvf.origin_),
94 Foam::rotatingWallVelocityFvPatchVectorField::
95 rotatingWallVelocityFvPatchVectorField
97 const rotatingWallVelocityFvPatchVectorField& pivpvf,
98 const DimensionedField<vector, volMesh>& iF
101 fixedValueFvPatchField<vector>(pivpvf, iF),
102 origin_(pivpvf.origin_),
104 omega_(pivpvf.omega_)
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 void Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs()
117 // Calculate the rotating wall velocity from the specification of the motion
120 (-omega_)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
123 // Remove the component of Up normal to the wall
124 // just in case it is not exactly circular
125 const vectorField n(patch().nf());
126 vectorField::operator=(Up - n*(n & Up));
128 fixedValueFvPatchVectorField::updateCoeffs();
132 void Foam::rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const
134 fvPatchVectorField::write(os);
135 os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
136 os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
137 os.writeKeyword("omega") << omega_ << token::END_STATEMENT << nl;
138 writeEntry("value", os);
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 rotatingWallVelocityFvPatchVectorField
153 // ************************************************************************* //