Skip to content

Commit

Permalink
feat: Add empty auxiliary step
Browse files Browse the repository at this point in the history
Can use multiple dispatch to mutate the field inside the main loop,
depending on the simulation's demands.
  • Loading branch information
musoke committed Oct 1, 2021
1 parent 8abcb35 commit 4471272
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/UltraDark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ function update_gravitational_potential!(grids, constants; a=1.0)
ldiv!(grids.Φx, grids.rfft_plan, grids.Φk)
end

"""
auxiliary_step!(Δt, grids, t, constants)
Do an auxiliary inner step.
By default this does nothing, but can be overridden in multiple dispatch.
"""
function auxiliary_step!(Δt, grids, t, constants)
end

"""
add_external_potential!(t, grids, constants)
Expand Down Expand Up @@ -126,6 +135,7 @@ function take_steps!(grids, t_start, Δt, n, output_config, a, constants)
inner_step!(Δt, grids, constants; a=a(t))
update_gravitational_potential!(grids, constants; a=a(t))
add_external_potential!(t, grids, constants)
auxiliary_step!(Δt, grids, t, constants)

output_summary_row(grids, output_config, t, a(t), Δt)
end
Expand Down

0 comments on commit 4471272

Please sign in to comment.