The contribution of a member to the structure stiffness is obtained by adding to the structure stiffness matrix term in row loc[i] and column loc[j], the term , the member stiffness term for i = 1 to 4 and for j = 1 to 4.
In programming terms, we can write this as:
for all members and for each member i and j looping for all i-th and all j-th. There is another point that needs to be stated. Without considerable modification and complication, the stiffness solution algorithm yields all member displacements. From the displacements, all member forces are then calculated. The reactions are determined by equilibrium of member forces and the reactions at the supports, since the corresponding displacements are set to zero. We do this by setting the location vector values to zero to correspond to zero displacements. The assembly algorithm then takes care of it by only assembling the contributions of the member stiffness to the structure stiffness if the location vector's value is not zero. This is best examined in the program listing. Below is the program snippet where this is accomplished. Notice that structure stiffness is denoted by Ks, location vector by locVec and the i,j-th element of the member stiffness by k[i,j].
def assemble(self,k,locVec): Ks = self.Ks # alias for i in range(4): if locVec[i] != 0: for j in range(4): if locVec[j] != 0: Ks[locVec[i]-1,locVec[j]-1] += k[i,j] return KsThe assembly of structure stiffness yields the structure stiffness . As member stiffness is symmetrical, structure stiffness is also symmetrical. It should also be noticed that its leading diagonal terms are all non-zero and positive. If either of the two conditions is not satisfied, then the structure stiffness is wrong, or the structure is a mechanism and can deform under infinitely small loads.
Structure stiffness relates structure nodal loads with the nodal displacements as follows:
It is simpler to derive all the expressions for one load case only and take care of several load cases directly in the computer program.