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