pressureInletOutletVelocityFvPatchVectorField.C
Go to the documentation of this file.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 "pressureInletOutletVelocityFvPatchVectorField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "volFields.H"
00030 #include "surfaceFields.H"
00031
00032
00033
00034 namespace Foam
00035 {
00036
00037
00038
00039 pressureInletOutletVelocityFvPatchVectorField::
00040 pressureInletOutletVelocityFvPatchVectorField
00041 (
00042 const fvPatch& p,
00043 const DimensionedField<vector, volMesh>& iF
00044 )
00045 :
00046 directionMixedFvPatchVectorField(p, iF),
00047 phiName_("phi")
00048 {
00049 refValue() = vector::zero;
00050 refGrad() = vector::zero;
00051 valueFraction() = symmTensor::zero;
00052 }
00053
00054
00055 pressureInletOutletVelocityFvPatchVectorField::
00056 pressureInletOutletVelocityFvPatchVectorField
00057 (
00058 const pressureInletOutletVelocityFvPatchVectorField& ptf,
00059 const fvPatch& p,
00060 const DimensionedField<vector, volMesh>& iF,
00061 const fvPatchFieldMapper& mapper
00062 )
00063 :
00064 directionMixedFvPatchVectorField(ptf, p, iF, mapper),
00065 phiName_(ptf.phiName_)
00066 {
00067 if (ptf.tangentialVelocity_.size())
00068 {
00069 tangentialVelocity_ = mapper(ptf.tangentialVelocity_);
00070 }
00071 }
00072
00073
00074 pressureInletOutletVelocityFvPatchVectorField::
00075 pressureInletOutletVelocityFvPatchVectorField
00076 (
00077 const fvPatch& p,
00078 const DimensionedField<vector, volMesh>& iF,
00079 const dictionary& dict
00080 )
00081 :
00082 directionMixedFvPatchVectorField(p, iF),
00083 phiName_(dict.lookupOrDefault<word>("phi", "phi"))
00084 {
00085 fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
00086
00087 if (dict.found("tangentialVelocity"))
00088 {
00089 setTangentialVelocity
00090 (
00091 vectorField("tangentialVelocity", dict, p.size())
00092 );
00093 }
00094 else
00095 {
00096 refValue() = vector::zero;
00097 }
00098
00099 refGrad() = vector::zero;
00100 valueFraction() = symmTensor::zero;
00101 }
00102
00103
00104 pressureInletOutletVelocityFvPatchVectorField::
00105 pressureInletOutletVelocityFvPatchVectorField
00106 (
00107 const pressureInletOutletVelocityFvPatchVectorField& pivpvf
00108 )
00109 :
00110 directionMixedFvPatchVectorField(pivpvf),
00111 phiName_(pivpvf.phiName_),
00112 tangentialVelocity_(pivpvf.tangentialVelocity_)
00113 {}
00114
00115
00116 pressureInletOutletVelocityFvPatchVectorField::
00117 pressureInletOutletVelocityFvPatchVectorField
00118 (
00119 const pressureInletOutletVelocityFvPatchVectorField& pivpvf,
00120 const DimensionedField<vector, volMesh>& iF
00121 )
00122 :
00123 directionMixedFvPatchVectorField(pivpvf, iF),
00124 phiName_(pivpvf.phiName_),
00125 tangentialVelocity_(pivpvf.tangentialVelocity_)
00126 {}
00127
00128
00129
00130
00131 void pressureInletOutletVelocityFvPatchVectorField::
00132 setTangentialVelocity(const vectorField& tangentialVelocity)
00133 {
00134 tangentialVelocity_ = tangentialVelocity;
00135 vectorField n = patch().nf();
00136 refValue() = tangentialVelocity_ - n*(n & tangentialVelocity_);
00137 }
00138
00139
00140 void pressureInletOutletVelocityFvPatchVectorField::autoMap
00141 (
00142 const fvPatchFieldMapper& m
00143 )
00144 {
00145 directionMixedFvPatchVectorField::autoMap(m);
00146 if (tangentialVelocity_.size())
00147 {
00148 tangentialVelocity_.autoMap(m);
00149 }
00150 }
00151
00152
00153 void pressureInletOutletVelocityFvPatchVectorField::rmap
00154 (
00155 const fvPatchVectorField& ptf,
00156 const labelList& addr
00157 )
00158 {
00159 directionMixedFvPatchVectorField::rmap(ptf, addr);
00160
00161 if (tangentialVelocity_.size())
00162 {
00163 const pressureInletOutletVelocityFvPatchVectorField& tiptf =
00164 refCast<const pressureInletOutletVelocityFvPatchVectorField>(ptf);
00165
00166 tangentialVelocity_.rmap(tiptf.tangentialVelocity_, addr);
00167 }
00168 }
00169
00170
00171 void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()
00172 {
00173 if (updated())
00174 {
00175 return;
00176 }
00177
00178 const fvsPatchField<scalar>& phip =
00179 patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
00180
00181 valueFraction() = neg(phip)*(I - sqr(patch().nf()));
00182
00183 directionMixedFvPatchVectorField::updateCoeffs();
00184 directionMixedFvPatchVectorField::evaluate();
00185 }
00186
00187
00188 void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const
00189 {
00190 fvPatchVectorField::write(os);
00191 if (phiName_ != "phi")
00192 {
00193 os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
00194 }
00195 if (tangentialVelocity_.size())
00196 {
00197 tangentialVelocity_.writeEntry("tangentialVelocity", os);
00198 }
00199 writeEntry("value", os);
00200 }
00201
00202
00203
00204
00205 void pressureInletOutletVelocityFvPatchVectorField::operator=
00206 (
00207 const fvPatchField<vector>& pvf
00208 )
00209 {
00210 vectorField normalValue = transform(valueFraction(), refValue());
00211 vectorField transformGradValue = transform(I - valueFraction(), pvf);
00212 fvPatchField<vector>::operator=(normalValue + transformGradValue);
00213 }
00214
00215
00216
00217
00218 makePatchTypeField
00219 (
00220 fvPatchVectorField,
00221 pressureInletOutletVelocityFvPatchVectorField
00222 );
00223
00224
00225
00226 }
00227
00228
Copyright © 2000-2009 OpenCFD Ltd