adaptive-cfd / WABBIT

Wavelet Adaptive Block-Based solver for Interactions with Turbulence
https://www.cfd.tu-berlin.de/
GNU General Public License v3.0
56 stars 27 forks source link

Rework of adapt_tree and synch_ghosts #58

Closed Arcadia197 closed 6 months ago

Arcadia197 commented 6 months ago

I am continuing my work to waltz through the code and do preparations for CVS, while covering groundwork topics along the way. This time there are some hefty changes for adapt_tree and sync _ghosts / the underlying data transfer routines.

Here the major parts:

The work is not compleeeetely finished but there is much yet to read for you, thomas. Here some leftovers:

Broader cleaning I came up with along the way, maybe I move this to issues:

At last my presentation from today to have the algorithm in front of you 24-05-23 short update.odp

Arcadia197 commented 6 months ago

I checked and the discrepancy in the wavelet/adaptive tests actually arises from a small bug in the old version. Somehow CE for level 3 was not executed, actually the whole adapt tree loop. This arises from the fact that 3 is Jmin_active and no blocks were coarsened in step 4 (as for indicator everywhere and random this was done in the first iteration), so the condition at the end of the loop exits early.

The new version sets all flags for the indicator in the first iteration but keeps them and still only coarsens level wise so values are correct. We need to update the test results though ... Possibly after changing the security zone settings anyways.

tommy-engels commented 6 months ago

I checked and the discrepancy in the wavelet/adaptive tests actually arises from a small bug in the old version. Somehow CE for level 3 was not executed, actually the whole adapt tree loop. This arises from the fact that 3 is Jmin_active and no blocks were coarsened in step 4 (as for indicator everywhere and random this was done in the first iteration), so the condition at the end of the loop exits early.

The new version sets all flags for the indicator in the first iteration but keeps them and still only coarsens level wise so values are correct. We need to update the test results though ... Possibly after changing the security zone settings anyways.

Okay, so you found the "error", which is actually a bugfix in the new version! Congratulations!! I will go ahead and test this new version on the cluster now

Arcadia197 commented 6 months ago

Another point: We might prevent the overcreation of blocks when merging (creating the mother block before the daughters are deleted) by setting one of them to the mother block and just shifting the SC inside itself. It's not too much to code and would circumvent the Block-increase for the non-CVS cases.

Arcadia197 commented 6 months ago

Did some preparations to adapt the security zone, to be discussed together as there is one puzzle piece missing to do it

Arcadia197 commented 6 months ago

Added security zone changes after our discussions today. I went for the encoding approach and we actually do not sync more as before.

Obviously now all adaptive lifted convection test as well as the acm test fail.

Here some visualization of the difference in the results:

  1. Absolute difference between pressure fields from acm test at last timestep (t=1) in logarithmic form. The red squares are where the grid differs. The rest ranges from $2\times10^{-5}$ downwards. This difference is to show that in the tests no substantial deterioration is directly visible. How can we further test that the implementation doesn't eradicate too much? diffP_test_acm
  2. Pressure field as reference P_test_acm
tommy-engels commented 6 months ago

I merged the PR into the main code, let us discuss the changes to the unit tests on monday. In addition to your tests, I did the compression test for all wavelets with the new securityZone, and the compression behavior is correct. This is a good indicator that the new security zone works as intended.

tommy-engels commented 6 months ago

new.compression-test-fortran.pdf old.compression-test-fortran.pdf

here are the tests for the new (your) vs old version