Exemplo n.º 1
0
 def echo_quantities_error():
     function = LegacyFunctionSpecification()
     function.addParameter('quantity_in', dtype='float64', direction=function.IN)
     function.addParameter('quantity_out', dtype='float64', direction=function.OUT)
     function.result_type = 'int32'
     function.must_handle_array = True
     function.has_units = True
     function.id = 25
     return function
    def get_dens():
        function = LegacyFunctionSpecification()
        function.addParameter('index', dtype='int32', direction=function.IN)
        function.addParameter('dens', dtype='float64', direction=function.OUT)
        function.addParameter('N', dtype='int32', direction=function.LENGTH)

        function.result_type = 'int32'
        function.must_handle_array = True
        return function
Exemplo n.º 3
0
 def set_position():
     function = LegacyFunctionSpecification()
     function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN)
     function.addParameter('x', dtype='float64', direction=function.IN)
     function.addParameter('y', dtype='float64', direction=function.IN)
     function.addParameter('z', dtype='float64', direction=function.IN)
     function.addParameter('length', 'int32', function.LENGTH)
     function.result_type = 'int32'
     function.must_handle_array = True
     return function
Exemplo n.º 4
0
 def set_grid_momentum_density():
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     for x in ['i','j','k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     for x in ['rhovx', 'rhovy', 'rhovz',]:
         function.addParameter(x, dtype='d', direction=function.IN)
     function.addParameter('index_of_grid', dtype='i', direction=function.IN, default = 1)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 5
0
 def set_grid_magnetic_field():
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     for x in ['i','j','k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     for x in ['B1i', 'B2i', 'B3i']:
         function.addParameter(x, dtype='d', direction=function.IN)
     function.addParameter('index_of_grid', dtype='i', direction=function.IN, default = 1)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 6
0
 def get_potential():
     """
     Retrieves the gravitational potential on the given gridpoint (only
     for codes supporting an external gravitational potential).
     """
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     for x in ['i', 'j', 'k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     function.addParameter('potential', dtype='d', direction=function.OUT)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 7
0
 def get_potential():
     """
     Retrieves the gravitational potential on the given gridpoint (only
     for codes supporting an external gravitational potential).
     """
     function = LegacyFunctionSpecification()  
     function.must_handle_array = True
     for x in ['i','j','k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     function.addParameter('potential', dtype='d', direction=function.OUT)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 8
0
 def get_spiral_density():
     """
     Retrieve the density of the 3D spiral arms at a given point
     """
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     function.addParameter('x', dtype='float64', direction=function.IN, description="x position", unit=units.kpc)
     function.addParameter('y', dtype='float64', direction=function.IN, description="y position", unit=units.kpc)
     function.addParameter('z', dtype='float64', direction=function.IN, description="z position", unit=units.kpc)
     function.addParameter('dens', dtype='float64', direction=function.OUT, description="epicyclic freq", unit=2.32e7*units.MSun/units.kpc**3)
     function.addParameter('npoints', dtype='i', direction=function.LENGTH)
     function.result_type = 'int32'
     return function
Exemplo n.º 9
0
 def get_epifreq():
     """
     Retrieve the epicyclic frequency due to the axisymmetric potetial at a given point
     """
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     function.addParameter('x', dtype='float64', direction=function.IN, description="x position", unit=units.kpc)
     function.addParameter('y', dtype='float64', direction=function.IN, description="y position", unit=units.kpc)
     function.addParameter('z', dtype='float64', direction=function.IN, description="z position", unit=units.kpc)
     function.addParameter('k', dtype='float64', direction=function.OUT, description="epicyclic freq", unit=10*units.kms)
     function.addParameter('npoints', dtype='i', direction=function.LENGTH)
     function.result_type = 'int32'
     return function
Exemplo n.º 10
0
 def get_local_density():
     """
     Retrieve the local stellar density at a given point
     """
     function = LegacyFunctionSpecification()
     function.addParameter('t', dtype='float64', direction=function.IN, description="time", unit=97781310.5721*units.yr)
     function.addParameter('x', dtype='float64', direction=function.IN, description="x position", unit=units.kpc)
     function.addParameter('y', dtype='float64', direction=function.IN, description="y position", unit=units.kpc)
     function.addParameter('z', dtype='float64', direction=function.IN, description="z position", unit=units.kpc)
     function.addParameter('density', dtype='float64', direction=function.OUT, description="local density", unit=2.32e7*units.MSun/units.kpc**3)
     function.addParameter('npoints', dtype='i', direction=function.LENGTH)
     function.result_type = 'int32'
     function.must_handle_array = True
     return function
Exemplo n.º 11
0
 def get_grid_energy_density():
     """
     Retreives the energy densitity at the given grid-point
     """
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     for x in ['i','j','k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     function.addParameter('index_of_grid', dtype='i', direction=function.IN, default = 1)
     for x in ['en',]:
         function.addParameter(x, dtype='d', direction=function.OUT)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 12
0
 def set_grid_state():
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     for x in ['i', 'j', 'k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     for x in ['rho', 'rhovx', 'rhovy', 'rhovz', 'en']:
         function.addParameter(x, dtype='d', direction=function.IN)
     function.addParameter('index_of_grid',
                           dtype='i',
                           direction=function.IN,
                           default=1)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 13
0
    def get_tidal_radius():
        """
        Retrieve the tidal radius of a star cluster
        """
        function = LegacyFunctionSpecification()
        function.must_handle_array = True
        function.addParameter('t', dtype='float64', direction=function.IN, description="time", unit=97781310.5721*units.yr)
        function.addParameter('x', dtype='float64', direction=function.IN, description="x position", unit=units.kpc)
        function.addParameter('y', dtype='float64', direction=function.IN, description="y position", unit=units.kpc)
        function.addParameter('z', dtype='float64', direction=function.IN, description="z position", unit=units.kpc)
        function.addParameter('mc', dtype='float64', direction=function.IN, description="initial cluster mass", unit=2.32e7*units.MSun)
        function.addParameter('rt', dtype='float64', direction=function.OUT, description="tidal radius", unit=units.kpc)

        function.addParameter('npoints', dtype='i', direction=function.LENGTH)
        function.result_type = 'int32'
        return function
Exemplo n.º 14
0
    def get_eigen_values():
        """
        Retrieve the eigen values of the tidal tensor.
        """
        function = LegacyFunctionSpecification()
        function.must_handle_array = True
        function.addParameter('t', dtype='float64', direction=function.IN, description="time", unit=97781310.5721*units.yr)
        function.addParameter('x', dtype='float64', direction=function.IN, description="x position", unit=units.kpc)
        function.addParameter('y', dtype='float64', direction=function.IN, description="y position", unit=units.kpc)
        function.addParameter('z', dtype='float64', direction=function.IN, description="z position", unit=units.kpc)
        function.addParameter('lambda1', dtype='float64', direction=function.OUT, description="eigen values", unit=100*units.kms**2/units.kpc**2)
        function.addParameter('lambda2', dtype='float64', direction=function.OUT, description="eigen values", unit=100*units.kms**2/units.kpc**2)
        function.addParameter('lambda3', dtype='float64', direction=function.OUT, description="eigen values", unit=100*units.kms**2/units.kpc**2)
        function.addParameter('npoints', dtype='i', direction=function.LENGTH)
        function.result_type = 'int32'

        return function
Exemplo n.º 15
0
 def get_spiral_density():
    """
    Retrieve the density of the 3D spiral arms at a given point
    """
    function = LegacyFunctionSpecification() 
    function.must_handle_array = True 
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('dens', dtype='float64', direction=function.OUT
                          , description="epicyclic freq",unit= 2.32e7*units.MSun/units.kpc**3)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 16
0
 def get_epifreq():
    """
    Retrieve the epicyclic frequency due to the axisymmetric potetial at a given point
    """
    function = LegacyFunctionSpecification() 
    function.must_handle_array = True 
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('k', dtype='float64', direction=function.OUT
                          , description="epicyclic freq",unit= 10*units.kms)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 17
0
 def get_gravity_at_point():
    """
    Get the gravitational acceleration at the given points. To calculate the force on
    bodies at those points, multiply with the mass of the bodies
    """
    function = LegacyFunctionSpecification()  
    for x in ['eps','x','y','z']:
       function.addParameter(x, dtype='float64', direction=function.IN, unit=units.kpc)
    for x in ['ax','ay','az']:
       function.addParameter(
          x, 
          dtype='float64', 
          direction=function.OUT,     
          unit=100*units.km**2* units.s**-2/units.kpc
          )
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32' 
    function.must_handle_array = True
    return function
Exemplo n.º 18
0
 def get_local_density():
    """
    Retrieve the local stellar density at a given point
    """
    function = LegacyFunctionSpecification()
    function.addParameter('t', dtype='float64', direction=function.IN
                          , description="time",unit=97781310.5721*units.yr)
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('density', dtype='float64', direction=function.OUT
                          , description="local density",unit= 2.32e7*units.MSun/units.kpc**3)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    function.must_handle_array = True 
    return function
Exemplo n.º 19
0
 def get_gravity_at_point():
    """
    Get the gravitational acceleration at the given points. To calculate the force on
    bodies at those points, multiply with the mass of the bodies
    """
    function = LegacyFunctionSpecification()  
    for x in ['eps','x','y','z']:
       function.addParameter(x, dtype='float64', direction=function.IN, unit=units.kpc)
    for x in ['ax','ay','az']:
       function.addParameter(
          x, 
          dtype='float64', 
          direction=function.OUT,     
          unit=100*units.km**2* units.s**-2/units.kpc
          )
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32' 
    function.must_handle_array = True
    return function
Exemplo n.º 20
0
 def get_grid_energy_density():
     """
     Retreives the energy densitity at the given grid-point
     """
     function = LegacyFunctionSpecification()
     function.must_handle_array = True
     for x in ['i', 'j', 'k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     function.addParameter('index_of_grid',
                           dtype='i',
                           direction=function.IN,
                           default=1)
     for x in [
             'en',
     ]:
         function.addParameter(x, dtype='d', direction=function.OUT)
     function.addParameter('number_of_points', 'i', function.LENGTH)
     function.result_type = 'i'
     return function
Exemplo n.º 21
0
 def get_tidal_radius():
    """
    Retrieve the tidal radius of a star cluster
    """
    function = LegacyFunctionSpecification() 
    function.must_handle_array = True
    function.addParameter('t', dtype='float64', direction=function.IN
                          , description="time",unit= 97781310.5721*units.yr)
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('mc', dtype='float64', direction=function.IN
                          , description="initial cluster mass",unit=2.32e7*units.MSun)
    function.addParameter('rt', dtype='float64', direction=function.OUT
                          , description="tidal radius",unit= units.kpc)
    
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 22
0
 def get_potential_at_point():
    """
    Determine the gravitational potential on any given point
    """
    function = LegacyFunctionSpecification()  
    for x in ['eps','x','y','z']:
       function.addParameter(
          x, 
          dtype='float64', 
          direction=function.IN,
          unit=units.kpc
          )
    for x in ['phi']:
       function.addParameter(
          x, 
          dtype='float64', 
          direction=function.OUT,
          unit=100*units.km**2 * units.s**-2
          )
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    function.must_handle_array = True
    return function
Exemplo n.º 23
0
 def get_potential_at_point():
    """
    Determine the gravitational potential on any given point
    """
    function = LegacyFunctionSpecification()  
    for x in ['eps','x','y','z']:
       function.addParameter(
          x, 
          dtype='float64', 
          direction=function.IN,
          unit=units.kpc
          )
    for x in ['phi']:
       function.addParameter(
          x, 
          dtype='float64', 
          direction=function.OUT,
          unit=100*units.km**2 * units.s**-2
          )
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    function.must_handle_array = True
    return function
Exemplo n.º 24
0
 def get_tidal_tensor():
    """
    Retrieve the second derivatives of the total force at a given point
    and at a given time.
    """
    function = LegacyFunctionSpecification() 
    function.must_handle_array = True
    function.addParameter('t', dtype='float64', direction=function.IN
                          , description="time",unit= 97781310.5721*units.yr)
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)  
    function.addParameter('Fxx', dtype='float64', direction=function.OUT
                          , description="fxx",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fyx', dtype='float64', direction=function.OUT
                          , description="fyx",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fzx', dtype='float64', direction=function.OUT
                          , description="fzx",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fxy', dtype='float64', direction=function.OUT
                          , description="fxy",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fyy', dtype='float64', direction=function.OUT
                          , description="fyy",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fzy', dtype='float64', direction=function.OUT
                          , description="fzy",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fxz', dtype='float64', direction=function.OUT
                          , description="fxz",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fyz', dtype='float64', direction=function.OUT
                          , description="fyz",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fzz', dtype='float64', direction=function.OUT
                          , description="fzz",unit=100*units.kms**2/units.kpc**2 )
    
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 25
0
 def get_tidal_tensor():
    """
    Retrieve the second derivatives of the total force at a given point
    and at a given time.
    """
    function = LegacyFunctionSpecification() 
    function.must_handle_array = True
    function.addParameter('t', dtype='float64', direction=function.IN
                          , description="time",unit= 97781310.5721*units.yr)
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)  
    function.addParameter('Fxx', dtype='float64', direction=function.OUT
                          , description="fxx",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fyx', dtype='float64', direction=function.OUT
                          , description="fyx",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fzx', dtype='float64', direction=function.OUT
                          , description="fzx",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fxy', dtype='float64', direction=function.OUT
                          , description="fxy",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fyy', dtype='float64', direction=function.OUT
                          , description="fyy",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fzy', dtype='float64', direction=function.OUT
                          , description="fzy",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fxz', dtype='float64', direction=function.OUT
                          , description="fxz",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fyz', dtype='float64', direction=function.OUT
                          , description="fyz",unit=100*units.kms**2/units.kpc**2 )
    function.addParameter('Fzz', dtype='float64', direction=function.OUT
                          , description="fzz",unit=100*units.kms**2/units.kpc**2 )
    
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 26
0
   def get_eigen_values():
      """
      Retrieve the eigen values of the tidal tensor.
      """
      function = LegacyFunctionSpecification() 
      function.must_handle_array = True
      function.addParameter('t', dtype='float64', direction=function.IN
                            , description="time",unit= 97781310.5721*units.yr)
      function.addParameter('x', dtype='float64', direction=function.IN
                            , description="x position",unit=units.kpc)
      function.addParameter('y', dtype='float64', direction=function.IN
                            , description="y position",unit=units.kpc)
      function.addParameter('z', dtype='float64', direction=function.IN
                            , description="z position",unit=units.kpc)
      function.addParameter('lambda1', dtype='float64', direction=function.OUT
                            , description="eigen values",unit= 100*units.kms**2/units.kpc**2)
      function.addParameter('lambda2', dtype='float64', direction=function.OUT
                            , description="eigen values",unit= 100*units.kms**2/units.kpc**2)
      function.addParameter('lambda3', dtype='float64', direction=function.OUT
                            , description="eigen values",unit= 100*units.kms**2/units.kpc**2)
      function.addParameter('npoints', dtype='i', direction=function.LENGTH)
      function.result_type = 'int32'

      return function