IBAMR / IBAMR

An adaptive and distributed-memory parallel implementation of the immersed boundary (IB) method
http://ibamr.github.io/
Other
352 stars 144 forks source link

Refactor out the scratch hierarchy from IBFEMethod #1235

Closed drwells closed 3 years ago

drwells commented 3 years ago

This might be useful to have if we want to scale up IBMethod - it would also be nice for writing more classes like IBFEMethod (e.g., the deal.II equivalent). Cleaning up this interface will also make #1226 easier to understand since it will be clearer where the data goes with an explicit interface (instead of IBFEMethod owning everything.

drwells commented 3 years ago

@boyceg not urgent, but hopefully you know the answer - one of the next things to do is to calculate the workload, store it in the primary hierarchy, regrid the primary hierarchy, and then copy it over to the secondary hierarchy. Hence, a question: how do we add variables that are going to be regrided? I read through HierarchyIntegrator::registerVariable() but it isn't explicitly set anywhere.

boyceg commented 3 years ago

This version of HierarchyIntegrator::registerVariable() is intended to be used for persistent variables (i.e. that are automatically transferred during a regridding operation).

drwells commented 3 years ago

That works inside HierarchyIntegrator but I cannot figure out how to do it independently of our own code: do you know what exactly triggers the association?

Some things in particular that don't work:

i.e., we can do the regrid independently of everything else in IBTK (good) but it doesn't propagate data. See https://github.com/drwells/IBAMR/blob/088d5ec143fe93ce07b61c02e71cb8f514fbf9bf/tests/IBTK/scratch_hierarchy_01.cpp for my attempts.

drwells commented 3 years ago

In all cases, patch level data is no longer allocated after that level is regridded.

boyceg commented 3 years ago

You need to allocate and communicate the data you want to retain after regrid in an implementation of initializeLevelData(). See HierarchyIntegrator::initializeLevelData().

boyceg commented 3 years ago

This function is from StandardTagAndInitStrategy.

boyceg commented 3 years ago

Basically, when you regrid, you need to have a list of the patch data indices that you want to retain, along with suitable transfer operators for each to handle coarsening/refining.

drwells commented 3 years ago

I figured it out, but for the record - the answer is ultimately that one must keep the old patch levels around and then transfer whatever data you want to transfer from them using RefineAlgorithm et al.

boyceg commented 3 years ago

Oh yeah, if you throw away the level before you transfer the data, then you lose that data. This is handled more-or-less automatically in StandardTagAndInitStrategy.