58def build_deck(output_path: str | os.PathLike[str] =
"out/", *,
59 final_time: float = FINAL_TIME, num_steps: int = NUM_STEPS,
60 mesh_size: float |
None =
None, horizon: float |
None =
None,
61 damping_on: bool =
False, eps: float = EPSILON,
62 zero_ic: bool =
False,
63 mesh_dir: str | os.PathLike[str] |
None =
None,
64 write_mesh: bool =
True,
65 in_process_mesh: bool =
False) -> Deck:
66 mesh_size = min(R1, R2) / 5.0
if mesh_size
is None else mesh_size
67 horizon = 3.0 * mesh_size
if horizon
is None else horizon
72 d = Deck(dim=2, t_final=final_time, n_steps=num_steps)
73 d.set_output(output_path, tags=TAGS, interval=num_steps // 10, debug=2,
75 d.set_gravity(0.0, -GRAVITY)
76 d.set_neighbor(update_criteria=
"simple_all", s_factor=10.0, update_interval=40,
77 near_bd_nodes_tol=0.5)
80 meshes = [MeshSpec(size=mesh_size), MeshSpec(size=mesh_size)]
82 base = Path(mesh_dir)
if mesh_dir
is not None else HERE /
"inp"
83 meshes = [MeshSpec(file=base / f
"mesh_cir_{i}.msh", size=mesh_size,
84 write=write_mesh)
for i
in (1, 2)]
86 g1 = d.add_particle_type(Geometry(
"circle", [R1, 0.0, 0.0, 0.0]), meshes[0])
87 g2 = d.add_particle_type(Geometry(
"circle", [R2, 0.0, 0.0, 0.0]), meshes[1])
89 m1 = d.add_material(horizon=horizon, density=DENSITY, K=K, G=G, Gc=GC,
91 m2 = d.add_material(horizon=horizon, density=DENSITY, K=K, G=G, Gc=GC,
94 kn = contact_stiffness(K, K, horizon)
95 for i, j
in ((0, 0), (0, 1), (1, 1)):
96 d.add_contact_pair(i, j, contact_radius_factor=R_CONTACT_FACTOR, Kn=kn,
97 eps=eps, mu=FRICTION_COEFF, damping_on=damping_on,
98 friction_on=
False, beta_n_factor=BETA_N_FACTOR,
100 d.set_contact_laws(damping_law=
"com_and_node",
101 friction_law=
"coulomb_simple")
104 d.add_displacement_bc(particles=[0], direction=[1, 2],
105 zero_displacement=
True)
108 fallen = PARTICLE_DIST - horizon
110 vy = -math.sqrt(2.0 * GRAVITY * fallen)
111 d.add_initial_velocity([0.0, vy, 0.0], particles=[1])
113 top_gap = PARTICLE_DIST
114 d.place(R1, R1, 0.0, geometry=g1, material=m1, contact=0)
115 d.place(R1, 2.0 * R1 + R2 + top_gap, 0.0, geometry=g2, material=m2,
116 contact=1, theta=math.pi)