Example #1
0
 def __init__(self, **keyword_arguments):
     mode = keyword_arguments.pop("mode", "ocean_only")
     CodeInterface.__init__(
         self,
         name_of_the_worker=self.name_of_the_worker(mode),
         **keyword_arguments)
     LiteratureReferencesMixIn.__init__(self)
Example #2
0
    def __init__(self,
                 pot,
                 t=0. | units.Gyr,
                 tgalpy=0. | units.Gyr,
                 ro=8,
                 vo=220.,
                 reverse=False):
        LiteratureReferencesMixIn.__init__(self)

        #Galpy scaling parameters
        self.ro = ro
        self.vo = vo

        #Galpy potential
        self.pot = pot

        #Initialize model time
        self.model_time = t

        #Initialize galpy time
        #Depending on how the galpy potential is setup, one may want to define a different initial galpy time
        #from which to evolve the potential (e.g. negative times)
        self.tgalpy = tgalpy.value_in(units.Gyr) / bovy_conversion.time_in_Gyr(
            ro=self.ro, vo=self.vo)
        #Move galpy potential backwards in time?
        self.reverse = reverse
Example #3
0
 def __init__(self,mass,a,G=constants.G):
     LiteratureReferencesMixIn.__init__(self)
     self.mass = mass
     self.a = a
     self.G = G
     self.GM = self.G*self.mass
     self.a2 = self.a**2
 def __init__(self,rho0,rs,G=constants.G):
     LiteratureReferencesMixIn.__init__(self)
     self.rho0 = rho0
     self.rs = rs
     self.G = G
     self.four_pi_rho0 = 4.*numpy.pi*self.rho0
     self.four_pi_rho0_G = self.four_pi_rho0*self.G
Example #5
0
 def __init__(self,rho0,rs,G=constants.G):
     LiteratureReferencesMixIn.__init__(self)
     self.rho0 = rho0
     self.rs = rs
     self.G = G
     self.four_pi_rho0 = 4.*numpy.pi*self.rho0
     self.four_pi_rho0_G = self.four_pi_rho0*self.G
 def __init__(self,mass,a,G=constants.G):
     LiteratureReferencesMixIn.__init__(self)
     self.mass = mass
     self.a = a
     self.G = G
     self.GM = self.G*self.mass
     self.a2 = self.a**2
Example #7
0
    def __init__(self, ):
        # self.__name__ = "LogarithmicDiskProfile"

        LiteratureReferencesMixIn.__init__(self)
        logger.info("Setting DefaultLogarithmicModelParameters")
        DefaultLogarithmicModelParameters.__init__(self)

        self.model_time = 0 | units.Myr
 def __init__(self,rho0,r0,alpha,rc,G=constants.G):
     LiteratureReferencesMixIn.__init__(self)
     self.rho0 = rho0
     self.r0 = r0
     self.alpha = alpha
     self.rc = rc
     self.G = G
     self.rho0_r0_to_alpha = self.rho0*self.r0**self.alpha
     
     if 3.<=self.alpha: print "Warning: power-law index must be less than 3."
Example #9
0
 def __init__(self,rho0,r0,alpha,rc,G=constants.G):
     LiteratureReferencesMixIn.__init__(self)
     self.rho0 = rho0
     self.r0 = r0
     self.alpha = alpha
     self.rc = rc
     self.G = G
     self.rho0_r0_to_alpha = self.rho0*self.r0**self.alpha
     
     if 3.<=self.alpha: print "Warning: power-law index must be less than 3."
Example #10
0
    def __init__(
        self,
        t_start=0 | units.Myr,
    ):
        # self.__name__ = "SpiralArmsProfile"

        logger.info("Setting DefaultSpiralModelParameters")
        DefaultSpiralModelParameters.__init__(self)
        LiteratureReferencesMixIn.__init__(self)
        self.time_initial = t_start
        self.model_time = 0 | units.Myr
        # Cz
        self.Cz = [8 / (3 * pi), 0.5, 8 / (15 * pi)]
Example #11
0
 def __init__(self,
              pot,
              t=0. | units.Gyr,
              tgalpy=0. | units.Gyr,
              ro=8,
              vo=220.):
     LiteratureReferencesMixIn.__init__(self)
     self.ro = ro
     self.vo = vo
     self.fconv = bovy_conversion.force_in_kmsMyr(ro=self.ro, vo=self.vo)
     self.pot = pot
     self.model_time = t
     self.tstart = tgalpy
     self.tgalpy = tgalpy.value_in(units.Gyr) * conv
Example #12
0
    def __init__(self, pot, t=0., tgalpy=0., ro=8, vo=220., reverse=False):
        """
        NAME:

           __init__

        PURPOSE:

           initialize a galpy potential for use with AMUSE

        INPUT:

           pot - galpy potential object or list of such objects

           t - start time for AMUSE simulation (can be an AMUSE Quantity)

           tgalpy - start time for galpy potential, can be less than zero (can be Quantity)

           ro=, vo= distance and velocity scales for translation into internal units (default from configuration file)

           reverse - set whether galpy potential evolves forwards or backwards in time (default: False)

        OUTPUT:

           (none)

        HISTORY:

           2019-08-12 - Written - Webb (UofT)

        """
        LiteratureReferencesMixIn.__init__(self)
        self.pot = pot
        self.ro = ro
        self.vo = vo
        self.reverse = reverse
        #Initialize model time
        if isinstance(t, ScalarQuantity):
            self.model_time = t
        else:
            self.model_time= \
                t*bovy_conversion.time_in_Gyr(ro=self.ro,vo=self.vo) \
                | units.Gyr
        #Initialize galpy time
        if isinstance(tgalpy, ScalarQuantity):
            self.tgalpy= tgalpy.value_in(units.Gyr)\
                /bovy_conversion.time_in_Gyr(ro=self.ro,vo=self.vo)
        else:
            self.tgalpy = tgalpy
Example #13
0
    def __init__(
        self,
        t_start=0 | units.yr,
        spiral_type="normal",
    ):
        # self.__name__ = "TimeDependentSpiralArmsDiskModel"

        LiteratureReferencesMixIn.__init__(self)

        logger.info("Creating LogarithmicDiskProfile")
        self.disk = LogarithmicDiskProfile()
        logger.info("Creating SpiralArmsProfile")
        if spiral_type == "normal":
            logger.info("Using spiral type normal")
            self.spiralarms = SpiralArmsProfile(t_start=t_start, )
        elif spiral_type == "strong":
            logger.info("Using spiral type strong")
            self.spiralarms = StrongSpiralArmsProfile(t_start=t_start, )
        else:
            logger.info("Unknown spiral type, defaulting to normal")
            self.spiralarms = SpiralArmsProfile(t_start=t_start, )
Example #14
0
    def __init__(self, mode=MODE_NORMAL, **keyword_arguments):
        self.mode = mode

        keyword_arguments.setdefault('number_of_workers', 8)
        CodeInterface.__init__(
            self,
            name_of_the_worker=self.name_of_the_worker(mode),
            **keyword_arguments)
        LiteratureReferencesMixIn.__init__(self)

        #~ if 'AMUSE_DIR' in os.environ:
        #~ amuse_dir = os.environ['AMUSE_DIR']
        #~ path = amuse_dir + '/src/omuse/community/pop/'
        #~ self.change_directory(path)

        if mode in [self.MODE_TEST]:
            self.set_namelist_filename('pop_in_lowres')
        elif mode in [self.MODE_NORMAL, self.MODE_320x384x40]:
            self.set_namelist_filename('pop_in_lowres')
        elif mode in [self.MODE_HIGH, self.MODE_3600x2400x42]:
            self.set_namelist_filename('pop_in_highres')
        else:
            raise Exception('Unknown mode')
Example #15
0
 def __init__(self, **options):
     CodeInterface.__init__(self,
                            name_of_the_worker=self.name_of_the_worker(),
                            **options)
     LiteratureReferencesMixIn.__init__(self)
 def __init__(self):
     LiteratureReferencesMixIn.__init__(self)
     self.bulge = PowerLawCutoff_profile(2.22638e8|units.MSun/units.kpc**3, 1.|units.kpc, 1.8, 1.9|units.kpc)
     self.disk = MiyamotoNagai_profile(6.81766163214e10|units.MSun, 3.|units.kpc, 0.28|units.kpc)
     self.halo = NFW_profile(8484685.92946|units.MSun/units.kpc**3, 16.|units.kpc)
Example #17
0
 def __init__(self):
     LiteratureReferencesMixIn.__init__(self)
     self.bulge = PowerLawCutoff_profile(2.22638e8|units.MSun/units.kpc**3, 1.|units.kpc, 1.8, 1.9|units.kpc)
     self.disk = MiyamotoNagai_profile(6.81766163214e10|units.MSun, 3.|units.kpc, 0.28|units.kpc)
     self.halo = NFW_profile(8484685.92946|units.MSun/units.kpc**3, 16.|units.kpc)