Particle tracking error
3 Attachment(s)
This bug is possibly related to this http://www.cfd-online.com/Forums/ope...an-fields.html
OpenFOAM sometimes forgot to change particle cell when particle move from one mesh cell to another. I was carrying out some particle simulations on 1 core machine and when I tried to decompose it so I could continue calculation on 8 core machine I received following error: Code:
Time = 0.000655 After some time of incomprehension and study of this impossible problem I saw that this particle moved normally for some time, then slowed and its coordinates on paraview screen and in positions file started to diverge. Here is the particle coordinates from paraview on 0.00065 time (-0.0346717 -0.0330058 0.0613266) and here is the "positions" file coordinates (-0.0344722 -0.03249445 0.06133771). Then I looked at cell id of particle and everything fall into place. Positions file tells us that particle is in the 4132 cell and if we look at this particle in paraview it will be in 4132 cell alright, but actually it is in 246747 cell if we look at its coordinates in positions file. I uploaded "ParticlePositionErrorScaledText.jpg" screenshot to illustrate this. Then I traced this particle and found moment when its cell started to diverge. Particle moved from 4132 cell to 4107 cell but its cell stayed 4132 in "positions" file. Most frustrating thing about this bug is that I can't replicate it. When I tried to continue calculation from time step before cell transition, particle correctly changed cell. This bug steadily happens when I start calculations, but I don't know bugged particle id beforehand which makes debugging difficult. Bug happened on OpenFOAM v3.0.1 by The OpenFOAM Foundation. Edit: I didn't know that OpenFOAM random number generator seeded by constant, so I can replicate this bug. After some time of study I found out that though initial particle cell is correct, initial tet is not. OpenFOAM split every cell on several tets even if mesh was tetrahedral. I used injection model based on PatchInjection where particle position set by patchInjectionBase::setPositionAndCell function. On patchInjectionBase.C:218 line there is comment which says: Code:
// The position is between the face and cell centre, which could This modification of setPositionAndCell function in injection model fixes the error in serial case: Code:
bool continueLoop = false; Edit 2: Fixed parallel issue. In fact I made my injection model based on PatchFlowRateInjection not on PatchInjection. Parallel calculation on PatchInjection working just fine and comparing this two models I find an error on PatchFlowRateInjection.C:173. Code:
error My previous modification of setPositionAndCell function breaks parallel execution. I returned setPositionAndCell to previous state and added "parcel.initCellFacePt();" to the end of setProperties function in injection model. For PatchFlowRateInjection it looks like this: Code:
template<class CloudType> file particleI.H:711 Code:
if (!mesh_.pointInCellBB(position_, oldCellI, 0.3)) |
Greetings alchem,
Many thanks for the detailed report and updates! Quote:
As for the fix you've used in "setProperties", namely by using "initCellFacePt" and further increasing the search distance in that method, is something I'm unable to assess if this is really necessary or not and in under which conditions. If you can provide more details, preferably a test case with which we can reproduce this error, it would make it a lot easier to fully assess if that is the best solution or not. Nonetheless, I'll try to keep this in mind, specially due to another recent bug report: http://bugs.openfoam.org/view.php?id=2199 Best regards, Bruno |
1 Attachment(s)
Greetings Bruno,
Thanks for your reply! Error occurred in tube which deliver particles to coaxial nozzle so I made simple tube mesh to reproduce error and to my surprise on new mesh error never occurred. Original case is too large to post it here so I split mesh, made test case only with its small part and finally caught the error. Here is the test case Attachment 50001. To reproduce the error execute following commands: Code:
icoUncoupledKinematicParcelFoam Code:
--> FOAM FATAL ERROR: Code:
Checking geometry... Alexey |
Hello guys,
What is the usage for the following two lines: Code:
nParcels - scalar(nParcelsToInject) https://github.com/OpenFOAM/OpenFOAM...cachedRandom.C Code:
(>template<> Thank you if you could give some hints. Quote:
|
Hello,
globalPosition(start,end) returns random number between start and end. Unlike position(start, end) it returns the same number on all threads in a parallel case. Pstream::master() - returns true if we are in a master thread scalar01() - returns random number between 0 and 1 Pstream::scatter(value) - send value to slave threads Finally return start + value returns same random value between start and end on all parallel threads It seems we need to use globalPosition instead of position because otherwise different random numbers on different threads will break global number of particles consistency. |
Greetings to all!
My apologies, but I never managed to look into this since my last post here. Fortunately a massive overhaul was done recently on OpenFOAM-dev that will hopefully solve this issue. See the following commit for more details: https://github.com/OpenFOAM/OpenFOAM...a9bc8c1aff0b85 And as explained in the commit, don't expect to be able to continue a simulation from a previous version with this new version. However, you should be able to start a new simulation without problems. I don't know if and when OpenFOAM 5 will be released, but if and when it is, it will also have this feature. Either way, you can already test this by installing and using OpenFOAM-dev, by following the:
Best regards, Bruno |
All times are GMT -4. The time now is 15:55. |