Skip to content

Commit

Permalink
src: Add option Mongwane to ODESolver
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Dec 24, 2023
1 parent 5702669 commit 8a047d5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ODESolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ include("Sync.jl")
Eovlve!:
* evolve one complete time step for all levels
===============================================================================#
function Evolve!(f::Function, gfs)
function Evolve!(f::Function, gfs; Mongwane = false)
lmax = length(gfs.levs)

#----------------------------------------#
# march the first substep for all levels #
#----------------------------------------#
for l = 1:lmax # notice that we march coarse level first
if l > 1
(Mongwane) ? Sync.Prolongation_new(gfs, l, false) :
Sync.Prolongation(gfs, l, false)
end
rk4!(f, gfs.levs[l])
(Mongwane) ? rk4_new!(f, gfs.levs[l]) : rk4!(f, gfs.levs[l])
end

#-------------------------------------------------#
Expand All @@ -37,8 +38,10 @@ function Evolve!(f::Function, gfs)
if l < lmax
Sync.Restriction(gfs, l) # from l+1 to l
end
Sync.Prolongation(gfs, l, mod(substeps[l], 2) == 0) # from l-1 to l
rk4!(f, gfs.levs[l])
# from l-1 to l
(Mongwane) ? Sync.Prolongation_new(gfs, l, mod(substeps[l], 2) == 0) :
Sync.Prolongation(gfs, l, mod(substeps[l], 2) == 0)
(Mongwane) ? rk4_new!(f, gfs.levs[l]) : rk4!(f, gfs.levs[l])
end
end
end
Expand Down

0 comments on commit 8a047d5

Please sign in to comment.