  This study employs resolvent analysis to explore the dynamics and coherent
structures in the boundary layer of a foil that swims via a travelling wave
undulation. A modified NACA foil shape is used together with undulatory
kinematics to represent fish-like bodies at realistic Reynolds numbers ($
\mathit{Re} = 10,000 $ and $ \mathit{Re} = 100,000 $) in both thrust- and
drag-producing propulsion regimes. We introduce a novel coordinate
transformation that enables the implementation of the data-driven resolvent
analysis \citep{herrmann_data-driven_2021} to dissect the stability of the
boundary layer of the swimming foil. This is the first study to implement
resolvent analysis on deforming bodies with non-zero thickness and at realistic
swimming Reynolds numbers. The analysis reinforces the notion that swimming
kinematics drive the system's physics. In drag-producing regimes, it reveals
breakdown mechanisms of the propulsive wave, while thrust-producing regimes
show a uniform wave amplification across the foil's back half. The key thrust
and drag mechanisms scale with the boundary-layer thickness, implying geometric
self-similarity in this $\mathit{Re}$ regime. In addition, we identify a
mechanism that is less strongly coupled to the body motion. We offer a
comparison to a rough foil that reduces the amplification of this mechanism,
demonstrating the potential of roughness to control the amplification of key
mechanisms in the flow. The results provide valuable insights into the dynamics
of swimming bodies and highlight avenues for developing opposition control
strategies.
