## 4 Contact Force Calculation  
Contact forces are calculated when a contact is detected. That means that for each time instant a check if the bodies overlap is performed. When overlapping (contact) is detected, a contact pair is determined, and the local frame of reference is set up (see Figure 5). The contact pair is a set of two points that will touch each other when contact occurs.  
We first analyze the case when a contact takes place only at one point as in Figure 5. The contact force is calculated by determining its normal (\(R_{n}\)) and tangential (\(R_{t}\)) components in a local frame of reference. To this end, we need the velocity of the block's vertex \(d\) relative to the contact point \(b\) on the beam (see Figure 5). To obtain the relative velocities and forces in the local frame, a transformation matrix \(\mathbf{Q}\) is used to provide  
\[\mathbf{U} =\mathbf{Q}\dot{q}, \tag{39}\] \[\mathbf{R} =\mathbf{Q}\mathbf{r}. \tag{40}\]By applying transformation matrix \(\mathbf{Q}\), an equation relating the relative velocities and contact forces of the contact pair is obtained:  
\[\mathbf{U}_{i+1}=\overline{\mathbf{U}}+\mathbf{W}\Delta t\mathbf{R}_{i+1}, \tag{41}\]  
where  
\[\overline{\mathbf{U}}=\mathbf{Q}(\overline{\mathbf{q}})\overline{\mathbf{v}}, \tag{42}\]  
\[\mathbf{W}=\mathbf{Q}(\overline{\mathbf{q}})\mathbf{BQ}^{T}(\overline{\mathbf{q}}), \tag{43}\]  
in which \(\overline{\mathbf{q}}\) defines a position of the system at some instant within the interval \([t_{i},t_{i+1}]\). Equation (41) is used to calculate the contact forces. Conditions (12) then imply \(U_{n,i+1}=0\). The value of \(U_{i,i+1}\) is initially assumed to be zero, implying sticking contact conditions. Now with \(\mathbf{U}_{i+1}=\mathbf{0}\) equation (41) allows us to proceed with the evaluation of the contact forces. In this process, the Coulomb law is considered, from which we can tell if contact is of the sticking or sliding type, and the value of the tangent contact force is determined accordingly. This involves checking if \(R_{i,i+1}\) remains below its limit value, in which case sticking contact takes place; otherwise, the value of \(R_{i,i+1}\) is set to its limit and \(U_{i,i+1}\
eq 0\) (sliding) takes place.  
The solution for contact forces is provided in [32; 44].  
When several contacts occur simultaneously, more impulse forces act at the same time and (41) takes the following form:  
\[\mathbf{U}_{i+1}^{h}=\overline{\mathbf{U}}^{h}+\sum_{j\
eq h}\mathbf{W}^{hj}\Delta t \mathbf{R}_{i+1}^{j}+\mathbf{W}^{hh}\Delta t\mathbf{R}_{i+1}^{h}\,, \tag{44}\]  
where \(h\) refers to a particular contact and \(j\) refers to all other remaining contacts. In this case, the solution is looked for iteratively. For each iteration, every contact is solved according to (44) in which the previously obtained values for the other contact forces are used. This procedure is repeated until newly obtained values of the contact forces do not change from the previous more than a predefined amount. Details about this procedure are provided in [32]. For the beam-block problem, a maximum of two simultaneous contacts can occur (assuming contact only at block vertices) and the solution is obtained by using (44) as described.