Skip to main content

roche/
rcirc.rs

1use pyo3::prelude::*;
2
3#[pyfunction]
4///
5///  Returns circularisation radius from Verbunt & Rappaport (as fraction of
6/// binary separation)
7/// 
8/// Arguments:
9/// 
10/// * `q`: Mass ratio = M2/M1
11/// 
12pub fn rcirc(q: f64) -> f64 {
13    let lq = q.log10();
14    0.0883 + lq * (-0.04858 + lq * (0.11489 + 0.020475 * lq))
15}
16
17#[cfg(test)]
18mod tests {
19    use super::*;
20
21    #[test]
22    fn rcirc_test() -> () {
23        // Values from trm.roche.rcirc
24        assert_eq!(rcirc(0.2), 0.17139454448755287);
25    }
26}