Use the correct number of nodes for boundary conditions in GridGenerator
In the past, we tried two different versions for setting the number of boundary condition nodes in GridGenerator.cpp
With this merge we use this version again:
para->getParH(level)->velocityBC.numberOfBCnodes = numberOfVelocityValues;
We used the following code for some time:
blocks = (numberOfVelocityValues / para->getParH(level)->numberofthreads) + 1;
para->getParH(level)->velocityBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads;
History of this code snippet:
- 14.07.2022 Add calculation with blocks (https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/commit/784f9f9dcedef2af16cc3422002ed4e50be06c38). We did this to make the develop version more similar to the open source version
- 04.08.2022 Reverted the previous change (https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/commit/0514d9bca6f3f337073beed8b489c7c6481301c0). We did this as the previous change caused NaNs in the Sphere app.
- 16.09.2022 We reverted the commit from 04.08.2022 in commit https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/commit/8cee52f57f8cbf14efa336c8800c3591618ac983 (Merge: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/merge_requests/150). This means we used
blocks * para->getParH(level)->numberofthreads
once again.
Why do we change this again?
Not using the exact number of nodes causes problems when calculating mean values over all boundary nodes: Multiplying by the number of blocks adds some extra nodes to numberOfBCnodes. When you do a calculation that needs the values of all boundary nodes and use numberOfBCnodes, you get incorrect results.
Tests:
We added a regression test with multiple boundary conditions in https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/merge_requests/222. When we compared both versions of the code snippets above in the regression test, we found no differences.
To do:
-
Discuss this with @m.schoenherr -
Ask Henrik and Henry about 27d5e091 (Blocks still needed?)