initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / transportModels / incompressible / viscosityModels / CrossPowerLaw / CrossPowerLaw.C
blob91e36e215a15c96a965a9ed64fa892f4ba630f39
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "CrossPowerLaw.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "surfaceFields.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 namespace Foam
35 namespace viscosityModels
37     defineTypeNameAndDebug(CrossPowerLaw, 0);
39     addToRunTimeSelectionTable
40     (
41         viscosityModel,
42         CrossPowerLaw,
43         dictionary
44     );
49 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
51 Foam::tmp<Foam::volScalarField>
52 Foam::viscosityModels::CrossPowerLaw::calcNu() const
54     return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
58 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
60 Foam::viscosityModels::CrossPowerLaw::CrossPowerLaw
62     const word& name,
63     const dictionary& viscosityProperties,
64     const volVectorField& U,
65     const surfaceScalarField& phi
68     viscosityModel(name, viscosityProperties, U, phi),
69     CrossPowerLawCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
70     nu0_(CrossPowerLawCoeffs_.lookup("nu0")),
71     nuInf_(CrossPowerLawCoeffs_.lookup("nuInf")),
72     m_(CrossPowerLawCoeffs_.lookup("m")),
73     n_(CrossPowerLawCoeffs_.lookup("n")),
74     nu_
75     (
76         IOobject
77         (
78             name,
79             U_.time().timeName(),
80             U_.db(),
81             IOobject::NO_READ,
82             IOobject::AUTO_WRITE
83         ),
84         calcNu()
85     )
89 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
91 bool Foam::viscosityModels::CrossPowerLaw::read
93     const dictionary& viscosityProperties
96     viscosityModel::read(viscosityProperties);
98     CrossPowerLawCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
100     CrossPowerLawCoeffs_.lookup("nu0") >> nu0_;
101     CrossPowerLawCoeffs_.lookup("nuInf") >> nuInf_;
102     CrossPowerLawCoeffs_.lookup("m") >> m_;
103     CrossPowerLawCoeffs_.lookup("n") >> n_;
105     return true;
109 // ************************************************************************* //