2
from adaptivity2 import refine_metric, adapt, metric_pnorm
5
def test_refine_metric():
6
# from mpi4py import MPI
9
# comm = MPI.COMM_WORLD
11
# mesh = Mesh("greenland.xml.gz")
12
mesh = UnitSquareMesh(100, 100)
14
V = FunctionSpace(mesh, "CG", 2)
15
f = interpolate(Expression("0.1*sin(50.*(2*x[0]-1)) + atan2(-0.1, (2.0*(2*x[0]-1) - sin(5.*(2*x[1]-1))))"), V)
18
#Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
23
Mp = refine_metric(mesh_metric(mesh), level)
27
Mp = refine_metric(mesh_metric(mesh), level)
31
Mp = refine_metric(mesh_metric(mesh), level)
35
Mp = refine_metric(mesh_metric(mesh), level)
39
Mp = refine_metric(mesh_metric(mesh), level)
43
Mp = refine_metric(mesh_metric(mesh), level)
47
Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
51
Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
55
Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
59
Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
63
Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
67
Mp = metric_pnorm(f, mesh, eta, max_edge_ratio=5)
71
# from IPython import embed
74
plot(mesh, title="initial mesh")
75
plot(new_mesh1, title="coarsen 1")
76
plot(new_mesh2, title="coarsen 2")
77
plot(new_mesh3, title="coarsen 3")
78
plot(new_mesh4, title="coarsen 4")
79
plot(new_mesh5, title="coarsen 5")
80
plot(new_mesh6, title="coarsen 6")
84
if __name__=="__main__":
b'\\ No newline at end of file'