CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   Segmentation Fault when using class based on KinematicParcel in parallel (

gschaider August 13, 2008 15:34

Version: 1.5 How to reprodu
Version: 1.5

How to reproduce: Using the rhoTurbTwinParcelFoam and the simplifiedSiwek-case. Decompose the case for 8 processors. The run fails at the first timestep with a segmentation fault:

[7] #6 Foam: Foam::operator<<>(Foam:, Foam::KinematicParcel<foam::basicthermoparcel> const&) at ~/OpenFOAM/OpenFOAM-1.5-debug/src/lagrangian/intermediate/lnInclude/KinematicPar celIO.C:218

The problem seems to be the line there
because typeID() is the only accessor-method in KinematicParcel that doesn't have a return-reference variant. So propably that cast trys to access the address of the returned temporary value (and the memory following it)

Possible fixes:

1. Quick and dirty: replace that line with

2. Add a reference-variant for typeId() and do it like Thermo & ReactingParcel:
&const_cast<kinematicparcel<parceltype>&>(p).typeI d()

mattijs August 18, 2008 06:18

Thanks - we put it in.
Thanks - we put it in.

All times are GMT -4. The time now is 11:40.