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

Immediate Segmentation fault when running new solver

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

Like Tree1Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   June 29, 2016, 15:03
Default Immediate Segmentation fault when running new solver
  #1
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
I am experimenting with writing my own solver, but I am having trouble running a copy of a standard openFoam solver. I am using foam extend 3.2 and all I have done is to copy and make the simpleFoam solver into my_simpleFoam solver located in $FOAM_USER_APPBIN. The wmake proceeded without any evident problems, but now when I run my_simpleFoam i immediately get greeted with 'Segmentation fault'

I have absolutely no idea how to proceed! Any help would be much appreciated!
Jack001 is offline   Reply With Quote

Old   June 29, 2016, 15:07
Default
  #2
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Jack,

if you did it like you told, there should not be a error. The best way is to delete your solver, copy paste again and try.

  • Change the name of *.C file
  • Change the name of application and needed C file in Make/files and change the path as you already did
  • compile it
I also recommend that after you copied the solver, go inside and wclean it first, or remove the *dep and Make/linux*** folders/file.

All in all this will take less than 1 minute and would be easier for you and all who want to give you support (: because you did not provide enough information (it could be everything that causes this error).

Good luck
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 29, 2016, 15:21
Default
  #3
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
Hi Tobi,

Sorry, I got a bit ahead of myself, here is everything I have done as you suggest. I have repeated the following steps a few times now (I delete the directory and remove the binary executable created each time ) but the result is still the same!

I am currently inside $WM_PROJECT_USER/applications/solvers

Code:
cp -r $FOAM_SOLVERS/incompressible/simpleFoam .
mv simpleFoam my_simpleFoam
cd my_simpleFoam
wclean
mv simpleFoam.C my_simpleFoam.C
go inside Make/files and change to

Code:
my_simpleFoam.C

EXE = $(FOAM_USER_APPBIN)/my_simpleFoam
execute wmake. Now if we do ls $FOAM_USER_APPBIN we see the compiled application executable!

Now we just want to test run my_simpleFoam by typing the this name at the command line. The result is a segmentation fault! I am not expecting this since the standard simpleFoam solver that is already compiled can be run (but obviously crashes because it can't find a controlDict)

Any ideas?
Jack001 is offline   Reply With Quote

Old   June 29, 2016, 15:59
Default
  #4
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

well I am very familiar with compiling and FOAM but this is somehow wired. Just one thing that I could imagine ... did you load different foam version?
Further more, did you try do wclean simpleFoam and wmake it again? Normally simpleFoam should also give the error. If you can observe this behavior there is something wrong in your FOAM compilation. Just recompile everything.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 29, 2016, 16:06
Default
  #5
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
Hi Tobi,

Thanks for your help - I only have one openFoam version active in my environment and that is foam extend 3.2

Since I am running on a server with many other users, who share the same installation I don't want to change anything on the main installation path (I don't even think I can!)

It is very strange indeed!
Jack001 is offline   Reply With Quote

Old   June 29, 2016, 17:15
Default
  #6
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Can you post the output of your application, that we can check when the error occur?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 29, 2016, 17:17
Default
  #7
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
Which output would you like? The only output I get when I run my_simpleFoam is "Segmentation fault". Would you like to see the output of the wmake?
Jack001 is offline   Reply With Quote

Old   June 30, 2016, 09:12
Default
  #8
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
Hi Tobi,

You were correct initially - the problem was with the installation of foam extend. Thank you for help!
Jack001 is offline   Reply With Quote

Old   June 30, 2016, 09:56
Default
  #9
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Jack,

very nice. That means you recompiled FOAM yourself? Well I could have told you that you can make a local compilation without changing anything at the foam-extend that is used for all.

How did you figure out that FOAM was broken? Anyway, nice to here that you solved the problem.

Quote:
Thank you for help!
You are welcomed.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 30, 2016, 20:37
Default
  #10
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
I took your word for it! I guess others can rest assured that provided the above steps are taken, it should work provided the openFoam build is correct!
Jack001 is offline   Reply With Quote

Old   July 18, 2016, 11:05
Default segmentation fault foam-3.1 extended
  #11
Member
 
Heliana Cardenas
Join Date: Jul 2013
Posts: 30
Rep Power: 5
heliana60 is on a distinguished road
Hi There,

I am having a similar problem but I actually want to recompile a new solver in foam-3.1 extended. The solver I copied from works perfectly, then I do a new my_solver and compile it with no errors. When I try to run it (without any further modification) I also get immediately Segmentation Fault.

Do yu have any idea why this would be?

Cheers,

Heliana

Quote:
Originally Posted by Tobi View Post
Hi Jack,

very nice. That means you recompiled FOAM yourself? Well I could have told you that you can make a local compilation without changing anything at the foam-extend that is used for all.

How did you figure out that FOAM was broken? Anyway, nice to here that you solved the problem.



You are welcomed.
heliana60 is offline   Reply With Quote

Old   July 18, 2016, 11:14
Default
  #12
Member
 
Jack
Join Date: May 2015
Posts: 91
Rep Power: 3
Jack001 is on a distinguished road
I probably won't be able to offer much help other than to say that Tobi is correct - provided you follow the above steps it should work. In my case there were a few inconsistencies with the way the extend environment was set up. Did you install it yourself?

In my case the problem was with the compiler used in the build. Specifically changing to gcc 4.9.2 instead of 5.2.0. Its tricky to know I guess without any further information. Sadly I am not very knowledgable on the build of foam extend so again cant help, but this is where I would start to investigate.
Tobi likes this.
Jack001 is offline   Reply With Quote

Old   July 18, 2016, 13:15
Default
  #13
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by heliana60 View Post
Hi There,

I am having a similar problem but I actually want to recompile a new solver in foam-3.1 extended. The solver I copied from works perfectly, then I do a new my_solver and compile it with no errors. When I try to run it (without any further modification) I also get immediately Segmentation Fault.

Do yu have any idea why this would be?

Cheers,

Heliana
Dear Heliana,

if you can compile the original solver and run it without any problems, then you should also be able to make a new solver by coping it, rename the *.C file and change the Make/files with respect to the new *.C file and furthermore you should change the path to $(USER_APPBIN).

if this is not working properly, then you did something wrong. In addition, what do you mean with "immediately". Do you get the FOAM header and some other stuff or you just really get immediately the error message. Without further information we just can guess.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 19, 2016, 05:04
Default
  #14
Member
 
Heliana Cardenas
Join Date: Jul 2013
Posts: 30
Rep Power: 5
heliana60 is on a distinguished road
Hi Tobi,

I tried to recompile foam-3.1 extend and now I get a bunch of errors when the solvers are compiled. Well they are actually not really compiled now, so maybe there was already a problem i did not know about. I am right now trying to re-install and compile again f31 and seeing same error, something of the like:

collect2: error: ld returned 1 exit status
/home/heliana/foam/foam-extend-3.1/wmake/Makefile:152: recipe for target '/home/heliana/foam/foam-extend-3.1/applications/bin/linux64GccDPOpt/coalChemistryFoam' failed

I have already installed in my computer OF23x and before it used to work all fine when I changed between environments. I am following http://www.tfd.chalmers.se/~hani/kur...OwnLaptop.html instructions to install the extend.

If you have any hint it would be nice if you could let me know,

I write again as soon as my compilation finishes.

Thank you!

heliana


Quote:
Originally Posted by Tobi View Post
Dear Heliana,

if you can compile the original solver and run it without any problems, then you should also be able to make a new solver by coping it, rename the *.C file and change the Make/files with respect to the new *.C file and furthermore you should change the path to $(USER_APPBIN).

if this is not working properly, then you did something wrong. In addition, what do you mean with "immediately". Do you get the FOAM header and some other stuff or you just really get immediately the error message. Without further information we just can guess.
heliana60 is offline   Reply With Quote

Old   July 19, 2016, 05:19
Default
  #15
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Heliana,

for a better understanding please distinguish between "install" and "compile". These methods are different but as far as I got it, you compile the code.

In your case I would just remove the old foam-extend clone the repo again, make sure that all pre-requirements are available and recompile it (on a modern machine ~ 30 min - 60min. Here you should use
Code:
./Allwmake > log 2>&1
You will find a lot of threads about compiling foam here and Bruno also made a good wiki page for compiling different versions on different platforms (just search).

Furthermore, be sure to load FOAM within a clean terminal. Sometimes I get a problem if I first load ofxx and then ofxy in the same terminal.

Good luck.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 19, 2016, 07:10
Default segementation error
  #16
New Member
 
nurjs
Join Date: Oct 2015
Location: Iraq
Posts: 11
Rep Power: 3
nurjs is on a distinguished road
hi here,
I complete my geometry and mesh it using ICEM meshing .When i run it in fluent i obtain segmentation error exiting when saving ,
I don;t have any chooses only OK then fluent close.
I tried so much time but this message still appears.
Any one know how can i solve this problem?
nurjs is offline   Reply With Quote

Old   July 19, 2016, 07:28
Default
  #17
Member
 
Heliana Cardenas
Join Date: Jul 2013
Posts: 30
Rep Power: 5
heliana60 is on a distinguished road
Hi Tobi,

Yes you are absolutely right, I should use the proper terms. So, like you said, I meant compiling. I removed the old foam-extend and cloned it again, and when I compile I get always this error:

/home/heliana/foam/foam-extend-3.1/lib/linux64GccDPOpt/libtriSurface.so: undefined reference to `yyFlexLexer::yywrap()'

I presume this is something relatex to flex ??

I'm digging into forums to see what I find. Do you have any idea?

Cheers,

Heliana

Quote:
Originally Posted by Tobi View Post
Dear Heliana,

for a better understanding please distinguish between "install" and "compile". These methods are different but as far as I got it, you compile the code.

In your case I would just remove the old foam-extend clone the repo again, make sure that all pre-requirements are available and recompile it (on a modern machine ~ 30 min - 60min. Here you should use
Code:
./Allwmake > log 2>&1
You will find a lot of threads about compiling foam here and Bruno also made a good wiki page for compiling different versions on different platforms (just search).

Furthermore, be sure to load FOAM within a clean terminal. Sometimes I get a problem if I first load ofxx and then ofxy in the same terminal.

Good luck.
heliana60 is offline   Reply With Quote

Old   July 19, 2016, 16:51
Default problem with ICEM mesh
  #18
New Member
 
nurjs
Join Date: Oct 2015
Location: Iraq
Posts: 11
Rep Power: 3
nurjs is on a distinguished road
Hi all,
I am new in ICEM meshing, i have many problem when doing my mesh. My geometry is multi cylinder inside a box.
My problem when i make blocking and split my cylinders and complete meshing. In fluent the interface between solid and liquid (shadow not appears)
why this happen i defined it in mesh?
please any help
nurjs is offline   Reply With Quote

Old   July 19, 2016, 16:54
Default
  #19
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,664
Blog Entries: 6
Rep Power: 31
Tobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
a) Not related to that topic
b) ICEM does not belong to OpenFOAM
c) ICEM does not belong to OpenFOAM and subforum Programming & development

Please use the right forum: http://www.cfd-online.com/Forums/ansys-meshing/
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 20, 2016, 05:16
Default
  #20
Member
 
Heliana Cardenas
Join Date: Jul 2013
Posts: 30
Rep Power: 5
heliana60 is on a distinguished road
Dear Tobi,

I have been struggling a bit again with the compilation of foam-3.1 extend.. I found this website: http://www.tfd.chalmers.se/~hani/kur...sAndTricks.htm where it says what to do when there is a problem like the one I got.. Sadly, when I do what they say, the compilation does not work because of the same errors. I noticed though which of the applications are the ones that don't compile, like src/triSurface, when I try to compile for example, that one alone, compilation does not work even by modifying:

So, I just substituted the line:
extern "C" int yywrap()
with
int yyFlexLexer::yywrap()

in the .L files as suggested by:

http://www.cfd-online.com/OpenFOAM_D...es/1/7503.html


Do you know how or have experience of how I could fix this problem? I cannot get my head around it

Cheers,

Heliana

Quote:
Originally Posted by heliana60 View Post
Hi Tobi,

Yes you are absolutely right, I should use the proper terms. So, like you said, I meant compiling. I removed the old foam-extend and cloned it again, and when I compile I get always this error:

/home/heliana/foam/foam-extend-3.1/lib/linux64GccDPOpt/libtriSurface.so: undefined reference to `yyFlexLexer::yywrap()'

I presume this is something relatex to flex ??

I'm digging into forums to see what I find. Do you have any idea?

Cheers,

Heliana
heliana60 is offline   Reply With Quote

Reply

Tags
foam extend

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fluent divergence for no reason sufjanst FLUENT 2 March 23, 2016 17:08
segmentation fault - parallel running CrisMoreira OpenFOAM Running, Solving & CFD 13 November 1, 2015 17:13
Segmentation fault when running in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 8, 2015 08:12
Strange Segmentation Fault jd210 OpenFOAM Running, Solving & CFD 0 March 30, 2015 07:04
Statically Compiling OpenFOAM Issues herzfeldd OpenFOAM Installation 21 January 6, 2009 10:38


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