mdolab / pyofm

Python wrapper for OpenFOAM meshes
Other
7 stars 4 forks source link

When compile openfoam in "Debug" mode, pyofm will get error. #11

Closed z-g-h closed 6 months ago

z-g-h commented 6 months ago

when compile openfoam in "Debug" mode, running reg_tests or dafoam case will get error :

  --> FOAM FATAL ERROR: 
  attempt to access element 0 from zero sized list

    From function void Foam::UList<T>::checkIndex(Foam::label) const [with T = double; Foam::label = int]
    in file /home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/UListI.H at line 157.

  FOAM aborting

  #0  Foam::error::printStack(Foam::Ostream&) at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OSspecific/POSIX/printStack.C:234
  #1  Foam::error::abort() at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/error.C:282
  #2  Foam::Ostream& Foam::operator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/errorManip.H:91 (discriminator 4)
  #3  Foam::UList<double>::checkIndex(int) const at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/UListI.H:159
  #4  Foam::UList<double>::operator[](int) at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/UListI.H:252
  #5  Foam::fileMonitorWatcher::removeWatch(int) at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OSspecific/POSIX/fileMonitor.C:278
  #6  Foam::fileMonitor::removeWatch(int) at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OSspecific/POSIX/fileMonitor.C:494
  #7  Foam::fileOperation::removeWatch(int) const at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C:592
  #8  Foam::Time::~Time() at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/db/Time/Time.C:718 (discriminator 2)
  #9  Foam::Time::~Time() at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/db/Time/Time.C:728
  #10  Foam::OFMesh::~OFMesh() at ~/dafoam/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/autoPtrI.H:166
  #11  Foam::OFMesh::~OFMesh() at ~/dafoam/repos/pyofm/src/OFMesh.C:30
  #12  ? at ~/dafoam/repos/pyofm/src/pyOFMesh.cpp:1392
  #13  ? in ~/dafoam/packages/miniconda3/bin/python
  #14  ? in ~/dafoam/packages/miniconda3/bin/python
  #15  ? in ~/dafoam/packages/miniconda3/bin/python
  #16  ? in ~/dafoam/packages/miniconda3/bin/python
  #17  PyGC_Collect in ~/dafoam/packages/miniconda3/bin/python
  #18  Py_FinalizeEx in ~/dafoam/packages/miniconda3/bin/python
  #19  Py_RunMain in ~/dafoam/packages/miniconda3/bin/python
  #20  Py_BytesMain in ~/dafoam/packages/miniconda3/bin/python
  #21  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
  #22  ? in ~/dafoam/packages/miniconda3/bin/python

It seems that this error occurs when Function (which uses PYOFM object) is finished and destroy PYOFM object.

friedenhe commented 6 months ago

Thanks for the feedback. I just merged your PR