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

Speed difference of "scalar, label" with"double, int"

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By GerhardHolzinger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2015, 05:31
Default Speed difference of "scalar, label" with"double, int"
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 848
Rep Power: 18
sharonyue is on a distinguished road
Hi guys,

We know that in OpenFOAM we can use label instead of int and scalar instead of double. If we just wanna to use the simple mathematical manipulation.

Is the code using double or int faster than scalar of label?

Or...std::cout is faster than Info?

Cause for now Im solving population balance model. For a mesh with 17m cells. It uses 3.12s to calculate the source term(only some tedious algebraic manipulation). 1.29 to solve NS equations. 0.29s to solve moments equations.

Thanks,
__________________
My OpenFOAM algorithm website: http://dyfluid.com
By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam
We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html
sharonyue is offline   Reply With Quote

Old   April 25, 2017, 08:04
Default
  #2
New Member
 
Lukas Lebovitz
Join Date: Mar 2017
Location: Zürich, Switzerland
Posts: 25
Rep Power: 9
lukas.lebo is on a distinguished road
Hey did you ever find out more about this? Label/Scalar vs Int/Double?
lukas.lebo is offline   Reply With Quote

Old   April 25, 2017, 09:00
Default
  #3
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Quote:
Originally Posted by sharonyue View Post
Hi guys,

We know that in OpenFOAM we can use label instead of int and scalar instead of double. If we just wanna to use the simple mathematical manipulation.

Is the code using double or int faster than scalar of label?

Or...std::cout is faster than Info?

Thanks,
The data type label is an int, depending on your settings either 32 or 64 bit long.
The data type scalar is a floating point number, depending on your compiler settings, either a float (32bit) or double (64bit).

Study the source code in $FOAM_SRC/OpenFOAM/primitives/ints and $FOAM_SRC/OpenFOAM/primitives/Scalar

The Info keyword, widely used in OpenFOAM, at some point will use std::cout.

So, label, scalar and Info is there for our convenience. There should be no performance penalty.
vivek05 and openfoam_aero like this.
GerhardHolzinger 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
[snappyHexMesh] snappyHexMesh and cyclic boundaries Ruli OpenFOAM Meshing & Mesh Conversion 2 December 9, 2013 07:51
operation speed Difference between 32bit & 64bit IUIU FLUENT 1 February 9, 2011 23:06
Parallel with Windoze, speed difference between PV Charles CFX 3 March 10, 2005 02:25


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