示例#1
0
 def set_initial_condition(self,U0): 
     ODESolver.set_initial_condition(self,U0) #kaller funksjonen
     self.v = np.zeros((self.N+1, self.neq))
示例#2
0
 def __init__(self, f, N=20, eps=1E-6):
     ODESolver.__init__(self, f)
     self.N = N
     self.eps = eps
示例#3
0
 def __init__(self, f, N=10, eps = 1e-6):
     ODESolver.__init__(self,f) 
     self.N = N #lagre som distansevariable
     self.eps = eps
示例#4
0
from RK4Stepper import RK4Stepper
from ODESolver import ODESolver
import numpy as np


def getStartingState(zcoord):
    return SystemState(
        EarthPosition=[
            -3.1617821569319294E10, 1.436603570949401E11, 117565.96043321176
        ],
        EarthVelocity=[
            -29581.545053209236, -6515.282025813395, -0.010617114855559093
        ],
        AsteroidPosition=[-1.59458654e+11, -1.94077604e+11, 6.61733278e+09],
        AsteroidVelocity=[13224.513110762178, -14246.151046842608, zcoord])


space = Space()
stepper = RK4Stepper()
solver = ODESolver(stepper, space)


def printer(time, state, iteration):
    print(state)


solver.registerOutput(printer)

hit = solver.integrate(0, 365 * 24 * 60 * 60, 5 * 60, 10E-6,
                       getStartingState(1000))