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

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Global
00025     nonLinearwallFunctions
00026 
00027 Description
00028     Calculate wall generation and dissipation from wall-functions
00029     for non-linear models.
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 {
00034     labelList cellBoundaryFaceCount(epsilon_.size(), 0);
00035 
00036     scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value());
00037 
00038     const fvPatchList& patches = mesh_.boundary();
00039 
00040     //- Initialise the near-wall G and epsilon fields to zero
00041     forAll(patches, patchi)
00042     {
00043         const fvPatch& curPatch = patches[patchi];
00044 
00045         if (isA<wallFvPatch>(curPatch))
00046         {
00047             forAll(curPatch, facei)
00048             {
00049                 label faceCelli = curPatch.faceCells()[facei];
00050 
00051                 epsilon_[faceCelli] = 0.0;
00052                 G[faceCelli] = 0.0;
00053             }
00054         }
00055     }
00056 
00057     //- Accumulate the wall face contributions to epsilon and G
00058     //  Increment cellBoundaryFaceCount for each face for averaging
00059     forAll(patches, patchi)
00060     {
00061         const fvPatch& curPatch = patches[patchi];
00062 
00063         if (isA<wallFvPatch>(curPatch))
00064         {
00065             #include <finiteVolume/checkPatchFieldTypes.H>
00066 
00067             const scalarField& nuw = nu().boundaryField()[patchi];
00068             const scalarField& nutw = nut_.boundaryField()[patchi];
00069 
00070             scalarField magFaceGradU = mag(U_.boundaryField()[patchi].snGrad());
00071 
00072             forAll(curPatch, facei)
00073             {
00074                 label faceCelli = curPatch.faceCells()[facei];
00075 
00076                 //- using local Cmu !
00077                 scalar Cmu25 = pow(Cmu_[faceCelli], 0.25);
00078                 scalar Cmu75 = pow(Cmu_[faceCelli], 0.75);
00079 
00080                 scalar yPlus =
00081                     Cmu25*y_[patchi][facei]
00082                     *sqrt(k_[faceCelli])
00083                     /nuw[facei];
00084 
00085                 // For corner cells (with two boundary or more faces),
00086                 // epsilon and G in the near-wall cell are calculated
00087                 // as an average
00088 
00089                 cellBoundaryFaceCount[faceCelli]++;
00090 
00091                 epsilon_[faceCelli] +=
00092                      Cmu75*pow(k_[faceCelli], 1.5)
00093                     /(kappa_.value()*y_[patchi][facei]);
00094 
00095                 if (yPlus > yPlusLam)
00096                 {
00097                     G[faceCelli] +=
00098                         (nutw[facei] + nuw[facei])
00099                         *magFaceGradU[facei]
00100                         *Cmu25*sqrt(k_[faceCelli])
00101                         /(kappa_.value()*y_[patchi][facei])
00102                       - (nonlinearStress_[faceCelli] && gradU_[faceCelli]);
00103                 }
00104             }
00105         }
00106     }
00107 
00108     // Perform the averaging
00109 
00110     forAll(patches, patchi)
00111     {
00112         const fvPatch& curPatch = patches[patchi];
00113 
00114         if (isA<wallFvPatch>(curPatch))
00115         {
00116             forAll(curPatch, facei)
00117             {
00118                 label faceCelli = curPatch.faceCells()[facei];
00119 
00120                 epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00121                 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
00122             }
00123         }
00124     }
00125 }
00126 
00127 
00128 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines