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