-
Notifications
You must be signed in to change notification settings - Fork 2
/
main00_mesh.py
49 lines (36 loc) · 1.07 KB
/
main00_mesh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8; -*-
import pathlib
import matplotlib.pyplot as plt
import dolfin
from extrafeathers import meshfunction
from extrafeathers import meshiowrapper
from extrafeathers import plotmagic
print(pathlib.Path.cwd())
meshiowrapper.import_gmsh(src="demo/meshes/box.msh",
dst="demo/meshes/box.h5") # for use by the flow solvers
mesh, domain_parts, boundary_parts = meshiowrapper.read_hdf5_mesh("demo/meshes/box.h5")
# Visualize the fluid mesh
plt.figure(1)
plt.clf()
# mesh itself
plt.subplot(2, 2, 1)
dolfin.plot(mesh)
plt.ylabel("Mesh")
# local mesh size
plt.subplot(2, 2, 2)
theplot = dolfin.plot(meshfunction.meshsize(mesh))
plt.colorbar(theplot)
plt.ylabel("Local mesh size")
# domain parts (subdomains)
plt.subplot(2, 2, 3)
theplot = dolfin.plot(domain_parts)
plt.colorbar(theplot)
plt.ylabel("Phys. surfaces")
# boundary parts
plt.subplot(2, 2, 4)
plotmagic.plot_facet_meshfunction(boundary_parts, invalid_values=[2**64 - 1])
plt.axis("scaled")
plt.legend(loc="best")
plt.ylabel("Phys. boundaries")
plt.suptitle("Structure")
plt.show()