mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.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 "mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H"
00028 #include "RASModel.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031 #include "addToRunTimeSelectionTable.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037 namespace compressible
00038 {
00039 namespace RASModels
00040 {
00041
00042
00043
00044 tmp<scalarField>
00045 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
00046 (
00047 const scalarField& magUp
00048 ) const
00049 {
00050 const label patchI = patch().index();
00051
00052 const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
00053 const scalarField& y = rasModel.y()[patchI];
00054 const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
00055 const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
00056
00057 tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
00058 scalarField& yPlus = tyPlus();
00059
00060 forAll(yPlus, faceI)
00061 {
00062 scalar kappaRe = kappa_*magUp[faceI]*y[faceI]/(muw[faceI]/rhow[faceI]);
00063
00064 scalar yp = yPlusLam_;
00065 scalar ryPlusLam = 1.0/yp;
00066
00067 int iter = 0;
00068 scalar yPlusLast = 0.0;
00069
00070 do
00071 {
00072 yPlusLast = yp;
00073 yp = (kappaRe + yp)/(1.0 + log(E_*yp));
00074
00075 } while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10);
00076
00077 yPlus[faceI] = max(0.0, yp);
00078 }
00079
00080 return tyPlus;
00081 }
00082
00083
00084 tmp<scalarField>
00085 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
00086 {
00087 const label patchI = patch().index();
00088
00089 const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
00090 const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
00091 const scalarField magUp = mag(Uw.patchInternalField() - Uw);
00092 const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
00093
00094 tmp<scalarField> tyPlus = calcYPlus(magUp);
00095 scalarField& yPlus = tyPlus();
00096
00097 tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
00098 scalarField& mutw = tmutw();
00099
00100 forAll(yPlus, faceI)
00101 {
00102 if (yPlus[faceI] > yPlusLam_)
00103 {
00104 mutw[faceI] =
00105 muw[faceI]*(yPlus[faceI]*kappa_/log(E_*yPlus[faceI]) - 1.0);
00106 }
00107 }
00108
00109 return tmutw;
00110 }
00111
00112
00113
00114
00115 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
00116 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
00117 (
00118 const fvPatch& p,
00119 const DimensionedField<scalar, volMesh>& iF
00120 )
00121 :
00122 mutWallFunctionFvPatchScalarField(p, iF)
00123 {}
00124
00125
00126 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
00127 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
00128 (
00129 const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& ptf,
00130 const fvPatch& p,
00131 const DimensionedField<scalar, volMesh>& iF,
00132 const fvPatchFieldMapper& mapper
00133 )
00134 :
00135 mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
00136 {}
00137
00138
00139 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
00140 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
00141 (
00142 const fvPatch& p,
00143 const DimensionedField<scalar, volMesh>& iF,
00144 const dictionary& dict
00145 )
00146 :
00147 mutWallFunctionFvPatchScalarField(p, iF, dict)
00148 {}
00149
00150
00151 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
00152 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
00153 (
00154 const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf
00155 )
00156 :
00157 mutWallFunctionFvPatchScalarField(sawfpsf)
00158 {}
00159
00160
00161 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
00162 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
00163 (
00164 const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf,
00165 const DimensionedField<scalar, volMesh>& iF
00166 )
00167 :
00168 mutWallFunctionFvPatchScalarField(sawfpsf, iF)
00169 {}
00170
00171
00172
00173
00174 tmp<scalarField>
00175 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::yPlus() const
00176 {
00177 const label patchI = patch().index();
00178 const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
00179 const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
00180 const scalarField magUp = mag(Uw.patchInternalField() - Uw);
00181
00182 return calcYPlus(magUp);
00183 }
00184
00185
00186 void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
00187 (
00188 Ostream& os
00189 ) const
00190 {
00191 fvPatchField<scalar>::write(os);
00192 writeLocalEntries(os);
00193 writeEntry("value", os);
00194 }
00195
00196
00197
00198
00199 makePatchTypeField
00200 (
00201 fvPatchScalarField,
00202 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
00203 );
00204
00205
00206
00207 }
00208 }
00209 }
00210
00211
Copyright © 2000-2009 OpenCFD Ltd