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 "rotatingPressureInletOutletVelocityFvPatchVectorField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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
57 const DimensionedField<vector, volMesh>& iF
60 pressureInletOutletVelocityFvPatchVectorField(p, iF),
65 rotatingPressureInletOutletVelocityFvPatchVectorField::
66 rotatingPressureInletOutletVelocityFvPatchVectorField
68 const rotatingPressureInletOutletVelocityFvPatchVectorField& ptf,
70 const DimensionedField<vector, volMesh>& iF,
71 const fvPatchFieldMapper& mapper
74 pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
77 calcTangentialVelocity();
81 rotatingPressureInletOutletVelocityFvPatchVectorField::
82 rotatingPressureInletOutletVelocityFvPatchVectorField
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 rotatingPressureInletOutletVelocityFvPatchVectorField
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // ************************************************************************* //