Skip to content

Commit

Permalink
Implemented a step limiter for when the B coefficients have converged
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxwell-Rosen committed Nov 28, 2023
1 parent 93e9128 commit 0d2d500
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Binary file modified figures/elliptical_orbit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions ias15PDE.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,18 @@ def push(func: callable, gunc: callable, xi, yi, dt, Bx = np.zeros(7), By = np.z
Output:
xn - new position x
yn - new position y'''

for i in range(12):
for i in range(20):
xh, yh = calculateNodePositions(Bx, By, xi, yi, func, gunc, dt, hp = h)
Fx, Fy = calculateDerivatives(xh, yh, func, gunc)
Gx, Gy = calculateGFromF_xy(Fx, Fy)
Bx, By = calculateB_xy(Gx, Gy)
Bxf, Byf = calculateB_xy(Gx, Gy)
diff_Bx = Bx - Bxf
diff_By = By - Byf
total_diff = np.sqrt(np.sum(diff_Bx**2) + np.sum(diff_By**2))
Bx = Bxf
By = Byf
if total_diff < 1e-16:
break
xn, yn = calculateNewPosition(Bx, By, xi, yi, func, gunc, dt)
return xn, yn, Bx, By

Expand Down
2 changes: 1 addition & 1 deletion regression_elipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
y0 = 0

ds = .001
s_final = np.pi*2
s_final = np.pi*2/100
nSteps = int(s_final/ds)
s = np.linspace(0,s_final,nSteps+1, endpoint=True)
x = np.zeros(nSteps+1)
Expand Down

0 comments on commit 0d2d500

Please sign in to comment.