## 6 Rigid-Flexible Coupling  
The interaction between an elephant's head and trunk as a multibody biomechanical system was described based on the hybrid Natural and Absolute Nodal Coordinates Formulation (NCF/ANCF) framework for rigid-flexible coupling. The head in this context was modeled using the Natural Coordinate Formulation (NCF), which accurately captured the rigid nature of the head structure, while the trunk was developed and described using the Absolute Nodal Coordinate Formulation (ANCF), which is appropriate for large deformation and rotation analysis in flexible multibody systems. Figure 17 shows the interaction between the elephant's trunk and the head it is rigidly attached to. The connection layer consists of mesh points that determine the rigid clamped joint which constrains the relative translation and rotation between the rigid and flexible bodies. The position vector \(\mathbf{r}_{n}\) and gradient vectors \(\mathbf{r}_{nx}\) and \(\mathbf{r}_{ny}\) at node n of the flexible body are fully constrained by the point \(\mathbf{j}\), \(\mathbf{u}\), and \(\mathbf{v}\) vectors of the rigid body. Figure 16: Wireframe illustration of a dynamic analysis of the trunk coiling. Figure 15: Wireframe illustration of bending the continuum trunk structure. The constraints equation of the clamped joint between the flexible body (trunk) and the rigid body (head) can be defined as  
\[\boldsymbol{\phi}_{\text{coupling}}= \begin{bmatrix}\boldsymbol{\phi}_{\text{ distance}}\\ \boldsymbol{\phi}_{\text{angle}}\\ \boldsymbol{\phi}_{\text{orthogonality}}\end{bmatrix}  \tag{43}\]  
The constraint function \(\Phi_{\text{distance}}\) imposes a certain distance, \(\mathbf{r}\), between point \(\mathbf{j}\) on the rigid body and nodes from \(\mathbf{r}_{1}\) to \(\mathbf{r}_{n}\), which correspond to meshed nodes along the cross-section of the flexible body in contact with the rigid body. This ensures that the relative distance between these two points remains constant so that the geometric or kinematic relationship is maintained; these constraints can be defined as  
Figure 17: Constraint formulation of rigid–flexible coupling and resulting head–trunk model. \[\mathbf{\phi}_{\text{distance}}= \begin{bmatrix}\mathbf{r}_{1j}^{T}\mathbf{r}_{1j}-r^{2 }\\ \vdots\\ \mathbf{r}_{nj}^{T}\mathbf{r}_{nj}-r^{2}\end{bmatrix}  \tag{44}\]  
The constraint function \(\Phi_{\text{angle}}\) ensures that the angle between the vectors \(\mathbf{r}_{nj}\) and \(\mathbf{u}\) remains constant, even as the bodies move within the system. This constraint ensures that the relative orientation between the two vectors or bodies is maintained; these constraints can be defined as  
\[\mathbf{\phi}_{\text{angle}}= \begin{bmatrix}\mathbf{r}_{1j}^{T}\mathbf{u}-\| \mathbf{r}_{1j}\|\|\mathbf{u}\|\cos\mathbf{\theta}_{1}\\ \vdots\\ \mathbf{r}_{nj}^{T}\mathbf{u}-\|\mathbf{r}_{nj}\|\|\mathbf{u}\|\cos\mathbf{ \theta}_{n}\end{bmatrix}  \tag{45}\]  
The angle \(\theta_{n}\) between the vectors \(\mathbf{r}_{nj}\) and \(\mathbf{u}\) can be calculated as  
\[\theta_{n}=\text{atan2}\big{(}\|\mathbf{r}_{nj}\times\mathbf{u}\|\,,\, \mathbf{r}_{nj}\cdot\mathbf{u}\big{)} \tag{46}\]  
The orthogonality constraint \(\Phi_{\text{orthogonality}}\) ensures that two vectors remain normal to each other, which can be defined as  
\[\mathbf{\phi}_{\text{orthogonality}}= \begin{bmatrix}\mathbf{r}_{1j}^{T}\,\mathbf{r }_{ij}\\ \mathbf{r}_{1x}^{T}\,\mathbf{v}\\ \mathbf{r}_{1y}^{T}\,\mathbf{r}_{1j}\\ \vdots\\ \mathbf{r}_{nj}^{T}\,\mathbf{r}_{ij}\\ \mathbf{r}_{nx}^{T}\,\mathbf{v}\\ \mathbf{r}_{ny}^{T}\,\mathbf{r}_{nj}\end{bmatrix}  \tag{47}\]  
The overall constraint equations, including the rigidity constraints of the rigid body described in the NCF and the rigid-flexible coupling constraints, can be represented as  
\[\mathbf{\phi}_{\text{Rigid-Flexible}}= \begin{bmatrix}\mathbf{\phi}_{\text{Rigid}}\\ \mathbf{\phi}_{\text{coupling}}\end{bmatrix}