OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

nonLinearWallFunctionsI.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2007 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Global
00026     nonLinearwallFunctions
00027 
00028 Description
00029     Calculate wall generation and dissipation from wall-functions 
00030     for non-linear models.
00031 
00032 \*---------------------------------------------------------------------------*/
00033 
00034 {
00035     labelList cellBoundaryFaceCount(epsilon_.size(), 0);
00036 
00037     const fvPatchList& patches = mesh_.boundary();
00038 
00039     //- Initialise the near-wall G and epsilon fields to zero
00040     forAll(patches, patchi)
00041     {
00042         const fvPatch& curPatch = patches[patchi];
00043 
00044         if (isType<wallFvPatch>(curPatch))
00045         {
00046             forAll(curPatch, facei)
00047             {
00048                 label faceCelli = curPatch.faceCells()[facei];
00049 
00050                 epsilon_[faceCelli] = 0.0;
00051                 G[faceCelli] = 0.0;
00052             }
00053         }
00054     }
00055 
00056     //- Accumulate the wall face contributions to epsilon and G
00057     //  Increment cellBoundaryFaceCount for each face for averaging
00058     forAll(patches, patchi)
00059     {
00060         const fvPatch& curPatch = patches[patchi];
00061 
00062         if (isType<wallFvPatch>(curPatch))
00063         {
00064 #           include "checkPatchFieldTypes.H"
00065 
00066             const scalarField& nuw = nu().boundaryField()[patchi];
00067             const scalarField& nutw = nut_.boundaryField()[patchi];
00068 
00069             scalarField magFaceGradU = mag(U_.boundaryField()[patchi].snGrad());
00070 
00071             forAll(curPatch, facei)
00072             {
00073                 label faceCelli = curPatch.faceCells()[facei];
00074 
00075                 //- using local Cmu !
00076                 scalar Cmu25 = pow(Cmu[faceCelli], 0.25);
00077                 scalar Cmu75 = pow(Cmu[faceCelli], 0.75);
00078 
00079                 scalar yPlus =
00080                     Cmu25*y_[patchi][facei]
00081                     *sqrt(k_[faceCelli])
00082                     /nuw[facei];
00083 
00084                 // For corner cells (with two boundary or more faces),
00085                 // epsilon and G in the near-wall cell are calculated
00086                 // as an average
00087 
00088                 cellBoundaryFaceCount[faceCelli]++;
00089 
00090                 epsilon_[faceCelli] +=
00091                      Cmu75*pow(k_[faceCelli], 1.5)
00092                     /(kappa_*y_[patchi][facei]);
00093 
00094                 if (yPlus > yPlusLam_)
00095                 {
00096                     G[faceCelli] +=
00097                         (nutw[facei] + nuw[facei])
00098                         *magFaceGradU[facei]
00099                         *Cmu25*sqrt(k_[faceCelli])
00100                         /(kappa_*y_[patchi][facei])
00101                       - (nonlinearStress[faceCelli] && gradU[faceCelli]);
00102                 }
00103             }
00104         }
00105     }
00106 
00107     // Perform the averaging
00108 
00109     forAll(patches, patchi)
00110     {
00111         const fvPatch& curPatch = patches[patchi];
00112 
00113         if (isType<wallFvPatch>(curPatch))
00114         {
00115             forAll(curPatch, facei)
00116             {
00117                 label faceCelli = curPatch.faceCells()[facei];
00118 
00119                 epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00120                 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00121             }
00122         }
00123     }
00124 }
00125 
00126 
00127 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd