Note
Click here to download the full example code
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,
55 c_s=c_air,
56 rho_f=rho_w,
57 c_f=c_w,
58 p_0=p_0,
59 wave_type=wave_type,
60 bubble_solution=True,
61 small_particle=True,
62 )
For this example we are plotting the acoustic radiation for against
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.
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.
87 # Plotting the acoustic radiation force with osaft
88 arf_plot = osaft.ARFPlot()
89 arf_plot.add_solutions(yosioka)
90 arf_plot.set_abscissa(x_values=R_values, attr_name="R_0")
91 fig, ax = arf_plot.plot_solutions(display_values=x_values, normalization="max")
92
93 # Finally, we manipulate the Axes object to make it more similar to the plot
94 # in the paper.
95
96 # adding a black vertical line at x = 1
97 ax.axvline(1, color="k")
98
99 # setting the x-axis ticks
100 ax.set_xticks([0, 1, 4])
101
102 # setting y-axis limits and the ticks
103 ax.set_ylim(0, 0.04)
104 ax.set_yticks([0, 0.01, 0.02, 0.03, 0.04])
105
106 # adding labels to both axis
107 ax.set_xlabel(r"${k_s R_0}/{\sqrt{3\lambda}}$")
108
109 # displaying the plot
110 fig.tight_layout()
111 plt.show()
112
113 # sphinx_gallery_thumbnail_number = -1
/home/docs/checkouts/readthedocs.org/user_builds/osaft/checkouts/stable/osaft/plotting/datacontainers/arf_datacontainer.py:56: 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.831 seconds)
Estimated memory usage: 9 MB