CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Segmentation fault with particleTracks (http://www.cfd-online.com/Forums/openfoam-solving/109129-segmentation-fault-particletracks.html)

gmagoon November 9, 2012 19:11

Segmentation fault with particleTracks
 
Hello,
I'm trying to generate particle tracks using the particleTracks utility from trajectories obtained from solidParticleFoam.
The output ends with the following:
Code:

...
Time = 39400.897
    Reading particle positions
    Read 682 particles
Time = 39400.898
    Reading particle positions
    Read 682 particles
Time = 39400.899
    Reading particle positions
    Read 682 particles
Time = 39400.9
    Reading particle positions
    Read 682 particles

Particle statistics:
    Found 0 particles originating from processor 0



Generating 0 particle tracks for cloud defaultCloud

Time = 39400
    Reading particle positions
    Constructing tracks

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigSegv::sigHandler(int) in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/libc.so.6"
#3 
 in "/opt/openfoam210/platforms/linux64GccDPOpt/bin/particleTracks"
#4  __libc_start_main in "/lib/libc.so.6"
#5 
 in "/opt/openfoam210/platforms/linux64GccDPOpt/bin/particleTracks"
Segmentation fault

This is using 1 processor and OpenFoam 2.1.0.

My particleTracksProperties file:
Code:


/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      particleTrackProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

cloudName      defaultCloud;

sampleFrequency 1;

maxPositions    1000000; 

// ************************************************************************* //

Any tips in figuring out what I might be doing wrong are appreciated.

I can try to provide any additional information that would help in diagnosing the problem.

Thanks in advance,
Greg

gmagoon November 12, 2012 11:13

I have just now tried to run this using the gdb debugger. The results aren't particularly informative to me (looks like the crash is in the main() function), but my hope is that they will be meaningful to someone else:
Code:

...
Particle statistics:
    Found 0 particles originating from processor 0



Generating 0 particle tracks for cloud defaultCloud

Time = 39400
    Reading particle positions
    Constructing tracks


Program received signal SIGSEGV, Segmentation fault.
0x00000000004098f0 in main ()
(gdb) where
#0  0x00000000004098f0 in main ()


gmagoon February 22, 2013 15:24

I think I've figured out the problem and came up with a way to address this.

I added some debugging lines to determined that was related to insufficient origId information; the code was storing -1 for all the IDs and the code was crashing on the line "if (allTracks[trackId].size() < maxPositions)" with trackId equal to -1. It turns out that I wasn't aware of the need for origId and origProcId files when I ran solidParticleFoam (which I used to generate the trajectories); solidParticleFoam didn't seem to require origID or origProcID in the 0/lagrangian/defaultCloud directory (actually, technically, I'm using 39400 as starting time here), and when I ran solidParticleFoam, it filled subsequent time directories with "1000{-1}" and "1000{0}" for these files, respectively.

If I instead put origID and origProcID in the 0/lagrangian/defaultCloud directory, filled with contents like shown below, before running solidParticleFoam, then subsequent use of particleTracks works fine, and without error.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      labelField;
    location    "39400";
    object      origId;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

1000
(
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      labelField;
    location    "39400";
    object      origProcId;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

1000
(
0
0
0
0
0
0
0
0
0
...

For context, there seems to be a similar issue that can be encountered when changing the number of processors that are used (http://www.openfoam.org/mantisbt/view.php?id=419), but this is unrelated, and wasn't an issue in my case.

Mojtaba.a February 7, 2015 09:56

Hi,

I have a similar problem.
But your solution didn't work on mine.

I am using DPMFoam on OF 2.3.
neither it worked on my own solver in which I added particle tracking library into icoFoam.

In both serial and parallel runs I get the following error:

Code:

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::coordSet::scalarCoord(int) const at ??:?
#4  Foam::writer<double>::writeTable(Foam::coordSet const&, Foam::List<Foam::List<double> const*> const&, Foam::Ostream&) const at ??:?
#5  Foam::rawSetWriter<double>::write(bool, Foam::PtrList<Foam::coordSet> const&, Foam::List<Foam::word> const&, Foam::List<Foam::List<Foam::Field<double> > > const&, Foam::Ostream&) const at ??:?
#6 
 at ??:?
#7  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#8 
 at ??:?
Segmentation fault (core dumped)

origId and origProcId are as follows for a sample time step:

origId:
Code:

9(0 1 2 3 4 5 6 7 8)
origProcId:
Code:

9{0}
I even added both "origId" and "origProcId" into the "0" time step, but no success.

Here is my particleTrackProperties file:

Code:

cloudName      kinematicCloud;

sampleFrequency 1;

maxPositions    9;

setFormat      csv;    // see sampleDict for set formats

Thanks.

Mojtaba.a February 7, 2015 10:10

I think I found a solution.

Changing the setFormat into vtk seems to solve the problem.
However I don't know why raw or csv formats don't work yet.


All times are GMT -4. The time now is 19:30.