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