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

Logarithm for volScalarField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2016, 14:12
Default Logarithm for volScalarField
  #1
New Member
 
Akash
Join Date: Jun 2014
Location: Oslo
Posts: 29
Rep Power: 11
pakanatiakash is on a distinguished road
Hi All

I am working on a multiphase solidification model and I need to construct a drag model taking into grain motion during solidification of binary alloys.

So I obtain reynolds number (volScalarField) from the velocity fields of solid and liquid. To obtain the drag coefficient, I need to have an expression like log10(Reynolds). So when I use this, the code compiles. But when I run the simulation I get the following error -

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 log10 in "/lib/x86_64-linux-gnu/libm.so.6"
#4 Foam::log10(Foam::dimensioned<double> const&) at ??:?
#5 ? at ??:?
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? at ??:?
Floating point exception (core dumped)

I am assuming this not the way to calculate logarithmic expressions. Can somebody guide me through this?

Thanks
Akash
pakanatiakash is offline   Reply With Quote

Old   April 2, 2016, 15:39
Default
  #2
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,

(obvious) Are you sure Reynolds field is positive? FPE suggests contrary.
alexeym is offline   Reply With Quote

Old   April 2, 2016, 15:45
Default
  #3
New Member
 
Akash
Join Date: Jun 2014
Location: Oslo
Posts: 29
Rep Power: 11
pakanatiakash is on a distinguished road
Its small (order 1e-4) but certainly positive.
pakanatiakash is offline   Reply With Quote

Old   April 2, 2016, 15:52
Default
  #4
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
Surely you can set up 1D problem with 10 cells and post output of

Code:
Info<< Reynolds << endl
here (just to verify). log10 over field uses standard log10 from cmath, according to "man log10" it raises FPE only when argument is +-0 or <0.
alexeym is offline   Reply With Quote

Old   April 2, 2016, 16:03
Default
  #5
New Member
 
Akash
Join Date: Jun 2014
Location: Oslo
Posts: 29
Rep Power: 11
pakanatiakash is on a distinguished road
Rel: 5.67461e-05
Rel: 5.67461e-05
Rel: 0.000116924
Rel: 0.000116924
Rel: 0.000114174
Rel: 0.000114174
Rel: 0.000117549
Rel: 0.000117549
Rel: 0.000113562
Rel: 0.000113562
Rel: 0.000122217
Rel: 0.000122217

The values are correct (with some slight error ofcourse) as I have verified with the analytical model.
pakanatiakash is offline   Reply With Quote

Old   April 2, 2016, 16:33
Default
  #6
New Member
 
Akash
Join Date: Jun 2014
Location: Oslo
Posts: 29
Rep Power: 11
pakanatiakash is on a distinguished road
So yea, I got the error. A numerical parameter in my code was the issue. This was setting Reynolds number to zero in some cells. Anyways, thanks for the help

Cheers
Akash
pakanatiakash is offline   Reply With Quote

Old   April 2, 2016, 16:38
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,

Since your output differs from standard volScalarField output:

Code:
dimensions      [0 0 0 0 0 0 0];

internalField   nonuniform List<scalar> 
10
(
...
)
;

boundaryField
{
...
boundaries
...
}
I assume, you are trying to hide something (as I have EXPLICITLY asked for Info<< Reynolds).

Also you can try running debug build to see where exactly (up to line number) you have problem.
alexeym 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
natural logarithm function zhoubinwx OpenFOAM Programming & Development 8 July 5, 2010 06:13
Could you tell me how to use logarithm function ( fanjl Phoenics 4 February 9, 2005 11:25


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