Meshing and Simulation
Imports
import numpy as np
import meshplot as mp
import wildmeshing as wm
import polyfempy as pf
Load Data
V = np.load("V.npy")
L = np.load("L.npy")
p=mp.plot(V, np.zeros((0,3)), return_plot=True)
p.add_edges(V, L, shading={});
p.add_points(V, shading={"point_color": "red", "point_size": 10})
Meshing
vs, tris, nodes, F_nodes = wm.triangulate_svg("plane_hole.svg", cut_outside=True)
p = mp.plot(vs, tris, shading={"wireframe": True}, return_plot=True)
p.add_points(V, shading={"point_color": "red", "point_size": 2});
p.add_points(nodes, shading={"point_color": "green", "point_size": 2})
Sidesets for Boundary Conditions
solver.set_high_order_mesh(vs, tris, nodes, F_nodes)
sp, sl, s = solver.get_boundary_sidesets()
[2019-11-29 15:44:44.935] [polyfem] [info] Loading mesh...
[2019-11-29 15:44:44.935] [polyfem] [info] mesh bb min [144.3, 163.8], max [244.3, 213.8]
[2019-11-29 15:44:44.935] [polyfem] [info] took 3.6782e-05s
p=mp.plot(sp, np.zeros((0,3)), return_plot=True)
p.add_edges(sp, sl);
e1 = sl[s[:,0] == 1, :]
e2 = sl[s[:,0] == 2, :]
e3 = sl[s[:,0] == 3, :]
e4 = sl[s[:,0] == 4, :]
p.add_points((sp[e1[:, 0], :]+sp[e1[:, 1], :])/2, shading={"point_color": "red", "point_size": 0.1});
p.add_points((sp[e2[:, 0], :]+sp[e2[:, 1], :])/2, shading={"point_color": "green", "point_size": 0.1});
p.add_points((sp[e3[:, 0], :]+sp[e3[:, 1], :])/2, shading={"point_color": "blue", "point_size": 0.1});
p.add_points((sp[e4[:, 0], :]+sp[e4[:, 1], :])/2, shading={"point_color": "black", "point_size": 0.1})
Problem and Settings Setup
settings = pf.Settings()
problem = pf.Problem()
settings.set_pde(pf.PDEs.NonLinearElasticity)
settings.discr_order = 2
settings.set_material_params("E", 210000)
settings.set_material_params("nu", 0.3)
problem.set_x_symmetric(1)
problem.set_y_symmetric(2)
problem.set_force(3, [100, 0])
settings.set_problem(problem)
Solving!
solver.settings(settings)
solver.solve()
[2019-11-29 15:44:45.100] [polyfem] [info] simplex_count: 314
[2019-11-29 15:44:45.100] [polyfem] [info] regular_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] regular_boundary_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] simple_singular_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] multi_singular_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] boundary_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] multi_singular_boundary_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] non_regular_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] non_regular_boundary_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] undefined_count: 0
[2019-11-29 15:44:45.100] [polyfem] [info] total count: 314
[2019-11-29 15:44:45.100] [polyfem] [info] Building not isoparametric basis...
[2019-11-29 15:44:45.101] [polyfem] [info] Computing polygonal basis...
[2019-11-29 15:44:45.101] [polyfem] [info] took 1.8151e-05s
[2019-11-29 15:44:45.101] [polyfem] [info] hmin: 3.41246
[2019-11-29 15:44:45.101] [polyfem] [info] hmax: 9.04418
[2019-11-29 15:44:45.101] [polyfem] [info] havg: 5.97291
[2019-11-29 15:44:45.101] [polyfem] [info] took 0.00120327s
[2019-11-29 15:44:45.101] [polyfem] [info] flipped elements 0
[2019-11-29 15:44:45.101] [polyfem] [info] h: 9.04418
[2019-11-29 15:44:45.101] [polyfem] [info] n bases: 679
[2019-11-29 15:44:45.101] [polyfem] [info] n pressure bases: 0
[2019-11-29 15:44:45.101] [polyfem] [info] Assigning rhs...
[2019-11-29 15:44:45.102] [polyfem] [info] took 0.000302436s
[2019-11-29 15:44:45.102] [polyfem] [info] Assembling stiffness mat...
[2019-11-29 15:44:45.102] [polyfem] [info] took 6.155e-06s
[2019-11-29 15:44:45.102] [polyfem] [info] sparsity: 0/0
[2019-11-29 15:44:45.102] [polyfem] [info] Solving NeoHookean with
[2019-11-29 15:44:45.102] [polyfem] [info] t: 1 prev: 0 step: 1
Results
sol_pts, sol_tri, disp = solver.get_sampled_solution()
misises, _ = solver.get_sampled_mises_avg()
mp.plot(sol_pts+disp, sol_tri, misises)