OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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