python bindings don't properly support boundary approximation
In !558 (merged) I added tests to ensure that the boundary approximation works on the C++ side. There everything is fine...
Running a similar test in python:
import math
import dune.common
import dune.grid
import sys
base = "../../../doc/grids/gmsh/"
reader = (dune.grid.reader.gmsh, base+"circle2ndorder.msh")
grid = dune.grid.ugGrid(reader, dimgrid=2)
assert(grid)
exact = 6.27593206157460
# import dune.plotting
def integrateBoundary(grid):
print(grid)
sum = 0.0
for intersection in grid.boundaryIntersections:
sum += intersection.geometry.volume
return sum
len = integrateBoundary(grid)
eoc = 0.0
for l in range(5):
grid.hierarchicalGrid.globalRefine(1)
len_refined = integrateBoundary(grid)
err0 = abs(len-exact)
err = abs(len_refined-exact)
eoc = math.log2(err0/err) # h0/h = 2
len = len_refined;
print("boundary length: ", len, "\t", exact, "\terr=", err, "\teoc=", eoc)
# we expect 2nd order convergence
if math.isclose(eoc,2.0,abs_tol=0.02):
print("Geometry approximation: 2d order convergence")
else:
print("Geometry approximation does not show expected 2d order convergence")
sys.exit(-1)
sys.exit(0)
doesn't show the expected 2nd order convergence. Actually it doesn't approximate the boundary at all.
This used to work in 2018, but with the integration in DUNE core something changed such that the gmsh file is read without support of curved boundaries.