00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "cylindricalInletVelocityFvPatchVectorField.H"
00028 #include <finiteVolume/volFields.H>
00029 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00030 #include <finiteVolume/fvPatchFieldMapper.H>
00031 #include <finiteVolume/surfaceFields.H>
00032 #include <OpenFOAM/mathematicalConstants.H>
00033
00034
00035
00036 Foam::
00037 cylindricalInletVelocityFvPatchVectorField::
00038 cylindricalInletVelocityFvPatchVectorField
00039 (
00040 const fvPatch& p,
00041 const DimensionedField<vector, volMesh>& iF
00042 )
00043 :
00044 fixedValueFvPatchField<vector>(p, iF),
00045 axialVelocity_(0),
00046 centre_(pTraits<vector>::zero),
00047 axis_(pTraits<vector>::zero),
00048 rpm_(0),
00049 radialVelocity_(0)
00050 {}
00051
00052
00053 Foam::
00054 cylindricalInletVelocityFvPatchVectorField::
00055 cylindricalInletVelocityFvPatchVectorField
00056 (
00057 const cylindricalInletVelocityFvPatchVectorField& ptf,
00058 const fvPatch& p,
00059 const DimensionedField<vector, volMesh>& iF,
00060 const fvPatchFieldMapper& mapper
00061 )
00062 :
00063 fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
00064 axialVelocity_(ptf.axialVelocity_),
00065 centre_(ptf.centre_),
00066 axis_(ptf.axis_),
00067 rpm_(ptf.rpm_),
00068 radialVelocity_(ptf.radialVelocity_)
00069 {}
00070
00071
00072 Foam::
00073 cylindricalInletVelocityFvPatchVectorField::
00074 cylindricalInletVelocityFvPatchVectorField
00075 (
00076 const fvPatch& p,
00077 const DimensionedField<vector, volMesh>& iF,
00078 const dictionary& dict
00079 )
00080 :
00081 fixedValueFvPatchField<vector>(p, iF, dict),
00082 axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
00083 centre_(dict.lookup("centre")),
00084 axis_(dict.lookup("axis")),
00085 rpm_(readScalar(dict.lookup("rpm"))),
00086 radialVelocity_(readScalar(dict.lookup("radialVelocity")))
00087 {}
00088
00089
00090 Foam::
00091 cylindricalInletVelocityFvPatchVectorField::
00092 cylindricalInletVelocityFvPatchVectorField
00093 (
00094 const cylindricalInletVelocityFvPatchVectorField& ptf
00095 )
00096 :
00097 fixedValueFvPatchField<vector>(ptf),
00098 axialVelocity_(ptf.axialVelocity_),
00099 centre_(ptf.centre_),
00100 axis_(ptf.axis_),
00101 rpm_(ptf.rpm_),
00102 radialVelocity_(ptf.radialVelocity_)
00103 {}
00104
00105
00106 Foam::
00107 cylindricalInletVelocityFvPatchVectorField::
00108 cylindricalInletVelocityFvPatchVectorField
00109 (
00110 const cylindricalInletVelocityFvPatchVectorField& ptf,
00111 const DimensionedField<vector, volMesh>& iF
00112 )
00113 :
00114 fixedValueFvPatchField<vector>(ptf, iF),
00115 axialVelocity_(ptf.axialVelocity_),
00116 centre_(ptf.centre_),
00117 axis_(ptf.axis_),
00118 rpm_(ptf.rpm_),
00119 radialVelocity_(ptf.radialVelocity_)
00120 {}
00121
00122
00123
00124
00125 void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
00126 {
00127 if (updated())
00128 {
00129 return;
00130 }
00131
00132 vector hatAxis = axis_/mag(axis_);
00133
00134 vectorField r = (patch().Cf() - centre_);
00135
00136 vectorField d = r - (hatAxis & r)*hatAxis;
00137
00138 vectorField tangVelo =
00139 (rpm_*mathematicalConstant::pi/30.0)*(hatAxis)^d;
00140
00141 operator==(tangVelo + axis_*axialVelocity_ + radialVelocity_*d);
00142
00143 fixedValueFvPatchField<vector>::updateCoeffs();
00144 }
00145
00146
00147 void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const
00148 {
00149 fvPatchField<vector>::write(os);
00150 os.writeKeyword("axialVelocity") << axialVelocity_ <<
00151 token::END_STATEMENT << nl;
00152 os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
00153 os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
00154 os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
00155 os.writeKeyword("radialVelocity") << radialVelocity_ <<
00156 token::END_STATEMENT << nl;
00157 writeEntry("value", os);
00158 }
00159
00160
00161
00162
00163 namespace Foam
00164 {
00165 makePatchTypeField
00166 (
00167 fvPatchVectorField,
00168 cylindricalInletVelocityFvPatchVectorField
00169 );
00170 }
00171
00172
00173