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):
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 (1955).
:param frequency: Frequency [Hz]
:type frequency: Union[Frequency, float, int]k
:param radius: Radius of the solid [m]
......@@ -82,36 +86,48 @@ class BaseYosioka(BaseSphereFrequencyComposite):
log.debug(repr(self))
def __repr__(self):
return (
f'YosiokaARF({self.f}, {self.R_0}, {self.rho_s}, '
f'{self.rho_f}, {self.c_f}, '
f'{self.p_0}, {self.position}'
)
return (f'YosiokaARF('
f'{self.f}, '
f'{self.R_0}, '
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):
out = 'Yosioka\'s solution with following properties: \n'
out += SF.get_str_text('Frequency', 'f', self.f, 'Hz')
out += SF.get_str_text('Pressure', 'p_0', self.p_0, 'Pa')
out += SF.get_str_text('Position', 'pos',
self.position, 'm')
out += SF.get_str_text('Wavelength', 'lambda',
self.field.lambda_f, 'm')
param_general = [
['Frequency', 'f', self.f, 'Hz'],
['Pressure', 'p_0', self.p_0, 'Pa'],
['Position', 'pos', self.position, 'm'],
['Wavelength', 'lambda', 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 += SF.get_str_text('Density', 'rho_f',
self.rho_f, 'kg/m^3')
out += SF.get_str_text('Sound Speed', 'c_0',
self.c_f, 'm/s')
out += SF.get_str_text('Compressibility', 'kappa_f',
self.kappa_f, '1/Pa')
param_fluid = [
['Density', 'rho_f', self.rho_f, 'kg/m^3'],
['Sound Speed', 'c_0', self.c_f, 'm/s'],
['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 += SF.get_str_text('Radius', 'R_0',
self.R_0, 'm')
out += SF.get_str_text('Density', 'rho_s',
self.rho_s, 'kg/m^3')
out += SF.get_str_text('Sound Speed', 'c_s',
self.c_s, 'm/s')
param_solid = [
['Radius', 'R_0', self.R_0, 'm'],
['Density', 'rho_s', self.rho_s, 'kg/m^3'],
['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
# -------------------------------------------------------------------------
......@@ -189,7 +205,9 @@ class BaseYosioka(BaseSphereFrequencyComposite):
@property
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
......@@ -201,6 +219,8 @@ class BaseYosioka(BaseSphereFrequencyComposite):
def c_s(self) -> float:
"""
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
......@@ -271,6 +291,8 @@ class BaseYosioka(BaseSphereFrequencyComposite):
def k_s(self) -> float:
"""
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
......
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