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 (
ActiveVariable, full_range,
SpecialFunctions as sp)
from ..base_arf import BaseARF
from .scatteringfield import ScatteringField
from gorkov.solutions.base_arf import BaseARF
from scatteringfield import ScatteringField
class ARF(ScatteringField, BaseARF):
"""ARF according to Yosioka's theory of 1955
# TODO: this should not be a warning
.. warning::
This model is based on the following assumptions:
- 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],
radius: Union[Sphere, float, int],
rho_s: float, c_s: float, rho_f: float, c_f: float,
......@@ -102,10 +104,9 @@ class ARF(ScatteringField, BaseARF):
:rtype: float
"""
# TODO: adapt to small particle and bubble
if self.particle_type == "general":
out = self._compute_general_arf()
elif self.particle_type == "special":
out = self._compute_special_arf()
elif self.particle_type == "bubble":
out = self._compute_bubble_arf()
elif self.particle_type == "sphere":
......@@ -116,6 +117,7 @@ class ARF(ScatteringField, BaseARF):
return out
# TODO rename
def _compute_general_arf(self) -> float:
"""
Computes general analytical solution for the ARF
......@@ -174,13 +176,6 @@ class ARF(ScatteringField, BaseARF):
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:
"""
based on eq. (56)
......
......@@ -45,7 +45,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
:type c_s: float
:param rho_f: Density of the fluid [kg/m^3]
: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
:param p_0: Pressure amplitude of the field [Pa]
:type p_0: float
......@@ -66,7 +66,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
# Independent variables
self.n_max = n_max
# TODO: remove particle_type
self._particle_type = PassiveVariable(
particle_type,
"Type of the particle")
......@@ -82,6 +82,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
self._xlambda.is_computed_by(
self.solid._rho_f, self.fluid._rho_f
)
# TODO: change dependency
self._sigma.is_computed_by(
self.fluid._k_f, self.solid._k_f
)
......@@ -89,6 +90,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
log.info(str(self))
log.debug(repr(self))
# TODO: remove particle_type
def __repr__(self):
return (f'YosiokaARF('
f'{self.f}, '
......@@ -103,6 +105,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
f'{self.wave_type}, '
f'{self.n_max} ')
# TODO: remove particle_type
def __str__(self):
out = 'Yosioka\'s solution with following properties: \n'
param_general = [
......@@ -324,9 +327,9 @@ class BaseYosioka(BaseSphereFrequencyComposite):
"""
return self.field.E_ac
# ----------------------------------
# -------------------------------------------------------------------------
# Wrappers for independent variables
# ----------------------------------
# -------------------------------------------------------------------------
@property
def R_0(self) -> float:
......@@ -355,6 +358,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
:rtype: float
"""
# TODO: Define in terms of wave speeds rather than wavenumbers
return self.k_s / self.k_f
def _compute_xlambda(self) -> float:
......@@ -365,9 +369,11 @@ class BaseYosioka(BaseSphereFrequencyComposite):
"""
return self.rho_s / self.rho_f
# ----------------
# -------------------------------------------------------------------------
# Helper functions
# ----------------
# -------------------------------------------------------------------------
# TODO Delete this
def legendre_coeffs(
self,
......@@ -386,6 +392,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
out = []
if self.n_max is None:
# TODO: Remove this bug
self.n_max = 10
for n in range(iterations):
out.append(lambda_function(n))
......
......@@ -24,6 +24,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
- plane progressive / standing wave field
"""
# TODO: remove particle_type
def __init__(self, frequency: Union[Frequency, float],
radius: Union[Sphere, float],
rho_s: float, c_s: float, rho_f: float, c_f: float,
......@@ -55,6 +56,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
:rtype: None
"""
# TODO: remove particle_type
BaseYosioka.__init__(self, frequency, radius,
rho_s, c_s, rho_f, c_f,
p_0, position,
......@@ -82,6 +84,8 @@ class ScatteringField(BaseYosioka, BaseScattering):
self.solid._k_f, self._R_0, self.field._A_in
)
# TODO: but user facing first
# -------------------------------------------------------------------------
# Velocity Potentials
# -------------------------------------------------------------------------
......@@ -177,6 +181,10 @@ class ScatteringField(BaseYosioka, BaseScattering):
# 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
) -> float:
"""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