Question: Your Task Write the function assembleKff ( ) that takes five input arguments n _ dof, n _ elem, elem _ node, elem _ stiff

Your Task
Write the function assembleKff() that takes five input arguments n_dof, n_elem, elem_node, elem_stiff_val, eq_num and returns one output k_ff:
Input arguments:
n_dof: an integer representing the number of nodes with free displacement (not prescribed). This is the largest positive number in eq_num.
n_elem: an integer representing the number of spring elements.
elem_node: a 2-D NumPy array of size (_2)(n_elem2) containing the left/right node numbers for all string elements.
elem_stiff_val: a 1-D NumPy array of length _n_elem containing the stiffness values for all string elements, matching the order of elem_node.
eq_num: a 1-D NumPy array of length _n_node that determines how you should reorder your system of equations.
Output:
k_ff: a 2-D NumPy array that represents the global stiffness matrix corresponding to the free nodes.
Algorithm to create the array k_ff:
Initialize the k_ff array with zeros. Make sure to use the correct type. What should the size of k_ff be?
Loop over all spring elements in elem_node. For each element:
Create the element stiffness matrix kell.Identify the four node pairs for the element.Check if both nodes in a pair are free nodes. Only if both nodes in a pair are free can that pair contribute to the global matrix k_ff.add the contributions of kell into the global matrix k_ff, following the procedure described above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!