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