initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / rotatingWallVelocity / rotatingWallVelocityFvPatchVectorField.C
blob9000fb51c25887c0aeb2ddf2ef89dc6c7f1e8da6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
41     const fvPatch& p,
42     const DimensionedField<vector, volMesh>& iF
45     fixedValueFvPatchField<vector>(p, iF),
46     origin_(vector::zero),
47     axis_(vector::zero),
48     omega_(0)
52 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
54     const rotatingWallVelocityFvPatchVectorField& ptf,
55     const fvPatch& p,
56     const DimensionedField<vector, volMesh>& iF,
57     const fvPatchFieldMapper& mapper
60     fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
61     origin_(ptf.origin_),
62     axis_(ptf.axis_),
63     omega_(ptf.omega_)
67 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
69     const fvPatch& p,
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
80     updateCoeffs();
84 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
86     const rotatingWallVelocityFvPatchVectorField& pivpvf
89     fixedValueFvPatchField<vector>(pivpvf),
90     origin_(pivpvf.origin_),
91     axis_(pivpvf.axis_),
92     omega_(pivpvf.omega_)
96 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
98     const rotatingWallVelocityFvPatchVectorField& pivpvf,
99     const DimensionedField<vector, volMesh>& iF
102     fixedValueFvPatchField<vector>(pivpvf, iF),
103     origin_(pivpvf.origin_),
104     axis_(pivpvf.axis_),
105     omega_(pivpvf.omega_)
109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
111 void rotatingWallVelocityFvPatchVectorField::updateCoeffs()
113     if (updated())
114     {
115         return;
116     }
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 makePatchTypeField
144     fvPatchVectorField,
145     rotatingWallVelocityFvPatchVectorField
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace Foam
153 // ************************************************************************* //