Skip to content

Commit 0cd23f0

Browse files
committed
self_contact scene setup
1 parent 760b740 commit 0cd23f0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

self_contact/simulator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import time_integrator
99

1010
# simulation setup
11-
side_len = 1
11+
side_len = 0.45
1212
rho = 1000 # density of square
1313
E = 1e5 # Young's modulus
1414
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
1616
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
1818
DBC_v = [np.array([0.0, -0.5])] # dirichlet node velocity
1919
DBC_limit = [np.array([0.0, -0.7])] # dirichlet node limit position
2020
ground_n = np.array([0.0, 1.0]) # normal of the slope
@@ -23,7 +23,9 @@
2323
mu = 0.11 # friction coefficient of the slope
2424

2525
# 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
2729
x = np.append(x, [[0.0, side_len * 0.6]], axis=0) # ceil origin (with normal [0.0, -1.0])
2830
v = np.array([[0.0, 0.0]] * len(x)) # velocity
2931
m = [rho * side_len * side_len / ((n_seg + 1) * (n_seg + 1))] * len(x) # calculate node mass evenly

0 commit comments

Comments
 (0)