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/)
-   -   double free or corruption (!prev) in a solver not apparently using malloc or similar. (https://www.cfd-online.com/Forums/openfoam-programming-development/129322-double-free-corruption-prev-solver-not-apparently-using-malloc-similar.html)

iblu February 3, 2014 03:56

double free or corruption (!prev) in a solver not apparently using malloc or similar.
 
2 Attachment(s)
Hi, i'm running a OF solver developed by a subcontractor and can't get t to work more than a single timestep. At that point the solver exits and gives a double free or corruption (!prev). Compiled it with "make" without errors. Tried to compile it with GCC but it would not be able to find the .H files listed after each #include directive listed, so given up as I am not sure why it would not find them. Used valgrind and obtained an error file I am not really able to understand (i'm new to CFD and my C is a vague memory from my first year at uni oh so many years ago). I attach the program code (thermalblabla) and valgrind output (both as txt).
Would love to understand how can I track down the error, so would appreciate some help. May I say I had not had this problems with seemingly the same code before having to reinstall it all, but other colleagues had it. I don't think I had a different code. Maybe I compiled it wrong?
thanks. If i have not put enough info, pls let me know
:confused: i.

mturcios777 February 3, 2014 13:11

With compilation, do you mean make or wmake?

iblu February 3, 2014 15:44

ah, good question. I might have used make - sorry I'm home now and working on another computer and the wrong partition so can't check just yet :o. just read something on OpenFoam on wmake but I don't know enough to understand the difference with make. I know in the thermoblabla folder I have a .dep file, i have the Make directory with the option and files files. Might try a fresh recompile and report back in the morning. thanks

mturcios777 February 3, 2014 16:53

You should read up on compiling for OpenFOAM:

http://www.openfoam.org/docs/user/co...plications.php

iblu February 4, 2014 04:03

:mad: still the same problem after recompiling with wmake.
I've dug out the old skype conversation with the subcontractor but can't find no clues, except perhaps silly thing, my platforms are called linuxGccDPOpt, his were called linux64GccDPOpt I thought that 64 referred to the mysterious 64 bits of his whatever built of whatever. can't be that can it... during wmake I can see it links to my platforms nicely

Thanks, will read up on compiling!

alexeym February 4, 2014 04:10

Hi,

What if the problem is not in this "double free" but in your case files? Can you post the error which solver produces after one time step?

iblu February 4, 2014 04:23

2 Attachment(s)
hello
I have a solver err log file which remains blank (although I have to look up how to tell the program to write on it, as it's always been blank). The solver file simply puts "end" at the end of the time step (have attached it in any case)
Have also attached the error generated on terminal
thanks

alexeym February 4, 2014 04:34

Well,

Now I'd like to look at your controlDict as it seems that your endTime is 1, also lines in 'error to terminal-1.txt' with

Code:

/opt/openfoam211/platforms/linuxGccDPOpt/lib/libsampling.so
made me think that you a doing sampling with functionObjects and this can actually lead to the error.

iblu February 4, 2014 04:40

1 Attachment(s)
here the controlDict
sorry i don't understand, what else should i provide you with?

alexeym February 4, 2014 04:48

Well ;)

1. Only one time step is actually done due to

Code:

stopAt          writeNow;
change it to

Code:

stopAt          endTime;
2. And

Code:

libs (
      "libOpenFOAM.so"  // OpenFOAM will (probably) crash if this library is not specified
      "libsimpleSwakFunctionObjects.so"
      "libmyBCs.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
    );

tells that you're actually using swakFunctionObjects where 'double free' occurs. I can't suggest anything about it as I don't know why do you need this libraries.

iblu February 4, 2014 06:49

well indeed... how silly of me not checking that detail about the endtime :o proper beginner!!!!
I must admit even when it worked it did end up giving that glibc error, but at least it was at the end of the simulation. so i have to get back to the developer about the libraries as I do not know the consequences in the long term (or on the results)

iblu February 4, 2014 09:00

1 Attachment(s)
the simulation goes to step 2 but then it stays there, and I have a solver err log that i do not like a single bit...

alexeym February 4, 2014 09:19

Step 2 is a time step after first time step or second run or the solver (according to comments in controlDict you need to restart solver after first 50 steps with modified relaxation factors)?

As you've posted only stack trace I don't know what field causes the error. Usually you can start by changing GAMG solver to PCG (or PBiCG, it depends). Also you can try to change discretisation schemes (go with first order). Play with relaxation factors. To suggest anything I need to have a look at your fvSchemes and fvSolution.

iblu February 4, 2014 09:43

3 Attachment(s)
thanks and sorry for giving you only bits at a time unknowingly
control dict should be set so the simulation runs for 50 time steps, so 2 is the second time step
I ma following the direction of the subcontractor with relaxation factors and stuff, so here is the solver log and the other files...

alexeym February 4, 2014 10:00

It seems that you've got problem solving velocity equation.

Comments in the fvSolution (relaxationFactors section) state that relaxation factor for U equation should be 0.2 up to time step 150 (while in the file you've attached relaxation factor for U is commented out). Uncomment line with relaxation factor for U equation.

Also attached fvScheme (while it should be fvSchemes) and fvSolution are actually the same file.

iblu February 4, 2014 10:28

1 Attachment(s)
:mad: that what happens when you do too many things at once sorry

uncommented, relaunched.

iblu February 5, 2014 03:04

thanks for all your help Alexej
my chugging computer completed the simulation successfully. There are still problems of memory allocation at the end of the run, which I need to raise with the subcontractor, but hopefully I get to arrive to some results.
best regards
I.


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