Skip to content

Commit

Permalink
Fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aadi-bh committed Nov 23, 2023
1 parent 84c8fc2 commit 48b7a50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions burgers_filtered.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def burgers(t, u_hat, N, M, filter, a=1):
kk = freqs(NN)
nonlinear = -1 * fft(u**2/2) * 1j * kk
nonlinear *= a
# nonlinear *= filter
nonlinear *= filter
return unpad(mask(nonlinear), M//2)
def semigroup_heat(dt, k, eps):
S_half = sparse.diags(np.exp(-1 * eps * k**2 * dt / 2))
Expand All @@ -104,7 +104,7 @@ def semigroup_none(dt, k, eps):
fig.tight_layout()
god = np.loadtxt("burg3_GOD_3.txt").transpose()
# ax[0].plot(god[0] * 2 * np.pi, god[1], 'ko', markersize=0.1, label="Godunov flux")
for i in range(6):
for i in range(8):
N = np.power(2, i + 4);
M = 3 * N // 2;
NN = (2 * M//2) + N
Expand Down
10 changes: 5 additions & 5 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

def elrk4(SemiGroup,Nonlinear,y0,tinterval,dt,args):
y = y0
t, tfinal = tinterval
t, tf = tinterval
time = [t,]
solution = [y,]
flag = True
Expand Down Expand Up @@ -48,14 +48,14 @@ def elrk4(SemiGroup,Nonlinear,y0,tinterval,dt,args):
# solution.append(y)

time.append(t)
if t + dt > tfinal:
dt = tfinal - t
elif (t >= tfinal):
if t + dt > tf:
dt = tf - t
elif (t >= tf):
flag = False
elif np.any(np.isnan(y)):
flag = False
print("t, dt = ", t, dt)

times = np.array(time)
# solutions = np.array(solution)
solution.append(y)
return times, solution

0 comments on commit 48b7a50

Please sign in to comment.