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 ndof, nelem, elemnode, elemstiffval, eqnum and returns one output kff:
Input arguments:
ndof: an integer representing the number of nodes with free displacement not prescribed This is the largest positive number in eqnum.
nelem: an integer representing the number of spring elements.
elemnode: a D NumPy array of size nelem containing the leftright node numbers for all string elements.
elemstiffval: a D NumPy array of length nelem containing the stiffness values for all string elements, matching the order of elemnode.
eqnum: a D NumPy array of length nnode that determines how you should reorder your system of equations.
Output:
kff: a D NumPy array that represents the global stiffness matrix corresponding to the free nodes.
Algorithm to create the array kff:
Initialize the kff array with zeros. Make sure to use the correct type. What should the size of kff be
Loop over all spring elements in elemnode. For each element:
Create the element stiffness matrix kellIdentify 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 kffadd the contributions of kell into the global matrix kff following the procedure described above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
