amuse icon indicating copy to clipboard operation
amuse copied to clipboard

single star not evolved in presence of binary

Open silviatoonen opened this issue 3 years ago • 9 comments

I'm running a very simple simulation with AMUSE & SeBa of the evolution of 1 binary and 1 single star. I make 3 star particles, of which 2 I place in the binary set. If star 0&1 are put in the binary, all goes well. The binary evolves, and the single star as well. However, if I place star 0 & 2 in the binary, then the evolution of star 1 is not executed.

macOS 10.13.6 gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.10.44.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

To Reproduce script used:

import numpy as np
import matplotlib.pyplot as plt
from amuse.community.seba.interface import SeBa
from amuse.datamodel import Particles
from amuse.support.console import set_printing_strategy
from amuse.units import quantities
from amuse.units import units, constants
from amuse.units.optparse import OptionParser


def evolve_model(m1,m2,m3,semi_major_axis,eccentricity,metallicity,end_time):

    stars = Particles(3)
    stars[0].mass = m1
    stars[1].mass = m2
    stars[2].mass = m3

    binary = Particles(1)
    binary.semi_major_axis = semi_major_axis
    binary.eccentricity = eccentricity
    binary.child1 = stars[0]
    binary.child2 = stars[2]

    code = SeBa()
#    code = SeBa(redirection='none')
    code.parameters.metallicity = metallicity
    code.particles.add_particles(stars)
    code.binaries.add_particles(binary)

    channel_stars = code.particles.new_channel_to(stars)
    channel_binary = code.binaries.new_channel_to(binary)
    channel_stars.copy()
    channel_binary.copy()

    time = 0.0|units.Myr
    previous_dt = 0.0|units.Myr
    
    while time <= end_time:
        print(time, stars.mass, stars.core_mass, stars.relative_mass, stars.stellar_type)
        dt = min(code.particles.time_step)
        time += dt
        previous_dt = dt
        code.evolve_model(time)
        channel_stars.copy()
        channel_binary.copy()
        
    print(time, stars.mass, stars.core_mass, stars.relative_mass, stars.stellar_type)



def parse_arguments():
    result = OptionParser()
    result.add_option("--m1", unit=units.MSun, dest='m1', type='float', default=14|units.MSun)
    result.add_option("--m2", unit=units.MSun, dest='m2', type='float', default=10|units.MSun)
    result.add_option("--m3", unit=units.MSun, dest='m3', type='float', default=5|units.MSun)
    result.add_option("-a", unit=units.RSun, dest='semi_major_axis', type='float', default=30000|units.RSun)
    result.add_option("-e", unit=units.none, dest='eccentricity', type='float', default=0.3|units.none)
    result.add_option("-Z", unit=units.none, dest='metallicity', type='float', default=0.02|units.none)
    result.add_option("--tf", unit=units.Myr, dest='end_time', type='float', default=13500.|units.Myr)
    options, args = result.parse_args()
    return options.__dict__
    
if __name__ == "__main__":
    set_printing_strategy("custom", preferred_units = [units.MSun, units.RSun, units.Myr], precision=5)
    options = parse_arguments()
    evolve_model(**options)

silviatoonen avatar May 06 '22 10:05 silviatoonen

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 05 '22 11:07 stale[bot]

I have confirmed this issue. It's very odd - the ordering of particles in AMUSE seems to make a difference...

rieder avatar Jul 05 '22 12:07 rieder

The issue seems very specific, it doesn't seem to happen if additional stars are added! (didn't test yet if the ordering matters here as well - I guess it might?)

rieder avatar Jul 05 '22 14:07 rieder

Does it happen if one uses sse/BSE instead of SeBa? Cheers Silvia


Dr. Silvia Toonen Assistant professor Anton Pannekoek Institute University of Amsterdam Email: @.@.> @.@.> will soon be deactivated. Website: https://staff.fnwi.uva.nl/s.g.m.toonen/https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstaff.fnwi.uva.nl%2Fs.g.m.toonen%2F&data=04%7C01%7Cservicedesk-icts%40uva.nl%7Ce2bdbbd0a70043e9f36f08d8ccef8185%7Ca0f1cacd618c4403b94576fb3d6874e5%7C1%7C0%7C637484676327089939%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=89YxQBjtPoJ%2BC3gAfS9IC6HGNPTNQPeMg47HQL0UMoo%3D&reserved=0


From: Steven Rieder @.> Sent: 05 July 2022 15:15 To: amusecode/amuse @.> Cc: Silvia Toonen @.>; Author @.> Subject: Re: [amusecode/amuse] single star not evolved in presence of binary (Issue #850)

The issue seems very specific, it doesn't seem to happen if additional stars are added! (didn't test yet if the ordering matters here as well - I guess it might?)

— Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Famusecode%2Famuse%2Fissues%2F850%23issuecomment-1175113681&data=05%7C01%7CS.G.M.Toonen%40uva.nl%7C0fcf23fbe9eb4db4b9d208da5e90e2dd%7Ca0f1cacd618c4403b94576fb3d6874e5%7C0%7C0%7C637926273611002710%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DO9gVueWwDuPkxXGOG17oaaaUlv0sWFfTLqVK%2F6%2FFz8%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGUXULDZYCG3ONT3GP24E5TVSQ7R7ANCNFSM5VHXVBYA&data=05%7C01%7CS.G.M.Toonen%40uva.nl%7C0fcf23fbe9eb4db4b9d208da5e90e2dd%7Ca0f1cacd618c4403b94576fb3d6874e5%7C0%7C0%7C637926273611002710%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=j95rCxWLtaZZd9CK8tRqYOiXR0QZ2KceYLszlaS02hw%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

silviatoonen avatar Jul 05 '22 15:07 silviatoonen

It looks like the issue also exists when using BSE instead of SeBa. So this is probably an AMUSE bug of some kind...

rieder avatar Jul 08 '22 15:07 rieder

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 06 '22 15:09 stale[bot]

this bit in interface.cc of Seba, in new_binary line 786 or so:

    if (child1 == seba_insertion_point) {
        seba_insertion_point = child1->get_younger_sister();
    }
    if (child2 == seba_insertion_point) {
        seba_insertion_point = child2->get_younger_sister();
    }
    if (child1 == seba_insertion_point) {
        seba_insertion_point = child1->get_younger_sister();

is suspicious: it tries to defer the insertion point in case one of the cilds is the instertion point, but it defers it to the younger sister, which is never defined for the insertion point..it probably (unless I misunderstand this bit of code, possible..) needs to be replaced by elder sister (because the childs get detached from the tree and reinserted). case in point is that doing this change fixes the testcase...

ipelupessy avatar Sep 08 '22 11:09 ipelupessy

I think the issue with BSE is that it will only evolve the binaries anyways...

ipelupessy avatar Sep 08 '22 12:09 ipelupessy

this bit in interface.cc of Seba, in new_binary line 786 or so:

    if (child1 == seba_insertion_point) {
        seba_insertion_point = child1->get_younger_sister();
    }
    if (child2 == seba_insertion_point) {
        seba_insertion_point = child2->get_younger_sister();
    }
    if (child1 == seba_insertion_point) {
        seba_insertion_point = child1->get_younger_sister();

is suspicious: it tries to defer the insertion point in case one of the cilds is the instertion point, but it defers it to the younger sister, which is never defined for the insertion point..it probably (unless I misunderstand this bit of code, possible..) needs to be replaced by elder sister (because the childs get detached from the tree and reinserted). case in point is that doing this change fixes the testcase...

@spzwart, @silviatoonen could you comment on this?

rieder avatar Sep 12 '22 08:09 rieder

@spzwart : can you comment on this? This is part of the code I haven't interacted with before

silviatoonen avatar Oct 10 '22 11:10 silviatoonen