Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
f905e379
Commit
f905e379
authored
Mar 14, 2018
by
Matthieu Schaller
Browse files
Added the missing 1/2 factor to go from potential to potential energy.
parent
19c1797e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/statistics.c
View file @
f905e379
...
...
@@ -191,7 +191,7 @@ void stats_collect_part_mapper(void *map_data, int nr_parts, void *extra_data) {
stats
.
E_int
+=
m
*
u_inter
;
stats
.
E_rad
+=
cooling_get_radiated_energy
(
xp
);
if
(
gp
!=
NULL
)
{
stats
.
E_pot_self
+=
m
*
gravity_get_physical_potential
(
gp
,
cosmo
);
stats
.
E_pot_self
+=
0
.
5
f
*
m
*
gravity_get_physical_potential
(
gp
,
cosmo
);
stats
.
E_pot_ext
+=
m
*
external_gravity_get_potential_energy
(
time
,
potential
,
phys_const
,
gp
);
}
...
...
@@ -292,7 +292,7 @@ void stats_collect_gpart_mapper(void *map_data, int nr_gparts,
/* Collect energies. */
stats
.
E_kin
+=
0
.
5
f
*
m
*
(
v
[
0
]
*
v
[
0
]
+
v
[
1
]
*
v
[
1
]
+
v
[
2
]
*
v
[
2
])
*
a_inv2
;
/* 1/2 m a^2 \dot{r}^2 */
stats
.
E_pot_self
+=
m
*
gravity_get_physical_potential
(
gp
,
cosmo
);
stats
.
E_pot_self
+=
0
.
5
f
*
m
*
gravity_get_physical_potential
(
gp
,
cosmo
);
stats
.
E_pot_ext
+=
m
*
external_gravity_get_potential_energy
(
time
,
potential
,
phys_const
,
gp
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment