예제 #1
0
 def SingleParticleDerivativeVector(self,kstate,particle,t):
     if self.interaction_type == "ClassicalNBody":
         rad = farts.xy2rad(kstate[particle],
                            self.SingleParticleNewtonianForce(particle,
                                                              2,
                                                              2))
                                                               
                                                               
     elif self.interaction_type == None:
         rad = farts.xy2rad(self.state[particle],(0,0))
         
     elif self.interaction_type == "ClassicalElastic":
         raise ValueError("ClassicalElastic collisions not implemented yet")
     
     
     r = rad[0,0]   
     phi = rad[0,1]
     
     if(r > 999 or r < self.event_horizon):
             if particle not in self.cleanup:
                 self.cleanup.append(particle)        
     
     f = np.array(([rad[0,0],rad[1,0]],[rad[0,1],rad[1,1]]))
     G=np.array([[f[0,1],
                  -(1/f[0,0]**4)*(self.a(t)**2-2*self.M*f[0,0]+(f[0,0]**2))*((self.M*(f[0,0]**4)*f[0,1]**2)/(self.a(t)**2-2*self.M*f[0,0]+(f[0,0]**2))**2-((f[0,0]**5)*(f[0,1]**2))/((self.a(t)**2)-2*self.M*f[0,0]+(f[0,0]**2))**2+self.M*(-1+self.a(t)*f[1,1])**2+(f[0,0]**3)*((f[0,1]**2)/((self.a(t)**2)-2*self.M*f[0,0]+(f[0,0]**2))-(f[1,1]**2)))+rad[2,0]],
                  [f[1,1],
                  -((2*f[0,1]*(self.a(t)*self.M+(-(self.a(t)**2)*self.M+f[0,0]**3)*f[1,1]))/(f[0,0]*(2*(self.a(t)**2)*self.M+(self.a(t)**2)*f[0,0]+(f[0,0]**3))))+rad[2,1]]])
     
     return(farts.G2xy(G,r,phi))
예제 #2
0
    def SingleParticleDerivativeVector(self, kstate, particle, t):
        #print("\n\n\nInput XY state: ", self.state)
        if self.interaction == False:
            rad = farts.xy2rad(kstate[particle],(0,0))
        elif self.interaction == 'ClassicalNBody':
        	rad = farts.xy2rad(kstate[particle],
                	           self.SingleParticleNewtonianForce(particle, 100, self.cr))
        elif self.interation == True:
        	raise ValueError('Ambiguous interaction specification')

        r = rad[0,0]
        phi = rad[0,1]
        if(r > 999 or r < self.event_horizon-0.2):
            if particle not in self.cleanup:
                self.cleanup.append(particle)
        f = np.array(([rad[0,0],rad[1,0]],
                      [rad[0,1],rad[1,1]]))
       
        #print("\nInput RP state: ", f)
        # The Kerr metric
        G=np.array([[f[0,1],
                    (-(self.M*pow(pow(self.a(t),2) - 2*self.M*f[0,0] + pow(f[0,0],2),2)) + self.a(t)*self.M*pow(pow(self.a(t),2) - 2*self.M*f[0,0] + pow(f[0,0],2),2)*f[1,1] + pow(pow(self.a(t),2) - 2*self.M*f[0,0] + pow(f[0,0],2),2)*f[1,1]*(self.a(t)*self.M + (-(pow(self.a(t),2)*self.M) + pow(f[0,0],3))*f[1,1]) + pow(f[0,0],3)*(-pow(self.a(t),2) + self.M*f[0,0])*pow(f[0,1],2))/(pow(f[0,0],4)*(pow(self.a(t),2) - 2*self.M*f[0,0] + pow(f[0,0],2)))],
                   [f[1,1],
                   (2*(-(self.a(t)*self.M) + (pow(self.a(t),2)*self.M + 2*self.M*pow(f[0,0],2) - pow(f[0,0],3))*f[1,1])*f[0,1])/(pow(f[0,0],2)*(pow(self.a(t),2) - 2*self.M*f[0,0] + pow(f[0,0],2)))]])
        #print("\nRTP G: ",G)
        #G = np.array([[f[0,1],rad[2,0]],
        #              [f[1,1],rad[2,1]]])
        xyG = farts.G2xy(G,r,phi)
        #print("\nXY G: ",xyG)
        return(xyG)