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

powerLaw.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 "powerLaw.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(powerLaw, 0);
00037 
00038     addToRunTimeSelectionTable
00039     (
00040         viscosityModel,
00041         powerLaw,
00042         dictionary
00043     );
00044 }
00045 }
00046 
00047 
00048 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
00049 
00050 Foam::tmp<Foam::volScalarField>
00051 Foam::viscosityModels::powerLaw::calcNu() const
00052 {
00053     return max
00054     (
00055         nuMin_,
00056         min
00057         (
00058             nuMax_,
00059             k_*pow
00060             (
00061                 max
00062                 (
00063                     dimensionedScalar("one", dimTime, 1.0)*strainRate(),
00064                     dimensionedScalar("VSMALL", dimless, VSMALL)
00065                 ),
00066                 n_.value() - scalar(1.0)
00067             )
00068         )
00069     );
00070 }
00071 
00072 
00073 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00074 
00075 Foam::viscosityModels::powerLaw::powerLaw
00076 (
00077     const word& name,
00078     const dictionary& viscosityProperties,
00079     const volVectorField& U,
00080     const surfaceScalarField& phi
00081 )
00082 :
00083     viscosityModel(name, viscosityProperties, U, phi),
00084     powerLawCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
00085     k_(powerLawCoeffs_.lookup("k")),
00086     n_(powerLawCoeffs_.lookup("n")),
00087     nuMin_(powerLawCoeffs_.lookup("nuMin")),
00088     nuMax_(powerLawCoeffs_.lookup("nuMax")),
00089     nu_
00090     (
00091         IOobject
00092         (
00093             name,
00094             U_.time().timeName(),
00095             U_.db(),
00096             IOobject::NO_READ,
00097             IOobject::AUTO_WRITE
00098         ),
00099         calcNu()
00100     )
00101 {}
00102 
00103 
00104 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00105 
00106 bool Foam::viscosityModels::powerLaw::read
00107 (
00108     const dictionary& viscosityProperties
00109 )
00110 {
00111     viscosityModel::read(viscosityProperties);
00112 
00113     powerLawCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
00114 
00115     powerLawCoeffs_.lookup("k") >> k_;
00116     powerLawCoeffs_.lookup("n") >> n_;
00117     powerLawCoeffs_.lookup("nuMin") >> nuMin_;
00118     powerLawCoeffs_.lookup("nuMax") >> nuMax_;
00119 
00120     return true;
00121 }
00122 
00123 
00124 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines