66def build_deck(output_path: str | os.PathLike[str] =
"runs/",
67 *, final_time: float = FINAL_TIME,
68 num_steps: int = NUM_STEPS,
69 mesh_size: float = MESH_SIZE,
70 horizon: float |
None =
None,
71 mesh_dir: str | os.PathLike[str] |
None =
None,
72 mesh_files: tuple[str, str] |
None =
None,
73 write_mesh: bool =
True,
74 in_process_mesh: bool =
False) -> Deck:
77 ``in_process_mesh`` keeps Gmsh output in memory and writes no ``.msh``,
78 which is what the README demo uses. The parity runs instead point both the
79 Python and the C++ side at the same ``.msh`` files under ``mesh_dir``.
81 horizon = 3.0 * mesh_size
if horizon
is None else horizon
84 G_t = to_G(E=E_t, nu=NU_T)
86 G_e = to_G(E=E_e, nu=NU_E)
88 d = Deck(dim=2, t_final=final_time, n_steps=num_steps,
94 dt_out_n = max(1, num_steps // 40)
95 d.set_output(output_path,
96 tags=[
"Displacement",
"Velocity",
"Force",
"Damage_Z",
97 "Damage",
"Particle_ID",
"Fixity"],
98 interval=dt_out_n, debug=1, pvd_collection=
True)
100 d.set_gravity(0.0, -GRAVITY)
101 d.set_neighbor(update_criteria=
"simple_all", s_factor=8.0, update_interval=5,
102 near_bd_nodes_tol=0.5)
105 tri = Geometry(
"triangle", [-0.5 * W, 0.0, 0.0,
108 ell = Geometry(
"ellipse_minus_ellipse",
109 [A_OUT, B_OUT, A_IN, B_IN, ELL_THETA, 0.0, 0.0, 0.0])
112 tri_mesh = MeshSpec(size=mesh_size)
113 ell_mesh = MeshSpec(size=mesh_size)
115 base = Path(mesh_dir)
if mesh_dir
is not None else HERE /
"inp"
116 names = mesh_files
or (MESH_TRI, MESH_ELL)
117 tri_mesh = MeshSpec(file=base / names[0], size=mesh_size,
119 ell_mesh = MeshSpec(file=base / names[1], size=mesh_size,
122 g_tri = d.add_particle_type(tri, tri_mesh)
123 g_ell = d.add_particle_type(ell, ell_mesh)
126 m_tri = d.add_material(horizon=horizon, density=RHO_T, K=K_T, G=G_t,
127 Gc=GC_T, influence_fn_type=1)
128 m_ell = d.add_material(horizon=horizon, density=RHO_E, K=K_E, G=G_e,
129 Gc=GC_E, influence_fn_type=1)
132 d.add_contact_pair(0, 0, contact_radius_factor=R_CONTACT_FACTOR,
133 Kn=contact_stiffness(K_T, K_T, horizon), eps=0.95,
134 beta_n_factor=100.0, K=K_T)
137 d.add_contact_pair(0, 1, contact_radius_factor=0.90,
138 Kn=contact_stiffness(K_T, K_E, horizon), eps=0.4,
140 K=peridem.harmonic_mean(K_T, K_E))
141 d.add_contact_pair(1, 1, contact_radius_factor=R_CONTACT_FACTOR,
142 Kn=contact_stiffness(K_E, K_E, horizon), eps=0.95,
143 beta_n_factor=100.0, K=K_E)
144 d.set_contact_laws(damping_law=
"com_and_node",
145 friction_law=
"coulomb_simple")
149 d.add_displacement_bc(particles=[0], direction=[1, 2],
150 zero_displacement=
True)
151 d.add_initial_velocity([0.0, IC_VY, 0.0], particles=[1])
155 ell_cy = tip_y + TIP_GAP + B_OUT
156 cx, cy, cz = tri.center
157 d.place(cx, cy, 0.0, geometry=g_tri, material=m_tri, contact=0, wall=
True)
158 d.place(0.0, ell_cy, 0.0, geometry=g_ell, material=m_ell, contact=1)