|
8 | 8 | import time_integrator |
9 | 9 |
|
10 | 10 | # simulation setup |
11 | | -side_len = 1 |
| 11 | +side_len = 0.45 |
12 | 12 | rho = 1000 # density of square |
13 | 13 | E = 1e5 # Young's modulus |
14 | 14 | nu = 0.4 # Poisson's ratio |
15 | | -n_seg = 4 # num of segments per side of the square |
| 15 | +n_seg = 2 # num of segments per side of the square |
16 | 16 | h = 0.01 # time step size in s |
17 | | -DBC = [(n_seg + 1) * (n_seg + 1)] # dirichlet node index |
| 17 | +DBC = [(n_seg + 1) * (n_seg + 1) * 2] # dirichlet node index |
18 | 18 | DBC_v = [np.array([0.0, -0.5])] # dirichlet node velocity |
19 | 19 | DBC_limit = [np.array([0.0, -0.7])] # dirichlet node limit position |
20 | 20 | ground_n = np.array([0.0, 1.0]) # normal of the slope |
|
23 | 23 | mu = 0.11 # friction coefficient of the slope |
24 | 24 |
|
25 | 25 | # initialize simulation |
26 | | -[x, e] = square_mesh.generate(side_len, n_seg) # node positions and edge node indices |
| 26 | +[x, e] = square_mesh.generate(side_len, n_seg) # node positions and triangle node indices of the top square |
| 27 | +e = np.append(e, np.array(e) + [len(x)] * 3, axis=0) # add triangle node indices of the bottom square |
| 28 | +x = np.append(x, x + [side_len * 0.1, -side_len * 1.1], axis=0) # add node positions of the bottom square |
27 | 29 | x = np.append(x, [[0.0, side_len * 0.6]], axis=0) # ceil origin (with normal [0.0, -1.0]) |
28 | 30 | v = np.array([[0.0, 0.0]] * len(x)) # velocity |
29 | 31 | m = [rho * side_len * side_len / ((n_seg + 1) * (n_seg + 1))] * len(x) # calculate node mass evenly |
|
0 commit comments