From 7d5c682b7e6be5d6a2fbdba562b3ea6bb654d96d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 10 Jan 2025 11:41:23 +0100 Subject: [PATCH 1/2] Correct Formula for Potential Energy --- .../elixir_eulergravity_jeans_instability.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl index a070890e1be..dac9f918651 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl @@ -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 From 5dbb9d2877d545ba184d35aa40f07c10ed431011 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 11 Jan 2025 17:48:02 +0100 Subject: [PATCH 2/2] Update examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl Co-authored-by: Hendrik Ranocha --- .../elixir_eulergravity_jeans_instability.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl index dac9f918651..23c44cab4b4 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl @@ -139,7 +139,7 @@ function Trixi.analyze(::Val{:energy_potential}, du, u_euler, t, # OBS! subtraction is specific to Jeans instability test where rho0 = 1.5e7 # 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] + return 0.5f0 * (u_euler_local[1] - 1.5f7) * u_gravity_local[1] end return e_potential end