conservation-laws / ryujin

High-performance high-order finite element solver for hyperbolic conservation equations
https://conservation-laws.org
Other
105 stars 25 forks source link

`OfflineData`: 3D support: normal and mass are not computed correctly across MPI ranks #39

Open tamiko opened 8 months ago

tamiko commented 8 months ago

The logic in OfflineData<dim, Number>::construct_boundary_map currently reads as follows:

for (auto cell = begin; cell != end; ++cell) {

  if (!cell->is_artificial() /* !cell->is_artificial_on_level() /*)
    continue;

  for (auto f : GeometryInfo<dim>::face_indices()) {
    const auto face = cell->face(f);
    const auto id = face->boundary_id();

    if (!face->at_boundary())
      continue;

    // ...

    /* Skip nonlocal degrees of freedom: */                                
    if (index >= n_locally_owned_)                                         
      continue; 
  }   /* f */
}     /* cell */

This logic only works in 2D and will fail in 3D when we encounter hanging nodes on boundaries. We might also miss to set up boundary degrees of freedom.

tamiko commented 4 months ago

Fix should be straightforward: We need to assemble the normal (and boundary mass) into a temporary vector with AffineConstraints::add_local_to_global() and compress(VectorOperation::add) after assembly. Then, we can collect the normal and put it into our BoundaryMap.