Skip to content

Conversation

@maxbriel
Copy link
Collaborator

@maxbriel maxbriel commented Feb 7, 2026

Related to issue #794.

The time from the solver was not correctly added to the binary.time.
The solver here runs from 0 to max_time-binary.time.
This solution adds the final solver time to the binary.time

Alternative solution is to change the solver from binary.time -> max-time. This would be more in-line with the normal detached step.

@maxbriel maxbriel self-assigned this Feb 7, 2026
@maxbriel maxbriel added the bug Something isn't working label Feb 7, 2026
@maxbriel maxbriel linked an issue Feb 7, 2026 that may be closed by this pull request
@maxbriel maxbriel requested review from a team and sgossage February 9, 2026 06:38
@maxbriel maxbriel changed the title Append solver time to binary.time [fix] Append solver time to binary.time Feb 9, 2026
@sgossage
Copy link
Contributor

sgossage commented Feb 9, 2026

I think what's going on is actually that the CO step solver uses a bad time interval. Right now it always starts at 0 and spans up to the max time minus the current binary.time. It should start at the current binary.time and go until the max time (similar to how it is done for normal stars). I suggest the following change.

Right now we have:

        t0 = binary.time
        ...

        while status == -1 and n < 6:
            try:
                res = solve_ivp(self.evo,
                                events=self.evo.ev_contact,
                                method="BDF",
                            t_span=(0, self.max_time - t0),
                            ...)

            ....
            t0 += res.t[-1]

and we should use

        t0 = binary.time
        ...

        while status == -1 and n < 6:
            try:
                res = solve_ivp(self.evo,
                                events=self.evo.ev_contact,
                                method="BDF",
                            t_span=(t0, self.max_time),
                            ...)

            ....
            t0 += res.t[-1]

@maxbriel
Copy link
Collaborator Author

That's good. Either we change the interval or how we add the time. I'm happy to go with the solver change.

@maxbriel maxbriel requested a review from sgossage February 10, 2026 05:32
@maxbriel maxbriel changed the title [fix] Append solver time to binary.time [fix] Change solver interval to align with the evolution time Feb 10, 2026
@astroJeff astroJeff merged commit 6f70801 into main Feb 12, 2026
4 checks passed
@astroJeff astroJeff deleted the mb_co_contact_fix branch February 12, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: CO_contact unusual time values reported

3 participants