Skip to content

Commit

Permalink
src: Absorb h in k
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Dec 25, 2023
1 parent ad684b2 commit 9cc4e3e
Show file tree
Hide file tree
Showing 6 changed files with 869 additions and 865 deletions.
18 changes: 11 additions & 7 deletions src/ODESolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,26 @@ function rk4_new!(f::Function, levf)
@. u_p = u * 1.0
lev.time = t
f(lev, k1, u; interior_only = true)
@. u += k1 * (dt / 6)
@. k1 *= dt
@. u += k1 * (1 / 6)

@. w = u_p + k1 * (dt / 2)
@. w = u_p + k1 * (1 / 2)
lev.time = t + 0.5 * dt
f(lev, k2, w; interior_only = true)
@. u += k2 * (dt / 3)
@. k2 *= dt
@. u += k2 * (1 / 3)

@. w = u_p + k2 * (dt / 2)
@. w = u_p + k2 * (1 / 2)
lev.time = t + 0.5 * dt
f(lev, k3, w; interior_only = true)
@. u += k3 * (dt / 3)
@. k3 *= dt
@. u += k3 * (1 / 3)

@. w = u_p + k3 * dt
@. w = u_p + k3
lev.time = t + dt
f(lev, k4, w; interior_only = true)
@. u += k4 * (dt / 6)
@. k4 *= dt
@. u += k4 * (1 / 6)
lev.time = t + dt
end

Expand Down
4 changes: 2 additions & 2 deletions src/Sync.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Prolongation_new(gfs, l, interp_in_time::Bool; ord_s = 3)
f = (j == 1) ? i : nxa - i + 1
c = if2c[f]
if aligned[f]
kcs = [levc.k[m][v][c] * dtc for m = 1:4]
kcs = [levc.k[m][v][c] for m = 1:4]
kfs = calc_kfs_from_kcs(kcs, dtc, interp_in_time)
# setting k
for m = 1:3
Expand All @@ -37,7 +37,7 @@ function Prolongation_new(gfs, l, interp_in_time::Bool; ord_s = 3)
kfss = zeros(Float64, 3, 4)
ys = zeros(Float64, 4)
for ic = 1:4
kcs = [levc.k[m][v][c+ic-2] * dtc for m = 1:4]
kcs = [levc.k[m][v][c+ic-2] for m = 1:4]
kfss[:, ic] = calc_kfs_from_kcs(kcs, dtc, interp_in_time)
ys[ic] =
interp_in_time ? DenseOutput.y(0.5, uc_p[c+ic-2], kcs) :
Expand Down
Loading

0 comments on commit 9cc4e3e

Please sign in to comment.