Add annulus volume function to utils
Closed this issue · 3 comments
jonnymaserati commented
Add the following function to the utils
module:
def annular_volume(od : float, id : float = None, length: float = None):
"""
Calculate an annular volume.
If no ``id`` is provided then circular volume is calculated. If no
``length`` is provided, then the unit volume is calculated (i.e. the
area).
Units are assumed consistent across input parameters, i.e. the
calculation is dimensionless.
Parameters
----------
od : float
The outer diameter.
id : float | None, optional
The innter diameter, default is 0.
length : float | None, optional
The length of the annulus.
Returns
-------
annular_volume : float
The (unit) volume of the annulus or cylinder.
"""
length = 1 if length is None else length
id = 0 if id is None else id
annular_unit_volume = np.pi * ((od - id)**2) / 4
annular_volume = annular_unit_volume * length
return annular_volume
enomado commented
looks like annular_volume(Any)->Any
to me 😊
BTW Please answer my email 🙏
jonnymaserati commented
Ha ha... well, it turns out that with those little additions the function becomes very handy - it'll also take numpy arrays.
jonnymaserati commented
Included in #167