[Bug] Mesh Quality is not computed correctly when using ghost_mode="shared_vertex" or "shared_facet"
sblauth opened this issue · 1 comments
When using fenics.parameters["ghost_mode"] = "shard_vertex"
or fenics.parameters["ghost_mode"] = "shard_vertex"
for integration over internal facets instead of the default fenics.parameters["ghost_mode"] = "none"
, the mesh quality computation does not work correctly anymore and returns a quality of zero on all processes.
This happens in parallel for all cpp implemented mesh qualities ("skewness"
, "maximum_angle"
, and even "radius_ratios"
, where the latter relies solely on the FEniCS implementation, i.e., it calls fenics.MeshQuality.radius_ratios(mesh).array()
.
This bug does apparently not happen in sequential computing.
Here is a MWE:
import numpy as np
import cashocs
from fenics import *
# parameters["ghost_mode"] = "none" # works
# parameters["ghost_mode"] = "shared_vertex" # fails in parallel
# parameters["ghost_mode"] = "shared_facet" # fails in parallel
mesh, subdomains, boundaries, dx, ds, dS = cashocs.regular_mesh(16)
quality = cashocs.compute_mesh_quality(
mesh, quality_type="min", quality_measure="skewness"
)
print(f"Mesh Quality = {quality:.3e}")
This will not work for parameters["ghost_mode"] = "shared_vertex"
or parameters["ghost_mode"] = "shared_facet"
when run in parallel for the quality measures "skewness"
, "maximum_angle"
or "radius_ratios"
.
Moreover, it "kind of" works when using the average quality instead of the minimum, however, then the values are different. My idea is that the array of qualities has some zeros that are padded, thus always reaching a minimum of zero and distorting the average quality measures.