Skip to content

Commit

Permalink
Merge evolve of single and multi domain simulations
Browse files Browse the repository at this point in the history
Also remove unneeded functions
  • Loading branch information
lxmota committed Feb 7, 2025
1 parent c72ab22 commit 097620e
Showing 1 changed file with 5 additions and 40 deletions.
45 changes: 5 additions & 40 deletions src/evolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,12 @@
# is released under the BSD license detailed in the file license.txt in the
# top-level Norma.jl directory.

function evolve(sim::SingleDomainSimulation)
function evolve(sim::Simulation)
watch_keep_time(sim)
apply_ics(sim)
apply_bcs(sim)
initialize(sim)
initialize_writing(sim)
write_step(sim)
while true
advance_time(sim)
if stop_evolve(sim) == true
break
end
start_runtimer(sim)
watch_keep_time(sim)
if typeof(sim) == SingleDomainSimulation
apply_bcs(sim)
advance(sim)
end_runtimer(sim)
write_step(sim)
end
finalize_writing(sim)
end

function evolve(sim::MultiDomainSimulation)
watch_keep_time(sim)
apply_ics(sim)
initialize(sim)
initialize_writing(sim)
write_step(sim)
Expand All @@ -39,11 +20,11 @@ function evolve(sim::MultiDomainSimulation)
end
start_runtimer(sim)
watch_keep_time(sim)
if typeof(sim) == SingleDomainSimulation
apply_bcs(sim)
end
advance(sim)
end_runtimer(sim)
if sim.failed == true
break
end
write_step(sim)
end
finalize_writing(sim)
Expand Down Expand Up @@ -244,22 +225,6 @@ function advance_time(sim::MultiDomainSimulation)
sim.schwarz_controller.stop = stop
end

function regress_time(sim::SingleDomainSimulation)
sim.integrator.time = sim.model.time = sim.integrator.prev_time
sim.integrator.stop -= 1
end

function regress_time(sim::MultiDomainSimulation)
sim.schwarz_controller.time = sim.schwarz_controller.prev_time
stop = sim.schwarz_controller.stop - 1
final_time = sim.schwarz_controller.final_time
initial_time = sim.schwarz_controller.initial_time
num_stops = sim.schwarz_controller.num_stops
prev_time = (final_time - initial_time) * Float64(stop) / Float64(num_stops - 1) + initial_time
sim.schwarz_controller.prev_time = prev_time
sim.schwarz_controller.stop = stop
end

function start_runtimer(sim::SingleDomainSimulation)
sim.integrator.runtime_step = time()
end
Expand Down

0 comments on commit 097620e

Please sign in to comment.