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
00028
00029 #include "maxwellSlipUFvPatchVectorField.H"
00030 #include "addToRunTimeSelectionTable.H"
00031 #include "mathematicalConstants.H"
00032 #include "fvPatchFieldMapper.H"
00033 #include "volFields.H"
00034 #include "surfaceFields.H"
00035 #include "fvCFD.H"
00036
00037
00038
00039 namespace Foam
00040 {
00041
00042
00043
00044 maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
00045 (
00046 const fvPatch& p,
00047 const DimensionedField<vector, volMesh>& iF
00048 )
00049 :
00050 mixedFixedValueSlipFvPatchVectorField(p, iF),
00051 accommodationCoeff_(1.0),
00052 Uwall_(p.size(), vector(0.0, 0.0, 0.0)),
00053 thermalCreep_(true),
00054 curvature_(true)
00055 {}
00056
00057
00058 maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
00059 (
00060 const maxwellSlipUFvPatchVectorField& tdpvf,
00061 const fvPatch& p,
00062 const DimensionedField<vector, volMesh>& iF,
00063 const fvPatchFieldMapper& mapper
00064 )
00065 :
00066 mixedFixedValueSlipFvPatchVectorField(tdpvf, p, iF, mapper),
00067 accommodationCoeff_(tdpvf.accommodationCoeff_),
00068 Uwall_(tdpvf.Uwall_),
00069 thermalCreep_(tdpvf.thermalCreep_),
00070 curvature_(tdpvf.curvature_)
00071 {}
00072
00073
00074 maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
00075 (
00076 const fvPatch& p,
00077 const DimensionedField<vector, volMesh>& iF,
00078 const dictionary& dict
00079 )
00080 :
00081 mixedFixedValueSlipFvPatchVectorField(p, iF),
00082 accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
00083 Uwall_("Uwall", dict, p.size()),
00084 thermalCreep_(dict.lookupOrDefault("thermalCreep", true)),
00085 curvature_(dict.lookupOrDefault("curvature", true))
00086 {
00087 if
00088 (
00089 mag(accommodationCoeff_) < SMALL
00090 ||
00091 mag(accommodationCoeff_) > 2.0
00092 )
00093 {
00094 FatalIOErrorIn
00095 (
00096 "maxwellSlipUFvPatchScalarField::"
00097 "maxwellSlipUFvPatchScalarField"
00098 "(const fvPatch&, const scalarField&, const dictionary&)",
00099 dict
00100 ) << "unphysical accommodationCoeff_ specified"
00101 << "(0 < accommodationCoeff_ <= 1)" << endl
00102 << exit(FatalError);
00103 }
00104
00105 if (dict.found("value"))
00106 {
00107 fvPatchField<vector>::operator=
00108 (
00109 vectorField("value", dict, p.size())
00110 );
00111 }
00112 else
00113 {
00114 mixedFixedValueSlipFvPatchVectorField::evaluate();
00115 }
00116 }
00117
00118
00119 maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
00120 (
00121 const maxwellSlipUFvPatchVectorField& tdpvf,
00122 const DimensionedField<vector, volMesh>& iF
00123 )
00124 :
00125 mixedFixedValueSlipFvPatchVectorField(tdpvf, iF),
00126 accommodationCoeff_(tdpvf.accommodationCoeff_),
00127 Uwall_(tdpvf.Uwall_),
00128 thermalCreep_(tdpvf.thermalCreep_),
00129 curvature_(tdpvf.curvature_)
00130 {}
00131
00132
00133
00134
00135
00136 void maxwellSlipUFvPatchVectorField::updateCoeffs()
00137 {
00138 if (updated())
00139 {
00140 return;
00141 }
00142
00143 const fvPatchScalarField& pmu =
00144 patch().lookupPatchField<volScalarField, scalar>("mu");
00145 const fvPatchScalarField& prho =
00146 patch().lookupPatchField<volScalarField, scalar>("rho");
00147 const fvPatchField<scalar>& ppsi =
00148 patch().lookupPatchField<volScalarField, scalar>("psi");
00149
00150 Field<scalar> C1 = sqrt(ppsi*mathematicalConstant::pi/2.0)
00151 *(2.0 - accommodationCoeff_)/accommodationCoeff_;
00152
00153 Field<scalar> pnu = pmu/prho;
00154 valueFraction() = (1.0/(1.0 + patch().deltaCoeffs()*C1*pnu));
00155
00156 refValue() = Uwall_;
00157
00158 if(thermalCreep_)
00159 {
00160 const volScalarField& vsfT =
00161 this->db().objectRegistry::lookupObject<volScalarField>("T");
00162 label patchi = this->patch().index();
00163 const fvPatchScalarField& pT = vsfT.boundaryField()[patchi];
00164 Field<vector> gradpT = fvc::grad(vsfT)().boundaryField()[patchi];
00165 vectorField n = patch().nf();
00166
00167 refValue() -= 3.0*pnu/(4.0*pT)*transform(I - n*n, gradpT);
00168 }
00169
00170 if(curvature_)
00171 {
00172 const fvPatchTensorField& ptauMC =
00173 patch().lookupPatchField<volTensorField, tensor>("tauMC");
00174 vectorField n = patch().nf();
00175
00176 refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
00177 }
00178
00179 mixedFixedValueSlipFvPatchVectorField::updateCoeffs();
00180 }
00181
00182
00183
00184 void maxwellSlipUFvPatchVectorField::write(Ostream& os) const
00185 {
00186 fvPatchVectorField::write(os);
00187 os.writeKeyword("accommodationCoeff")
00188 << accommodationCoeff_ << token::END_STATEMENT << nl;
00189 Uwall_.writeEntry("Uwall", os);
00190 os.writeKeyword("thermalCreep")
00191 << thermalCreep_ << token::END_STATEMENT << nl;
00192 os.writeKeyword("curvature") << curvature_ << token::END_STATEMENT << nl;
00193
00194 os.writeKeyword("refValue")
00195 << refValue() << token::END_STATEMENT << nl;
00196 os.writeKeyword("valueFraction")
00197 << valueFraction() << token::END_STATEMENT << nl;
00198
00199 writeEntry("value", os);
00200 }
00201
00202
00203
00204
00205 makePatchTypeField(fvPatchVectorField, maxwellSlipUFvPatchVectorField);
00206
00207
00208
00209 }
00210
00211