inletOutletFvPatchField.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 "inletOutletFvPatchField.H"
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 template<class Type>
00037 inletOutletFvPatchField<Type>::inletOutletFvPatchField
00038 (
00039 const fvPatch& p,
00040 const DimensionedField<Type, volMesh>& iF
00041 )
00042 :
00043 mixedFvPatchField<Type>(p, iF),
00044 phiName_("phi")
00045 {
00046 this->refValue() = pTraits<Type>::zero;
00047 this->refGrad() = pTraits<Type>::zero;
00048 this->valueFraction() = 0.0;
00049 }
00050
00051
00052 template<class Type>
00053 inletOutletFvPatchField<Type>::inletOutletFvPatchField
00054 (
00055 const inletOutletFvPatchField<Type>& ptf,
00056 const fvPatch& p,
00057 const DimensionedField<Type, volMesh>& iF,
00058 const fvPatchFieldMapper& mapper
00059 )
00060 :
00061 mixedFvPatchField<Type>(ptf, p, iF, mapper),
00062 phiName_(ptf.phiName_)
00063 {}
00064
00065
00066 template<class Type>
00067 inletOutletFvPatchField<Type>::inletOutletFvPatchField
00068 (
00069 const fvPatch& p,
00070 const DimensionedField<Type, volMesh>& iF,
00071 const dictionary& dict
00072 )
00073 :
00074 mixedFvPatchField<Type>(p, iF),
00075 phiName_(dict.lookupOrDefault<word>("phi", "phi"))
00076 {
00077 this->refValue() = Field<Type>("inletValue", dict, p.size());
00078
00079 if (dict.found("value"))
00080 {
00081 fvPatchField<Type>::operator=
00082 (
00083 Field<Type>("value", dict, p.size())
00084 );
00085 }
00086 else
00087 {
00088 fvPatchField<Type>::operator=(this->refValue());
00089 }
00090
00091 this->refGrad() = pTraits<Type>::zero;
00092 this->valueFraction() = 0.0;
00093 }
00094
00095
00096 template<class Type>
00097 inletOutletFvPatchField<Type>::inletOutletFvPatchField
00098 (
00099 const inletOutletFvPatchField<Type>& ptf
00100 )
00101 :
00102 mixedFvPatchField<Type>(ptf),
00103 phiName_(ptf.phiName_)
00104 {}
00105
00106
00107 template<class Type>
00108 inletOutletFvPatchField<Type>::inletOutletFvPatchField
00109 (
00110 const inletOutletFvPatchField<Type>& ptf,
00111 const DimensionedField<Type, volMesh>& iF
00112 )
00113 :
00114 mixedFvPatchField<Type>(ptf, iF),
00115 phiName_(ptf.phiName_)
00116 {}
00117
00118
00119
00120
00121 template<class Type>
00122 void inletOutletFvPatchField<Type>::updateCoeffs()
00123 {
00124 if (this->updated())
00125 {
00126 return;
00127 }
00128
00129 const Field<scalar>& phip = this->patch().lookupPatchField
00130 (
00131 phiName_,
00132 reinterpret_cast<const surfaceScalarField*>(0),
00133 reinterpret_cast<const scalar*>(0)
00134 );
00135
00136 this->valueFraction() = 1.0 - pos(phip);
00137
00138 mixedFvPatchField<Type>::updateCoeffs();
00139 }
00140
00141
00142 template<class Type>
00143 void inletOutletFvPatchField<Type>::write(Ostream& os) const
00144 {
00145 fvPatchField<Type>::write(os);
00146 if (phiName_ != "phi")
00147 {
00148 os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
00149 }
00150 this->refValue().writeEntry("inletValue", os);
00151 this->writeEntry("value", os);
00152 }
00153
00154
00155
00156
00157 template<class Type>
00158 void inletOutletFvPatchField<Type>::operator=
00159 (
00160 const fvPatchField<Type>& ptf
00161 )
00162 {
00163 fvPatchField<Type>::operator=
00164 (
00165 this->valueFraction()*this->refValue()
00166 + (1 - this->valueFraction())*ptf
00167 );
00168 }
00169
00170
00171
00172
00173 }
00174
00175
Copyright © 2000-2009 OpenCFD Ltd