Skip to content

Commit

Permalink
Removed unnecessary function definition
Browse files Browse the repository at this point in the history
  • Loading branch information
larsson4 committed Mar 22, 2024
1 parent ce67070 commit bdaca1c
Showing 1 changed file with 1 addition and 79 deletions.
80 changes: 1 addition & 79 deletions utils/python/linelast_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,85 +146,7 @@ def grid_mesh_configs(nx, ny, l, w):
return mesh_configs, bdr_data, if_data, mesh_type, n_mesh


def cwgrid_mesh_configs(nx, ny, l, w):
bdr_data = []
if_data = []
n_joint = (nx + 1) * (ny + 1)
n_rod_H = (ny + 1) * nx
n_rod_V = (nx + 1) * ny
n_rod = n_rod_H + n_rod_V
n_mesh = n_joint + n_rod
mesh_configs = np.zeros([n_mesh, 6])
mesh_type = np.concatenate((np.full((int(n_joint),), 0.0),np.full((int(n_rod_H),), 1.0),np.full((int(n_rod_V),), 2.0)))
# Setup joints
for i in range(n_joint):
xi = (i + nx+1) % (nx+1)
yi = np.floor(i / (nx+1))
mesh_configs[i,:] = [xi*(l+w), yi*(l+w), 0., 0., 0., 0.]

# Boundary check
# global_battr / mesh_idx / comp_battr
if xi == 0.0:
bdr_data += [[1, i, 4]] # constrain one end
elif xi == nx:
bdr_data += [[2, i, 2]] # constrain one end
if yi==0.0:
bdr_data += [[4, i, 1]] # constrained ends
elif yi==ny:
bdr_data += [[5, i, 3]] # constrained ends

# Interface check
# mesh1 / mesh2 / battr1 / battr2 / port_idx
# Case port idx = 0
if xi < nx:
if_data += [[i, i + n_joint - yi, 2, 4, 0]]
# Case port idx = 1
if xi > 0:
if_data += [[i, i + n_joint - yi - 1, 4, 2, 1]]
# Case port idx = 2
if yi < ny:
if_data += [[i, n_joint + n_rod_H + i, 3, 1, 2]]
# Case port idx = 3
if yi > 0:
if_data += [[i, n_joint + n_rod_H + i - (nx+1), 1, 3, 3]]

# Setup horizontal rods
for i in range(n_rod_H):
xi = (i + nx) % (nx)
yi = np.floor(i / (nx))
mesh_configs[n_joint + i,:] = [xi*(l+w) + w, yi*(l+w), 0., 0., 0., 0.]
# Boundary check
if yi==0.0:
bdr_data += [[3, n_joint + i, 3]] # free boundary
bdr_data += [[4, n_joint + i, 1]] # fixed boundary

elif yi==ny:
bdr_data += [[5, n_joint + i, 3]] # fixed boundary
bdr_data += [[3, n_joint + i, 1]] # free boundary
else:
bdr_data += [[3, n_joint + i, 1]] # free boundary
bdr_data += [[3, n_joint + i, 3]] # free boundary

# Setup vertical rods
for i in range(n_rod_V):
xi = (i + nx+1) % (nx+1)
yi = np.floor(i / (nx+1))
mesh_configs[n_joint + n_rod_H + i,:] = [xi*(l+w), yi*(l+w) + w, 0., 0., 0., 0.]

# Boundary check
if xi == 0.0:
bdr_data += [[1, n_joint + n_rod_H + i, 4]] # constrain one end
bdr_data += [[3, n_joint + n_rod_H + i, 2]] # free boundary
elif xi == nx:
bdr_data += [[2, n_joint + n_rod_H + i, 2]] # constrain one end
bdr_data += [[3, n_joint + n_rod_H + i, 4]] # free boundary
else:
bdr_data += [[3, n_joint + n_rod_H + i, 2]] # constrain one end
bdr_data += [[3, n_joint + n_rod_H + i, 4]] # free boundary

return mesh_configs, bdr_data, if_data, mesh_type, n_mesh

def LatticeCantilever(nx, ny, prefix = "linelast.lattice"):
def LatticeCantilever(nx, ny):
# nx and ny are the number of sections in x- and y-direction, respectively
l = 4.0
w = 1.0
Expand Down

0 comments on commit bdaca1c

Please sign in to comment.