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

Understanding memory handling of GeometricFields / posible bug in

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2015, 09:13
Default Understanding memory handling of GeometricFields / posible bug in
  #1
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I'm seeing an odd error where sometimes, when calling virtual tmp<scalarField> kappaEff(const label patchI) const in RASModel.H, the size of the alphat(patchI) field is zero. This causes a crash in return thermo().kappaEff(at, patchI); because it tries to calculate the sum of fields of different sizes. So far I have only noticed this problem in parallel runs and it does not occur every time.

Inside of the virtual tmp<scalarField> alphat(const label patchI) const function in the compressible turbulenceModel.H, the size of the alphat patch field is correct on each processor core, but after returning it sometimes becomes empty which leads to the crash.

I'm wondering if this is because the tmp<volScalarField> returned from alphat() goes out of scope and gets deleted, but I don't know what happens to the boundary fields when the parent volScalarField is deleted. On return there should only be a tmp<scalarField> object pointing to the patch field, but no valid pointer or tmp object which points to the parent.

Could this be a reason? If yes, then this is possibly a bug. A possible fix could be to store the volScalarField in the class instead of using a temporary object so it doesn't get invalid during runtime.

Any comments or helpful explanations? I've put quite some thought into the memory management now but I think I can't manage to grasp the whole picture at once

In short: returning the boundary patch field of a temporary volScalarField results in erroneous behavior, because the data gets invalidated. At least that's what I think is happening.
I have now tried to store a permanent tmp<volScalarField> object in the laminar turbulence model class and it does not seem to happen anymore, so I am slightly optimistic. I think this problem might also exist in more functions in this class, so if this turns out to fix it I will create a bug report.

Last edited by chriss85; May 7, 2015 at 10:16.
chriss85 is offline   Reply With Quote

Old   May 7, 2015, 10:57
Default
  #2
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
Report: http://www.openfoam.org/mantisbt/view.php?id=1686

Let me know if there is anything else about this topic.
chriss85 is offline   Reply With Quote

Reply


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
Run-time memory allocation error akalopsis CFX 0 November 17, 2014 17:17
Lenovo C30 memory configuration and discussions with Lenovo matthewe Hardware 3 October 17, 2013 10:23
[GAMBIT] Understanding memory (ram) limits ghost82 ANSYS Meshing & Geometry 5 September 9, 2013 12:54
Help understanding Memory Allocation Factor Todd CFX 1 March 6, 2008 13:27
CFX CPU time & real time Nick Strantzias CFX 8 July 23, 2006 17:50


All times are GMT -4. The time now is 12:08.