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 6db170a7 authored by Jonas Fankhauser's avatar Jonas Fankhauser
Browse files

xlambda renahme to lambda rho, more comments added

parent 73b525ff
Pipeline #98025 passed with stages
in 5 minutes and 26 seconds
......@@ -70,7 +70,7 @@ class ARF(ScatteringField, BaseARF):
self._F.is_computed_by(
self._sigma,
self._xlambda,
self._labmda_rho,
self.field._wave_type,
self.particle._k_f,
self._R_0)
......@@ -95,9 +95,9 @@ class ARF(ScatteringField, BaseARF):
"""
Acoustic radiation force [N]
Computes the ARF, based on the general solution, or the
approximation for either small particles or spheres, if the respective
options are selected.
Computes the ARF, based on the general solution (Eq. 44), or the
approximation for either small particles (Eq. 59, 62) or small bubbles
(Eq. 68, 73), if the respective options are selected.
"""
if self.small_particle and self.bubble_solution:
......@@ -117,7 +117,8 @@ class ARF(ScatteringField, BaseARF):
def _compute_general_arf(self) -> float:
"""
Computes general analytical solution for the ARF
according to Eq. (44)
(Eq. 44)
"""
out = 4 * [0]
......@@ -154,11 +155,11 @@ class ARF(ScatteringField, BaseARF):
n += 1
out[0] *= -2 * pi * self.R_0 ** 2 * self.rho_f
out[1] *= 2 * pi * self.xlambda ** 2 * self.rho_f
out[2] *= -2 * pi * self.R_0 * self.xlambda * self.rho_f
out[3] *= 2 * pi * self.R_0 * self.xlambda * self.rho_f
out[1] *= 2 * pi * self.lambda_rho ** 2 * self.rho_f
out[2] *= -2 * pi * self.R_0 * self.lambda_rho * self.rho_f
out[3] *= 2 * pi * self.R_0 * self.lambda_rho * self.rho_f
out[4] *= (-2 * pi * (self.k_f ** 2) *
(self.R_0 ** 2) * (self.xlambda ** 2) * self.rho_f)
(self.R_0 ** 2) * (self.lambda_rho ** 2) * self.rho_f)
# (Eq. 44)
out = sum(out)
......@@ -220,8 +221,8 @@ class ARF(ScatteringField, BaseARF):
def _bubble_arf(self) -> float:
order_bubble = (self.k_f * self.R_0) ** 2
conditions = [self.xlambda < 0.1 * order_bubble,
self.xlambda > 10 * order_bubble,
conditions = [self.lambda_rho < 0.1 * order_bubble,
self.lambda_rho > 10 * order_bubble,
(self.k_s * self.R_0) ** 2 > 0.1,
(self.k_f * self.R_0) ** 2 > 0.1]
for c in conditions:
......@@ -245,8 +246,9 @@ class ARF(ScatteringField, BaseARF):
out = (4 * pi * self.R_0 ** 2
* (self.k_s * self.R_0) ** 4
* self.I_ac)
out /= (self.c_f * (self.sigma ** 2 * (self.k_s * self.R_0) ** 6
+ (3 * self.xlambda - (self.k_s * self.R_0) ** 2) ** 2))
out /= (self.c_f
* (self.sigma ** 2 * (self.k_s * self.R_0) ** 6
+ (3 * self.lambda_rho - (self.k_s * self.R_0) ** 2) ** 2))
return out
def _standing_wave_solution_bubble(self) -> float:
......@@ -269,8 +271,7 @@ class ARF(ScatteringField, BaseARF):
"""
Density-compressibility factor F [-]
dimensionless parameter used for special solutions
dependent on the wave type and the assumption
Acoustic contrast factor for small particle solutions.
"""
return self._F.value
......@@ -285,13 +286,14 @@ class ARF(ScatteringField, BaseARF):
if self.wave_type == "standing":
if self.bubble_solution:
# (63)
out = self.xlambda + (2 * (self.xlambda - 1) / 3)
out /= 1 + 2 * self.xlambda
out -= 1 / (3 * self.xlambda * self.sigma ** 2)
out = self.lambda_rho + (2 * (self.lambda_rho - 1) / 3)
out /= 1 + 2 * self.lambda_rho
out -= 1 / (3 * self.lambda_rho * self.sigma ** 2)
else:
# (75)
resonance_term = 3 * self.xlambda - (self.k_s * self.R_0) ** 2
resonance_term = (3 * self.lambda_rho
- (self.k_s * self.R_0) ** 2)
out = self.sigma * self.k_s * self.R_0 * resonance_term
out /= (self.sigma ** 2 * (self.k_s * self.R_0) ** 6
+ resonance_term ** 2)
......@@ -303,10 +305,10 @@ class ARF(ScatteringField, BaseARF):
"and bubble solution. "
"Set bubble_solution = False")
else:
out = ((self.xlambda - (1 + 2 * self.xlambda) /
(3 * self.xlambda * self.sigma ** 2)) ** 2)
out += (2 / 9) * ((1 - self.xlambda) ** 2)
out /= (1 + 2 * self.xlambda) ** 2
out = ((self.lambda_rho - (1 + 2 * self.lambda_rho) /
(3 * self.lambda_rho * self.sigma ** 2)) ** 2)
out += (2 / 9) * ((1 - self.lambda_rho) ** 2)
out /= (1 + 2 * self.lambda_rho) ** 2
else:
raise ValueError("Factor F is only defined for travelling and "
"standing waves.")
......
......@@ -14,9 +14,7 @@ from gorkov import (
class BaseYosioka(BaseSphereFrequencyComposite):
"""
Baseclass for Yosioka's (1955) solution
In this class wrappers are formulated which are inherited to higher classes
Baseclass for solution from Yosioka & Kawasima (1955)
"""
def __init__(self, frequency: Union[Frequency, float, int],
......@@ -31,19 +29,15 @@ class BaseYosioka(BaseSphereFrequencyComposite):
Initializes the class and sets all parameter needed for the
computation.
We use an inviscid fluid as a particle, because it is a good
start to model finite compressibility as it is assumed
in the paper from Yoskioka and Kawasima (1955).
:param frequency: Frequency [Hz]
:param radius: Radius of the solid [m]
:param radius: Radius of the particle [m]
:param rho_s: Density of the fluid-like solid [kg/m^3]
:param c_s: Speed of sound of the particle [m/s]
:param rho_f: Density of the fluid [kg/m^3]
:param c_f: speed of sound in the fluid [m/s]
:param p_0: Pressure amplitude of the field [Pa]
:param position: Position within the standing wave field [m]
:param wave_type: either standing or progressive wave
:param c_f: Speed of sound in the fluid [m/s]
:param p_0: Pressure amplitude of the incident field [Pa]
:param position: Position in the standing wave field [m]
:param wave_type: Either standing or progressive wave [-]
"""
# init of parent class
......@@ -59,13 +53,14 @@ class BaseYosioka(BaseSphereFrequencyComposite):
self._R_0 = PassiveVariable(radius, "Particle-Radius")
# Dependent variables
self._xlambda = ActiveVariable(self._compute_xlambda,
"ratio of densities")
self._labmda_rho = ActiveVariable(self._compute_xlambda,
"ratio of densities")
self._sigma = ActiveVariable(self._compute_sigma,
"ratio of speed of sounds")
# Dependencies
self._xlambda.is_computed_by(self.particle._rho_f, self.fluid._rho_f)
self._labmda_rho.is_computed_by(self.particle._rho_f,
self.fluid._rho_f)
self._sigma.is_computed_by(self.particle._c_f, self.fluid._c_f)
log.info(str(self))
......@@ -128,10 +123,10 @@ class BaseYosioka(BaseSphereFrequencyComposite):
return self._sigma.value
@property
def xlambda(self) -> float:
def lambda_rho(self) -> float:
"""ratio of densities [-]
"""
return self._xlambda.value
return self._labmda_rho.value
# -------------------------------------------------------------------------
# Wrappers for Independent Field Attributes
......
......@@ -61,11 +61,11 @@ class ScatteringField(BaseYosioka, BaseScattering):
# -------------------------------------------------------------------------
self._A_n.is_computed_by(
self._xlambda, self.fluid._k_f,
self._labmda_rho, self.fluid._k_f,
self.particle._k_f, self._R_0, self.field._A_in
)
self._B_n.is_computed_by(
self._xlambda, self.fluid._k_f,
self._labmda_rho, self.fluid._k_f,
self.particle._k_f, self._R_0, self.field._A_in
)
......@@ -239,9 +239,8 @@ class ScatteringField(BaseYosioka, BaseScattering):
:param t: time [s]
:return: velocity potential [m^2/s]
"""
coeff = self.legendre_coeffs(lambda n:
self.B_n(n)
* sp.besselj(n, self.k_s * r))
coeff = self.legendre_coeffs(
lambda n: self.B_n(n) * sp.besselj(n, self.k_s * r))
out = exp(-1j * (self.omega * t))
out *= leg.cos_poly(theta, coeff)
......@@ -289,11 +288,11 @@ class ScatteringField(BaseYosioka, BaseScattering):
for n in full_range(n_old, N):
s = self.k_s * self.R_0
f = self.k_f * self.R_0
term1 = (self.xlambda * self.k_f *
term1 = (self.lambda_rho * self.k_f *
sp.besselj(n, s) * sp.d1_besselj(n, f))
term2 = self.k_s * sp.d1_besselj(n, s) * sp.besselj(n, f)
term3 = self.k_s * sp.d1_besselj(n, s) * sp.hankelh2(n, f)
term4 = (self.xlambda * self.k_f *
term4 = (self.lambda_rho * self.k_f *
sp.besselj(n, s) * sp.d1_hankelh2(n, f))
out = (term1 - term2) / (term3 - term4)
out *= self.field.A_in(n)
......@@ -310,7 +309,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
out = 1j * self.k_f
out /= f ** 2
term1 = self.k_s * sp.d1_besselj(n, s) * sp.hankelh2(n, f)
term2 = (self.xlambda * self.k_f *
term2 = (self.lambda_rho * self.k_f *
sp.besselj(n, s) * sp.d1_hankelh2(n, f))
out /= (term1 - term2)
out *= self.field.A_in(n)
......
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