File: plot_rt.py

package info (click to toggle)
basix 0.0.1~git20210122.4f10ef2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 696 kB
  • sloc: cpp: 3,987; python: 1,918; makefile: 33
file content (18 lines) | stat: -rw-r--r-- 480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import matplotlib.pyplot as plt
from basix import RaviartThomas, create_lattice, CellType, LatticeType


RT = RaviartThomas("triangle", 3)
pts = create_lattice(CellType.triangle, 20, LatticeType.equispaced, True)

w = RT.tabulate(0, pts)[0]
nc = w.shape[1]//2
print(w.shape)

fig, ax = plt.subplots(3, 5)
for j, a in enumerate(ax.flatten()):
    rt_shape_fn_x = w[:, j]
    rt_shape_fn_y = w[:, j + nc]
    a.quiver(pts[:, 0], pts[:, 1], rt_shape_fn_x, rt_shape_fn_y)

plt.show()