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

Program Behavior Different with "WM_COMPILE_OPTION=Debug"

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 20, 2014, 16:05
Default Program Behavior Different with "WM_COMPILE_OPTION=Debug"
  #1
Member
 
Eric M. Tridas
Join Date: May 2011
Location: Tampa, Florida
Posts: 48
Rep Power: 15
eric.m.tridas is on a distinguished road
Hi Guys,

I've been programming a library lately and ran into a seemingly impossible to find bug. I had been stuck for days when I decided to do fresh OF install with debugging enabled. After this install I recompiled my library and went to test it and it worked fine! This was very confusing to me and although I am happy the bug has seemingly disappeared I still want to know what the issue was.

Has anyone else ever ran into this type of issue?

Thanks,

Eric
eric.m.tridas is offline   Reply With Quote

Old   September 21, 2014, 13:16
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Eric,

Perhaps you've tripped on an Heisenbug? http://en.wikipedia.org/wiki/Heisenbug

From your description, that sort of bug usually happens because the programmer is not being careful enough with every single compilation step. For example:
  • If you did not rename the utility/solver/library in "Make/files" early enough during your development, you might be getting not one but 2 binaries of the same name in different paths. Try running:
    Code:
    ls -l $FOAM_USER_LIBBIN/libMyCustomLibrary.so
    ls -l $FOAM_LIBBIN/libMyCustomLibrary.so
    er, rename "libMyCustomLibrary" for your library's name - if the file exists at both locations, then only one of them is being picked up at loading time.
  • "libMyCustomLibrary" and "libmyCustomLibrary" is not the same thing!!! Notice the lower case "m"? That's more than enough for a problem.
  • Somewhat less common are issues related to initialization of variables. Assuming that a variable always starts with zero when it's created, e.g:
    Code:
    scalar myArea;
    this is extremely risky, since it might start off with "1.31242316e-234" instead of 0
Beyond this, the rule is usually simple and common to many professions, may it be for chefs, mechanics, programmers, laboratory scientists, and even any calculator users: always make sure you know and understand the initial conditions you're using, i.e. always keep your workbench clean!!

Best regards,
Bruno
__________________
wyldckat 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
Chemkin Forums? PSR.f program help? johnjohnmulley Main CFD Forum 2 August 5, 2013 08:53
error in program: mani.rajendiran Fluent UDF and Scheme Programming 0 March 22, 2012 12:25
Which opensource and free CAD program? Xwang Main CFD Forum 1 October 24, 2010 18:29
Update boundary conditions calculated by an external program CedricVH OpenFOAM 2 January 15, 2010 12:55
Problem in program tib FLUENT 0 January 28, 2004 15:13


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