To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 04d368e6 authored by Jonas Fankhauser's avatar Jonas Fankhauser
Browse files

Cosmetics

parent ce3dc12c
Pipeline #97978 failed with stages
in 3 minutes and 2 seconds
......@@ -93,10 +93,11 @@ class ARF(ScatteringField, BaseARF):
def acoustic_radiation_force(self) -> float:
"""
Computes the ARF and returns the force in Newton. Depending on the
user-input assumptions are made for either small spheres or bubbles.
Acoustic radiation force [N]
:rtype: float
Computes the ARF, based on the general solution, or the
approximation for either small particles or spheres, if the respective
options are selected.
"""
if self.small_particle and self.bubble_solution:
......@@ -116,13 +117,12 @@ class ARF(ScatteringField, BaseARF):
def _compute_general_arf(self) -> float:
"""
Computes general analytical solution for the ARF
according to eq. (44)
:rtype: float
according to Eq. (44)
"""
out = 4 * [0]
if self.n_max is None:
if self.N_max is None:
N_max = 10
else:
N_max = self.N_max
......@@ -160,7 +160,7 @@ class ARF(ScatteringField, BaseARF):
out[4] *= (-2 * pi * (self.k_f ** 2) *
(self.R_0 ** 2) * (self.xlambda ** 2) * self.rho_f)
# (eq. 44)
# (Eq. 44)
out = sum(out)
"""
......@@ -195,8 +195,7 @@ class ARF(ScatteringField, BaseARF):
def _small_particle_traveling_wave_solution(self) -> float:
"""
based on eq. (59)
:rtype: float
Eq. (59)
"""
out = (pi * self.R_0 ** 2 * 4 * (self.k_f * self.R_0) ** 4
......@@ -206,8 +205,7 @@ class ARF(ScatteringField, BaseARF):
def _small_particle_standing_wave_solution(self) -> float:
"""
based on eq. (62)
:rtype: float
Eq. (62)
"""
out = (pi * self.R_0 ** 2 * 4 * self.k_f * self.R_0
......@@ -241,7 +239,7 @@ class ARF(ScatteringField, BaseARF):
def _bubble_traveling_wave_solution(self) -> float:
"""
based on eq. (68)
Eq. (68)
:rtype: float
"""
out = (4 * pi * self.R_0 ** 2
......@@ -253,8 +251,7 @@ class ARF(ScatteringField, BaseARF):
def _standing_wave_solution_bubble(self) -> float:
"""
based on eq. (74)
:rtype: float
Eq. (74)
"""
out = -4 * pi / self.k_f ** 2
......@@ -270,7 +267,8 @@ class ARF(ScatteringField, BaseARF):
@property
def F(self) -> float:
"""
Density-compressibility factor F []
Density-compressibility factor F [-]
dimensionless parameter used for special solutions
dependent on the wave type and the assumption
"""
......@@ -279,11 +277,12 @@ class ARF(ScatteringField, BaseARF):
def _compute_F(self) -> float:
"""
Compute density-compressibility factor F
according to eq. (60), (63), (75)
According to Eq. (60), (63), (75)
"""
# (60)
if self.field.wave_type == "standing":
if self.wave_type == "standing":
if self.bubble_solution:
# (63)
out = self.xlambda + (2 * (self.xlambda - 1) / 3)
......@@ -297,8 +296,8 @@ class ARF(ScatteringField, BaseARF):
out /= (self.sigma ** 2 * (self.k_s * self.R_0) ** 6
+ resonance_term ** 2)
elif (self.field.wave_type == 'travelling'
or self.field.wave_type == 'traveling'):
elif (self.wave_type == 'travelling'
or self.wave_type == 'traveling'):
if self.bubble_solution:
raise ValueError("Factor F is not defined for traveling wave"
"and bubble solution. "
......@@ -314,12 +313,12 @@ class ARF(ScatteringField, BaseARF):
return out
def K_n(self, n: int) -> complex:
"""
returns the coefficients from eq. (43)
"""Coefficient :math:`K_n` [m^2/s]
:param n: degree []
:type n: int
:rtype: complex
(Eq. 43)
:param n: mode [-]
:return: coefficient [m^2/s]
"""
if n < len(self._K_n.value):
......@@ -329,12 +328,12 @@ class ARF(ScatteringField, BaseARF):
return self._K_n.value[n]
def M_n(self, n: int) -> complex:
"""
returns the coefficients from eq. (42)
"""Coefficient :math:`M_n` [m^2/s]
(Eq. 42)
:param n: degree []
:type n: int
:rtype: complex
:param n: mode [-]
:return: coefficient [m^2/s]
"""
if n < len(self._M_n.value):
......@@ -345,7 +344,7 @@ class ARF(ScatteringField, BaseARF):
def _compute_K_n(self, N: int) -> None:
"""
Compute K_n according to eq. (43)
Compute K_n according to Eq. (43)
"""
n_old = len(self._K_n.value)
......@@ -357,7 +356,7 @@ class ARF(ScatteringField, BaseARF):
def _compute_M_n(self, N: int) -> None:
"""
Compute M_n according to eq. (42)
Compute M_n according to Eq. (42)
"""
n_old = len(self._M_n.value)
......
......@@ -123,15 +123,13 @@ class BaseYosioka(BaseSphereFrequencyComposite):
@property
def sigma(self) -> float:
"""c - ratio or k-ratio [].
:rtype: float
"""ratio of speeds of sound [-].
"""
return self._sigma.value
@property
def xlambda(self) -> float:
"""rho - ratio []
:rtype: float
"""ratio of densities [-]
"""
return self._xlambda.value
......
......@@ -79,17 +79,12 @@ class ScatteringField(BaseYosioka, BaseScattering):
def radial_acoustic_fluid_velocity(self, r: float, theta: float, t: float
) -> float:
"""Radial acoustic velocity
Returns the value for the radial acoustic velocity in [m/s].
"""Radial acoustic fluid velocity [m/s]
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: float
:return: velocity [m/s]
"""
coeff = self.legendre_coeffs(
......@@ -112,17 +107,12 @@ class ScatteringField(BaseYosioka, BaseScattering):
def tangential_acoustic_fluid_velocity(self, r: float, theta: float,
t: float) -> float:
"""Tangential acoustic velocity
Returns the value for the tangential acoustic velocity in [m/s].
"""Tangential acoustic velocity [m/s]
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: float
:return: velocity [m/s]
"""
coeff = self.legendre_coeffs(
......@@ -147,17 +137,12 @@ class ScatteringField(BaseYosioka, BaseScattering):
def radial_particle_velocity(self, r: float, theta: float,
t: float) -> float:
"""Radial particle velocity
Returns the value for the radial particle velocity in [m/s].
"""Radial particle velocity [m/s]
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: float
:return: velocity [m/s]
"""
coeff = self.legendre_coeffs(
......@@ -171,19 +156,12 @@ class ScatteringField(BaseYosioka, BaseScattering):
def tangential_particle_velocity(self, r: float, theta: float,
t: float) -> float:
"""Tangential particle velocity
Returns the value for the tangential particle velocity in [m/s].
This method must be implemented by every theory to have a common
interface for other modules.
"""Tangential particle velocity [m/s]
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: float
:return: velocity [m/s]
"""
coeff = self.legendre_coeffs(
......@@ -202,36 +180,28 @@ class ScatteringField(BaseYosioka, BaseScattering):
# -------------------------------------------------------------------------
def Phi_1(self, r: float, theta: float, t: float) -> complex:
"""The velocity potential outside the sphere
"""Fluid velocity potential :math:`\Phi_1` [m^2/s]
Compute the velocity potential outside the sphere
according to (17)
(Eq. 17)
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: complex
:return: velocity potential [m^2/s]
"""
return self.Phi_i(r, theta, t) + self.Phi_s(r, theta, t)
def Phi_i(self, r: float, theta: float, t: float) -> complex:
"""The incident velocity potential
"""Fluid velocity potential of the incident field :math:`\Phi_i`
[m^2/s]
Compute the incident velocity potential
according to (16) for travelling waves
and (27) for standing waves.
(Eq. 16, 27)
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: complex
:return: velocity potential [m^2/s]
"""
coeff = self.legendre_coeffs(lambda n:
......@@ -243,19 +213,15 @@ class ScatteringField(BaseYosioka, BaseScattering):
return out
def Phi_s(self, r: float, theta: float, t: float) -> complex:
"""The scattered velocity potential
"""Fluid velocity potential of the scattered field :math:`\Phi_s`
[m^2/s]
Compute the scattered velocity potential
according to (18) for travelling waves
and (29) for standing waves
(Eq. 18, 29)
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: complex
:return: velocity potential [m^2/s]
"""
coeff = self.legendre_coeffs(lambda n:
self.A_n(n)
......@@ -266,19 +232,12 @@ class ScatteringField(BaseYosioka, BaseScattering):
return out
def Phi_star(self, r: float, theta: float, t: float) -> complex:
"""The velocity potential inside the sphere
Compute the velocity potential inside the sphere
according to (19) for travelling waves
and (30) for standing waves
"""Particle velocity potential :math:`\Phi^*` [m^2/s]
:param r: radial coordinate [m]
:type r: float
:param theta: tangential coordinate [rad]
:type theta: float
:param t: time [s]
:type t: float
:rtype: complex
:return: velocity potential [m^2/s]
"""
coeff = self.legendre_coeffs(lambda n:
self.B_n(n)
......@@ -293,6 +252,14 @@ class ScatteringField(BaseYosioka, BaseScattering):
# -------------------------------------------------------------------------
def A_n(self, n: int) -> complex:
"""Coefficient :math:`A_n` [m^2/s]
(Eq. 22)
:param n: mode [-]
:return: coefficient [m^2/s]
"""
if n < len(self._A_n.value):
return self._A_n.value[n]
else:
......@@ -300,6 +267,14 @@ class ScatteringField(BaseYosioka, BaseScattering):
return self._A_n.value[n]
def B_n(self, n: int) -> complex:
"""Coefficient :math:`B_n` [m^2/s]
(Eq. 23)
:param n: mode [-]
:return: coefficient [m^2/s]
"""
if n < len(self._B_n.value):
return self._B_n.value[n]
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment