From 35f12bb6bdd761ef6dc225a2a812e4b424fbbcc3 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Wed, 17 Aug 2016 09:38:17 +0100
Subject: [PATCH] viscosityModels::Casson: New viscosity model

Description
    An incompressible Casson non-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

Contributed by Sergey Sindeev
---
 src/transportModels/incompressible/Make/files |   1 +
 .../viscosityModels/Casson/Casson.C           | 126 +++++++++++++++
 .../viscosityModels/Casson/Casson.H           | 146 ++++++++++++++++++
 3 files changed, 273 insertions(+)
 create mode 100644 src/transportModels/incompressible/viscosityModels/Casson/Casson.C
 create mode 100644 src/transportModels/incompressible/viscosityModels/Casson/Casson.H

diff --git a/src/transportModels/incompressible/Make/files b/src/transportModels/incompressible/Make/files
index 76baf5df241..40eea6a11f2 100644
--- a/src/transportModels/incompressible/Make/files
+++ b/src/transportModels/incompressible/Make/files
@@ -5,6 +5,7 @@ viscosityModels/powerLaw/powerLaw.C
 viscosityModels/CrossPowerLaw/CrossPowerLaw.C
 viscosityModels/BirdCarreau/BirdCarreau.C
 viscosityModels/HerschelBulkley/HerschelBulkley.C
+viscosityModels/Casson/Casson.C
 
 transportModel/transportModel.C
 singlePhaseTransportModel/singlePhaseTransportModel.C
diff --git a/src/transportModels/incompressible/viscosityModels/Casson/Casson.C b/src/transportModels/incompressible/viscosityModels/Casson/Casson.C
new file mode 100644
index 00000000000..3f8d4423473
--- /dev/null
+++ b/src/transportModels/incompressible/viscosityModels/Casson/Casson.C
@@ -0,0 +1,126 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 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 "addToRunTimeSelectionTable.H"
+#include "surfaceFields.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace viscosityModels
+{
+    defineTypeNameAndDebug(Casson, 0);
+    addToRunTimeSelectionTable
+    (
+        viscosityModel,
+        Casson,
+        dictionary
+    );
+}
+}
+
+
+// * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
+
+Foam::tmp<Foam::volScalarField>
+Foam::viscosityModels::Casson::calcNu() const
+{
+    return max
+    (
+        nuMin_,
+        min
+        (
+            nuMax_,
+            sqr
+            (
+                sqrt
+                (
+                    tau0_
+                   /max
+                    (
+                        strainRate(),
+                        dimensionedScalar("VSMALL", dimless/dimTime, VSMALL)
+                    )
+                ) + sqrt(m_)
+            )
+        )
+    );
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::viscosityModels::Casson::Casson
+(
+    const word& name,
+    const dictionary& viscosityProperties,
+    const volVectorField& U,
+    const surfaceScalarField& phi
+)
+:
+    viscosityModel(name, viscosityProperties, U, phi),
+    CassonCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
+    m_(CassonCoeffs_.lookup("m")),
+    tau0_(CassonCoeffs_.lookup("tau0")),
+    nuMin_(CassonCoeffs_.lookup("nuMin")),
+    nuMax_(CassonCoeffs_.lookup("nuMax")),
+    nu_
+    (
+        IOobject
+        (
+            "nu",
+            U_.time().timeName(),
+            U_.db(),
+            IOobject::NO_READ,
+            IOobject::AUTO_WRITE
+        ),
+        calcNu()
+    )
+{}
+
+
+// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
+
+bool Foam::viscosityModels::Casson::read
+(
+    const dictionary& viscosityProperties
+)
+{
+    viscosityModel::read(viscosityProperties);
+
+    CassonCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
+
+    CassonCoeffs_.lookup("m") >> m_;
+    CassonCoeffs_.lookup("tau0") >> tau0_;
+    CassonCoeffs_.lookup("nuMin_") >> nuMin_;
+    CassonCoeffs_.lookup("nuMax_") >> nuMax_;
+
+    return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/transportModels/incompressible/viscosityModels/Casson/Casson.H b/src/transportModels/incompressible/viscosityModels/Casson/Casson.H
new file mode 100644
index 00000000000..cceedb6d088
--- /dev/null
+++ b/src/transportModels/incompressible/viscosityModels/Casson/Casson.H
@@ -0,0 +1,146 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 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::viscosityModels::Casson
+
+Description
+    An incompressible Casson non-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
+
+SourceFiles
+    Casson.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Casson_H
+#define Casson_H
+
+#include "viscosityModel.H"
+#include "dimensionedScalar.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace viscosityModels
+{
+
+
+/*---------------------------------------------------------------------------*\
+                           Class Casson Declaration
+\*---------------------------------------------------------------------------*/
+
+class Casson
+:
+    public viscosityModel
+{
+    // Private data
+
+        dictionary CassonCoeffs_;
+
+        dimensionedScalar m_;
+        dimensionedScalar tau0_;
+        dimensionedScalar nuMin_;
+        dimensionedScalar nuMax_;
+
+        volScalarField nu_;
+
+
+    // Private Member Functions
+
+        //- Calculate and return the laminar viscosity
+        tmp<volScalarField> calcNu() const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("Casson");
+
+
+    // Constructors
+
+        //- Construct from components
+        Casson
+        (
+            const word& name,
+            const dictionary& viscosityProperties,
+            const volVectorField& U,
+            const surfaceScalarField& phi
+        );
+
+
+    //- Destructor
+    virtual ~Casson()
+    {}
+
+
+    // Member Functions
+
+        //- Return the laminar viscosity
+        virtual tmp<volScalarField> nu() const
+        {
+            return nu_;
+        }
+
+        //- Return the laminar viscosity for patch
+        virtual tmp<scalarField> nu(const label patchi) const
+        {
+            return nu_.boundaryField()[patchi];
+        }
+
+        //- Correct the laminar viscosity
+        virtual void correct()
+        {
+            nu_ = calcNu();
+        }
+
+        //- Read transportProperties dictionary
+        virtual bool read(const dictionary& viscosityProperties);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace viscosityModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
-- 
GitLab