buoyantPressureFvPatchScalarField.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 "buoyantPressureFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031 #include "uniformDimensionedFields.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038
00039
00040 buoyantPressureFvPatchScalarField::
00041 buoyantPressureFvPatchScalarField
00042 (
00043 const fvPatch& p,
00044 const DimensionedField<scalar, volMesh>& iF
00045 )
00046 :
00047 fixedGradientFvPatchScalarField(p, iF),
00048 rhoName_("rho")
00049 {}
00050
00051
00052 buoyantPressureFvPatchScalarField::
00053 buoyantPressureFvPatchScalarField
00054 (
00055 const fvPatch& p,
00056 const DimensionedField<scalar, volMesh>& iF,
00057 const dictionary& dict
00058 )
00059 :
00060 fixedGradientFvPatchScalarField(p, iF),
00061 rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
00062 {
00063 fvPatchField<scalar>::operator=(patchInternalField());
00064 gradient() = 0.0;
00065 }
00066
00067
00068 buoyantPressureFvPatchScalarField::
00069 buoyantPressureFvPatchScalarField
00070 (
00071 const buoyantPressureFvPatchScalarField& ptf,
00072 const fvPatch& p,
00073 const DimensionedField<scalar, volMesh>& iF,
00074 const fvPatchFieldMapper& mapper
00075 )
00076 :
00077 fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
00078 rhoName_(ptf.rhoName_)
00079 {}
00080
00081
00082 buoyantPressureFvPatchScalarField::
00083 buoyantPressureFvPatchScalarField
00084 (
00085 const buoyantPressureFvPatchScalarField& ptf
00086 )
00087 :
00088 fixedGradientFvPatchScalarField(ptf),
00089 rhoName_(ptf.rhoName_)
00090 {}
00091
00092
00093 buoyantPressureFvPatchScalarField::
00094 buoyantPressureFvPatchScalarField
00095 (
00096 const buoyantPressureFvPatchScalarField& ptf,
00097 const DimensionedField<scalar, volMesh>& iF
00098 )
00099 :
00100 fixedGradientFvPatchScalarField(ptf, iF),
00101 rhoName_(ptf.rhoName_)
00102 {}
00103
00104
00105
00106
00107 void buoyantPressureFvPatchScalarField::updateCoeffs()
00108 {
00109 if (updated())
00110 {
00111 return;
00112 }
00113
00114 const uniformDimensionedVectorField& g =
00115 db().lookupObject<uniformDimensionedVectorField>("g");
00116
00117 const fvPatchField<scalar>& rho =
00118 patch().lookupPatchField<volScalarField, scalar>(rhoName_);
00119
00120
00121
00122
00123 if (dimensionedInternalField().name() == "pd")
00124 {
00125 gradient() = -rho.snGrad()*(g.value() & patch().Cf());
00126 }
00127 else
00128 {
00129 gradient() = rho*(g.value() & patch().nf());
00130 }
00131
00132 fixedGradientFvPatchScalarField::updateCoeffs();
00133 }
00134
00135
00136 void buoyantPressureFvPatchScalarField::write(Ostream& os) const
00137 {
00138 fixedGradientFvPatchScalarField::write(os);
00139 os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
00140 writeEntry("value", os);
00141 }
00142
00143
00144
00145
00146 makePatchTypeField
00147 (
00148 fvPatchScalarField,
00149 buoyantPressureFvPatchScalarField
00150 );
00151
00152
00153
00154 }
00155
00156
Copyright © 2000-2009 OpenCFD Ltd