OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

wallFunctions.H

Go to the documentation of this file.
00001 {
00002     labelList cellBoundaryFaceCount(epsilon.size(), 0);
00003 
00004     scalar Cmu25 = ::pow(Cmu.value(), 0.25);
00005     scalar Cmu75 = ::pow(Cmu.value(), 0.75);
00006     scalar kappa_ = kappa.value();
00007 
00008     const fvPatchList& patches = mesh.boundary();
00009 
00010     //- Initialise the near-wall P field to zero
00011     forAll(patches, patchi)
00012     {
00013         const fvPatch& currPatch = patches[patchi];
00014 
00015         if (isType<wallFvPatch>(currPatch))
00016         {
00017             forAll(currPatch, facei)
00018             {
00019                 label faceCelli = currPatch.faceCells()[facei];
00020 
00021                 epsilon[faceCelli] = 0.0;
00022                 G[faceCelli] = 0.0;
00023             }
00024         }
00025     }
00026 
00027     //- Accumulate the wall face contributions to epsilon and G
00028     //  Increment cellBoundaryFaceCount for each face for averaging
00029     forAll(patches, patchi)
00030     {
00031         const fvPatch& currPatch = patches[patchi];
00032 
00033         if (isType<wallFvPatch>(currPatch))
00034         {
00035             const scalarField& nuw = nutb.boundaryField()[patchi];
00036 
00037             scalarField magFaceGradU = mag(U.boundaryField()[patchi].snGrad());
00038 
00039             forAll(currPatch, facei)
00040             {
00041                 label faceCelli = currPatch.faceCells()[facei];
00042 
00043                 scalar yPlus =
00044                     Cmu25*y[patchi][facei]
00045                     *::sqrt(k[faceCelli])
00046                     /nub.value();
00047 
00048 
00049                 // For corner cells (with two boundary or more faces),
00050                 // epsilon and G in the near-wall cell are calculated
00051                 // as an average
00052 
00053                 cellBoundaryFaceCount[faceCelli]++;
00054 
00055                 epsilon[faceCelli] +=
00056                      Cmu75*::pow(k[faceCelli], 1.5)
00057                     /(kappa_*y[patchi][facei]);
00058 
00059                 if (yPlus > 11.6)
00060                 {
00061                     G[faceCelli] +=
00062                         nuw[facei]*magFaceGradU[facei]
00063                         *Cmu25*::sqrt(k[faceCelli])
00064                         /(kappa_*y[patchi][facei]);
00065                 }
00066             }
00067         }
00068     }
00069 
00070 
00071     // perform the averaging
00072 
00073     forAll(patches, patchi)
00074     {
00075         const fvPatch& curPatch = patches[patchi];
00076 
00077         if (isType<wallFvPatch>(curPatch))
00078         {
00079             forAll(curPatch, facei)
00080             {
00081                 label faceCelli = curPatch.faceCells()[facei];
00082 
00083                 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00084                 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00085             }
00086         }
00087     }
00088 }
Copyright © 2000-2009 OpenCFD Ltd