CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Segmentation fault (http://www.cfd-online.com/Forums/openfoam/66019-segmentation-fault.html)

dipling July 3, 2009 05:26

Segmentation fault
 
Hello,

i am still working/searching for a good solution for MeshMoving. I figured out that the Cut/adding-cell algorithm can be find in the LayerAR.C (with its baseclasses).
For testing I took the DieselEngineFoamSolver with "EngineTopoChangerMesh.H" (instead of EngineMesh.H) and "CreateEngineDynmiacMesh.H" (instead of CreateEngineMesh.H).

For the first loops (crank angle -180 - (-170.5)) all is done fine. But then the solver gives the following message when the crank angle exactly reaching -170:

Code:

deformSwitch 20
INFO 0
PistonDeformation0
Piston layering mode
01
1
MinLayerThickness 0.003
Segmentation fault

Normally there is :
Code:

deformSwitch 20
INFO 0
PistonDeformation0
Piston layering mode
01
1
MinLayerThickness 0.003
2
3
3
....

In the source code at this point: (layerAR.C)

Code:

Info << "1" << endl;
Info << "MinLayerThickness " << minLayerThickness << endl;
autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh();
 
Info << "2"

For me it seems to be a memory error ? I am not the C++ pro, just basic solid skills.

I would be very happy anybody can help me! Any have fun to decrypt my Enlish :p

gschaider July 3, 2009 08:05

I'm afraid the 'easiest' way to find out the exact location of the error is compiling a debug-version and running that (see http://openfoamwiki.net/index.php/HowTo_debugging)

Unless this is a well-known error. Then someone might be able to tell you directly what is wrong

dipling July 3, 2009 08:46

ok, i will repeat it with the debug-mode. let's see...

dipling July 15, 2009 10:40

Hello,

i recompiled the openfoam-15-dev now with the linxgccdebug compiler. Now i can compile everything in debug-mode. I made the the same procedure like last time.

Now:

Quote:

index 532 out of range 0 ... 531

From function UList<T>::checkIndex(const label)
in file /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/UListI.H at line 111.

FOAM aborting
I have some Problems to indentifier UList<T>

The void checks if i is < 0 or < size (obv 531 in this case) but i have no idea where he gets:
a) index i
b) size

If anybody knows that, it would be very helpfull. :)

gschaider July 16, 2009 05:12

Quote:

Originally Posted by dipling (Post 222790)
Hello,

i recompiled the openfoam-15-dev now with the linxgccdebug compiler. Now i can compile everything in debug-mode. I made the the same procedure like last time.

Now:



I have some Problems to indentifier UList<T>

The void checks if i is < 0 or < size (obv 531 in this case) but i have no idea where he gets:
a) index i
b) size

If anybody knows that, it would be very helpfull. :)

That kind of information is what makes the debug-version very popular (but also very slow): it intercepted an access outside of an array that in the optimized version would have resulted in the segmentation fault that you originally experienced. Normally there should also be a stack trace. For the interpretation of that have a look at

http://openfoamwiki.net/index.php/HowTo_debugging

Normally the actual error should be one or two points below the intercepted UList-access. The stack-trace reports reports the filenames and the line-numbers in the debug-version. And that is the information of interest

Bernhard

dipling July 30, 2009 09:33

Hello,

it's me again ;) I teste the "bt" command in gdb after the segmentation fault:

Code:

#0  0xb804d430 in __kernel_vsyscall ()
#1  0xb61b36d0 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb61b5098 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb6648458 in Foam::error::abort (this=0xb69cf620) at lnInclude/error.C:243
#4  0x08087d58 in Foam::operator<< <Foam::error> (os=@0x89be5d8, m={fPtr_ = 0xb664815a <Foam::error::abort()>, err_ = @0xb69cf620})
    at /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/errorManip.H:86
#5  0x08096597 in Foam::UList<double>::checkIndex (this=0x8b3528c, i=1) at /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/UListI.H:111
#6  0x080965c2 in Foam::UList<double>::operator[] (this=0x8b3528c, i=1) at /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/UListI.H:136
#7  0xb73df753 in Foam::volPointInterpolation::interpolateInternalField<Foam::Vector<double> > (this=0xbfb6955c, vf=@0xbfb687d0, pf=@0x8b0c6e8)
    at lnInclude/volPointInterpolate.C:67
#8  0xb73e9caa in Foam::volPointInterpolation::interpolate<Foam::Vector<double> > (this=0xbfb6955c, vf=@0xbfb687d0) at lnInclude/volPointInterpolate.C:184
#9  0xb7404129 in interpolationCellPointFace (this=0x8a507a0, pInterp=@0xbfb6955c, psi=@0xbfb687d0)
    at interpolation/interpolation/interpolationCellPointFace/interpolationCellPointFace.C:53
#10 0xb740425d in Foam::interpolation<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::interpolationCellPointFace<Foam::Vector<double> > >::New (
    pInterp=@0xbfb6955c, psi=@0xbfb687d0) at lnInclude/interpolation.H:80
#11 0xb6c4db56 in Foam::interpolation<Foam::Vector<double> >::New (interpolationType=@0xbfb674d8, pInterp=@0xbfb6955c, psi=@0xbfb687d0)
    at /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude/newInterpolation.C:58
#12 0xb6c4dbcf in Foam::interpolation<Foam::Vector<double> >::New (interpolationSchemes=@0xbfb67f4c, pInterp=@0xbfb6955c, psi=@0xbfb687d0)
    at /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude/newInterpolation.C:71
#13 0xb6c46b5f in Foam::spray::evolve (this=0xbfb67c58) at spray/sprayOps.C:57
#14 0x080811d6 in main (argc=Cannot access memory at address 0x528c

Can anybody extract some information where he gets i=1 ?The reason why Foam is crashing is listet below..


The orginally error is now:

index 1 out of range 0 ... 0

From function UList<T>::checkIndex(const label)
in file /home/cfd/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/UListI.H at line 111.

FOAM aborting


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