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

Temperature dependent viscosity model

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By masahiroT
  • 1 Post By atulkjoy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2018, 04:50
Default Temperature dependent viscosity model
  #1
New Member
 
masahiro T
Join Date: Jul 2018
Posts: 1
Rep Power: 0
masahiroT is on a distinguished road
Hi all

I have a problem with a task.Please help me.

I added temperature equation in interfoam.
And, I modified the powerlaw to make temperature dependence on the viscosity.
(Temperature dependence changes at a certain temperature)


this is a part of temppowerLaw.C

//------------------------------------------------------------------------------
Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::temppowerLaw::calcNu() const
{
const volScalarField& T= U_.mesh().lookupObject<volScalarField>("T");

volScalarField nunu
(
IOobject
(
"nunu",
U_.mesh().time().timeName(),
U_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
U_.mesh(),
dimensionedScalar("nunu", dimensionSet(0,2,-1,0,0,0,0),0.1),
"zeroGradient"
);
forAll(T,celli)
{
if (T[celli] > Tswch_.value())
{
nu0_.value()/rho0_.value()*(Foam::exp(k_.value()/T[celli]);
}
else
{

(AA_.value()*pow(T[celli],3)+BB_.value()*pow(T[celli],2)+CC_.value()*T[celli]+DD_.value())/rho0_.value(); }
}
return nunu;
}
-------------------------------------------------------------------------------------------------------------------------

I can compile it but, I get an printstack error when I run.



Selecting incompressible transport model temppowerLaw
#0 Foam::error:rintStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/printStack.C:221
#1 Foam::sigSegv::sigHandler(int) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/signals/sigSegv.C:56
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::List<double>::List(Foam::List<double> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/List.C:107
#4 Foam::Field<double>::Field(Foam::Field<double> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/Field.C:201
#5 Foam:imensionedField<double, Foam::volMesh>:imensionedField(Foam::IOobject const&, Foam:imensionedField<double, Foam::volMesh> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/DimensionedField.C:192 (discriminator 2)
#6 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricField.C:486
#7 Foam::viscosityModels::temppowerLaw::temppowerLaw( 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 ~/OpenFOAM/vmg-2.3.0/src/transportModels/incompressible2/viscosityModels/temppowerLaw/temppowerLaw.C:125 (discriminator 6)
#8 Foam::viscosityModel::adddictionaryConstructorToTa ble<Foam::viscosityModels::temppowerLaw>::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 ~/OpenFOAM/OpenFOAM-2.3.0/src/transportModels/incompressible/lnInclude/viscosityModel.H:96 (discriminator 2)
#9 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 ~/OpenFOAM/vmg-2.3.0/src/transportModels/incompressible2/viscosityModels/viscosityModel/viscosityModelNew.C:61
#10 Foam::myIncompressibleTwoPhaseMixture_kappa::myInc ompressibleTwoPhaseMixture_kappa(Foam::GeometricFi eld<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/vmg-2.3.0/src/transportModels/incompressible2/myIncompressibleTwoPhaseMixture_kappa/myIncompressibleTwoPhaseMixture_kappa.C:117 (discriminator 18)
#11
at ~/OpenFOAM/vmg-2.3.0/applications/solvers/multiphase/interTempFoam_kappa/createFields.H:51
#12 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13
at ??:?


I have no idea how to solve this problem.

Could anybody please help me

I use version 2.3.0 best regards
atulkjoy likes this.
masahiroT is offline   Reply With Quote

Old   July 20, 2018, 03:37
Default
  #2
Member
 
Atul Kumar
Join Date: Dec 2015
Location: National Centre for Combustion Research and Development
Posts: 48
Rep Power: 10
atulkjoy is on a distinguished road
Quote:
Originally Posted by masahiroT View Post
Hi all

I have a problem with a task.Please help me.

I added temperature equation in interfoam.
And, I modified the powerlaw to make temperature dependence on the viscosity.
(Temperature dependence changes at a certain temperature)


this is a part of temppowerLaw.C

//------------------------------------------------------------------------------
Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::temppowerLaw::calcNu() const
{
const volScalarField& T= U_.mesh().lookupObject<volScalarField>("T");

volScalarField nunu
(
IOobject
(
"nunu",
U_.mesh().time().timeName(),
U_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
U_.mesh(),
dimensionedScalar("nunu", dimensionSet(0,2,-1,0,0,0,0),0.1),
"zeroGradient"
);
forAll(T,celli)
{
if (T[celli] > Tswch_.value())
{
nu0_.value()/rho0_.value()*(Foam::exp(k_.value()/T[celli]);
}
else
{

(AA_.value()*pow(T[celli],3)+BB_.value()*pow(T[celli],2)+CC_.value()*T[celli]+DD_.value())/rho0_.value(); }
}
return nunu;
}
-------------------------------------------------------------------------------------------------------------------------

I can compile it but, I get an printstack error when I run.



Selecting incompressible transport model temppowerLaw
#0 Foam::error:rintStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/printStack.C:221
#1 Foam::sigSegv::sigHandler(int) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/signals/sigSegv.C:56
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::List<double>::List(Foam::List<double> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/List.C:107
#4 Foam::Field<double>::Field(Foam::Field<double> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/Field.C:201
#5 Foam:imensionedField<double, Foam::volMesh>:imensionedField(Foam::IOobject const&, Foam:imensionedField<double, Foam::volMesh> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/DimensionedField.C:192 (discriminator 2)
#6 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricField.C:486
#7 Foam::viscosityModels::temppowerLaw::temppowerLaw( 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 ~/OpenFOAM/vmg-2.3.0/src/transportModels/incompressible2/viscosityModels/temppowerLaw/temppowerLaw.C:125 (discriminator 6)
#8 Foam::viscosityModel::adddictionaryConstructorToTa ble<Foam::viscosityModels::temppowerLaw>::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 ~/OpenFOAM/OpenFOAM-2.3.0/src/transportModels/incompressible/lnInclude/viscosityModel.H:96 (discriminator 2)
#9 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 ~/OpenFOAM/vmg-2.3.0/src/transportModels/incompressible2/viscosityModels/viscosityModel/viscosityModelNew.C:61
#10 Foam::myIncompressibleTwoPhaseMixture_kappa::myInc ompressibleTwoPhaseMixture_kappa(Foam::GeometricFi eld<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/vmg-2.3.0/src/transportModels/incompressible2/myIncompressibleTwoPhaseMixture_kappa/myIncompressibleTwoPhaseMixture_kappa.C:117 (discriminator 18)
#11
at ~/OpenFOAM/vmg-2.3.0/applications/solvers/multiphase/interTempFoam_kappa/createFields.H:51
#12 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13
at ??:?


I have no idea how to solve this problem.

Could anybody please help me

I use version 2.3.0 best regards

Check with T.ref()[cellI] rather than T[cellI]
also try to change in

I got sort same error while I had written Chapman-Enscog model of transport in src/ThermoPhysicalModel/species/Transport/chapman

Please see implementation
Attached Files
File Type: gz chapman.tar.gz (2.9 KB, 27 views)
Zhiheng Wang likes this.
atulkjoy is offline   Reply With Quote

Reply


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
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 40 January 27, 2023 08:18
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Problems in converging viscosity UDF dependent upon strain rate and temperature. alexskerhut Fluent UDF and Scheme Programming 1 March 17, 2016 08:19
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion faizan_habib7 CFX 4 February 1, 2016 18:00
Time and temperature dependent viscosity sur4j OpenFOAM 16 January 12, 2015 01:56


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