Now let us compute the load vector for the one-dimensional case. The load vector is related to the integral of the product of the source function and the trial function. Consider the integral for a single segment with vertices
(6.34)
The trial function on the segment has the form . To evaluate the integral, it is necessary to interpolate the source function on the segment by a linear function. Let us represent in the form . The coefficients and are determined from the interpolation conditions at the nodes
(6.35)
Solving this system analogously to (5.8), we obtain
(6.36)
Let us substitute the interpolated source function and the trial function into (6.34). Taking into account (5.7) and (5.8) from the section on hat functions
Expand the brackets and split the integral into parts
Let us compute each of the integrals
Substituting the expressions for from (6.36) and using the relations (5.8), after simplification we obtain
Further transformations taking into account (5.8) lead to the final result
Expand and regroup the terms
where is the length of the segment.
We introduce the notation for the elements of the local load vector of the segment
(6.37)
Thus, the local load vector for a one-dimensional element has the form
(6.38)
The global load vector is obtained by summing the contributions from all segments of the mesh using assembly: the elements of the local vectors are added to the corresponding elements of the global vector according to the global numbering of the nodes. The dimension of the global load vector equals , where is the total number of nodes in the mesh. It is important to note that for interior nodes the contributions from two adjacent elements are summed, as a result of which the element of the global load vector for an interior node takes the form
(6.39)
where and are the lengths of the adjacent segments. For boundary nodes the element contributions are assembled in the same way, but the corresponding components of the system may be modified when boundary conditions are imposed.
For example, for a mesh with nodes the global load vector, assembled from the local contributions by rule (6.39) for interior nodes, takes the form (before boundary conditions are applied)