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