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

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