Skip to content

Commit

Permalink
Correct Formula for Potential Energy
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Jan 10, 2025
1 parent 62e3584 commit 7d5c682
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ function Trixi.analyze(::Val{:energy_potential}, du, u_euler, t,
u_gravity_local = Trixi.get_node_vars(u_gravity, equations_gravity, dg, i, j,
element)
# OBS! subtraction is specific to Jeans instability test where rho0 = 1.5e7
return (u_euler_local[1] - 1.5e7) * u_gravity_local[1]
# For formula of potential energy see
# "Galactic Dynamics" by Binney and Tremaine, 2nd ed., equation (2.18)
return 0.5 * (u_euler_local[1] - 1.5e7) * u_gravity_local[1]
end
return e_potential
end
Expand Down

0 comments on commit 7d5c682

Please sign in to comment.