CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Temperature dependent viscosity (Carreau-Yasuda)

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 6, 2016, 09:48
Default Temperature dependent viscosity (Carreau-Yasuda)
  #1
New Member
 
Join Date: Apr 2016
Posts: 13
Rep Power: 6
open is on a distinguished road
New OpenFoam (2.4) user!

As per the title... I wish to use a temperature dependent viscosity model. I've seen various posts and papers on this so I've followed the example modifying the power law - that compiles ok.

My next step was to take the BirdCarreau and modify to suit Carreau-Yasuda:
Quote:
u=u0 * alpha * [lambda * alpha * strainrate + 1]^((n-1)/2)
alpha = exp[beta * (1/T - 1/Tref)]
TempCarreauYasuda.C (header also modified)
Code:
Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::TempCarreauYasuda::calcNu() const
{
    const volScalarField& T= U_.mesh().lookupObject<volScalarField>("T"); 

    return max
    (
    nuInf_,

        nu0_ * Foam::exp(beta_ * (1.0/T - 1.0/Tref_) )
    *pow(lambda_ * Foam::exp(beta_ * (1.0/T - 1.0/Tref_) ) * strainRate() + scalar(1), (n_ - 1.0)/a_)

    );
}
transportProperties
Code:
TempCarreauYasudaCoeffs
{
    nu0             nu0 [ 0 2 -1 0 0 0 0 ] 7.191; // 5645/rho
    nuInf           nuInf [ 0 2 -1 0 0 0 0 ] 1.2739e-03; // 1/rho
    lambda          lambda [ 0 0 -1 0 0 0 0 ] 0.28;
    n               n [ 0 0 0 0 0 0 0 ] 0.61;
    beta            beta [ 0 0 0 1 0 0 0 ] 6330.0;
    Tref            Tref [ 0 0 0 1 0 0 0 ] 473.15;
    a               a [ 0 0 0 0 0 0 0 ] 2.0; // can omit as will default to 2
}
Question 1: how can I define
Code:
Foam::exp(beta_ * (1.0/T - 1.0/Tref_) )
as a variable to avoid repetition?

Question 2: The code compiles without error. Why is the following error occurring:
Code:
Selecting incompressible transport model TempCarreauYasuda


--> FOAM FATAL ERROR: 
LHS and RHS of + have different dimensions
     dimensions : [0 0 -2 0 0 0 0] + [0 0 0 0 0 0 0]


    From function operator+(const dimensionSet&, const dimensionSet&)
    in file dimensionSet/dimensionSet.C at line 478.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::operator+(Foam::dimensionSet const&, Foam::dimensionSet const&) at ??:?
#3  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator+<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::dimensioned<double> const&) at ??:?
#4  Foam::viscosityModels::TempCarreauYasuda::calcNu() const at ??:?
#5  Foam::viscosityModels::TempCarreauYasuda::TempCarreauYasuda(Foam::word const&, Foam::dictionary const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:?
#6  Foam::viscosityModel::adddictionaryConstructorToTable<Foam::viscosityModels::TempCarreauYasuda>::New(Foam::word const&, Foam::dictionary const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:?
#7  Foam::viscosityModel::New(Foam::word const&, Foam::dictionary const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:?
#8  Foam::singlePhaseTransportModel::singlePhaseTransportModel(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:?
#9  ? at ??:?
#10  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11  ? at ??:?
It looks like a dimension problem but I'm not sure why.
open is offline   Reply With Quote

Old   May 6, 2016, 10:01
Default
  #2
New Member
 
Join Date: Apr 2016
Posts: 13
Rep Power: 6
open is on a distinguished road
Question 2 is resolved... I notice that I specified incorrect units in the transportProperties.

The full source code is attached (no guarantees) to help other beginners.

Still looking for guidance with the first question.
Attached Files
File Type: gz tempCarreauYasuda.tar.gz (2.5 KB, 29 views)
open is offline   Reply With Quote

Old   May 9, 2016, 03:51
Default
  #3
Member
 
Join Date: Sep 2014
Location: Germany
Posts: 88
Rep Power: 8
TobM is on a distinguished road
Do you mean something like that?

Code:
Foam::tmp<Foam::volScalarField> 
Foam::viscosityModels::TempCarreauYasuda::calcNu() const 
{
    const volScalarField& T= U_.mesh().lookupObject<volScalarField>("T");
    volScalarField test = Foam::exp(beta_ * (1.0/T - 1.0/Tref_) );      
    return max
    (
        nuInf_, 
        nu0_ * Foam::exp(beta_ * (1.0/T - 1.0/Tref_) )
      * pow(lambda_ * test * strainRate() + scalar(1), (n_ - 1.0)/a_)      
    );
 }
I hope it works...
TobM is offline   Reply With Quote

Old   June 21, 2016, 09:35
Default
  #4
New Member
 
Join Date: Apr 2016
Posts: 13
Rep Power: 6
open is on a distinguished road
Quote:
Originally Posted by TobM View Post
I hope it works...
Forgot to post back; yes works, and thank you for your help.
open is offline   Reply With Quote

Reply

Tags
openfoam, temperature, viscosity

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Temperature dependent SURFACE TENSION TEMPERATURE COEFFICIENT kcgmech Fluent UDF and Scheme Programming 1 November 22, 2016 18:01
Adding new temperature dependent viscosity model vabishek OpenFOAM Programming & Development 3 May 15, 2016 22:05
Temperature dependent density in transportProperties when using polynomials GregorAlan OpenFOAM Running, Solving & CFD 0 February 11, 2016 06:29
Temperature dependent Non-Newtonian viscosity UDF cric92 Fluent UDF and Scheme Programming 0 April 14, 2013 07:31
Pressure & Temperature dependent EOS hennas FLUENT 1 October 31, 2011 18:55


All times are GMT -4. The time now is 17:25.