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

Algeabraic operation with #calc

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 24, 2013, 14:09
Default Algeabraic operation with #calc
  #1
Senior Member
 
Canakkale Dardanelspor
Join Date: Aug 2012
Posts: 135
Rep Power: 13
HakikiCanakkaleli is on a distinguished road
Hi

== 1 ==
#calc, used in blockMeshDict context, seems to give different answers for the following:

== 2 ==

b 4;
c 3;
d 10;

// First one-line calculation
a #calc "b / d * c";

// Second one-line calculation
a #calc "(b * c) / d";

== 3 ==
I could not find any reasoning behind the difference; therefore, I thought it would be better to consider it as a small bug.
HakikiCanakkaleli is offline   Reply With Quote

Old   November 25, 2013, 04:54
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
You don't include the answers you get in your post, which would help debugging a lot. I'm guessing integer division is to blame.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   November 25, 2013, 05:34
Default
  #3
Senior Member
 
Join Date: Dec 2011
Posts: 111
Rep Power: 19
haakon will become famous soon enough
You could try to define b, c and d as scalars:

Code:
b 4.0;
c 3.0;
d 10.0;
and follow up with a detailed description of the input files and the error if it does not solve your problem.
haakon is offline   Reply With Quote

Reply

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
complex number operation in udf? hongxiao FLUENT 5 June 14, 2017 15:11
operation pressure and pressure outlet BC Lilly FLUENT 4 May 8, 2013 10:57
How to define the edge after Boolean Operation Jeffrey FLUENT 0 May 14, 2007 07:51
Initalization fails with Operation Pressure = 0 Pa Tobias FLUENT 3 October 31, 2005 10:02
Rotation flow calc. II. Andy Christian Main CFD Forum 2 April 10, 2003 05:06


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