TurbulenceModels::generalizedNewtonian: New structure to support generalized Newtonian laminar transport

Within this structure the BirdCarreau, Casson, CrossPowerLaw, HerschelBulkley,
powerLaw and strainRateFunction strain-dependent viscosity based non-Newtonian
fluid models may be selected for incompressible or compressible flow.

In the case of compressible flow the strain-dependent viscosity functions are
applied to the temperature dependent viscosity so that if the WLF viscosity
model is chosen in conjunction with the CrossPowerLaw the effective model is
Cross-WLF which is commonly used for polymer flow.

These models are selected in the constant/turbulenceProperties file, e.g.

simulationType  laminar;

laminar
{
    laminarModel generalizedNewtonian;

    viscosityModel CrossPowerLaw;

    nuInf      10;
    m          0.4;
    n          3;
}

This new implementation is more general and flexible than the previous
incompressible only non-Newtonian viscosity models, which were selected in the
constant/transportProperties file.  This implementation is now deprecated and
will be phased-out.
This commit is contained in:
Henry Weller
2018-10-04 22:31:48 +01:00
parent 79771811d8
commit 94d0b9ffe5
20 changed files with 2208 additions and 0 deletions

View File

@ -45,6 +45,9 @@ makeBaseTurbulenceModel
#include "Stokes.H"
makeLaminarModel(Stokes);
#include "generalizedNewtonian.H"
makeLaminarModel(generalizedNewtonian);
#include "Maxwell.H"
makeLaminarModel(Maxwell);

View File

@ -44,6 +44,9 @@ makeBaseTurbulenceModel
#include "Stokes.H"
makeLaminarModel(Stokes);
#include "generalizedNewtonian.H"
makeLaminarModel(generalizedNewtonian);
#include "Maxwell.H"
makeLaminarModel(Maxwell);

View File

@ -63,5 +63,14 @@ RASBCs = RAS/derivedFvPatchFields
$(RASBCs)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
$(RASBCs)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
generalizedNewtonianViscosityModels = laminar/generalizedNewtonian/generalizedNewtonianViscosityModels
$(generalizedNewtonianViscosityModels)/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.C
$(generalizedNewtonianViscosityModels)/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModelNew.C
$(generalizedNewtonianViscosityModels)/CrossPowerLaw/CrossPowerLaw.C
$(generalizedNewtonianViscosityModels)/BirdCarreau/BirdCarreau.C
$(generalizedNewtonianViscosityModels)/Casson/Casson.C
$(generalizedNewtonianViscosityModels)/HerschelBulkley/HerschelBulkley.C
$(generalizedNewtonianViscosityModels)/powerLaw/powerLaw.C
$(generalizedNewtonianViscosityModels)/strainRateFunction/strainRateFunction.C
LIB = $(FOAM_LIBBIN)/libturbulenceModels

View File

@ -0,0 +1,264 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "generalizedNewtonian.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvcGrad.H"
#include "fvcDiv.H"
#include "fvmLaplacian.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
generalizedNewtonian<BasicTurbulenceModel>::generalizedNewtonian
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
linearViscousStress<laminarModel<BasicTurbulenceModel>>
(
typeName,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
viscosityModel_
(
generalizedNewtonianViscosityModel::New
(
this->coeffDict_
)
),
nu_
(
IOobject
(
IOobject::groupName("generalizedNewtonian:nu", alphaRhoPhi.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
viscosityModel_->nu(this->nu(), strainRate())
)
{}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volScalarField>
generalizedNewtonian<BasicTurbulenceModel>::strainRate() const
{
return sqrt(2.0)*mag(symm(fvc::grad(this->U())));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool generalizedNewtonian<BasicTurbulenceModel>::read()
{
viscosityModel_->read(this->coeffDict_);
return true;
}
template<class BasicTurbulenceModel>
tmp<volScalarField>
generalizedNewtonian<BasicTurbulenceModel>::nut() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
IOobject::groupName("nut", this->alphaRhoPhi_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedScalar("nut", dimViscosity, 0.0)
)
);
}
template<class BasicTurbulenceModel>
tmp<scalarField>
generalizedNewtonian<BasicTurbulenceModel>::nut
(
const label patchi
) const
{
return tmp<scalarField>
(
new scalarField(this->mesh_.boundary()[patchi].size(), 0.0)
);
}
template<class BasicTurbulenceModel>
tmp<volScalarField>
generalizedNewtonian<BasicTurbulenceModel>::nuEff() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject::groupName("nuEff", this->alphaRhoPhi_.group()), nu_
)
);
}
template<class BasicTurbulenceModel>
tmp<scalarField>
generalizedNewtonian<BasicTurbulenceModel>::nuEff
(
const label patchi
) const
{
return nu_.boundaryField()[patchi];
}
template<class BasicTurbulenceModel>
tmp<volScalarField>
generalizedNewtonian<BasicTurbulenceModel>::k() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
IOobject::groupName("k", this->alphaRhoPhi_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedScalar("k", sqr(this->U_.dimensions()), 0.0)
)
);
}
template<class BasicTurbulenceModel>
tmp<volScalarField>
generalizedNewtonian<BasicTurbulenceModel>::epsilon() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
IOobject::groupName("epsilon", this->alphaRhoPhi_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedScalar
(
"epsilon", sqr(this->U_.dimensions())/dimTime, 0.0
)
)
);
}
template<class BasicTurbulenceModel>
tmp<volSymmTensorField>
generalizedNewtonian<BasicTurbulenceModel>::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
IOobject::groupName("R", this->alphaRhoPhi_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedSymmTensor
(
"R", sqr(this->U_.dimensions()), Zero
)
)
);
}
template<class BasicTurbulenceModel>
void generalizedNewtonian<BasicTurbulenceModel>::correct()
{
nu_ = viscosityModel_->nu(this->nu(), strainRate());
laminarModel<BasicTurbulenceModel>::correct();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace laminarModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonian
Description
Turbulence model for shear-dependent Non-Newtonian flow.
SourceFiles
generalizedNewtonian.C
\*---------------------------------------------------------------------------*/
#ifndef generalizedNewtonian_H
#define generalizedNewtonian_H
#include "laminarModel.H"
#include "linearViscousStress.H"
#include "generalizedNewtonianViscosityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
/*---------------------------------------------------------------------------*\
Class generalizedNewtonian Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class generalizedNewtonian
:
public linearViscousStress<laminarModel<BasicTurbulenceModel>>
{
protected:
// Protected data
//- Run-time selectable non-Newtonian viscosity model
autoPtr<generalizedNewtonianViscosityModel> viscosityModel_;
//- The non-Newtonian viscosity field
volScalarField nu_;
// Protected Member Functions
virtual tmp<volScalarField> strainRate() const;
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("generalizedNewtonian");
// Constructors
//- Construct from components
generalizedNewtonian
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<generalizedNewtonian> New
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~generalizedNewtonian()
{}
// Member Functions
//- Read turbulenceProperties dictionary
virtual bool read();
//- Return the turbulence viscosity,
// i.e. 0 for generalized Newtonian flow
virtual tmp<volScalarField> nut() const;
//- Return the turbulence viscosity on patch
virtual tmp<scalarField> nut(const label patchi) const;
//- Return the effective viscosity
// i.e. the generalizedNewtonian viscosity
virtual tmp<volScalarField> nuEff() const;
//- Return the effective viscosity on patch
virtual tmp<scalarField> nuEff(const label patchi) const;
//- Return the turbulence kinetic energy
// i.e. 0 for generalizedNewtonian flow
virtual tmp<volScalarField> k() const;
//- Return the turbulence kinetic energy dissipation rate,
// i.e. 0 for generalizedNewtonian flow
virtual tmp<volScalarField> epsilon() const;
//- Return the Reynolds stress tensor
// i.e. 0 for generalizedNewtonian flow
virtual tmp<volSymmTensorField> R() const;
//- Correct the generalizedNewtonian viscosity
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "generalizedNewtonian.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,131 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "BirdCarreau.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
defineTypeNameAndDebug(BirdCarreau, 0);
addToRunTimeSelectionTable
(
generalizedNewtonianViscosityModel,
BirdCarreau,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau::
BirdCarreau
(
const dictionary& viscosityProperties
)
:
generalizedNewtonianViscosityModel(viscosityProperties),
nuInf_("nuInf", dimViscosity, 0),
k_("k", dimTime, 0),
tauStar_( "tauStar", dimViscosity/dimTime, 0),
n_("n", dimless, 0),
a_("a", dimless, 2)
{
read(viscosityProperties);
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau::
read
(
const dictionary& viscosityProperties
)
{
generalizedNewtonianViscosityModel::read(viscosityProperties);
const dictionary& coeffs =
viscosityProperties.optionalSubDict(typeName + "Coeffs");
coeffs.lookup("nuInf") >> nuInf_;
if (coeffs.found("tauStar"))
{
coeffs.lookup("tauStar") >> tauStar_;
}
else
{
coeffs.lookup("k") >> k_;
}
coeffs.lookup("n") >> n_;
a_ = coeffs.lookupOrDefault
(
"a",
dimensionedScalar("a", dimless, 2)
);
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau::
nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const
{
return
nuInf_
+ (nu0 - nuInf_)
*pow
(
scalar(1)
+ pow
(
tauStar_.value() > 0
? nu0*strainRate/tauStar_
: k_*strainRate,
a_
),
(n_ - 1.0)/a_
);
}
// ************************************************************************* //

View File

@ -0,0 +1,140 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau
Description
Bird-Carreau generalized Newtonian viscosity model
The Bird-Carreau-Yasuda form is also supported if the optional \c a
coefficient is specified. \c a defaults to 2 for the Bird-Carreau model.
The strain rate coefficient can be specified either as the constant \c k or
the critical stress level at the transition to shear thinning \c
tauStar if \c tauStar is provided:
Kinematic viscosity [m^2/s]
\f[
\nu = \nu_\infty\,
+ (\nu_0 - \nu_\infty)\,
\left(1 + (k\gamma)^a \right)^{(n - 1)/a}
\f]
or
\f[
\nu = \nu_\infty
+ (\nu_0 - \nu_\infty)
\left(1 + (\frac{\nu_0\gamma}{\tau^*} )^a \right)^{(n - 1)/a}
\f]
Example specification for a polymer:
\verbatim
viscosityModel BirdCarreau;
nuInf 0;
tauStar 90;
n 0.5;
\endverbatim
SourceFiles
BirdCarreau.C
\*---------------------------------------------------------------------------*/
#ifndef BirdCarreau_H
#define BirdCarreau_H
#include "generalizedNewtonianViscosityModel.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
/*---------------------------------------------------------------------------*\
Class BirdCarreau Declaration
\*---------------------------------------------------------------------------*/
class BirdCarreau
:
public generalizedNewtonianViscosityModel
{
// Private data
dimensionedScalar nuInf_;
dimensionedScalar k_;
dimensionedScalar tauStar_;
dimensionedScalar n_;
dimensionedScalar a_;
public:
//- Runtime type information
TypeName("BirdCarreau");
// Constructors
//- Construct from components
BirdCarreau(const dictionary& viscosityProperties);
//- Destructor
virtual ~BirdCarreau()
{}
// Member Functions
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties);
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace generalizedNewtonianViscosityModels
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Casson.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
defineTypeNameAndDebug(Casson, 0);
addToRunTimeSelectionTable
(
generalizedNewtonianViscosityModel,
Casson,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModels::Casson::Casson
(
const dictionary& viscosityProperties
)
:
generalizedNewtonianViscosityModel(viscosityProperties),
m_("m", dimViscosity, 0),
tau0_("tau0", dimViscosity/dimTime, 0),
nuMin_("nuMin", dimViscosity, 0),
nuMax_("nuMax", dimViscosity, 0)
{
read(viscosityProperties);
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModels::Casson::read
(
const dictionary& viscosityProperties
)
{
generalizedNewtonianViscosityModel::read(viscosityProperties);
const dictionary& coeffs =
viscosityProperties.optionalSubDict(typeName + "Coeffs");
coeffs.lookup("m") >> m_;
coeffs.lookup("tau0") >> tau0_;
coeffs.lookup("nuMin_") >> nuMin_;
coeffs.lookup("nuMax_") >> nuMax_;
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::laminarModels::generalizedNewtonianViscosityModels::Casson::
nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const
{
return max
(
nuMin_,
min
(
nuMax_,
sqr
(
sqrt
(
tau0_
/max
(
strainRate,
dimensionedScalar("vSmall", dimless/dimTime, vSmall)
)
) + sqrt(m_)
)
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,131 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonianViscosityModels::Casson
Description
Casson generalized Newtonian viscosity model
References:
\verbatim
Casson, N. (1959).
Rheology of disperse systems.
In Proceedings of a Conference Organized by the
British Society of Rheology.
Pergamon Press, New York.
Fournier, R. L. (2011).
Basic transport phenomena in biomedical engineering.
CRC Press.
\endverbatim
Example specification for blood:
\verbatim
viscosityModel Casson;
m 3.934986e-6;
tau0 2.9032e-6;
nuMax 13.3333e-6;
nuMin 3.9047e-6;
\endverbatim
SourceFiles
Casson.C
\*---------------------------------------------------------------------------*/
#ifndef Casson_H
#define Casson_H
#include "generalizedNewtonianViscosityModel.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
/*---------------------------------------------------------------------------*\
Class Casson Declaration
\*---------------------------------------------------------------------------*/
class Casson
:
public generalizedNewtonianViscosityModel
{
// Private data
dimensionedScalar m_;
dimensionedScalar tau0_;
dimensionedScalar nuMin_;
dimensionedScalar nuMax_;
public:
//- Runtime type information
TypeName("Casson");
// Constructors
//- Construct from components
Casson(const dictionary& viscosityProperties);
//- Destructor
virtual ~Casson()
{}
// Member Functions
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties);
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace generalizedNewtonianViscosityModels
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CrossPowerLaw.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
defineTypeNameAndDebug(CrossPowerLaw, 0);
addToRunTimeSelectionTable
(
generalizedNewtonianViscosityModel,
CrossPowerLaw,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw::
CrossPowerLaw
(
const dictionary& viscosityProperties
)
:
generalizedNewtonianViscosityModel(viscosityProperties),
nuInf_("nuInf", dimViscosity, 0),
m_("m", dimTime, 0),
tauStar_( "tauStar", dimViscosity/dimTime, 0),
n_("n", dimless, 0)
{
read(viscosityProperties);
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw::
read
(
const dictionary& viscosityProperties
)
{
generalizedNewtonianViscosityModel::read(viscosityProperties);
const dictionary& coeffs =
viscosityProperties.optionalSubDict(typeName + "Coeffs");
coeffs.lookup("nuInf") >> nuInf_;
if (coeffs.found("tauStar"))
{
coeffs.lookup("tauStar") >> tauStar_;
}
else
{
coeffs.lookup("m") >> m_;
}
coeffs.lookup("n") >> n_;
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw::
nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const
{
return
nuInf_
+ (nu0 - nuInf_)
/(
scalar(1)
+ pow
(
tauStar_.value() > 0
? nu0*strainRate/tauStar_
: m_*strainRate,
n_
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw
Description
Cross-Power law generalized Newtonian viscosity model
The strain rate coefficient can be specified either as the constant \c m or
the critical stress level at the transition to shear thinning \c
tauStar if \c tauStar is provided:
Kinematic viscosity [m^2/s]
\f[
\nu = \nu_\infty + \frac{(\nu_0 - \nu_\infty)}{1 + (m\gamma)^n}
\f]
or
\f[
\nu = \nu_\infty
+ \frac{(\nu_0 - \nu_\infty)}
{1 + \left(\frac{\nu_0\gamma}{\tau^*}\right)^n}
\f]
Example specification:
\verbatim
viscosityModel CrossPowerLaw;
nuInf 10;
m 0.4;
n 3;
\endverbatim
SourceFiles
CrossPowerLaw.C
\*---------------------------------------------------------------------------*/
#ifndef CrossPowerLaw_H
#define CrossPowerLaw_H
#include "generalizedNewtonianViscosityModel.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
/*---------------------------------------------------------------------------*\
Class CrossPowerLaw Declaration
\*---------------------------------------------------------------------------*/
class CrossPowerLaw
:
public generalizedNewtonianViscosityModel
{
// Private data
dimensionedScalar nuInf_;
dimensionedScalar m_;
dimensionedScalar tauStar_;
dimensionedScalar n_;
public:
//- Runtime type information
TypeName("CrossPowerLaw");
// Constructors
//- Construct from components
CrossPowerLaw(const dictionary& viscosityProperties);
//- Destructor
virtual ~CrossPowerLaw()
{}
// Member Functions
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties);
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace generalizedNewtonianViscosityModels
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "HerschelBulkley.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
defineTypeNameAndDebug(HerschelBulkley, 0);
addToRunTimeSelectionTable
(
generalizedNewtonianViscosityModel,
HerschelBulkley,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley::
HerschelBulkley
(
const dictionary& viscosityProperties
)
:
generalizedNewtonianViscosityModel(viscosityProperties),
k_("k", dimViscosity, 0),
n_("n", dimless, 0),
tau0_("tau0", dimViscosity/dimTime, 0)
{
read(viscosityProperties);
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModels::
HerschelBulkley::read
(
const dictionary& viscosityProperties
)
{
generalizedNewtonianViscosityModel::read(viscosityProperties);
const dictionary& coeffs =
viscosityProperties.optionalSubDict(typeName + "Coeffs");
coeffs.lookup("k") >> k_;
coeffs.lookup("n") >> n_;
coeffs.lookup("tau0") >> tau0_;
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley::
nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const
{
dimensionedScalar tone("tone", dimTime, 1.0);
dimensionedScalar rtone("rtone", dimless/dimTime, 1.0);
return
(
min
(
nu0,
(tau0_ + k_*rtone*pow(tone*strainRate, n_))
/max
(
strainRate,
dimensionedScalar ("vSmall", dimless/dimTime, vSmall)
)
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley
Description
Herschel-Bulkley generalized Newtonian viscosity model
SourceFiles
HerschelBulkley.C
\*---------------------------------------------------------------------------*/
#ifndef HerschelBulkley_H
#define HerschelBulkley_H
#include "generalizedNewtonianViscosityModel.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
/*---------------------------------------------------------------------------*\
Class HerschelBulkley Declaration
\*---------------------------------------------------------------------------*/
class HerschelBulkley
:
public generalizedNewtonianViscosityModel
{
// Private data
dimensionedScalar k_;
dimensionedScalar n_;
dimensionedScalar tau0_;
public:
//- Runtime type information
TypeName("HerschelBulkley");
// Constructors
//- Construct from components
HerschelBulkley(const dictionary& viscosityProperties);
//- Destructor
virtual ~HerschelBulkley()
{}
// Member Functions
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties);
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace generalizedNewtonianViscosityModels
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "generalizedNewtonianViscosityModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
defineTypeNameAndDebug(generalizedNewtonianViscosityModel, 0);
defineRunTimeSelectionTable(generalizedNewtonianViscosityModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModel::
generalizedNewtonianViscosityModel
(
const dictionary& viscosityProperties
)
:
viscosityProperties_(viscosityProperties)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModel::read
(
const dictionary& viscosityProperties
)
{
viscosityProperties_ = viscosityProperties;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Namespace
Foam::laminarModels::generalizedNewtonianViscosityModels
Description
A namespace for various generalized Newtonian viscosity model
implementations.
Class
Foam::laminarModels::generalizedNewtonianViscosityModel
Description
An abstract base class for generalized Newtonian viscosity models.
SourceFiles
generalizedNewtonianViscosityModel.C
generalizedNewtonianViscosityModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef generalizedNewtonianViscosityModel_H
#define generalizedNewtonianViscosityModel_H
#include "dictionary.H"
#include "volFieldsFwd.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
/*---------------------------------------------------------------------------*\
Class generalizedNewtonianViscosityModel Declaration
\*---------------------------------------------------------------------------*/
class generalizedNewtonianViscosityModel
{
protected:
// Protected data
dictionary viscosityProperties_;
// Private Member Functions
//- Disallow copy construct
generalizedNewtonianViscosityModel
(
const generalizedNewtonianViscosityModel&
);
//- Disallow default bitwise assignment
void operator=(const generalizedNewtonianViscosityModel&);
public:
//- Runtime type information
TypeName("generalizedNewtonianViscosityModel");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
generalizedNewtonianViscosityModel,
dictionary,
(
const dictionary& viscosityProperties
),
(viscosityProperties)
);
// Selectors
//- Return a reference to the selected viscosity model
static autoPtr<generalizedNewtonianViscosityModel> New
(
const dictionary& viscosityProperties
);
// Constructors
//- Construct from components
generalizedNewtonianViscosityModel
(
const dictionary& viscosityProperties
);
//- Destructor
virtual ~generalizedNewtonianViscosityModel()
{}
// Member Functions
//- Return the phase transport properties dictionary
const dictionary& viscosityProperties() const
{
return viscosityProperties_;
}
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const = 0;
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "generalizedNewtonianViscosityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::laminarModels::generalizedNewtonianViscosityModel>
Foam::laminarModels::generalizedNewtonianViscosityModel::New
(
const dictionary& viscosityProperties
)
{
const word modelType
(
viscosityProperties.lookup("viscosityModel")
);
Info<< "Selecting generalized Newtonian model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown generalizedNewtonianViscosityModel type "
<< modelType << nl << nl
<< "Valid generalizedNewtonianViscosityModels are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<generalizedNewtonianViscosityModel>
(
cstrIter()(viscosityProperties)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "powerLaw.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
defineTypeNameAndDebug(powerLaw, 0);
addToRunTimeSelectionTable
(
generalizedNewtonianViscosityModel,
powerLaw,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw::powerLaw
(
const dictionary& viscosityProperties
)
:
generalizedNewtonianViscosityModel(viscosityProperties),
k_("k", dimViscosity, 0),
n_("n", dimless, 0),
nuMin_("nuMin", dimViscosity, 0),
nuMax_("nuMax", dimViscosity, 0)
{
read(viscosityProperties);
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw::read
(
const dictionary& viscosityProperties
)
{
generalizedNewtonianViscosityModel::read(viscosityProperties);
const dictionary& coeffs =
viscosityProperties.optionalSubDict(typeName + "Coeffs");
coeffs.lookup("k") >> k_;
coeffs.lookup("n") >> n_;
coeffs.lookup("nuMin") >> nuMin_;
coeffs.lookup("nuMax") >> nuMax_;
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw::
nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const
{
return max
(
nuMin_,
min
(
nuMax_,
k_*pow
(
max
(
dimensionedScalar("one", dimTime, 1.0)*strainRate,
dimensionedScalar("small", dimless, small)
),
n_.value() - scalar(1)
)
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,107 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw
Description
Standard power-law generalized Newtonian viscosity model
SourceFiles
powerLaw.C
\*---------------------------------------------------------------------------*/
#ifndef powerLaw_H
#define powerLaw_H
#include "generalizedNewtonianViscosityModel.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
/*---------------------------------------------------------------------------*\
Class powerLaw Declaration
\*---------------------------------------------------------------------------*/
class powerLaw
:
public generalizedNewtonianViscosityModel
{
// Private data
dimensionedScalar k_;
dimensionedScalar n_;
dimensionedScalar nuMin_;
dimensionedScalar nuMax_;
public:
//- Runtime type information
TypeName("powerLaw");
// Constructors
//- Construct from components
powerLaw(const dictionary& viscosityProperties);
//- Destructor
virtual ~powerLaw()
{}
// Member Functions
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties);
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace generalizedNewtonianViscosityModels
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "strainRateFunction.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
defineTypeNameAndDebug(strainRateFunction, 0);
addToRunTimeSelectionTable
(
generalizedNewtonianViscosityModel,
strainRateFunction,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction::
strainRateFunction
(
const dictionary& viscosityProperties
)
:
generalizedNewtonianViscosityModel(viscosityProperties),
strainRateFunction_
(
Function1<scalar>::New
(
"function",
viscosityProperties.optionalSubDict(typeName + "Coeffs")
)
)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::laminarModels::generalizedNewtonianViscosityModels::
strainRateFunction::read
(
const dictionary& viscosityProperties
)
{
generalizedNewtonianViscosityModel::read(viscosityProperties);
strainRateFunction_.clear();
strainRateFunction_ = Function1<scalar>::New
(
"function",
viscosityProperties.optionalSubDict
(
typeName + "Coeffs"
)
);
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction::
nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const
{
tmp<volScalarField> tnu
(
new volScalarField
(
IOobject
(
IOobject::groupName(type() + ":nu", nu0.group()),
nu0.time().timeName(),
nu0.db(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
nu0.mesh(),
dimensionedScalar("0", dimViscosity, 0)
)
);
tnu.ref().primitiveFieldRef() = strainRateFunction_->value(strainRate);
volScalarField::Boundary& nuBf = tnu.ref().boundaryFieldRef();
const volScalarField::Boundary& sigmaBf = strainRate.boundaryField();
forAll(nuBf, patchi)
{
nuBf[patchi] = strainRateFunction_->value(sigmaBf[patchi]);
}
return tnu;
}
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction
Description
Run-time selected strain-rate function generalized Newtonian viscosity model
Example linear function of strain-rate:
\verbatim
generalizedNewtonianModel strainRateFunction;
function polynomial ((0 0.1) (1 1.3));
\endverbatim
See also
Foam::generalizedNewtonianViscosityModel
Foam::Function1
SourceFiles
strainRateFunction.C
\*---------------------------------------------------------------------------*/
#ifndef strainRateFunction_H
#define strainRateFunction_H
#include "generalizedNewtonianViscosityModel.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace laminarModels
{
namespace generalizedNewtonianViscosityModels
{
/*---------------------------------------------------------------------------*\
Class strainRateFunction Declaration
\*---------------------------------------------------------------------------*/
class strainRateFunction
:
public generalizedNewtonianViscosityModel
{
// Private data
//- Strain-rate function
autoPtr<Function1<scalar>> strainRateFunction_;
public:
//- Runtime type information
TypeName("strainRateFunction");
// Constructors
//- Construct from components
strainRateFunction(const dictionary& viscosityProperties);
//- Destructor
virtual ~strainRateFunction()
{}
// Member Functions
//- Read transportProperties dictionary
virtual bool read(const dictionary& viscosityProperties);
//- Return the laminar viscosity
virtual tmp<volScalarField> nu
(
const volScalarField& nu0,
const volScalarField& strainRate
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace generalizedNewtonianViscosityModels
} // End namespace laminarModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //