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 f82cf1b8 authored by Cyrill Mast's avatar Cyrill Mast
Browse files

repr, str and docs

parent 19652f72
...@@ -29,6 +29,10 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -29,6 +29,10 @@ class BaseYosioka(BaseSphereFrequencyComposite):
Initializes the class and sets all parameter needed for the Initializes the class and sets all parameter needed for the
computation. 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 (1955).
:param frequency: Frequency [Hz] :param frequency: Frequency [Hz]
:type frequency: Union[Frequency, float, int]k :type frequency: Union[Frequency, float, int]k
:param radius: Radius of the solid [m] :param radius: Radius of the solid [m]
...@@ -82,36 +86,48 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -82,36 +86,48 @@ class BaseYosioka(BaseSphereFrequencyComposite):
log.debug(repr(self)) log.debug(repr(self))
def __repr__(self): def __repr__(self):
return ( return (f'YosiokaARF('
f'YosiokaARF({self.f}, {self.R_0}, {self.rho_s}, ' f'{self.f}, '
f'{self.rho_f}, {self.c_f}, ' f'{self.R_0}, '
f'{self.p_0}, {self.position}' f'{self.rho_s}, '
) f'{self.rho_f}, '
f'{self.c_f}, '
f'{self.c_s}, '
f'{self.p_0}, '
f'{self.position}, '
f'{self.particle_type}, '
f'{self.wave_type}, '
f'{self.n_max} ')
def __str__(self): def __str__(self):
out = 'Yosioka\'s solution with following properties: \n' out = 'Yosioka\'s solution with following properties: \n'
out += SF.get_str_text('Frequency', 'f', self.f, 'Hz') param_general = [
out += SF.get_str_text('Pressure', 'p_0', self.p_0, 'Pa') ['Frequency', 'f', self.f, 'Hz'],
out += SF.get_str_text('Position', 'pos', ['Pressure', 'p_0', self.p_0, 'Pa'],
self.position, 'm') ['Position', 'pos', self.position, 'm'],
out += SF.get_str_text('Wavelength', 'lambda', ['Wavelength', 'lambda', self.field.lambda_f, 'm']
self.field.lambda_f, 'm') ]
for p in param_general:
out += SF.get_str_text(p[0], p[1], p[2], p[3])
out += 'Fluid\n' out += 'Fluid\n'
out += SF.get_str_text('Density', 'rho_f', param_fluid = [
self.rho_f, 'kg/m^3') ['Density', 'rho_f', self.rho_f, 'kg/m^3'],
out += SF.get_str_text('Sound Speed', 'c_0', ['Sound Speed', 'c_0', self.c_f, 'm/s'],
self.c_f, 'm/s') ['Compressibility', 'kappa_f', self.kappa_f, '1/Pa']
out += SF.get_str_text('Compressibility', 'kappa_f', ]
self.kappa_f, '1/Pa') for p in param_fluid:
out += SF.get_str_text(p[0], p[1], p[2], p[3])
out += 'Particle\n' out += 'Particle\n'
out += SF.get_str_text('Radius', 'R_0', param_solid = [
self.R_0, 'm') ['Radius', 'R_0', self.R_0, 'm'],
out += SF.get_str_text('Density', 'rho_s', ['Density', 'rho_s', self.rho_s, 'kg/m^3'],
self.rho_s, 'kg/m^3') ['Sound Speed', 'c_s', self.c_s, 'm/s']
out += SF.get_str_text('Sound Speed', 'c_s', ]
self.c_s, 'm/s') for p in param_solid:
out += SF.get_str_text(p[0], p[1], p[2], p[3])
return out return out
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
...@@ -189,7 +205,9 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -189,7 +205,9 @@ class BaseYosioka(BaseSphereFrequencyComposite):
@property @property
def rho_s(self) -> float: def rho_s(self) -> float:
""" """
Wraps to :attr:`gorkov.core.solids.RigidSolid.rho_s` Wraps to :attr:`gorkov.core.fluids.InviscidFluid.rho_f`
Since we assumed an inviscid fluid as a particle
we wrap to the fluid property.
""" """
return self.solid.rho_f return self.solid.rho_f
...@@ -201,6 +219,8 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -201,6 +219,8 @@ class BaseYosioka(BaseSphereFrequencyComposite):
def c_s(self) -> float: def c_s(self) -> float:
""" """
Wraps to :attr:`gorkov.core.fluids.InviscidFluid.c_f` Wraps to :attr:`gorkov.core.fluids.InviscidFluid.c_f`
Since we assumed an inviscid fluid as a particle
we wrap to the fluid property.
""" """
return self.solid.c_f return self.solid.c_f
...@@ -271,6 +291,8 @@ class BaseYosioka(BaseSphereFrequencyComposite): ...@@ -271,6 +291,8 @@ class BaseYosioka(BaseSphereFrequencyComposite):
def k_s(self) -> float: def k_s(self) -> float:
""" """
Wraps to :attr:`gorkov.core.fluids.InviscidFluid.k_f` Wraps to :attr:`gorkov.core.fluids.InviscidFluid.k_f`
Since we assumed an inviscid fluid as a particle
we wrap to the fluid property.
""" """
return self.solid.k_f return self.solid.k_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