21
Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy Sciences Department, Fluid Mechanics Division, Lund University

Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

  • Upload
    others

  • View
    16

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Non-Newtonian Models in OpenFOAM,

Implementation a non-Newtonian model

Naser Hamedi

Energy Sciences Department, Fluid Mechanics Division, Lund University

Page 2: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Contents

• Non-Newtonian fluids

• Non-Newtonian models in OpenFOAM

• TransportModels in OpenFOAM

• Casson model

• Shear rate

• Non-Newtonian solvers

• Adding Casson model to OpenFOAM

• Run the channel flow case

Page 3: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Non-Newtonian fluid

• . In Newtonian fluids, the strain shear rate is linearly

dependent to shear stress with a constant coefficient

which is called viscosity.

𝜏 = 𝜇 𝛾

• Fluids in which shear stress is not directly

proportional to deformation rate are non-Newtonian

flow.

• Examples: Toothpaste and paint.

Page 4: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Non-newtonian curves

Chhabra, R. P. and Richardson, J. F., Non-Newtonian flow in the process industries: Fundamentals

and engineering Applications. Butterworth-Heinemann, Oxford, (1999).

Page 5: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Non-Newtonian models in OpenFOAM

Non-Newtonian Model Mathematical Eq. Coefficient

powerLaw 𝜂 = 𝐾 𝛾𝑛−1K: Consistency index

𝛾: Shear rate

n: power law index

CrossPwerLaw 𝜂 =𝜂0−𝜂𝑖𝑛𝑓

1+ 𝑚 𝛾 𝑛+𝜂𝑖𝑛𝑓

m: time constant

𝜂0: lower bound viscosity

𝜂𝑖𝑛𝑓: upper bound viscosity

𝛾: Shear rate

HerschelBulckley 𝜂 = 𝜏𝑦 + 𝑘 𝛾 𝑛−1

𝜏𝑦: yield stress

𝑘: time constant

𝛾: Shear strain rate

BirdCarrea 𝜂 = 𝜂𝑖𝑛𝑓 + 𝜂0 − 𝜂𝑖𝑛𝑓 1 + 𝑘 𝛾 𝑛−1

k: time constant

𝜂0: lower bound viscosity

𝜂𝑖𝑛𝑓: upper bound viscosity

𝛾: Shear rate

viscosityModel in OpenFOAM is a defined as an abstract class (powerLaw, HerschelBuckley, etc).

Page 6: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

TransportModels in OpenFOAM

• The transport model library in OpenFOAM is classified into two

base classes, transport models and viscosity models.

• The role of the transport models is not transporting the

properties. On the other words, the viscosity is made accessible

by transport models.

• There are two implementations of transport model classes,singlePhaseTransportModel and

incompressibleTwoPhaseMixer.

• All of the single phase solvers in OpenFOAM uses singlePhaseTransportModel to calculate the viscosity

nu().

• additional data stored by incompressibleTwoPhaseMixer

Page 7: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Casson model

• Many models have been developed to describe the blood

viscosity. The Casson model is the most widely used

model to model the human blood:

• 𝜂 =𝜏𝑦

𝛾+ 𝑚

• η is the viscosity, τy is yield stress, 𝛾 is shear strain rate

(1/s) and m is consistency index.

Page 8: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Strain rate

• The shear strain rate (strainRate()) is a member

function in viscosityModel class which is defined in viscosityModel.C:

Foam::tmp<Foam::volScalarField>

Foam::viscosityModel::strainRate() const

{

return sqrt(2.0)*mag(symm(fvc::grad(U_)));

}

Page 9: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Non-Newtonian solvers in OpenFOAM

SimpleFoamSteady state solver for incompressible, turbulent flow of non-

Newtonian fluid

nonNewtonianIcoFoamTransient solver for incompressible, laminar flow of non-Newtonian

fluid

PISOFoamTransient solver for incompressible, turbulent flow of non-Newtonian

fluid

Page 10: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

nonNewtonianicoFoam

• The only difference between icoFoam and nonNewtonianIcoFoam

is the fluid (an object) which is defined in nonNewtonianIcoFoam to

access to all member functions and member data of singlephaseTransportModel.

• Fluid is defined in createField.H.

fvVectorMatrix UEqn

(

fvm::ddt(U)

+ fvm::div(phi, U)

- fvm::laplacian(fluid.nu(), U)

);

solve(UEqn == -fvc::grad(p))

Page 11: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Adding Casson model-1

• The viscosity models are located in:

$FOAM_SRC/transportModels/incompressible/viscosityModels

• To make a new viscosity model, first we make copy a viscosity model e.g. BirdCarrea model in a directory that we create

in the OpenFOAM installation:

cd $WM_PROJECT_DIR

cp -r --parents \ src/transportModels/incompressible/viscosityModels/BirdCarreau/ \

$WM_PROJECT_USER_DIR/

cd $WM_PROJECT_USER_DIR/src/transportModels/incompressible/viscosityModels

mv BirdCarreau Casson

cd Casson

mv BirdCarreau.C Casson.C

mv BirdCarreau.H Casson.H

sed -i s/BirdCarreau/Casson/g Casson.C

sed –i s/BirdCarreau/Casson/g Casson.H

Page 12: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Adding Casson model-2

• We also need Make/files and Make/options:

mkdir Make

• Create Make/files and add Casson model to it:

Casson.C

LIB = $(FOAM_USER_LIBBIN)/libCasson

• Create Make/options:

EXE_INC = \

-I$(LIB_SRC)/transportModels/incompressible/lnInclude \

-I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS = \

-lfiniteVolume

Page 13: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Adding Casson model-2

• In Casson.C to define the viscosity function:

return max

(

nuMin_,

min

(

nuMax_,

pow

(

pow(

tau0_/max

(

strainRate(),

dimensionedScalar("VSMALL", dimless/dimTime, VSMALL)

),0.5

)

+pow(m_,0.5)

,

scalar(2.0)

)

)

);

𝜂 =𝜏𝑦

𝛾+ 𝑚

• The key note to define the Casson non-Newtonian model is defining the values in which the model

function shows singularity.

• We have to define some values for the viscosity in very high value (as nuMax) and very low value (as

nuMin).

Page 14: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Adding Casson model-3

• In Casson.C to define the constructors:

m_(CassonCoeffs_.lookup("m")),

tau0_(CassonCoeffs_.lookup("tau0")),

nuMin_(CassonCoeffs_.lookup("nuMin")),

nuMax_(CassonCoeffs_.lookup("nuMax")),

CassonCoeffs_.lookup("m") >> m_;

CassonCoeffs_.lookup("tau0") >> tau0_;

CassonCoeffs_.lookup("nuMin") >> nuMin_;

CassonCoeffs_.lookup("nuMax") >> nuMax_;

• In Casson.C to define the member functions:

• In Casson.H in class Casson decleration:

dimensionedScalar m_;

dimensionedScalar tau0_;

dimensionedScalar nuMin_;

dimensionedScalar nuMax_;

• To compile: wmake libso

Page 15: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Run the 2D-channel flow case

• Channel 50×1×0.1 (m3)

• Long enough channel length to have fully-developed velocity profile

• The discretized domain was created in ANSYS ICEM and exported with .msh extension.

• To export in OpenFOAM:

fluentMeshtoFoam fluent.msh

Name of the file

Page 16: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

0/pFoamFile

{

version 2.0;

format ascii;

class volScalarField;

object p;

}

// * * * * * * * * * * * * * * * * * * * * * *

* * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField

{

INLET

{

type zeroGradient;

}

OUTLET

{

type fixedValue;

value uniform 0;

}

FIXED_WALLS

{

type zeroGradient;

}

FRONT_AND_BACK

{

type empty;

}

}

//

****************************************

********************************* //

Page 17: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

0/Udimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField

{

INLET

{

type fixedValue;

value uniform (1 0 0);

}

OUTLET

{

type zeroGradient;

}

FIXED_WALLS

{

type fixedValue;

value uniform (0 0 0);

}

FRONT_AND_BACK

{

type empty;

}

}

Page 18: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Run the 2D-channel flow case

• In constant/transportProperties we add:

transportModel Casson;

.

.

.

.

CassonCoeffs

{

m m [ 0 2 -1 0 0 0 0 ] 0.00414;

tau0 tau0 [0 2 -2 0 0 0 0] 0.0038;

nuMin nuMin [0 2 -1 0 0 0 0] 0.0001;

nuMax nuMax [0 2 -1 0 0 0 0] 100;

}

Page 19: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Run the 2D-channel flow case

• In system/controlDict:

application nonNewtonianIcoFoam;.

.

.

.

libs

(

"libCasson.so"

);

• And finally:

nonNewtonianIcoFoam

Page 20: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Results

INLET

Page 21: Non-Newtonian Models in OpenFOAM, Implementation a non ...hani/kurser/OS_CFD_2014/Naser... · Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy

Naser HamediEmail: [email protected]