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

solid -> particle

- name Kawasima added
- n_max => N_max
parent b2cfac4e
Pipeline #97940 canceled with stages
in 1 minute and 31 seconds
......@@ -9,7 +9,7 @@ from gorkov import (
SpecialFunctions as sp)
from gorkov.solutions.base_arf import BaseARF
from scatteringfield import ScatteringField
from gorkov.solutions.Yosioka1955.scatteringfield import ScatteringField
class ARF(ScatteringField, BaseARF):
......@@ -29,7 +29,7 @@ class ARF(ScatteringField, BaseARF):
rho_s: float, c_s: float, rho_f: float, c_f: float,
p_0: float, position: Optional[float],
wave_type: str = "traveling",
particle_type: str = "general", n_max: int = 10) -> None:
particle_type: str = "general", N_max: int = 10) -> None:
"""
Initializes the class and sets all parameter needed for the
computation.
......@@ -67,7 +67,7 @@ class ARF(ScatteringField, BaseARF):
position=position,
wave_type=wave_type,
particle_type=particle_type,
n_max=n_max)
N_max=N_max)
self._F = ActiveVariable(self._compute_F,
"density-compressibility factor")
......@@ -80,18 +80,17 @@ class ARF(ScatteringField, BaseARF):
self._sigma,
self._xlambda,
self.field._wave_type,
self._particle_type,
self.solid._k_f,
self.particle._k_f,
self._R_0)
self._K_n.is_computed_by(
self.solid._k_f,
self.particle._k_f,
self._R_0,
self._B_n,
self.fluid._k_f)
self._M_n.is_computed_by(
self.solid._k_f,
self.particle._k_f,
self._R_0,
self._B_n,
self.fluid._k_f)
......
......@@ -25,7 +25,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
rho_f: float, c_f: float,
p_0: float, position: Optional[float],
wave_type: str = "traveling",
particle_type: str = "general", n_max: int = 10) -> None:
particle_type: str = "general", N_max: int = 10) -> None:
"""
Initializes the class and sets all parameter needed for the
......@@ -33,7 +33,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
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 (1955).
in the paper from Yoskioka and Kawasima (1955).
:param frequency: Frequency [Hz]
:type frequency: Union[Frequency, float, int]k
......@@ -51,7 +51,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
:type p_0: float
:param position: Position within the standing wave field [m]
:type position: Optional[float]
:param wave_type: either standing or progressive wavefield
:param wave_type: either standing or progressive wave
:type wave_type: str
:rtype: None
"""
......@@ -60,18 +60,18 @@ class BaseYosioka(BaseSphereFrequencyComposite):
self.BSF = BaseSphereFrequencyComposite(frequency, radius)
# Initialize Components
self.solid = InviscidFluid(self.frequency, rho_s, c_s)
self.particle = InviscidFluid(self.frequency, rho_s, c_s)
self.fluid = InviscidFluid(self.frequency, rho_f, c_f)
self.field = BackgroundField(self.fluid, p_0, wave_type, position)
# Independent variables
self.n_max = n_max
self.N_max = N_max
# TODO: remove particle_type
self._particle_type = PassiveVariable(
particle_type,
"Type of the particle")
# Independent variables:
self._R_0 = PassiveVariable(radius, "Particle-Radius")
# Dependent variables
self._xlambda = ActiveVariable(self._compute_xlambda,
"ratio of densities")
......@@ -79,18 +79,12 @@ class BaseYosioka(BaseSphereFrequencyComposite):
"ratio of speed of sounds")
# Dependencies
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
)
self._xlambda.is_computed_by(self.particle._rho_f, self.fluid._rho_f)
self._sigma.is_computed_by(self.particle._k_f, self.fluid._k_f)
log.info(str(self))
log.debug(repr(self))
# TODO: remove particle_type
def __repr__(self):
return (f'YosiokaARF('
f'{self.f}, '
......@@ -101,11 +95,9 @@ class BaseYosioka(BaseSphereFrequencyComposite):
f'{self.c_s}, '
f'{self.p_0}, '
f'{self.position}, '
f'{self.particle_type}, '
f'{self.wave_type}, '
f'{self.n_max} ')
f'{self.N_max} ')
# TODO: remove particle_type
def __str__(self):
out = 'Yosioka\'s solution with following properties: \n'
param_general = [
......@@ -114,8 +106,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
['Position', 'pos', self.position, 'm'],
['Wavelength', 'lambda', self.field.lambda_f, 'm'],
['Wavetype', 'wavetype', self.wave_type, ''],
['Particle Type', 'particle_type', self.particle_type, ''],
['Number of Iterations', 'n_max', self.n_max, '']
['Number of Iterations', 'N_max', self.N_max, '']
]
for p in param_general:
out += SF.get_str_text(p[0], p[1], p[2], p[3])
......@@ -219,11 +210,11 @@ class BaseYosioka(BaseSphereFrequencyComposite):
Since we assumed an inviscid fluid as a particle
we wrap to the fluid property.
"""
return self.solid.rho_f
return self.particle.rho_f
@rho_s.setter
def rho_s(self, value: float) -> None:
self.solid.rho_f = value
self.particle.rho_f = value
@property
def c_s(self) -> float:
......@@ -232,11 +223,11 @@ class BaseYosioka(BaseSphereFrequencyComposite):
Since we assumed an inviscid fluid as a particle
we wrap to the fluid property.
"""
return self.solid.c_f
return self.particle.c_f
@c_s.setter
def c_s(self, value: float) -> None:
self.solid.c_f = value
self.particle.c_f = value
@property
def particle_type(self) -> str:
......@@ -305,7 +296,7 @@ class BaseYosioka(BaseSphereFrequencyComposite):
Since we assumed an inviscid fluid as a particle
we wrap to the fluid property.
"""
return self.solid.k_f
return self.particle.k_f
# -------------------------------------------------------------------------
# Wrappers for Dependent Field Attributes
......@@ -391,9 +382,9 @@ class BaseYosioka(BaseSphereFrequencyComposite):
"""
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):
out.append(lambda_function(n))
return out
......
......@@ -6,8 +6,8 @@ from gorkov import (
SpecialFunctions as sp,
exp, log, full_range, ActiveVariable)
from .baseclass import BaseYosioka
from ..base_scattering import BaseScattering
from gorkov.solutions.Yosioka1955.baseclass import BaseYosioka
from gorkov.solutions.base_scattering import BaseScattering
class ScatteringField(BaseYosioka, BaseScattering):
......@@ -30,7 +30,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
rho_s: float, c_s: float, rho_f: float, c_f: float,
p_0: float, position: Optional[float],
wave_type: str = "traveling",
particle_type: str = "general", n_max: int = 10) -> None:
particle_type: str = "general", N_max: int = 10) -> None:
"""
Initializes the class and sets all parameter needed for the
computation.
......@@ -60,7 +60,7 @@ class ScatteringField(BaseYosioka, BaseScattering):
BaseYosioka.__init__(self, frequency, radius,
rho_s, c_s, rho_f, c_f,
p_0, position,
wave_type, particle_type, n_max)
wave_type, N_max)
log.info('Create ScatteringField')
......@@ -77,11 +77,11 @@ class ScatteringField(BaseYosioka, BaseScattering):
self._A_n.is_computed_by(
self._xlambda, self.fluid._k_f,
self.solid._k_f, self._R_0, self.field._A_in
self.particle._k_f, self._R_0, self.field._A_in
)
self._B_n.is_computed_by(
self._xlambda, self.fluid._k_f,
self.solid._k_f, self._R_0, self.field._A_in
self.particle._k_f, self._R_0, self.field._A_in
)
# TODO: but user facing first
......
......@@ -42,7 +42,7 @@ class TestYosioka(BaseTest):
position=self.pos,
wave_type=self.wave_type,
particle_type="general",
n_max=n_max)
N_max=n_max)
self.cls_special = Yosioka1955.ARF(frequency=self.f,
radius=self.R_0,
rho_s=self.rho_s, c_s=self.c_s,
......@@ -51,7 +51,7 @@ class TestYosioka(BaseTest):
position=self.pos,
wave_type=self.wave_type,
particle_type="special",
n_max=n_max)
N_max=n_max)
self.cls_bubble = Yosioka1955.ARF(frequency=self.f,
radius=self.R_0,
rho_s=self.rho_s, c_s=self.c_s,
......@@ -59,7 +59,7 @@ class TestYosioka(BaseTest):
p_0=self.p0,
position=self.pos,
wave_type=self.wave_type,
particle_type="bubble", n_max=n_max)
particle_type="bubble", N_max=n_max)
self.cls_sphere = Yosioka1955.ARF(frequency=self.f,
radius=self.R_0,
rho_s=self.rho_s, c_s=self.c_s,
......@@ -67,7 +67,7 @@ class TestYosioka(BaseTest):
p_0=self.p0,
position=self.pos,
wave_type=self.wave_type,
particle_type="sphere", n_max=n_max)
particle_type="sphere", N_max=n_max)
# for comparison
self.cls_king = King1934.ARF(self.f,
self.R_0, self.rho_s,
......
......@@ -42,7 +42,7 @@ class TestPlotVarious(BaseTestComposite):
c_s=self.c_s, p_0=self.p0,
position=self.pos,
wave_type=self.wave_type,
particle_type="analytical", n_max=n_max)
particle_type="analytical", N_max=n_max)
def randomly_change_parameters(self) -> None:
self.f = self.randomly_change_number(self.f)
......
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