APECSS: A software library for cavitation bubble dynamics and acoustic emissions

The dynamics of cavitation bubbles and the acoustic emissions they produce are important in a broad range of engineering applications and natural phenomena, either because the strong energy focusing of the bubble collapse is to be avoided, as it may cause damage to surfaces, or to be exploited, such as in emerging medical applications. APECSS (Acoustic Pulse Emitted by Cavitation in Spherical Symmetry) is a software library to simulate the dynamic behavior and acoustic emissions of cavitation bubbles using an efficient state-of-the-art numerical framework. APECSS supports different Rayleigh-Plesset models for bubble dynamics in incompressible and compressible media with Newtonian or viscoelastic rheology, considering clean or coated bubbles. Acoustic emissions may be modeled under different modeling assumptions using a tailored Lagrangian wave tracking method, including the formation and attenuation of shock waves. APECSS can be extended easily to include custom functionality and may be incorporated into other software frameworks.


Summary
The dynamics of cavitation bubbles and the acoustic emissions they produce are important in a broad range of engineering applications and natural phenomena, either because the strong energy focusing of the bubble collapse is to be avoided, as it may cause damage to surfaces, or to be exploited, such as in emerging medical applications. APECSS (Acoustic Pulse Emitted by Cavitation in Spherical Symmetry) is a software library to simulate the dynamic behavior and acoustic emissions of cavitation bubbles using an efficient state-of-the-art numerical framework. APECSS supports different Rayleigh-Plesset models for bubble dynamics in incompressible and compressible media with Newtonian or viscoelastic rheology, considering clean or coated bubbles. Acoustic emissions may be modeled under different modeling assumptions using a tailored Lagrangian wave tracking method, including the formation and attenuation of shock waves. APECSS can be extended easily to include custom functionality and may be incorporated into other software frameworks.

Statement of need
The pressure-driven dynamics of bubbles, a process commonly referred to as cavitation, and the acoustic emissions these bubbles produce play a central role in a large variety of engineering applications and natural phenomena (Lauterborn & Kurz, 2010;Plesset & Prosperetti, 1977). Cavitation drives material erosion of propellers and hydro turbines (Blake & Gibson, 1987;Reuter et al., 2022), can be used to improve the fatigue strength of materials by peening (Gu et al., 2021;Soyama & Korsunsky, 2022) or to clean surfaces and membranes (Reuter et al., 2017), and is utilized as a building block of smart materials (Athanassiadis et al., 2022) as well as in emerging diagnostic and therapeutic medical applications (Kooiman et al., 2020;Wan et al., 2015). The extreme conditions produced during a violent bubble collapse, with pressures of (10 10 ) Pa and gas temperatures in excess of 10 4 K, in reproducible benchtop experiments promotes cavitation as a microlaboratory for the study of high-pressure and high-temperature fluid dynamics (Brenner et al., 2002;Liang et al., 2022), and attracts interest as a microfluidic facility for sonochemistry (Meroni et al., 2022;Tandiono et al., 2011) and material synthesis (Barcikowski et al., 2019). Cavitation is also key to understanding many natural phenomena, such as the hunting behavior of pistol shrimps, which generate collapsing cavitation bubbles to stun their prey (Koukouvinis et al., 2017), or the proliferation of ferns, where cavitation bubbles catapult the spores into the air (Llorens et al., 2016). Furthermore, the dynamic behavior of bubbles subject to pressure changes is highly nonlinear and exhibits routes to chaos (Behnia et al., 2009). The acoustic emissions produced by such oscillating or collapsing bubbles are similarly complex Liang et al., 2022), being highly nonlinear and admitting the formation of shock fronts. These emissions are, for instance, used in medical applications to enhance the contrast of ultrasound imaging of the vasculature (Tang et al., 2011) or to monitor and control high-intensity focused ultrasound cancer treatments (O'Reilly & Hynynen, 2012), and are studied in the context of material damage from cavitation bubbles (Gonzalez-Avila et al., 2021), geological exploration using seismic airguns (MacGillivray, 2019) and the controlled perforation or lysis of biological cells (Helfield et al., 2016;Tandiono et al., 2012). Although by no means exhaustive, this versatile list of applications illustrates the importance of a comprehensive understanding of cavitation bubble dynamics and its acoustic emissions.
APECSS fills a gap in the open-source software domain by combining established models for bubble dynamics with a state-of-the-art numerical framework for the acoustic emissions that supports different modeling assumptions in a portable software library and with minimal computational overhead. APECSS is written in C and, aside from the standard math library, has no external dependencies. Compared to the Python and Matlab implementations we used previously for research and teaching, we observe a speed-up of more than 100× with APECSS for representative examples, enabling, for instance, large-scale parameter studies. The flexible and modular design of APECSS allows to easily extend and change its functionality, and integrate it into other software frameworks. Because of its straightforward installation and ease of use, APECSS is also attractive for undergraduate and postgraduate education, as a virtual laboratory for nonlinear mechanics, chaos and acoustics.
The acoustic emissions of an oscillating or collapsing bubble can be simulated assuming the surrounding medium is incompressible, with → ∞, or compressible, with = constant or = ( ), where is the speed of sound and is the pressure of the medium surrounding the bubble. For cases in which acoustic waves are emitted into a compressible medium with finite speed of sound, the information associated with the emissions is tracked in the radial direction by a Lagrangian wave tracking method , which we developed specifically for the acoustic emissions of cavitation bubbles and which is, at present, a unique feature of APECSS. Explicit expressions for the radial position, local velocity and pressure are available for small and moderate Mach numbers, assuming constant fluid properties (quasi-acoustic assumption) (Gilmore, 1952;Trilling, 1952) or pressure-dependent fluid properties . For large Mach numbers, including trans-and supersonic flows, ordinary differential equations are solved for the radial coordinate and the local velocity, whereby the velocity is determined by either integrating its spatial (Gilmore, 1952) or temporal (Hickling & Plesset, 1963) derivative along the outgoing characteristic, with the enthalpy and pressure readily obtained by explicit expressions . The formation and attenuation of shock fronts, should they occur, is accounted for by treating multivalued solutions at runtime. (g) Figure 1: Results of an argon bubble with initial radius 0 = 5 m in water, driven by ultrasound with a frequency of 23.5 kHz and a pressure amplitude of 145 kPa, as previously considered by (Holzfuss, 2010)  The pressure amplitude Δ ( , ) and velocity ( , ) of the acoustic wave generated by the primary collapse of the bubble as a function of the radial coordinate . (f) The pressure amplitude Δ ( , ) emitted by the bubble at a fixed radial distance = 100 m from the bubble center as a function of time . (g)-(h) Spatial profiles of the pressure amplitude Δ ( , ) and the velocity ( , ) at selected time instances, where 0 is the time at which the bubble assumes its minimum radius. The radial bubble dynamics are simulated using the Gilmore-NASG model (Denner, 2021) and the acoustic emissions are simulated using the in-built Lagrangian wave tracking method , integrating ordinary differential equations for ( ) and ( , ) along the outgoing characteristic and treating the multivalued solutions associated with the formed shock front at runtime. Argon is modeled by the ideal-gas EoS with a polytropic exponent of 1.666 and a van-der-Waals hard-core radius of 0 /8.86 (Holzfuss, 2010), and water is modeled using the Noble-Abel-stiffened-gas EoS with a polytropic exponent of 1.11, a Tait pressure constant of 6.48 × 10 8 Pa, a co-volume of 6.8 × 10 −4 m 3 /kg and a reference density of 997 kg/m 3 . The ambient and reference pressure is 10 5 Pa.
APECSS provides a compact and efficient simulation tool for the prediction of bubble dynamics and its acoustic emissions for research, as demonstrated by the studies that have driven and accompanied the development of APECSS (Denner, 2021;Gümmer et al., 2021), and higher education. A variety of results of the bubble dynamics and the acoustic emissions can be readily written into text files at the end of a simulation or at predefined intervals, as illustrated by the examples shown in Figure 1. The APECSS repository includes representative examples that introduce the capabilities of the software library and serve to test the correct functionality of APECSS. The examples also demonstrate how APECSS may be extended with additional functionality or be used to build models for more complex scenarios, such as incorporating an energy model for the gas temperature or modeling the acoustic interaction of multiple bubbles. Designed as a software library, the capabilities of APECSS can be adopted in other software frameworks, and its modular design enables a straightforward extension with custom functionality. A software tool for the simulation of bubble dynamics, cavitation processes and the associated acoustic emissions with features and attributes comparable to APECSS is currently not available open source.