Skip to content

Commit fafa540

Browse files
Correct Formula for Potential Energy (trixi-framework#2227)
* Correct Formula for Potential Energy * Update examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl Co-authored-by: Hendrik Ranocha <[email protected]> --------- Co-authored-by: Hendrik Ranocha <[email protected]>
1 parent c69fe96 commit fafa540

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ function Trixi.analyze(::Val{:energy_potential}, du, u_euler, t,
136136
u_gravity_local = Trixi.get_node_vars(u_gravity, equations_gravity, dg, i, j,
137137
element)
138138
# OBS! subtraction is specific to Jeans instability test where rho0 = 1.5e7
139-
return (u_euler_local[1] - 1.5e7) * u_gravity_local[1]
139+
# For formula of potential energy see
140+
# "Galactic Dynamics" by Binney and Tremaine, 2nd ed., equation (2.18)
141+
return 0.5f0 * (u_euler_local[1] - 1.5f7) * u_gravity_local[1]
140142
end
141143
return e_potential
142144
end

0 commit comments

Comments
 (0)