Yosioka and Kawasima (1955) Figure 2

With this example we want to recreate Figure 2 from the publication of Yosioka and Kawasima (1955).

First, we need to get an instance of our solution class. In this case osaft.yosioka1955.ARF(). The steps are the same as in the earlier examples.

13 import matplotlib.pyplot as plt
14 import numpy as np
15
16 import osaft
17
18 # --------
19 # Geometry
20 # --------
21 # Radius
22 R_0 = 1e-6  # [m]
23
24 # -----------------
25 # Properties of Air
26 # -----------------
27 # Speed of sound
28 c_air = 343  # [m/s]
29 # Density
30 rho_air = 1.225  # [kg/m^3]
31
32 # -------------------
33 # Properties of Water
34 # -------------------
35 # Speed of sound
36 c_w = 1_498  # [m/s]
37 # Density
38 rho_w = 997  # [kg/m^3]
39
40 # --------------------------------
41 # Properties of the Acoustic Field
42 # --------------------------------
43 # Frequency
44 f = 1e5  # [Hz]
45 # Pressure
46 p_0 = 101_325  # [Pa]
47 # Wave type
48 wave_type = osaft.WaveType.TRAVELLING
49
50 # Initializing Model Instance
51 yosioka = osaft.yosioka1955.ARF(
52     f=f,
53     R_0=R_0,
54     rho_s=rho_air, c_s=c_air,
55     rho_f=rho_w, c_f=c_w,
56     p_0=p_0,
57     wave_type=wave_type,
58     bubble_solution=True,
59     small_particle=True,
60 )

For this example we are plotting the acoustic radiation for against

\[44x(R_0) = k_s * R_0 / \sqrt{3 \tilde{\rho}}\]

where \(k_s\) is the wavenumber in the bubble, \(R_0\) is the radius, and \(\tilde{\rho}\) is the ratio of the particle density and the fluid density. \(x(R_0)\) is ranging between 0 and 4. We, therefore, need to compute the values of \(R_0\) takes, such that \(x(R_0)\) is in this range.

74 x_values = np.linspace(0.01, 4, num=100)
75 x_values = np.append(x_values, 1)
76 x_values = np.sort(x_values)
77
78 R_values = x_values * np.sqrt(3 * yosioka.rho_s / yosioka.rho_f) / yosioka.k_s

Now that we have the values on the x-axis, we can plot the ARF. We pass normalization_name = 'max'. This will normalize the ARF w.r.t. the max value in the plot.

 85 # Plotting the acoustic radiation force with osaft
 86 arf_plot = osaft.ARFPlot()
 87 arf_plot.add_solutions(yosioka)
 88 arf_plot.set_abscissa(x_values=R_values, attr_name='R_0')
 89 fig, ax = arf_plot.plot_solutions(display_values=x_values, normalization='max')
 90
 91 # Finally, we manipulate the Axes object to make it more similar to the plot
 92 # in the paper.
 93
 94 # adding a black vertical line at x = 1
 95 ax.axvline(1, color='k')
 96
 97 # setting the x-axis ticks
 98 ax.set_xticks([0, 1, 4])
 99
100 # setting y-axis limits and the ticks
101 ax.set_ylim(0, 0.04)
102 ax.set_yticks([0, 0.01, 0.02, 0.03, 0.04])
103
104 # adding labels to both axis
105 ax.set_xlabel(r'${k_s R_0}/{\sqrt{3\lambda}}$')
106
107 # displaying the plot
108 fig.tight_layout()
109 plt.show()
110
111 # sphinx_gallery_thumbnail_number = -1
example yosioka air bubble
/home/docs/checkouts/readthedocs.org/user_builds/osaft/checkouts/patch-doinikov2021_streaming/osaft/plotting/datacontainers/arf_datacontainer.py:52: AssumptionWarning: Theory might not be valid anymore!
  self._arf = self._compute_arf_single_process(attr_name, values)

Total running time of the script: ( 0 minutes 0.790 seconds)

Estimated memory usage: 9 MB

Gallery generated by Sphinx-Gallery