Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- L = 100
- m = 1/100
- alpha = 5/(10**5)
- k = alpha/m
- def f(X, t):
- x_deriv = k*(V_w(X, t)[0]-X[0])
- y_deriv = k*(V_w(X, t)[1]-X[1])
- return [x_deriv, y_deriv]
- def V_w(X, t):
- x = X[0]
- y = X[1]
- R = np.sqrt(x*x+y*y)
- T = 24*3600 #sekunder
- x_vec = -(2*np.pi*R/T)*y/R
- y_vec = (2*np.pi*R/T)*x/R
- return [x_vec, y_vec]
- def forward_Euler(f, h, X, t):
- x_koord = X[0] + h*f(X, t)[0]
- y_koord = X[1] + h*f(X, t)[1]
- return [x_koord, y_koord]
- def explicit_trapezoid_eq1(f, h, X, V t):
- [u_temp, v_temp] = forward_Euler(f, h, V, t)
- u =
- x_koord = X[0] + (h/2)*(f(X, t)+f([x_temp,y_temp], t))
- y_koord = X[1] + (h/2)*(f_y(X, t) + f_y([x_temp, y_temp], t))
- return x_koord, y_koord
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement