- marked as bug
Multimesh area not always correct in 2D
Issue #945
new
There are still cases where the area (the total length of the visible interface) is somewhat large. In the below example, the area error is about 5e-9. If I multiply or divide the angle by 2, the area is 1e-15. This is something we should investigate further @benjamik @logg .
from dolfin import *
angle_rad = 6.2417838048732141201e-09
angle_deg = 180.0*angle_rad / DOLFIN_PI
N = 1
a = -0.1
b = 1.1
mesh_0 = RectangleMesh(Point(a, a), Point(b, b), N, N)
mesh_1 = UnitSquareMesh(N, N)
mesh_2 = UnitSquareMesh(N, N)
mesh_2.rotate(angle_deg, 2, Point(0.0, 0.0))
mesh_3 = UnitSquareMesh(N, N)
mesh_3.rotate(2*angle_deg, 2, Point(0.0, 0.0))
# Create multimesh
multimesh = MultiMesh()
multimesh.add(mesh_0)
multimesh.add(mesh_1)
multimesh.add(mesh_2)
multimesh.add(mesh_3)
multimesh.build()
# Volume
#volume = multimesh.compute_volume()
#exact_volume = (b-a)*(b-a)
#volume_error = abs(volume - exact_volume)
#print("volume error", volume_error)
# Area
area = multimesh.compute_area()
s = (sin(angle_rad) + cos(angle_rad) - 1.0) / cos(angle_rad)
exact_area_1 = 2 + s;
exact_area_2 = 2 + s;
exact_area_3 = 4
exact_area = exact_area_1 + exact_area_2 + exact_area_3
area_error = abs(area - exact_area)
print("area error", area_error)
Comments (1)
-
reporter - Log in to comment