CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Immediate Segmentation fault when running new solver (https://www.cfd-online.com/Forums/openfoam-programming-development/173902-immediate-segmentation-fault-when-running-new-solver.html)

Jack001 June 29, 2016 15:03

Immediate Segmentation fault when running new solver
 
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!

Tobi June 29, 2016 15:07

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

Jack001 June 29, 2016 15:21

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?

Tobi June 29, 2016 15:59

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.

Jack001 June 29, 2016 16:06

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!

Tobi June 29, 2016 17:15

Can you post the output of your application, that we can check when the error occur?

Jack001 June 29, 2016 17:17

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 June 30, 2016 09:12

Hi Tobi,

You were correct initially - the problem was with the installation of foam extend. Thank you for help!

Tobi June 30, 2016 09:56

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.

Jack001 June 30, 2016 20:37

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!

heliana60 July 18, 2016 11:05

segmentation fault foam-3.1 extended
 
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 (Post 607447)
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.


Jack001 July 18, 2016 11:14

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 July 18, 2016 13:15

Quote:

Originally Posted by heliana60 (Post 610051)
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.

heliana60 July 19, 2016 05:04

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 (Post 610088)
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.


Tobi July 19, 2016 05:19

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.

nurjs July 19, 2016 07:10

segementation error
 
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?

heliana60 July 19, 2016 07:28

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 (Post 610202)
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.


nurjs July 19, 2016 16:51

problem with ICEM mesh
 
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

Tobi July 19, 2016 16:54

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/

heliana60 July 20, 2016 05:16

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 (Post 610231)
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



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