|
[Sponsors] |
September 4, 2014, 04:33 |
multiplication printstack error
|
#1 |
Member
Join Date: Jul 2014
Posts: 39
Rep Power: 11 |
Hello
I declared two volScalarfields in createFields.H, namely: Code:
volScalarField r ( IOobject ( "r", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("0", dimLength, 1.0) ) Code:
volScalarField faceCellDist ( IOobject ( "faceCellDist", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar ("0", dimLength, 1.0) ); Code:
const surfaceVectorField& Cf = mesh.Cf(); const volVectorField& C = mesh.C(); const labelList& own = mesh.owner(); forAll (own, I) { faceCellDist[I] = Foam::mag(C[own[I]] - Cf[I]); faceCellDist[I+1]=faceCellDist[I]; } and the initial value for "r": Code:
r=r*id.value()/2; My printStack (multiply) error comes when I do: Code:
r*faceCellDist Vrede |
|
September 4, 2014, 12:53 |
|
#2 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
printStack is not the error. What is the error? Was it a segmentation fault? (SigSEGV) or a floating point error? (SigFPE) The forAll(own, I) loop will cause a segmentation fault when it reaches the final index (i = faceCellDist.size()-1)... because I+1 will be out of range.
__________________
~~~ Follow me on twitter @DavidGaden |
|
September 5, 2014, 02:01 |
|
#3 |
Member
Join Date: Jul 2014
Posts: 39
Rep Power: 11 |
Good morning David.
Thank you for the quick reply. The error is as follows: #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::multiply(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:? #4 void Foam::multiply<Foam::fvPatchField>(Foam::FieldFiel d<Foam::fvPatchField, double>&, Foam::FieldField<Foam::fvPatchField, double> const&, Foam::FieldField<Foam::fvPatchField, double> const&) at ??:? #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator*<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #6 at ??:? #7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #8 at ??:? Segmentation fault (core dumped) Weirdly enough, the forAll loop does not give me an error, since it run successfully through the loop. Note: When I did this for a "1D" test case (shock tube tutorial of rhoCentralFoam), I did not have this error. Only when I went to "2D" (30 cells in x-dir, 3 in y-dir and 1 cell in z-dir) that this error showed. Kind regards |
|
September 5, 2014, 03:22 |
|
#4 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
Ah, I see. It's a segmentation fault. Opt doesn't always throw an error exactly where the bug is. You could try running in debug mode. And you should fix your forall loop.
__________________
~~~ Follow me on twitter @DavidGaden |
|
December 14, 2015, 12:50 |
|
#5 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
Dear all,
what if it's a floating point error? such as Code:
#0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::multiply(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:? #4 at ??:? #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator*<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:? #6 at ??:? #7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #8 at ??:? Floating point exception (core dumped) Sandra |
|
December 28, 2015, 12:08 |
|
#6 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quick answer:
Correct, it's a signal for Floating Point Error: "sigFpe" Occurred while multiplying two lists of double values: Quote:
Quote:
If you have access to the source code for the equation where this product occurs, you can try using old school debugging, as... I've already explained here: http://www.cfd-online.com/Forums/ope...tml#post577363 post #3 |
|||
December 29, 2015, 13:15 |
|
#7 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
Forgot to update that I fixed this.
Issue was that the fields being multiplied were of different sizes so I fixed that. Best, Sandra |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] blockMesh with double grading. | spwater | OpenFOAM Meshing & Mesh Conversion | 92 | January 12, 2019 09:00 |
[OpenFOAM] Native ParaView Reader Bugs | tj22 | ParaView | 270 | January 4, 2016 11:39 |
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh | gschaider | OpenFOAM Community Contributions | 300 | October 29, 2014 18:00 |
OpenFOAM without MPI | kokizzu | OpenFOAM Installation | 4 | May 26, 2014 09:17 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 19:08 |