jonnymaserati / welleng

A collection of Wells/Drilling Engineering tools, focused on well trajectory planning for the time being.
Apache License 2.0
119 stars 32 forks source link

Add annulus volume function to utils #157

Closed jonnymaserati closed 11 months ago

jonnymaserati commented 1 year ago

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 1 year ago

looks like annular_volume(Any)->Any to me 😊

BTW Please answer my email 🙏

jonnymaserati commented 1 year ago

Ha ha... well, it turns out that with those little additions the function becomes very handy - it'll also take numpy arrays.

jonnymaserati commented 11 months ago

Included in #167