Skip to content

Commit 60a6d23

Browse files
committed
Add type annotations to _Scales
1 parent 18da8bd commit 60a6d23

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

stagpy/stagyydata.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
"""
99

10+
from __future__ import annotations
1011
import re
1112
import pathlib
1213
from itertools import zip_longest
@@ -30,71 +31,70 @@ def _as_view_item(obj):
3031

3132

3233
class _Scales:
33-
"""Dimensionful scales.
34+
"""Dimensional scales.
3435
3536
Args:
36-
sdat (:class:`StagyyData`): the StagyyData instance owning the
37-
:class:`_Scales` instance.
37+
sdat: the StagyyData instance owning the :class:`_Scales` instance.
3838
"""
3939

40-
def __init__(self, sdat):
40+
def __init__(self, sdat: StagyyData):
4141
self._sdat = sdat
4242

4343
@crop
44-
def length(self):
44+
def length(self) -> float:
4545
"""Length in m."""
4646
thick = self._sdat.par['geometry']['d_dimensional']
4747
if self._sdat.par['boundaries']['air_layer']:
4848
thick += self._sdat.par['boundaries']['air_thickness']
4949
return thick
5050

5151
@property
52-
def temperature(self):
52+
def temperature(self) -> float:
5353
"""Temperature in K."""
5454
return self._sdat.par['refstate']['deltaT_dimensional']
5555

5656
@property
57-
def density(self):
57+
def density(self) -> float:
5858
"""Density in kg/m3."""
5959
return self._sdat.par['refstate']['dens_dimensional']
6060

6161
@property
62-
def th_cond(self):
62+
def th_cond(self) -> float:
6363
"""Thermal conductivity in W/(m.K)."""
6464
return self._sdat.par['refstate']['tcond_dimensional']
6565

6666
@property
67-
def sp_heat(self):
67+
def sp_heat(self) -> float:
6868
"""Specific heat capacity in J/(kg.K)."""
6969
return self._sdat.par['refstate']['Cp_dimensional']
7070

7171
@property
72-
def dyn_visc(self):
72+
def dyn_visc(self) -> float:
7373
"""Dynamic viscosity in Pa.s."""
7474
return self._sdat.par['viscosity']['eta0']
7575

7676
@property
77-
def th_diff(self):
77+
def th_diff(self) -> float:
7878
"""Thermal diffusivity in m2/s."""
7979
return self.th_cond / (self.density * self.sp_heat)
8080

8181
@property
82-
def time(self):
82+
def time(self) -> float:
8383
"""Time in s."""
8484
return self.length**2 / self.th_diff
8585

8686
@property
87-
def power(self):
87+
def power(self) -> float:
8888
"""Power in W."""
8989
return self.th_cond * self.temperature * self.length
9090

9191
@property
92-
def heat_flux(self):
92+
def heat_flux(self) -> float:
9393
"""Local heat flux in W/m2."""
9494
return self.power / self.length**2
9595

9696
@property
97-
def stress(self):
97+
def stress(self) -> float:
9898
"""Stress in Pa."""
9999
return self.dyn_visc / self.time
100100

0 commit comments

Comments
 (0)