ryosuke-hirai / HORMONE

Repository for hydrodynamical code HORMONE
GNU General Public License v3.0
1 stars 1 forks source link

Change smear to a 3-step process #86

Closed ryosuke-hirai closed 1 month ago

ryosuke-hirai commented 1 month ago

This PR drastically changes smear so that it only does one or two MPI reduction calls.

I added two lists of effective cells to keep track of things. list_split: List of effective cell IDs that are split over multiple MPI ranks. list_mydom(1,:): List of effective cell IDs that are partially covered by the domain. list_mydom(2,:): ID within list_split if it is split over multiple MPI ranks. Set to 0 when it is not on list_split.

  1. The first step sums up the conserved quantities (mass, momentum, energy, etc) over the effective cells. If only part of the effective cell is covered by the domain, the sum will only be a fraction of the total sum.
  2. The second step reduces the summed up quantities over all MPI ranks.
  3. The third step updates the local quantities by values averaged over the effective cell.
  4. (For which=='hydro' only) Energy requires some amendments due to the change in density distribution, so is reduced and smeared at an additional step.