pressureNormalInletOutletVelocityFvPatchVectorField.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 "pressureNormalInletOutletVelocityFvPatchVectorField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031 #include "surfaceFields.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038
00039
00040 pressureNormalInletOutletVelocityFvPatchVectorField::
00041 pressureNormalInletOutletVelocityFvPatchVectorField
00042 (
00043 const fvPatch& p,
00044 const DimensionedField<vector, volMesh>& iF
00045 )
00046 :
00047 mixedFvPatchVectorField(p, iF),
00048 phiName_("phi"),
00049 rhoName_("rho")
00050 {
00051 refValue() = *this;
00052 refGrad() = vector::zero;
00053 valueFraction() = 0.0;
00054 }
00055
00056
00057 pressureNormalInletOutletVelocityFvPatchVectorField::
00058 pressureNormalInletOutletVelocityFvPatchVectorField
00059 (
00060 const pressureNormalInletOutletVelocityFvPatchVectorField& ptf,
00061 const fvPatch& p,
00062 const DimensionedField<vector, volMesh>& iF,
00063 const fvPatchFieldMapper& mapper
00064 )
00065 :
00066 mixedFvPatchVectorField(ptf, p, iF, mapper),
00067 phiName_(ptf.phiName_),
00068 rhoName_(ptf.rhoName_)
00069 {}
00070
00071
00072 pressureNormalInletOutletVelocityFvPatchVectorField::
00073 pressureNormalInletOutletVelocityFvPatchVectorField
00074 (
00075 const fvPatch& p,
00076 const DimensionedField<vector, volMesh>& iF,
00077 const dictionary& dict
00078 )
00079 :
00080 mixedFvPatchVectorField(p, iF),
00081 phiName_(dict.lookupOrDefault<word>("phi", "phi")),
00082 rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
00083 {
00084 fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
00085 refValue() = *this;
00086 refGrad() = vector::zero;
00087 valueFraction() = 0.0;
00088 }
00089
00090
00091 pressureNormalInletOutletVelocityFvPatchVectorField::
00092 pressureNormalInletOutletVelocityFvPatchVectorField
00093 (
00094 const pressureNormalInletOutletVelocityFvPatchVectorField& pivpvf
00095 )
00096 :
00097 mixedFvPatchVectorField(pivpvf),
00098 phiName_(pivpvf.phiName_),
00099 rhoName_(pivpvf.rhoName_)
00100 {}
00101
00102
00103 pressureNormalInletOutletVelocityFvPatchVectorField::
00104 pressureNormalInletOutletVelocityFvPatchVectorField
00105 (
00106 const pressureNormalInletOutletVelocityFvPatchVectorField& pivpvf,
00107 const DimensionedField<vector, volMesh>& iF
00108 )
00109 :
00110 mixedFvPatchVectorField(pivpvf, iF),
00111 phiName_(pivpvf.phiName_),
00112 rhoName_(pivpvf.rhoName_)
00113 {}
00114
00115
00116
00117
00118 void pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
00119 {
00120 if (updated())
00121 {
00122 return;
00123 }
00124
00125 const surfaceScalarField& phi =
00126 db().lookupObject<surfaceScalarField>(phiName_);
00127
00128 const fvsPatchField<scalar>& phip =
00129 patch().patchField<surfaceScalarField, scalar>(phi);
00130
00131 vectorField n = patch().nf();
00132 const Field<scalar>& magS = patch().magSf();
00133
00134 if (phi.dimensions() == dimVelocity*dimArea)
00135 {
00136 refValue() = n*phip/magS;
00137 }
00138 else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
00139 {
00140 const fvPatchField<scalar>& rhop =
00141 patch().lookupPatchField<volScalarField, scalar>(rhoName_);
00142
00143 refValue() = n*phip/(rhop*magS);
00144 }
00145 else
00146 {
00147 FatalErrorIn
00148 (
00149 "pressureNormalInletOutletVelocityFvPatchVectorField::"
00150 "updateCoeffs()"
00151 ) << "dimensions of phi are not correct"
00152 << "\n on patch " << this->patch().name()
00153 << " of field " << this->dimensionedInternalField().name()
00154 << " in file " << this->dimensionedInternalField().objectPath()
00155 << exit(FatalError);
00156 }
00157
00158 valueFraction() = 1.0 - pos(phip);
00159
00160 mixedFvPatchVectorField::updateCoeffs();
00161 }
00162
00163
00164 void pressureNormalInletOutletVelocityFvPatchVectorField::
00165 write(Ostream& os) const
00166 {
00167 fvPatchVectorField::write(os);
00168 os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
00169 os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
00170 writeEntry("value", os);
00171 }
00172
00173
00174
00175
00176 void pressureNormalInletOutletVelocityFvPatchVectorField::operator=
00177 (
00178 const fvPatchField<vector>& pvf
00179 )
00180 {
00181 fvPatchField<vector>::operator=
00182 (
00183 valueFraction()*(patch().nf()*(patch().nf() & pvf))
00184 + (1 - valueFraction())*pvf
00185 );
00186 }
00187
00188
00189
00190
00191 makePatchTypeField
00192 (
00193 fvPatchVectorField,
00194 pressureNormalInletOutletVelocityFvPatchVectorField
00195 );
00196
00197
00198
00199 }
00200
00201
Copyright © 2000-2009 OpenCFD Ltd