mixedRhoEFvPatchScalarField.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 "mixedRhoEFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031
00032
00033
00034 namespace Foam
00035 {
00036
00037
00038
00039 mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
00040 (
00041 const fvPatch& p,
00042 const DimensionedField<scalar, volMesh>& iF
00043 )
00044 :
00045 mixedFvPatchScalarField(p, iF)
00046 {
00047 refValue() = 0.0;
00048 refGrad() = 0.0;
00049 valueFraction() = 0.0;
00050 }
00051
00052
00053 mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
00054 (
00055 const mixedRhoEFvPatchScalarField& ptf,
00056 const fvPatch& p,
00057 const DimensionedField<scalar, volMesh>& iF,
00058 const fvPatchFieldMapper& mapper
00059 )
00060 :
00061 mixedFvPatchScalarField(ptf, p, iF, mapper)
00062 {}
00063
00064
00065 mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
00066 (
00067 const fvPatch& p,
00068 const DimensionedField<scalar, volMesh>& iF,
00069 const dictionary& dict
00070 )
00071 :
00072 mixedFvPatchScalarField(p, iF)
00073 {
00074 if (dict.found("value"))
00075 {
00076 fvPatchField<scalar>::operator=
00077 (
00078 scalarField("value", dict, p.size())
00079 );
00080 }
00081 else
00082 {
00083 fvPatchField<scalar>::operator=(patchInternalField());
00084 }
00085
00086 refValue() = *this;
00087 refGrad() = 0.0;
00088 valueFraction() = 0.0;
00089 }
00090
00091
00092 mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
00093 (
00094 const mixedRhoEFvPatchScalarField& ptpsf
00095 )
00096 :
00097 mixedFvPatchScalarField(ptpsf)
00098 {}
00099
00100
00101 mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
00102 (
00103 const mixedRhoEFvPatchScalarField& ptpsf,
00104 const DimensionedField<scalar, volMesh>& iF
00105 )
00106 :
00107 mixedFvPatchScalarField(ptpsf, iF)
00108 {}
00109
00110
00111
00112
00113 void mixedRhoEFvPatchScalarField::autoMap
00114 (
00115 const fvPatchFieldMapper& m
00116 )
00117 {
00118 mixedFvPatchScalarField::autoMap(m);
00119 }
00120
00121
00122 void mixedRhoEFvPatchScalarField::rmap
00123 (
00124 const fvPatchField<scalar>& ptf,
00125 const labelList& addr
00126 )
00127 {
00128 mixedFvPatchField<scalar>::rmap(ptf, addr);
00129 }
00130
00131
00132 void mixedRhoEFvPatchScalarField::updateCoeffs()
00133 {
00134 if (updated())
00135 {
00136 return;
00137 }
00138
00139 const fvPatchField<scalar>& rhop =
00140 patch().lookupPatchField<volScalarField, scalar>("rho");
00141 const fvPatchField<vector>& rhoUp =
00142 patch().lookupPatchField<volVectorField, vector>("rhoU");
00143
00144
00145
00146 const volScalarField& T = db().lookupObject<volScalarField>("T");
00147 const label patchi = patch().index();
00148 fvPatchScalarField& Tp =
00149 const_cast<fvPatchScalarField&>(T.boundaryField()[patchi]);
00150
00151 Tp.evaluate();
00152
00153 const dictionary& thermodynamicProperties = db().lookupObject<IOdictionary>
00154 (
00155 "thermodynamicProperties"
00156 );
00157
00158 dimensionedScalar Cv(thermodynamicProperties.lookup("Cv"));
00159
00160 valueFraction() = rhop.snGrad()/
00161 (rhop.snGrad() - rhop*this->patch().deltaCoeffs());
00162
00163 refValue() = 0.5*rhop*magSqr(rhoUp/rhop);
00164 refGrad() =
00165 rhop*Cv.value()*Tp.snGrad()
00166 + (
00167 refValue()
00168 - (0.5*rhop.patchInternalField()*
00169 magSqr(rhoUp.patchInternalField()/rhop.patchInternalField()))
00170 )*patch().deltaCoeffs();
00171
00172 mixedFvPatchScalarField::updateCoeffs();
00173 }
00174
00175
00176 void mixedRhoEFvPatchScalarField::write(Ostream& os) const
00177 {
00178 fvPatchScalarField::write(os);
00179 os.writeKeyword("valueFraction") << valueFraction()
00180 << token::END_STATEMENT << endl;
00181 os.writeKeyword("refValue") << refValue() << token::END_STATEMENT << endl;
00182 os.writeKeyword("refGrad") << refGrad() << token::END_STATEMENT << endl;
00183 writeEntry("value", os);
00184 }
00185
00186
00187
00188
00189 makePatchTypeField(fvPatchScalarField, mixedRhoEFvPatchScalarField);
00190
00191
00192
00193 }
00194
00195
Copyright © 2000-2009 OpenCFD Ltd