hemelb-codes / hemelb

A high performance parallel lattice-Boltzmann code for large scale fluid flow in complex geometries
GNU Lesser General Public License v3.0
34 stars 11 forks source link

Problematic point coordinates of membrane vertices in output RBC vtp #776

Closed CharlesQiZhou closed 1 year ago

CharlesQiZhou commented 2 years ago

Multiple problematic values (e.g. nan, 0, -1) are found for the point coordinates of RBC membrane vertices (cells output from the simulation as vtp files). These problematic coordinates are presumably caused by some error of the VTK writing functions. See a snapshot of the problematic points as below:

RBCvtp_pointDataErrors

CharlesQiZhou commented 2 years ago

@mobernabeu @rupertnash

Suspicious commits related to the above issue: https://github.com/hemelb-codes/hemelb/commit/8e858e026d0db40912a3830c8a7872138345bf9c https://github.com/hemelb-codes/hemelb/commit/cd357fa96bcc2013b906713abcb568663ce40091 https://github.com/hemelb-codes/hemelb/commit/10b12ffec2ec9de4ee180a5af559aa5d2539c19c

mobernabeu commented 2 years ago

Thanks @CharlesQiZhou. I'd like you to write a unit tests that reproduces the problem and debug it locally (using some traces inside the writer) rather than in ARCHER2.

An idea could be to take a look at tests/redblood/RedBloodMeshTests.cc and based on the test testVTPReadMesh, make a similar one that reads a mesh, writes it to disc, and reads it back to check that the coordinates have not changed.

To run the unit tests, you need to run the executable tests/hemelb-tests in your build directory. It should be possible to specify a single unit test to be run, but I'm not that familiar with Catch2 yet.

Please make a new branch for the test, push it to Github, and pull request it against main so that we can give you feedback looking at the code.

(cc @Romain-Enjalbert FYI)

rupertnash commented 2 years ago

Apols for not making any progress here: one thought I had, is this an IO problem or has something gone wrong with the cell integration so a coordinate is NaN?

mobernabeu commented 2 years ago

Good call. I'm hoping that an appropriate unit tests will tell us whether this is a regression after the merge or not.

mobernabeu commented 2 years ago

How to call individual tests in Catch2: https://github.com/catchorg/Catch2/blob/devel/docs/command-line.md

First I thought that the naming convention in TEST_CASE is weird but then I discovered that one can pass regex-like expressions to select individual tests. Pretty cool!

rupertnash commented 2 years ago

@CharlesQiZhou - I think I've fixed this in #792 - can you check please?

CharlesQiZhou commented 2 years ago

@CharlesQiZhou - I think I've fixed this in #792 - can you check please?

Thanks @rupertnash. I ran a RBC test locally after git pull and rebuilding HemeLB. Unfortunately the issue is still there (see inf and nan values in the snapshot below). BTW, I got a "Invalid MIT-MAGIC-COOKIE-1 key" running the simulation. Seems new, what is that? image

rupertnash commented 1 year ago

The MIT magic cookie thing is something to do with X11 - I'm not really sure why that is coming up running hemelb as that has no GUI. Perhaps there's something in the build of VTK you are using?

CharlesQiZhou commented 1 year ago

Thanks @rupertnash for discussion offline. This is to confirm that the cell VTK issue is now gone, and we can close the ticket.