mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
General tidy.
Added new viscosity models: powerLaw, HerschelBulkley.
This commit is contained in:
@ -1,8 +1,10 @@
|
|||||||
viscosityModels/viscosityModel/viscosityModel.C
|
viscosityModels/viscosityModel/viscosityModel.C
|
||||||
viscosityModels/viscosityModel/newViscosityModel.C
|
viscosityModels/viscosityModel/newViscosityModel.C
|
||||||
viscosityModels/Newtonian/Newtonian.C
|
viscosityModels/Newtonian/Newtonian.C
|
||||||
|
viscosityModels/powerLaw/powerLaw.C
|
||||||
viscosityModels/CrossPowerLaw/CrossPowerLaw.C
|
viscosityModels/CrossPowerLaw/CrossPowerLaw.C
|
||||||
viscosityModels/BirdCarreau/BirdCarreau.C
|
viscosityModels/BirdCarreau/BirdCarreau.C
|
||||||
|
viscosityModels/HerschelBulkley/HerschelBulkley.C
|
||||||
|
|
||||||
transportModel/transportModel.C
|
transportModel/transportModel.C
|
||||||
singlePhaseTransportModel/singlePhaseTransportModel.C
|
singlePhaseTransportModel/singlePhaseTransportModel.C
|
||||||
|
|||||||
@ -28,31 +28,29 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace viscosityModels
|
namespace viscosityModels
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(BirdCarreau, 0);
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
defineTypeNameAndDebug(BirdCarreau, 0);
|
viscosityModel,
|
||||||
|
BirdCarreau,
|
||||||
addToRunTimeSelectionTable
|
dictionary
|
||||||
(
|
);
|
||||||
viscosityModel,
|
}
|
||||||
BirdCarreau,
|
}
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
Foam::tmp<Foam::volScalarField>
|
||||||
tmp<volScalarField> BirdCarreau::calcNu() const
|
Foam::viscosityModels::BirdCarreau::calcNu() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
nuInf_
|
nuInf_
|
||||||
+ (nu0_ - nuInf_)
|
+ (nu0_ - nuInf_)
|
||||||
*pow(scalar(1) + sqr(k_*strainRate()), (n_ - 1.0)/2.0);
|
*pow(scalar(1) + sqr(k_*strainRate()), (n_ - 1.0)/2.0);
|
||||||
@ -61,8 +59,7 @@ tmp<volScalarField> BirdCarreau::calcNu() const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// from components
|
Foam::viscosityModels::BirdCarreau::BirdCarreau
|
||||||
BirdCarreau::BirdCarreau
|
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& viscosityProperties,
|
const dictionary& viscosityProperties,
|
||||||
@ -93,7 +90,10 @@ BirdCarreau::BirdCarreau
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool BirdCarreau::read(const dictionary& viscosityProperties)
|
bool Foam::viscosityModels::BirdCarreau::read
|
||||||
|
(
|
||||||
|
const dictionary& viscosityProperties
|
||||||
|
)
|
||||||
{
|
{
|
||||||
viscosityModel::read(viscosityProperties);
|
viscosityModel::read(viscosityProperties);
|
||||||
|
|
||||||
@ -108,9 +108,4 @@ bool BirdCarreau::read(const dictionary& viscosityProperties)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace viscosityModels
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -28,29 +28,28 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace viscosityModels
|
namespace viscosityModels
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(CrossPowerLaw, 0);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
defineTypeNameAndDebug(CrossPowerLaw, 0);
|
viscosityModel,
|
||||||
|
CrossPowerLaw,
|
||||||
addToRunTimeSelectionTable
|
dictionary
|
||||||
(
|
);
|
||||||
viscosityModel,
|
}
|
||||||
CrossPowerLaw,
|
}
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Calculate and return the laminar viscosity
|
Foam::tmp<Foam::volScalarField>
|
||||||
tmp<volScalarField> CrossPowerLaw::calcNu() const
|
Foam::viscosityModels::CrossPowerLaw::calcNu() const
|
||||||
{
|
{
|
||||||
return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
|
return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
|
||||||
}
|
}
|
||||||
@ -58,7 +57,7 @@ tmp<volScalarField> CrossPowerLaw::calcNu() const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
CrossPowerLaw::CrossPowerLaw
|
Foam::viscosityModels::CrossPowerLaw::CrossPowerLaw
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& viscosityProperties,
|
const dictionary& viscosityProperties,
|
||||||
@ -89,7 +88,10 @@ CrossPowerLaw::CrossPowerLaw
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool CrossPowerLaw::read(const dictionary& viscosityProperties)
|
bool Foam::viscosityModels::CrossPowerLaw::read
|
||||||
|
(
|
||||||
|
const dictionary& viscosityProperties
|
||||||
|
)
|
||||||
{
|
{
|
||||||
viscosityModel::read(viscosityProperties);
|
viscosityModel::read(viscosityProperties);
|
||||||
|
|
||||||
@ -99,14 +101,9 @@ bool CrossPowerLaw::read(const dictionary& viscosityProperties)
|
|||||||
CrossPowerLawCoeffs_.lookup("nuInf") >> nuInf_;
|
CrossPowerLawCoeffs_.lookup("nuInf") >> nuInf_;
|
||||||
CrossPowerLawCoeffs_.lookup("m") >> m_;
|
CrossPowerLawCoeffs_.lookup("m") >> m_;
|
||||||
CrossPowerLawCoeffs_.lookup("n") >> n_;
|
CrossPowerLawCoeffs_.lookup("n") >> n_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace viscosityModels
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -0,0 +1,114 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "HerschelBulkley.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace viscosityModels
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(HerschelBulkley, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
viscosityModel,
|
||||||
|
HerschelBulkley,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::viscosityModels::HerschelBulkley::calcNu() const
|
||||||
|
{
|
||||||
|
dimensionedScalar tone("tone", dimTime, 1.0);
|
||||||
|
dimensionedScalar rtone("rtone", dimless/dimTime, 1.0);
|
||||||
|
tmp<volScalarField> sr(strainRate());
|
||||||
|
return (min(nu0_,(tau0_ + k_* rtone *( pow(tone * sr(), n_)
|
||||||
|
+ pow(tone*tau0_/nu0_,n_))) / (max(sr(), dimensionedScalar
|
||||||
|
("VSMALL", dimless/dimTime, VSMALL)))));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::viscosityModels::HerschelBulkley::HerschelBulkley
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& viscosityProperties,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
)
|
||||||
|
:
|
||||||
|
viscosityModel(name, viscosityProperties, U, phi),
|
||||||
|
HerschelBulkleyCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
|
||||||
|
k_(HerschelBulkleyCoeffs_.lookup("k")),
|
||||||
|
n_(HerschelBulkleyCoeffs_.lookup("n")),
|
||||||
|
tau0_(HerschelBulkleyCoeffs_.lookup("tau0")),
|
||||||
|
nu0_(HerschelBulkleyCoeffs_.lookup("nu0")),
|
||||||
|
nu_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
U_.time().timeName(),
|
||||||
|
U_.db(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
calcNu()
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::viscosityModels::HerschelBulkley::read
|
||||||
|
(
|
||||||
|
const dictionary& viscosityProperties
|
||||||
|
)
|
||||||
|
{
|
||||||
|
viscosityModel::read(viscosityProperties);
|
||||||
|
|
||||||
|
HerschelBulkleyCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
|
||||||
|
|
||||||
|
HerschelBulkleyCoeffs_.lookup("k") >> k_;
|
||||||
|
HerschelBulkleyCoeffs_.lookup("n") >> n_;
|
||||||
|
HerschelBulkleyCoeffs_.lookup("tau0") >> tau0_;
|
||||||
|
HerschelBulkleyCoeffs_.lookup("nu0") >> nu0_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::viscosityModels::HerschelBulkley
|
||||||
|
|
||||||
|
Description
|
||||||
|
Herschel-Bulkley non-Newtonian viscosity model.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
HerschelBulkley.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef HerschelBulkley_H
|
||||||
|
#define HerschelBulkley_H
|
||||||
|
|
||||||
|
#include "viscosityModel.H"
|
||||||
|
#include "dimensionedScalar.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace viscosityModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class HerschelBulkley Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class HerschelBulkley
|
||||||
|
:
|
||||||
|
public viscosityModel
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
dictionary HerschelBulkleyCoeffs_;
|
||||||
|
|
||||||
|
dimensionedScalar k_;
|
||||||
|
dimensionedScalar n_;
|
||||||
|
dimensionedScalar tau0_;
|
||||||
|
dimensionedScalar nu0_;
|
||||||
|
|
||||||
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Calculate and return the laminar viscosity
|
||||||
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("HerschelBulkley");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
HerschelBulkley
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& viscosityProperties,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~HerschelBulkley()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the laminar viscosity
|
||||||
|
tmp<volScalarField> nu() const
|
||||||
|
{
|
||||||
|
return nu_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Correct the laminar viscosity
|
||||||
|
void correct()
|
||||||
|
{
|
||||||
|
nu_ = calcNu();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read transportProperties dictionary
|
||||||
|
bool read(const dictionary& viscosityProperties);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace viscosityModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -28,22 +28,21 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace viscosityModels
|
namespace viscosityModels
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(Newtonian, 0);
|
||||||
|
addToRunTimeSelectionTable(viscosityModel, Newtonian, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(Newtonian, 0);
|
|
||||||
|
|
||||||
addToRunTimeSelectionTable(viscosityModel, Newtonian, dictionary);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Newtonian::Newtonian
|
Foam::viscosityModels::Newtonian::Newtonian
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& viscosityProperties,
|
const dictionary& viscosityProperties,
|
||||||
@ -71,7 +70,10 @@ Newtonian::Newtonian
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Newtonian::read(const dictionary& viscosityProperties)
|
bool Foam::viscosityModels::Newtonian::read
|
||||||
|
(
|
||||||
|
const dictionary& viscosityProperties
|
||||||
|
)
|
||||||
{
|
{
|
||||||
viscosityModel::read(viscosityProperties);
|
viscosityModel::read(viscosityProperties);
|
||||||
|
|
||||||
@ -82,9 +84,4 @@ bool Newtonian::read(const dictionary& viscosityProperties)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace viscosityModels
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
111
src/transportModels/incompressible/viscosityModels/powerLaw/powerLaw.C
Executable file
111
src/transportModels/incompressible/viscosityModels/powerLaw/powerLaw.C
Executable file
@ -0,0 +1,111 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "powerLaw.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace viscosityModels
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(powerLaw, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
viscosityModel,
|
||||||
|
powerLaw,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::viscosityModels::powerLaw::calcNu() const
|
||||||
|
{
|
||||||
|
dimensionedScalar tone("tone", dimTime, 1.0);
|
||||||
|
return (max(numin_, min(numax_, k_
|
||||||
|
* pow(tone * strainRate(), n_.value()- scalar(1.0)))));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::viscosityModels::powerLaw::powerLaw
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& viscosityProperties,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
)
|
||||||
|
:
|
||||||
|
viscosityModel(name, viscosityProperties, U, phi),
|
||||||
|
powerLawCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
|
||||||
|
k_(powerLawCoeffs_.lookup("k")),
|
||||||
|
n_(powerLawCoeffs_.lookup("n")),
|
||||||
|
numin_(powerLawCoeffs_.lookup("numin")),
|
||||||
|
numax_(powerLawCoeffs_.lookup("numax")),
|
||||||
|
nu_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
U_.time().timeName(),
|
||||||
|
U_.db(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
calcNu()
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::viscosityModels::powerLaw::read
|
||||||
|
(
|
||||||
|
const dictionary& viscosityProperties
|
||||||
|
)
|
||||||
|
{
|
||||||
|
viscosityModel::read(viscosityProperties);
|
||||||
|
|
||||||
|
powerLawCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
|
||||||
|
|
||||||
|
powerLawCoeffs_.lookup("k") >> k_;
|
||||||
|
powerLawCoeffs_.lookup("n") >> n_;
|
||||||
|
powerLawCoeffs_.lookup("numin") >> numin_;
|
||||||
|
powerLawCoeffs_.lookup("numax") >> numax_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
128
src/transportModels/incompressible/viscosityModels/powerLaw/powerLaw.H
Executable file
128
src/transportModels/incompressible/viscosityModels/powerLaw/powerLaw.H
Executable file
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::viscosityModels::powerLaw
|
||||||
|
|
||||||
|
Description
|
||||||
|
Standard power-law non-Newtonian viscosity model.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
powerLaw.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef powerLaw_H
|
||||||
|
#define powerLaw_H
|
||||||
|
|
||||||
|
#include "viscosityModel.H"
|
||||||
|
#include "dimensionedScalar.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace viscosityModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class powerLaw Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class powerLaw
|
||||||
|
:
|
||||||
|
public viscosityModel
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
dictionary powerLawCoeffs_;
|
||||||
|
|
||||||
|
dimensionedScalar k_;
|
||||||
|
dimensionedScalar n_;
|
||||||
|
dimensionedScalar numin_;
|
||||||
|
dimensionedScalar numax_;
|
||||||
|
|
||||||
|
volScalarField nu_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Calculate and return the laminar viscosity
|
||||||
|
tmp<volScalarField> calcNu() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("powerLaw");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
powerLaw
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& viscosityProperties,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~powerLaw()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the laminar viscosity
|
||||||
|
tmp<volScalarField> nu() const
|
||||||
|
{
|
||||||
|
return nu_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Correct the laminar viscosity
|
||||||
|
void correct()
|
||||||
|
{
|
||||||
|
nu_ = calcNu();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read transportProperties dictionary
|
||||||
|
bool read(const dictionary& viscosityProperties);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace viscosityModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -28,7 +28,6 @@ Namespace
|
|||||||
Description
|
Description
|
||||||
A namespace for various incompressible viscosityModel implementations.
|
A namespace for various incompressible viscosityModel implementations.
|
||||||
|
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::viscosityModel
|
Foam::viscosityModel
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user