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

HerschelBulkley.C

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-2011 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 \*---------------------------------------------------------------------------*/
00025 
00026 #include "HerschelBulkley.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/surfaceFields.H>
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace viscosityModels
00035 {
00036     defineTypeNameAndDebug(HerschelBulkley, 0);
00037 
00038     addToRunTimeSelectionTable
00039     (
00040         viscosityModel,
00041         HerschelBulkley,
00042         dictionary
00043     );
00044 }
00045 }
00046 
00047 
00048 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
00049 
00050 Foam::tmp<Foam::volScalarField>
00051 Foam::viscosityModels::HerschelBulkley::calcNu() const
00052 {
00053     dimensionedScalar tone("tone", dimTime, 1.0);
00054     dimensionedScalar rtone("rtone", dimless/dimTime, 1.0);
00055 
00056     tmp<volScalarField> sr(strainRate());
00057 
00058  // return
00059  // (
00060  //     min
00061  //     (
00062  //         nu0_,
00063  //         (tau0_ + k_*rtone*(pow(tone*sr(), n_) - pow(tone*tau0_/nu0_, n_)))
00064  //        /max(sr(), dimensionedScalar("VSMALL", dimless/dimTime, VSMALL))
00065  //     )
00066  // );
00067 
00068     return
00069     (
00070         min
00071         (
00072             nu0_,
00073             (tau0_ + k_*rtone*pow(tone*sr(), n_))
00074            /(max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL)))
00075         )
00076     );
00077 }
00078 
00079 
00080 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00081 
00082 Foam::viscosityModels::HerschelBulkley::HerschelBulkley
00083 (
00084     const word& name,
00085     const dictionary& viscosityProperties,
00086     const volVectorField& U,
00087     const surfaceScalarField& phi
00088 )
00089 :
00090     viscosityModel(name, viscosityProperties, U, phi),
00091     HerschelBulkleyCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
00092     k_(HerschelBulkleyCoeffs_.lookup("k")),
00093     n_(HerschelBulkleyCoeffs_.lookup("n")),
00094     tau0_(HerschelBulkleyCoeffs_.lookup("tau0")),
00095     nu0_(HerschelBulkleyCoeffs_.lookup("nu0")),
00096     nu_
00097     (
00098         IOobject
00099         (
00100             name,
00101             U_.time().timeName(),
00102             U_.db(),
00103             IOobject::NO_READ,
00104             IOobject::AUTO_WRITE
00105         ),
00106         calcNu()
00107     )
00108 {}
00109 
00110 
00111 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00112 
00113 bool Foam::viscosityModels::HerschelBulkley::read
00114 (
00115     const dictionary& viscosityProperties
00116 )
00117 {
00118     viscosityModel::read(viscosityProperties);
00119 
00120     HerschelBulkleyCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
00121 
00122     HerschelBulkleyCoeffs_.lookup("k") >> k_;
00123     HerschelBulkleyCoeffs_.lookup("n") >> n_;
00124     HerschelBulkleyCoeffs_.lookup("tau0") >> tau0_;
00125     HerschelBulkleyCoeffs_.lookup("nu0") >> nu0_;
00126 
00127     return true;
00128 }
00129 
00130 
00131 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines