|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001147||OpenFOAM||[All Projects] Bug||public||2014-02-01 19:47||2018-07-10 11:16|
|Platform||Linux||OS||Scientific Linux||OS Version||6.4|
|Target Version||Fixed in Version|
|Summary||0001147: Sample utility: line passing through internal cyclic boundary using midPoint set sampling definition isn't possible|
|Description||No error happens if "face" set sampling definition is chosen. Same error for either a sampling functionObject, or using the postProcessing sample utility.|
|Steps To Reproduce||In the attached minimal case I've set up a square baffle in the centre of a channel of square cross-section, and a sampling functionObject to output the velocity along two axial lines; one going through the baffle and one running past it. The line running through the baffle fails if midPoint is used.|
|Additional Information||Same behaviour observed for both GCC-4.6 and Clang-4.3 builds.|
@wallace: Many thanks for the simple and quick test case! It's really just a matter of following your instructions!
@Henry: Attached is the file "bug1147.patch", which one crazy hack of a patch. Seriously consider it only a proof of concept, because I couldn't code anything barely more elegant than that in a short time.
And sorry, but I left in a few stray debug lines, to assess if things were working as intended.
The explanation for the reported bug is simple: the method "particle::trackToFace()" always teleports the tracking point to the other side of the cyclic baffle, which after going through the all of the correct steps, it results in "midPointSet::genSamples()" crashing midway of "sampledSet::getCell()", because the second face is always on the other side of the cyclic patch pair, due to the teleport.
Hopefully the following step-by-step makes it a bit clearer, with the details on how to the provided patch tries to overcome this problem:
1- The story begins in "faceOnlySet::trackToBoundary()", which is where the collection of faces crossed by the tracking line is gathered. The hack here was to use the new option to properly handle teleporting, where:
a- In the first hit, it stores the first face before teleport, along with a flag indicating that a teleport needs to be performed.
b- In the second hit, it executes the teleport, stores the face from the other side and resets the flags related to the need for handling a teleport.
c- The tricky part is how "faceOnlySet::trackToBoundary()" and "particle::trackToFace()" handle the teleportation. This is because in "particle::trackToFace()" it has to postpone the jump to the second pass, which is why it has to rely so heavily on the flag "markedToTeleport_".
2- Later on, in "midPointSet::genSamples()" we have to handle the new scenario of "cell1" or "cell2" being -1, which occurs when it's a situation of having the two faces be related to the same special pair of patches.
3- In "sampledSet::getCell()", when it's not an internal face and if it fails to find the cell the point belongs to, then double-check if the "faceI" is part of one of the special patches that do particle teleportation... which if true, then return "-1".
|This is a lot of change for this particular purpose. I am also not happy about the increase in storage for ALL particle/parcel types even though it is only needed for this particular post-processing use. Actually this is a general problem with the Lagrangian library that all data which might be possibly used for any application/model is stored even if it is not needed for the particular case. My feeling is that we need more levels in the class hierachy to handle all the options, i.e. in this case we need a derived variant of particle which stores and handles the "teleportation" data appropriately. I think this will need to be delayed until we start writing the new robust tracking algorithm which handles bad cell which decompose with negative volume pyramids.|
||File Added: sampleCyclic.tgz|
||Tag Attached: Added the used Allrun script|
||Tag Attached: baffle|
||Tag Attached: functionObject|
||Tag Attached: sample|
||Tag Detached: functionObject|
|2015-03-29 21:29||wyldckat||File Added: bug1147.patch|
|2015-03-29 21:53||wyldckat||Note Added: 0004549|
|2015-03-29 22:03||henry||Note Added: 0004550|
|2018-07-10 11:16||administrator||Tag Detached: Added the used Allrun script|