MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / beam_model

Function beam_model

cython/fem/main.py:72–92  ·  view source on GitHub ↗
(elsize='qa0.4',                              # {{{
               constrain=None)

Source from the content-addressed store, hash-verified

70 return B
71# }}}
72def beam_model(elsize='qa0.4', # {{{
73 constrain=None):
74 A = dict(vertices=np.array(((0, 0), (10, 0), (10, 1), (0, 1))))
75 B = tr.triangulate(A, elsize)
76 if constrain is None:
77 B['constrained_x'] = [] # nodes with x dof fixed
78 B['constrained_y'] = [] # nodes with y dof fixed
79 return B
80 if constrain == 'left_edge':
81 node_ids = np.argwhere(B['vertices'][:,0] == 0)
82 elif constrain == 'right_edge':
83 max_x = np.max(B['vertices'][:,0])
84 node_ids = np.argwhere(np.abs(B['vertices'][:,0] - max_x) < 1.0e-7)
85 else:
86 node_L = np.argwhere(B['vertices'][:,0] == 0)
87 max_x = np.max(B['vertices'][:,0])
88 node_R = np.argwhere(np.abs(B['vertices'][:,0] - max_x) < 1.0e-7)
89 node_ids = np.vstack([node_L, node_R])
90 B['constrained_x'] = node_ids.squeeze() # nodes with x dof fixed
91 B['constrained_y'] = node_ids.squeeze() # nodes with y dof fixed
92 return B
93# }}}
94def torus_model(elsize='qpa0.05'): # {{{
95 # https://rufat.be/triangle/examples.html

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected