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

Segmentation fault

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 6, 2005, 20:28
Default Dear Sirs, After migrating f
  #1
Luiz Eduardo Bittencourt Sampaio (Sampaio)
Guest
 
Posts: n/a
Dear Sirs,
After migrating from Foam to OpenFoam, a strange thing happened: a new library that used to run nice in old Foam, is presenting a segmentation fault when it is called. Can anyone help me with this?

My library is a v2f model (kev2f.C), under directory $WM_PROJECT_USER_DIR/run/myturbmodels/kev2f/kev2f.C

My Make/files under this directory (.../kev2f) is:
"
kev2f/kev2f.C
kEpsilon/kEpsilon.C

LIB = $(FOAM_USER_LIBBIN)/libmyturbmodels
"

My Make/options in the same directory is:
"
EXE_INC = \
-I$(LIB_SRC)/cfdTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/turbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels

LIB_LIBS = \
-lcfdTools \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lmeshTools
"

As suggested in User Guide, I copied the foamUser dir to my applications dir ($WM_PROJECT_USER_DIR/applications), and there, in the foamUser/Make, my files and options looks like this:

file:
"
libfoamUser.C
LIB = $(FOAM_LIBBIN)/libfoamUser
"

options:
"
LIB_LIBS = \
-L$(FOAM_USER_LIBBIN) -lmyturbmodels
"

There was no problem in compilation, but I get a segmentation fault when I tried to run.
Can anyone help me?

Regards,
Luiz
  Reply With Quote

Old   January 7, 2005, 03:36
Default It's very hard to know what i
  #2
Henry Weller (Henry)
Guest
 
Posts: n/a
It's very hard to know what is going wrong from what you have written without having the code to play with. Probably the best thing would be finish it off, pack it up and send it over and I will have a play with it when I get a moment.

Henry
  Reply With Quote

Old   January 7, 2005, 03:44
Default Here's what I do when I have
  #3
Niklas Nordin (Niklas)
Guest
 
Posts: n/a
Here's what I do when I have this problem. It will probably help u 2.

1. make sure you get a core-dump: i.e. unlimit
2. setenv SIGFPE 1
3. run the case to produce the 'core'-file
4. analyze the core with gdb: gdb whateverFoam core, where 'whateverFoam' is the name of your code
5. in gdb type 'where'

it should tell you which line it crashed, it's also a good idea when you write new code to use the Debug setup, instead of the Opt, since this will give you alot more info.

N
  Reply With Quote

Old   January 10, 2005, 05:02
Default This is what I usually do whe
  #4
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
This is what I usually do when debugging memory faults:

Add in Make/options to the EXE_INC variable

-DFULLDEBUG -g -O0

The FULLDEBUG switch causes all the containers to compile with index checking. (This works only for those files that are being recompiled)

Try to produce a core file, see which routine is the culprit and copy its source file(s) into the local directory and add them to the Make/files list.

Also valgrind can be very useful.

Mattijs
  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
[Technical] Segmentation fault in map msg30 OpenFOAM Meshing & Mesh Conversion 6 March 27, 2008 10:49
Segmentation fault billy OpenFOAM Installation 20 April 23, 2007 22:57
segmentation fault natesan Siemens 4 January 12, 2004 08:51
Segmentation fault Veebs Siemens 3 June 4, 2002 22:17
Segmentation fault Jose Sanchez Siemens 1 December 16, 2001 08:13


All times are GMT -4. The time now is 03:33.