CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Different errors when linking custom library via solver vs controlDict

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2014, 03:12
Default Different errors when linking custom library via solver vs controlDict
  #1
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
So, I'm currently working my way through the hexRef, dynamicRefineFvMesh and refinementHistory group of files, and have gotten some way (I hope) towards making it work.

However, when I run the solver, I encounter a segmentation fault. My library is linked into the Make/options file of my solver, so I do not generally list it in the controlDict libs() section, but being curious, I added it to controlDict, and got a (different) segfault error.

I post the comparison of the errors below:

Code:
With library listed in controlDict

hexRef4::setRefinement : Splitting faces
hexRef4::setRefinement : Adding edge splits to unsplit faces
hexRef4::setRefinement : Changing owner/neighbour for otherwise unaffected faces
hexRef4::setRefinement : Create new internal faces for split cells
Refined from 9 to 36 cells.
#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::PtrList<Foam::fvsPatchField<double> >::~PtrList() at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/PtrList.C:133 (discriminator 1)
#4  Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::~GeometricField() at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/DimensionedField.C:276 (discriminator 1)
#5  Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::~GeometricField() at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricField.C:654
#6  Foam::surfaceInterpolation::clearOut() at ??:?
#7  Foam::fvMesh::updateMesh(Foam::mapPolyMesh const&) at ??:?
#8  Foam::dynamicRefineFvMeshHexRef4::refine(Foam::List<int> const&) at ??:?
#9  Foam::dynamicRefineFvMeshHexRef4::update() at ??:?
#10  
 at ~/OpenFOAM/christian-2.2.2/application/solver/multiphase/myInterFoam/myInterDyMFoam/myInterDyMFoam.C:92 (discriminator 1)
#11  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12  
 at ??:?
Segmentation fault (core dumped)

------------------------------------------------------------------------------------------------------------------

Without library listed

hexRef4::setRefinement : Splitting faces
hexRef4::setRefinement : Adding edge splits to unsplit faces
hexRef4::setRefinement : Changing owner/neighbour for otherwise unaffected faces
hexRef4::setRefinement : Create new internal faces for split cells
Refined from 9 to 36 cells.
Found 42 split faces 
iter* = 1
correctFluxes_ = 
6
(
#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::OSstream::write(Foam::word const&) at ??:?
#4  Foam::operator<<(Foam::Ostream&, Foam::word const&) at ??:?
#5  Foam::Ostream& Foam::operator<< <Foam::word, Foam::word, Foam::string::hash>(Foam::Ostream&, Foam::HashTable<Foam::word, Foam::word, Foam::string::hash> const&) at ??:?
#6  Foam::dynamicRefineFvMeshHexRef4::refine(Foam::List<int> const&) at ??:?
#7  Foam::dynamicRefineFvMeshHexRef4::update() at ??:?
#8  
 at ~/OpenFOAM/christian-2.2.2/application/solver/multiphase/myInterFoam/myInterDyMFoam/myInterDyMFoam.C:92 (discriminator 1)
#9  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#10  
 at ??:?
Segmentation fault (core dumped)
In the first case (with the library listed in controlDict), an error seems to come from a PtrList with something to do with the PatchFields. In the second case, the error is (I think) clearer. I was hitting problems in the section of my dynamicRefineMeshHexRef4.C file where it attempts to iterate through all of the fluxes listed by
Code:
HashTable<surfaceScalarField*> fluxes
        (
            lookupClass<surfaceScalarField>()
        );
and uses the dynamicRefineDict list to find the relevant velocity-flux pairings.
correctFluxes_ is the internal variable which holds these pairings, and if I enter suitable Info<< or Pout<< lines then I can get a nicely formatted list of pairs within the readDict() function, or any time before I call meshCutter_.setRefinement(cellsToRefine, meshMod, normalVector);. (Here you'll notice that I have a 3rd parameter to my call, this is because the aim is to refine in 2D).

dynamicRefineFvMeshHexRef4.C is almost identical to dynamicRefineFvMesh.C, the standard OF implementation, and in particular the section which is throwing errors is exactly identical. I am unsure if meshCutter_.setRefinement is supposed to clear the correctFluxes_ hashTable, and in the assumption it is not, then presumably my hexRef4.C file has (more!) problems.

Anyway, correctFluxes_ no longer holds the pairs, and so the iterator is immediately beyond the values available to print, leading to the 2nd error.

I have no idea why the two situations should behave differently?
They both include the same library, and run on the same code, but if I link in controlDict, it crashes maybe 20 lines earlier, to a probably(?) related issue, but not quite the same.

Any help would be much appreciated.
chrisb2244 is offline   Reply With Quote

Reply

Tags
library solver linking


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
Forces not calculated when including a library in controlDict fusij OpenFOAM 2 May 13, 2011 07:25
Working directory via command line Luiz CFX 4 March 6, 2011 20:02
Solver stops abruptly without errors prabhu CFX 1 December 20, 2007 01:35
compressible two phase flow in CFX4.4 youngan CFX 0 July 1, 2003 23:32


All times are GMT -4. The time now is 07:35.