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