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

new viscosity model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2015, 08:50
Default new viscosity model
  #1
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
Hello,
I try to implement a new temperature dependent viscosity model in which nu=a*exp(b/T)+c.Here is my code to calculate the viscosity.
Quote:
Foam::viscosityModels::TDepLaw::calcNu() constant
{
const volScalarField& T=U_.mesh().lookupObject<volScalarField>("T");
return (a_*exp(b_/T)+c_)
}
But it seems that the exp(b_/T) is not right.How can i calculate the viscosity at every cell by the a*exp(b/T)+c?
Many thanks,
Nemo.
huyidao is offline   Reply With Quote

Old   April 14, 2015, 08:59
Default
  #2
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
return (a_*exp(b_/T)+c_);
try to add the ;
kebsiali is offline   Reply With Quote

Old   April 14, 2015, 09:17
Default
  #3
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Quote:
Originally Posted by huyidao View Post
But it seems that the exp(b_/T) is not right.How can i calculate the viscosity at every cell by the a*exp(b/T)+c?
And what are the types of a_, b_, and c_? If b_ is just scalar, then b_/T has units K^-1 and transcendent functions are only defined for dimensionless arguments. Also can you express "But it seems that the exp(b_/T) is not right" in compiler error?
alexeym is offline   Reply With Quote

Old   April 14, 2015, 09:17
Default
  #4
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
I am sorry,my carelessness.in the code there is a ; ,and the code can be compiled successfully.
huyidao is offline   Reply With Quote

Old   April 14, 2015, 09:23
Default
  #5
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
why did you change the original post
you make me look stupid lol
kebsiali is offline   Reply With Quote

Old   April 14, 2015, 09:30
Default
  #6
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,



And what are the types of a_, b_, and c_? If b_ is just scalar, then b_/T has units K^-1 and transcendent functions are only defined for dimensionless arguments. Also can you express "But it seems that the exp(b_/T) is not right" in compiler error?
In the file transportproperties,I define the a_ and c_ has the same unit with nu,and b_ has the same unit with T.It can be compiled successfully.But when i run a simple Case,here are the errors
Quote:
Selecting incompressible transport model TDepLaw
#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) at ??:?
#4 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:perator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#5 Foam::viscosityModels::tempDepExp::calcNu() const at ??:?
#6 Foam::viscosityModels::tempDepExp::tempDepExp(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::adddictionaryConstructorToTa ble<Foam::viscosityModels::tempDepExp>::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::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 ??:?
#9 Foam::singlePhaseTransportModel::singlePhaseTransp ortModel(Foam::GeometricField<Foam::Vector<double> , Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:?
#10
at ??:?
#11 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12
at ??:?
Floating point exception (core dumped)
huyidao is offline   Reply With Quote

Old   April 14, 2015, 09:36
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

As the error is in Foam::divide, in general it is division by zero. Also in general T is greater than zero. In your case it seems not to be the case. To avoid division by zero, you can write denominator as T + Tsmall, where Tsmall is small dimensioned value with temperature units.

Also the error can indicate diverging solution, wrong initial or boundary conditions.
alexeym is offline   Reply With Quote

Old   April 14, 2015, 09:39
Default
  #8
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
I presume you followed the example that implemented the temperature dependant power law
meaning you declared a,b like he did with kslope and Tbase
if not? explain what you did
one more thing, can you specify what you did in transportProperties?
kebsiali is offline   Reply With Quote

Old   April 14, 2015, 09:53
Default
  #9
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
Hello kebsiali,I implented the viscosity model followed by this http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf
,and i think i have found my mistake,i set the temperature inlet boundary condition to 0 which is not right.
Thank you so much,alexeym and kebsiali.
huyidao 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 07:18
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
Validity of Sutherland's viscosity model for high-T gases tatu Main CFD Forum 1 March 6, 2013 12:00
modelling solids viscosity in eulerian multiphase model derkaiser FLUENT 1 December 5, 2011 03:42
Casson Viscosity model as one user define function Zahra Rahmdel FLUENT 0 November 6, 2004 05:53


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