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

All TODOs added

parent 12da6dae
Pipeline #97937 failed with stages
in 1 minute and 55 seconds
...@@ -8,20 +8,22 @@ from gorkov import ( ...@@ -8,20 +8,22 @@ from gorkov import (
ActiveVariable, full_range, ActiveVariable, full_range,
SpecialFunctions as sp) SpecialFunctions as sp)
from ..base_arf import BaseARF from gorkov.solutions.base_arf import BaseARF
from .scatteringfield import ScatteringField from scatteringfield import ScatteringField
class ARF(ScatteringField, BaseARF): class ARF(ScatteringField, BaseARF):
"""ARF according to Yosioka's theory of 1955 """ARF according to Yosioka's theory of 1955
# TODO: this should not be a warning
.. warning:: .. warning::
This model is based on the following assumptions: This model is based on the following assumptions:
- Inviscid fluid - Inviscid fluid
- Spheres of finite compressibility
- plane progressive / standing wave field
""" """
# TODO: add small particle limit and bubble instead of particle type
def __init__(self, frequency: Union[Frequency, float, int], def __init__(self, frequency: Union[Frequency, float, int],
radius: Union[Sphere, float, int], radius: Union[Sphere, float, int],
rho_s: float, c_s: float, rho_f: float, c_f: float, rho_s: float, c_s: float, rho_f: float, c_f: float,
...@@ -102,10 +104,9 @@ class ARF(ScatteringField, BaseARF): ...@@ -102,10 +104,9 @@ class ARF(ScatteringField, BaseARF):
:rtype: float :rtype: float
""" """
# TODO: adapt to small particle and bubble
if self.particle_type == "general": if self.particle_type == "general":
out = self._compute_general_arf() out = self._compute_general_arf()
elif self.particle_type == "special":
out = self._compute_special_arf()
elif self.particle_type == "bubble": elif self.particle_type == "bubble":
out = self._compute_bubble_arf() out = self._compute_bubble_arf()
elif self.particle_type == "sphere": elif self.particle_type == "sphere":
...@@ -116,6 +117,7 @@ class ARF(ScatteringField, BaseARF): ...@@ -116,6 +117,7 @@ class ARF(ScatteringField, BaseARF):
return out return out
# TODO rename
def _compute_general_arf(self) -> float: def _compute_general_arf(self) -> float:
""" """
Computes general analytical solution for the ARF Computes general analytical solution for the ARF
...@@ -174,13 +176,6 @@ class ARF(ScatteringField, BaseARF): ...@@ -174,13 +176,6 @@ class ARF(ScatteringField, BaseARF):
return out return out
def _compute_special_arf(self) -> float:
if self.wave_type == 'traveling':
out = self._traveling_wave_solution_special()
return out * (abs(self.field.A) ** 2).real
else:
raise NotImplementedError('Solution is no implemented (yet).')
def _traveling_wave_solution_special(self) -> float: def _traveling_wave_solution_special(self) -> float:
""" """
based on eq. (56) based on eq. (56)
......
...@@ -45,7 +45,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -45,7 +45,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
:type c_s: float :type c_s: float
:param rho_f: Density of the fluid [kg/m^3] :param rho_f: Density of the fluid [kg/m^3]
:type rho_f: float :type rho_f: float
:param c_f: Soundspeed of the fluid [m/s] :param c_f: speed of sound in the fluid [m/s]
:type c_f: float :type c_f: float
:param p_0: Pressure amplitude of the field [Pa] :param p_0: Pressure amplitude of the field [Pa]
:type p_0: float :type p_0: float
...@@ -66,7 +66,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -66,7 +66,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
# Independent variables # Independent variables
self.n_max = n_max self.n_max = n_max
# TODO: remove particle_type
self._particle_type = PassiveVariable( self._particle_type = PassiveVariable(
particle_type, particle_type,
"Type of the particle") "Type of the particle")
...@@ -82,6 +82,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -82,6 +82,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
self._xlambda.is_computed_by( self._xlambda.is_computed_by(
self.solid._rho_f, self.fluid._rho_f self.solid._rho_f, self.fluid._rho_f
) )
# TODO: change dependency
self._sigma.is_computed_by( self._sigma.is_computed_by(
self.fluid._k_f, self.solid._k_f self.fluid._k_f, self.solid._k_f
) )
...@@ -89,6 +90,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -89,6 +90,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
log.info(str(self)) log.info(str(self))
log.debug(repr(self)) log.debug(repr(self))
# TODO: remove particle_type
def __repr__(self): def __repr__(self):
return (f'YosiokaARF(' return (f'YosiokaARF('
f'{self.f}, ' f'{self.f}, '
...@@ -103,6 +105,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -103,6 +105,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
f'{self.wave_type}, ' f'{self.wave_type}, '
f'{self.n_max} ') f'{self.n_max} ')
# TODO: remove particle_type
def __str__(self): def __str__(self):
out = 'Yosioka\'s solution with following properties: \n' out = 'Yosioka\'s solution with following properties: \n'
param_general = [ param_general = [
...@@ -324,9 +327,9 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -324,9 +327,9 @@ class BaseYosioka(BaseSphereFrequencyComposite):
""" """
return self.field.E_ac return self.field.E_ac
# ---------------------------------- # -------------------------------------------------------------------------
# Wrappers for independent variables # Wrappers for independent variables
# ---------------------------------- # -------------------------------------------------------------------------
@property @property
def R_0(self) -> float: def R_0(self) -> float:
...@@ -355,6 +358,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -355,6 +358,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
:rtype: float :rtype: float
""" """
# TODO: Define in terms of wave speeds rather than wavenumbers
return self.k_s / self.k_f return self.k_s / self.k_f
def _compute_xlambda(self) -> float: def _compute_xlambda(self) -> float:
...@@ -365,9 +369,11 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -365,9 +369,11 @@ class BaseYosioka(BaseSphereFrequencyComposite):
""" """
return self.rho_s / self.rho_f return self.rho_s / self.rho_f
# ---------------- # -------------------------------------------------------------------------
# Helper functions # Helper functions
# ---------------- # -------------------------------------------------------------------------
# TODO Delete this
def legendre_coeffs( def legendre_coeffs(
self, self,
...@@ -386,6 +392,7 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -386,6 +392,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
out = [] out = []
if self.n_max is None: if self.n_max is None:
# TODO: Remove this bug
self.n_max = 10 self.n_max = 10
for n in range(iterations): for n in range(iterations):
out.append(lambda_function(n)) out.append(lambda_function(n))
......
...@@ -24,6 +24,7 @@ class ScatteringField(BaseYosioka, BaseScattering): ...@@ -24,6 +24,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
- plane progressive / standing wave field - plane progressive / standing wave field
""" """
# TODO: remove particle_type
def __init__(self, frequency: Union[Frequency, float], def __init__(self, frequency: Union[Frequency, float],
radius: Union[Sphere, float], radius: Union[Sphere, float],
rho_s: float, c_s: float, rho_f: float, c_f: float, rho_s: float, c_s: float, rho_f: float, c_f: float,
...@@ -55,6 +56,7 @@ class ScatteringField(BaseYosioka, BaseScattering): ...@@ -55,6 +56,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
:rtype: None :rtype: None
""" """
# TODO: remove particle_type
BaseYosioka.__init__(self, frequency, radius, BaseYosioka.__init__(self, frequency, radius,
rho_s, c_s, rho_f, c_f, rho_s, c_s, rho_f, c_f,
p_0, position, p_0, position,
...@@ -82,6 +84,8 @@ class ScatteringField(BaseYosioka, BaseScattering): ...@@ -82,6 +84,8 @@ class ScatteringField(BaseYosioka, BaseScattering):
self.solid._k_f, self._R_0, self.field._A_in self.solid._k_f, self._R_0, self.field._A_in
) )
# TODO: but user facing first
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Velocity Potentials # Velocity Potentials
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
...@@ -177,6 +181,10 @@ class ScatteringField(BaseYosioka, BaseScattering): ...@@ -177,6 +181,10 @@ class ScatteringField(BaseYosioka, BaseScattering):
# User-faced functions # User-faced functions
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# TODO: Mode argument missing in all methods
# TODO: Plotting scattering field and incident
# field separately not possible
def radial_acoustic_fluid_velocity(self, r: float, theta: float, t: float def radial_acoustic_fluid_velocity(self, r: float, theta: float, t: float
) -> float: ) -> float:
"""Radial acoustic velocity """Radial acoustic velocity
......
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