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