Question: Your Task Write the function assembleGlobalForceVector ( ) that takes five input arguments n _ load, force _ node, force _ val, n _ dof,

Your Task
Write the function assembleGlobalForceVector() that takes five input arguments n_load, force_node, force_val, n_dof, eq_num and returns one output p_f:
Input arguments:
n_load: the integer number of nonzero nodal forces.
force_node: a 1-D NumPy array of length _n_load containing the node numbers of the nodes that have nonzero forces on them.
force_val: a 1-D NumPy array of length _n_load containing the corresponding force values.
n_dof: an integer representing the number of nodes with free displacement (i.e. the number of nodes without prescribed displacement).
eq_num: a 1-D NumPy array of length _n_node that determines how you should reorder your system of equations.
Output:
p_f: a 1-D NumPy array that stores corresponding force values in the order specified by eq_num.
Remember:
Node numbers are 1-indexed but NumPy arrays are 0-indexed.
p_f is an array of float values.
Algorithm to create the array p_f:
p_f stores the force values for all the nodes that do not have prescribed displacement. What should be the size of this array?
Initialize this array with zeros.
p_f may include zero entries, corresponding to the nodes that do not have either prescribed force or displacement.
The non-zero entries of p_f are initially stored in force_val.
For each node where a force is applied (node number in force_node), the corresponding equation number is identified from the eq_num array.
The force value for that node (value in force_val) is then assigned to the position in the force vector p_f corresponding to this equation number. Note that this position is based on node numbers.
This process continues until all applied forces in force_val are mapped to their respective positions in p_f.

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!