FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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     scalar nub_ = nub.value();
00008 
00009     const fvPatchList& patches = mesh.boundary();
00010 
00011     //- Initialise the near-wall P field to zero
00012     forAll(patches, patchi)
00013     {
00014         const fvPatch& currPatch = patches[patchi];
00015 
00016         if (isA<wallFvPatch>(currPatch))
00017         {
00018             forAll(currPatch, facei)
00019             {
00020                 label faceCelli = currPatch.faceCells()[facei];
00021 
00022                 epsilon[faceCelli] = 0.0;
00023                 G[faceCelli] = 0.0;
00024             }
00025         }
00026     }
00027 
00028     //- Accumulate the wall face contributions to epsilon and G
00029     //  Increment cellBoundaryFaceCount for each face for averaging
00030     forAll(patches, patchi)
00031     {
00032         const fvPatch& currPatch = patches[patchi];
00033 
00034         if (isA<wallFvPatch>(currPatch))
00035         {
00036             const scalarField& nutbw = nutb.boundaryField()[patchi];
00037 
00038             scalarField magFaceGradU(mag(Ub.boundaryField()[patchi].snGrad()));
00039 
00040             forAll(currPatch, facei)
00041             {
00042                 label faceCelli = currPatch.faceCells()[facei];
00043 
00044                 scalar yPlus =
00045                     Cmu25*y[patchi][facei]
00046                     *::sqrt(k[faceCelli])
00047                     /nub_;
00048 
00049 
00050                 // For corner cells (with two boundary or more faces),
00051                 // epsilon and G in the near-wall cell are calculated
00052                 // as an average
00053 
00054                 cellBoundaryFaceCount[faceCelli]++;
00055 
00056                 epsilon[faceCelli] +=
00057                      Cmu75*::pow(k[faceCelli], 1.5)
00058                     /(kappa_*y[patchi][facei]);
00059 
00060                 if (yPlus > 11.6)
00061                 {
00062                     G[faceCelli] +=
00063                         (nutbw[facei] + nub_)*magFaceGradU[facei]
00064                         *Cmu25*::sqrt(k[faceCelli])
00065                         /(kappa_*y[patchi][facei]);
00066                 }
00067             }
00068         }
00069     }
00070 
00071 
00072     // perform the averaging
00073 
00074     forAll(patches, patchi)
00075     {
00076         const fvPatch& curPatch = patches[patchi];
00077 
00078         if (isA<wallFvPatch>(curPatch))
00079         {
00080             forAll(curPatch, facei)
00081             {
00082                 label faceCelli = curPatch.faceCells()[facei];
00083 
00084                 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00085                 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00086             }
00087         }
00088     }
00089 }
00090 
00091 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines