Non-Newtonian Models in OpenFOAM, Implementation a non-Newtonian model Naser Hamedi Energy Sciences Department, Fluid Mechanics Division, Lund University
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
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.
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).
Non-Newtonian models in OpenFOAM Non-Newtonian Model Mathematical Eq. Coefficient K: Consistency index 𝛿 𝑜−1 𝜃 = 𝐿 𝛿: Shear rate powerLaw n: power law index m: time constant 𝜃 0 : lower bound viscosity 𝜃 0 −𝜃 𝑗𝑜𝑔 𝜃 = 𝛿 𝑜 + 𝜃 𝑗𝑜𝑔 CrossPwerLaw 𝜃 𝑗𝑜𝑔 : upper bound viscosity 1+ 𝑛 𝛿: Shear rate 𝜐 𝑧 : yield stress 𝛿 𝑜−1 𝜃 = 𝜐 𝑧 + 𝑙 𝑙 : time constant HerschelBulckley 𝛿: Shear strain rate k: time constant 𝜃 0 : lower bound viscosity 𝛿 𝑜−1 𝜃 = 𝜃 𝑗𝑜𝑔 + 𝜃 0 − 𝜃 𝑗𝑜𝑔 1 + 𝑙 BirdCarrea 𝜃 𝑗𝑜𝑔 : upper bound viscosity 𝛿: Shear rate viscosityModel in OpenFOAM is a defined as an abstract class ( powerLaw, HerschelBuckley , etc).
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
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 shear strain rate • η is the viscosity, τ y is yield stress, (1/s) and m is consistency index.
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_))); }
Non-Newtonian solvers in OpenFOAM Steady state solver for incompressible, turbulent flow of non- SimpleFoam Newtonian fluid Transient solver for incompressible, laminar flow of non-Newtonian nonNewtonianIcoFoam fluid Transient solver for incompressible, turbulent flow of non-Newtonian PISOFoam fluid
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))
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
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
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).
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")), • In Casson.C to define the member functions: CassonCoeffs_.lookup("m") >> m_; CassonCoeffs_.lookup("tau0") >> tau0_; CassonCoeffs_.lookup("nuMin") >> nuMin_; CassonCoeffs_.lookup("nuMax") >> nuMax_; • In Casson.H in class Casson decleration: dimensionedScalar m_; dimensionedScalar tau0_; dimensionedScalar nuMin_; dimensionedScalar nuMax_; • To compile: wmake libso
Run the 2D-channel flow case • Channel 50 × 1 × 0.1 (m 3 ) • 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
0/p FoamFile { FIXED_WALLS version 2.0; { format ascii; type zeroGradient; class volScalarField; } object p; } // * * * * * * * * * * * * * * * * * * * * * * FRONT_AND_BACK * * * * * * * * * * * * * * * // { type empty; dimensions [0 2 -2 0 0 0 0]; } internalField uniform 0; } boundaryField // { **************************************** INLET ********************************* // { type zeroGradient; } OUTLET { type fixedValue; value uniform 0; }
0/U dimensions [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; } }
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; }
Run the 2D-channel flow case • In system/controlDict: application nonNewtonianIcoFoam; . . . . libs ( "libCasson.so" ); • And finally: nonNewtonianIcoFoam
Results INLET
Naser Hamedi Email: naser.hamedi@energy.lth.se
Recommend
More recommend