Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / derived / cylindricalInletVelocity / cylindricalInletVelocityFvPatchVectorField.C
blobf2badf6cfbf72f9e1165f73d40349eae0ccdcabb
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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 3 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 "cylindricalInletVelocityFvPatchVectorField.H"
28 #include "volFields.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "fvPatchFieldMapper.H"
31 #include "surfaceFields.H"
32 #include "mathematicalConstants.H"
34 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
36 Foam::
37 cylindricalInletVelocityFvPatchVectorField::
38 cylindricalInletVelocityFvPatchVectorField
40     const fvPatch& p,
41     const DimensionedField<vector, volMesh>& iF
44     fixedValueFvPatchField<vector>(p, iF),
45     axialVelocity_(0),
46     centre_(pTraits<vector>::zero),
47     axis_(pTraits<vector>::zero),
48     rpm_(0),
49     radialVelocity_(0)
53 Foam::
54 cylindricalInletVelocityFvPatchVectorField::
55 cylindricalInletVelocityFvPatchVectorField
57     const cylindricalInletVelocityFvPatchVectorField& ptf,
58     const fvPatch& p,
59     const DimensionedField<vector, volMesh>& iF,
60     const fvPatchFieldMapper& mapper
63     fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
64     axialVelocity_(ptf.axialVelocity_),
65     centre_(ptf.centre_),
66     axis_(ptf.axis_),
67     rpm_(ptf.rpm_),
68     radialVelocity_(ptf.radialVelocity_)
72 Foam::
73 cylindricalInletVelocityFvPatchVectorField::
74 cylindricalInletVelocityFvPatchVectorField
76     const fvPatch& p,
77     const DimensionedField<vector, volMesh>& iF,
78     const dictionary& dict
81     fixedValueFvPatchField<vector>(p, iF, dict),
82     axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
83     centre_(dict.lookup("centre")),
84     axis_(dict.lookup("axis")),
85     rpm_(readScalar(dict.lookup("rpm"))),
86     radialVelocity_(readScalar(dict.lookup("radialVelocity")))
90 Foam::
91 cylindricalInletVelocityFvPatchVectorField::
92 cylindricalInletVelocityFvPatchVectorField
94     const cylindricalInletVelocityFvPatchVectorField& ptf
97     fixedValueFvPatchField<vector>(ptf),
98     axialVelocity_(ptf.axialVelocity_),
99     centre_(ptf.centre_),
100     axis_(ptf.axis_),
101     rpm_(ptf.rpm_),
102     radialVelocity_(ptf.radialVelocity_)
106 Foam::
107 cylindricalInletVelocityFvPatchVectorField::
108 cylindricalInletVelocityFvPatchVectorField
110     const cylindricalInletVelocityFvPatchVectorField& ptf,
111     const DimensionedField<vector, volMesh>& iF
114     fixedValueFvPatchField<vector>(ptf, iF),
115     axialVelocity_(ptf.axialVelocity_),
116     centre_(ptf.centre_),
117     axis_(ptf.axis_),
118     rpm_(ptf.rpm_),
119     radialVelocity_(ptf.radialVelocity_)
123 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
125 void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
127     if (updated())
128     {
129         return;
130     }
132     vector hatAxis = axis_/mag(axis_);
134     const vectorField r(patch().Cf() - centre_);
135     tmp<vectorField> d =  r - (hatAxis & r)*hatAxis;
137     tmp<vectorField> tangVel =
138         (rpm_*constant::mathematical::pi/30.0)*(hatAxis) ^ d;
140     operator==(tangVel + axis_*axialVelocity_ + radialVelocity_*d);
142     fixedValueFvPatchField<vector>::updateCoeffs();
146 void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const
148     fvPatchField<vector>::write(os);
149     os.writeKeyword("axialVelocity") << axialVelocity_ <<
150         token::END_STATEMENT << nl;
151     os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
152     os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
153     os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
154     os.writeKeyword("radialVelocity") << radialVelocity_ <<
155         token::END_STATEMENT << nl;
156     writeEntry("value", os);
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 namespace Foam
164    makePatchTypeField
165    (
166        fvPatchVectorField,
167        cylindricalInletVelocityFvPatchVectorField
168    );
172 // ************************************************************************* //