BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / transportModels / incompressible / viscosityModels / CrossPowerLaw / CrossPowerLaw.C
blob3e87a3b8f6b150b6edaf4e904dd1770a0794d10a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "CrossPowerLaw.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "surfaceFields.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 namespace Foam
34 namespace viscosityModels
36     defineTypeNameAndDebug(CrossPowerLaw, 0);
38     addToRunTimeSelectionTable
39     (
40         viscosityModel,
41         CrossPowerLaw,
42         dictionary
43     );
48 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
50 Foam::tmp<Foam::volScalarField>
51 Foam::viscosityModels::CrossPowerLaw::calcNu() const
53     return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
57 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
59 Foam::viscosityModels::CrossPowerLaw::CrossPowerLaw
61     const word& name,
62     const dictionary& viscosityProperties,
63     const volVectorField& U,
64     const surfaceScalarField& phi
67     viscosityModel(name, viscosityProperties, U, phi),
68     CrossPowerLawCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
69     nu0_(CrossPowerLawCoeffs_.lookup("nu0")),
70     nuInf_(CrossPowerLawCoeffs_.lookup("nuInf")),
71     m_(CrossPowerLawCoeffs_.lookup("m")),
72     n_(CrossPowerLawCoeffs_.lookup("n")),
73     nu_
74     (
75         IOobject
76         (
77             name,
78             U_.time().timeName(),
79             U_.db(),
80             IOobject::NO_READ,
81             IOobject::AUTO_WRITE
82         ),
83         calcNu()
84     )
88 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
90 bool Foam::viscosityModels::CrossPowerLaw::read
92     const dictionary& viscosityProperties
95     viscosityModel::read(viscosityProperties);
97     CrossPowerLawCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
99     CrossPowerLawCoeffs_.lookup("nu0") >> nu0_;
100     CrossPowerLawCoeffs_.lookup("nuInf") >> nuInf_;
101     CrossPowerLawCoeffs_.lookup("m") >> m_;
102     CrossPowerLawCoeffs_.lookup("n") >> n_;
104     return true;
108 // ************************************************************************* //