Skip to content

Accretion

Steady-state protostellar accretion models.

PowerLawAccrete

Tapered power-law accretion model for a protostar.

Implements the steady-state accretion law relating a protostar's instantaneous accretion rate to its current mass m and final mass mf, following the formalism of McKee & Offner (2010) and Offner & McKee (2011).

Parameters:

Name Type Description Default
j float

Power-law index of the accretion rate's dependence on m/mf.

required
jf float

Power-law index of the accretion rate's dependence on mf.

required
m0 float

Normalization of the accretion rate, in Msun/yr.

required
deltan1 float

Tapering parameter that drives the accretion rate to zero as m -> mf. Default is 0 (no tapering).

0

Attributes:

Name Type Description
j float

See Parameters.

jf float

See Parameters.

m0 float

See Parameters.

deltan1 float

See Parameters.

Source code in src/ocotillopmf/accretion.py
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
class PowerLawAccrete:
    """Tapered power-law accretion model for a protostar.

    Implements the steady-state accretion law relating a protostar's
    instantaneous accretion rate to its current mass `m` and final mass
    `mf`, following the formalism of McKee & Offner (2010) and Offner &
    McKee (2011).

    Parameters
    ----------
    j : float
        Power-law index of the accretion rate's dependence on `m/mf`.
    jf : float
        Power-law index of the accretion rate's dependence on `mf`.
    m0 : float
        Normalization of the accretion rate, in Msun/yr.
    deltan1 : float, optional
        Tapering parameter that drives the accretion rate to zero as
        `m -> mf`. Default is 0 (no tapering).

    Attributes
    ----------
    j : float
        See Parameters.
    jf : float
        See Parameters.
    m0 : float
        See Parameters.
    deltan1 : float
        See Parameters.
    """

    deltan1 = 0.0
    j = 1.0
    jf = 0.0
    m0 = 1e-5
    ml = 0.033
    mmax = 100.0

    def __init__(self, j: float, jf: float, m0: float, deltan1: float = 0) -> None:
        self.j = j
        self.jf = jf
        self.m0 = m0
        self.deltan1 = deltan1

    def acc(self, m: ArrayLike, mf: ArrayLike) -> float | np.ndarray:
        """Instantaneous mass accretion rate.

        Parameters
        ----------
        m : float or array_like
            Current protostellar mass, in Msun.
        mf : float or array_like
            Final protostellar mass, in Msun.

        Returns
        -------
        float or ndarray
            Accretion rate dm/dt, in Msun/yr.
        """
        return (
            self.m0
            * (m / mf) ** self.j
            * mf**self.jf
            * (1.0 - self.deltan1 * (m / mf) ** (1.0 - self.j)) ** (0.5)
        )

    def tm(self, mf: ArrayLike) -> float | np.ndarray:
        """Total formation timescale for a star of final mass `mf`.

        Parameters
        ----------
        mf : float or array_like
            Final protostellar mass, in Msun.

        Returns
        -------
        float or ndarray
            Formation timescale, in yr.
        """
        return (mf ** (1.0 - self.jf) / ((1.0 - self.j) * self.m0)) * (1 + self.deltan1)

    def tacc(self, m: ArrayLike, mf: ArrayLike) -> float | np.ndarray:
        """Instantaneous accretion timescale, ``m / acc(m, mf)``.

        Parameters
        ----------
        m : float or array_like
            Current protostellar mass, in Msun.
        mf : float or array_like
            Final protostellar mass, in Msun.

        Returns
        -------
        float or ndarray
            Accretion timescale, in yr.
        """
        # return (1.-self.j)*(m/mf)**(1.-self.j)*(1. - self.deltan1*(m/mf)**(1.-self.j))**(-0.5)*self.tm(mf)/(1.+self.deltan1)
        return m / self.acc(m, mf)

    def tmav(self, IMF: Callable[[float], float], ML: float, MU: float) -> float:
        """IMF-averaged formation timescale over a mass range.

        Parameters
        ----------
        IMF : callable
            Initial mass function, called as ``IMF(m)`` for a final mass
            `m`.
        ML : float
            Lower mass bound of the integral, in Msun.
        MU : float
            Upper mass bound of the integral, in Msun.

        Returns
        -------
        float
            IMF-weighted average formation timescale, in yr.
        """
        mfs = np.logspace(np.log10(ML), np.log10(MU), int(1e3))
        tmi = self.tm(mfs)
        imfi = np.array([IMF(mi) for mi in mfs])
        integrand = tmi * imfi
        return sint.trapezoid(integrand, x=np.log(mfs))

acc(m, mf)

Instantaneous mass accretion rate.

Parameters:

Name Type Description Default
m float or array_like

Current protostellar mass, in Msun.

required
mf float or array_like

Final protostellar mass, in Msun.

required

Returns:

Type Description
float or ndarray

Accretion rate dm/dt, in Msun/yr.

Source code in src/ocotillopmf/accretion.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
def acc(self, m: ArrayLike, mf: ArrayLike) -> float | np.ndarray:
    """Instantaneous mass accretion rate.

    Parameters
    ----------
    m : float or array_like
        Current protostellar mass, in Msun.
    mf : float or array_like
        Final protostellar mass, in Msun.

    Returns
    -------
    float or ndarray
        Accretion rate dm/dt, in Msun/yr.
    """
    return (
        self.m0
        * (m / mf) ** self.j
        * mf**self.jf
        * (1.0 - self.deltan1 * (m / mf) ** (1.0 - self.j)) ** (0.5)
    )

tm(mf)

Total formation timescale for a star of final mass mf.

Parameters:

Name Type Description Default
mf float or array_like

Final protostellar mass, in Msun.

required

Returns:

Type Description
float or ndarray

Formation timescale, in yr.

Source code in src/ocotillopmf/accretion.py
77
78
79
80
81
82
83
84
85
86
87
88
89
90
def tm(self, mf: ArrayLike) -> float | np.ndarray:
    """Total formation timescale for a star of final mass `mf`.

    Parameters
    ----------
    mf : float or array_like
        Final protostellar mass, in Msun.

    Returns
    -------
    float or ndarray
        Formation timescale, in yr.
    """
    return (mf ** (1.0 - self.jf) / ((1.0 - self.j) * self.m0)) * (1 + self.deltan1)

tacc(m, mf)

Instantaneous accretion timescale, m / acc(m, mf).

Parameters:

Name Type Description Default
m float or array_like

Current protostellar mass, in Msun.

required
mf float or array_like

Final protostellar mass, in Msun.

required

Returns:

Type Description
float or ndarray

Accretion timescale, in yr.

Source code in src/ocotillopmf/accretion.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
def tacc(self, m: ArrayLike, mf: ArrayLike) -> float | np.ndarray:
    """Instantaneous accretion timescale, ``m / acc(m, mf)``.

    Parameters
    ----------
    m : float or array_like
        Current protostellar mass, in Msun.
    mf : float or array_like
        Final protostellar mass, in Msun.

    Returns
    -------
    float or ndarray
        Accretion timescale, in yr.
    """
    # return (1.-self.j)*(m/mf)**(1.-self.j)*(1. - self.deltan1*(m/mf)**(1.-self.j))**(-0.5)*self.tm(mf)/(1.+self.deltan1)
    return m / self.acc(m, mf)

tmav(IMF, ML, MU)

IMF-averaged formation timescale over a mass range.

Parameters:

Name Type Description Default
IMF callable

Initial mass function, called as IMF(m) for a final mass m.

required
ML float

Lower mass bound of the integral, in Msun.

required
MU float

Upper mass bound of the integral, in Msun.

required

Returns:

Type Description
float

IMF-weighted average formation timescale, in yr.

Source code in src/ocotillopmf/accretion.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
def tmav(self, IMF: Callable[[float], float], ML: float, MU: float) -> float:
    """IMF-averaged formation timescale over a mass range.

    Parameters
    ----------
    IMF : callable
        Initial mass function, called as ``IMF(m)`` for a final mass
        `m`.
    ML : float
        Lower mass bound of the integral, in Msun.
    MU : float
        Upper mass bound of the integral, in Msun.

    Returns
    -------
    float
        IMF-weighted average formation timescale, in yr.
    """
    mfs = np.logspace(np.log10(ML), np.log10(MU), int(1e3))
    tmi = self.tm(mfs)
    imfi = np.array([IMF(mi) for mi in mfs])
    integrand = tmi * imfi
    return sint.trapezoid(integrand, x=np.log(mfs))