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

BirdCarreau.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-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 \*---------------------------------------------------------------------------*/
00025 
00026 #include "BirdCarreau.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(BirdCarreau, 0);
00037     addToRunTimeSelectionTable
00038     (
00039         viscosityModel,
00040         BirdCarreau,
00041         dictionary
00042     );
00043 }
00044 }
00045 
00046 
00047 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
00048 
00049 Foam::tmp<Foam::volScalarField>
00050 Foam::viscosityModels::BirdCarreau::calcNu() const
00051 {
00052     return
00053         nuInf_
00054       + (nu0_ - nuInf_)
00055        *pow(scalar(1) + sqr(k_*strainRate()), (n_ - 1.0)/2.0);
00056 }
00057 
00058 
00059 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00060 
00061 Foam::viscosityModels::BirdCarreau::BirdCarreau
00062 (
00063     const word& name,
00064     const dictionary& viscosityProperties,
00065     const volVectorField& U,
00066     const surfaceScalarField& phi
00067 )
00068 :
00069     viscosityModel(name, viscosityProperties, U, phi),
00070     BirdCarreauCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
00071     nu0_(BirdCarreauCoeffs_.lookup("nu0")),
00072     nuInf_(BirdCarreauCoeffs_.lookup("nuInf")),
00073     k_(BirdCarreauCoeffs_.lookup("k")),
00074     n_(BirdCarreauCoeffs_.lookup("n")),
00075     nu_
00076     (
00077         IOobject
00078         (
00079             "nu",
00080             U_.time().timeName(),
00081             U_.db(),
00082             IOobject::NO_READ,
00083             IOobject::AUTO_WRITE
00084         ),
00085         calcNu()
00086     )
00087 {}
00088 
00089 
00090 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00091 
00092 bool Foam::viscosityModels::BirdCarreau::read
00093 (
00094     const dictionary& viscosityProperties
00095 )
00096 {
00097     viscosityModel::read(viscosityProperties);
00098 
00099     BirdCarreauCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
00100 
00101     BirdCarreauCoeffs_.lookup("nu0") >> nu0_;
00102     BirdCarreauCoeffs_.lookup("nuInf") >> nuInf_;
00103     BirdCarreauCoeffs_.lookup("k") >> k_;
00104     BirdCarreauCoeffs_.lookup("n") >> n_;
00105 
00106     return true;
00107 }
00108 
00109 
00110 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines