initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / rotatingPressureInletOutletVelocity / rotatingPressureInletOutletVelocityFvPatchVectorField.C
blob3a7e97c6b4bb6542595a11659ca7b3c7016d3812
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 "rotatingPressureInletOutletVelocityFvPatchVectorField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
39 void rotatingPressureInletOutletVelocityFvPatchVectorField::
40 calcTangentialVelocity()
42     vector axisHat = omega_/mag(omega_);
43     vectorField tangentialVelocity = 
44         (-omega_) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
46     vectorField n = patch().nf();
47     refValue() = tangentialVelocity - n*(n & tangentialVelocity);
51 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
53 rotatingPressureInletOutletVelocityFvPatchVectorField::
54 rotatingPressureInletOutletVelocityFvPatchVectorField
56     const fvPatch& p,
57     const DimensionedField<vector, volMesh>& iF
60     pressureInletOutletVelocityFvPatchVectorField(p, iF),
61     omega_(vector::zero)
65 rotatingPressureInletOutletVelocityFvPatchVectorField::
66 rotatingPressureInletOutletVelocityFvPatchVectorField
68     const rotatingPressureInletOutletVelocityFvPatchVectorField& ptf,
69     const fvPatch& p,
70     const DimensionedField<vector, volMesh>& iF,
71     const fvPatchFieldMapper& mapper
74     pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
75     omega_(ptf.omega_)
77     calcTangentialVelocity();
81 rotatingPressureInletOutletVelocityFvPatchVectorField::
82 rotatingPressureInletOutletVelocityFvPatchVectorField
84     const fvPatch& p,
85     const DimensionedField<vector, volMesh>& iF,
86     const dictionary& dict
89     pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
90     omega_(dict.lookup("omega"))
92     calcTangentialVelocity();
96 rotatingPressureInletOutletVelocityFvPatchVectorField::
97 rotatingPressureInletOutletVelocityFvPatchVectorField
99     const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf
102     pressureInletOutletVelocityFvPatchVectorField(pivpvf),
103     omega_(pivpvf.omega_)
105     calcTangentialVelocity();
109 rotatingPressureInletOutletVelocityFvPatchVectorField::
110 rotatingPressureInletOutletVelocityFvPatchVectorField
112     const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf,
113     const DimensionedField<vector, volMesh>& iF
116     pressureInletOutletVelocityFvPatchVectorField(pivpvf, iF),
117     omega_(pivpvf.omega_)
119     calcTangentialVelocity();
123 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
125 void rotatingPressureInletOutletVelocityFvPatchVectorField::
126 write(Ostream& os) const
128     fvPatchVectorField::write(os);
129     os.writeKeyword("phi") << phiName() << token::END_STATEMENT << nl;
130     os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
131     writeEntry("value", os);
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 makePatchTypeField
139     fvPatchVectorField,
140     rotatingPressureInletOutletVelocityFvPatchVectorField
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // ************************************************************************* //