Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
2b0b35b3
Commit
2b0b35b3
authored
1 year ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Fix computation of the potential energy in the isothermal potential case
parent
73ca24b8
No related branches found
No related tags found
7 merge requests
!1997
Yet another master into zoom buffer branch merge (with formatting all done!)
,
!1994
Draft: Testing master -> zoom merge
,
!1987
Update zoom_merge with master updates (after wrangling immense conflicts)
,
!1982
Update zoom merge branch with latest master developments
,
!1956
Rename space_getsid to space_getsid_and_swap_cells() to try to prevent...
,
!1945
Another master->zoom_merge update
,
!1921
Mhd canvas
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/potential/isothermal/potential.h
+3
-3
3 additions, 3 deletions
src/potential/isothermal/potential.h
with
3 additions
and
3 deletions
src/potential/isothermal/potential.h
+
3
−
3
View file @
2b0b35b3
...
@@ -97,7 +97,7 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
...
@@ -97,7 +97,7 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
return
potential
->
timestep_mult
*
sqrtf
(
a_2
/
dota_2
);
return
potential
->
timestep_mult
*
sqrtf
(
a_2
/
dota_2
);
}
}
/**
/**
c
* @brief Computes the gravitational acceleration from an isothermal potential.
* @brief Computes the gravitational acceleration from an isothermal potential.
*
*
* Note that the accelerations are multiplied by Newton's G constant
* Note that the accelerations are multiplied by Newton's G constant
...
@@ -138,7 +138,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
...
@@ -138,7 +138,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @brief Computes the gravitational potential energy of a particle in an
* @brief Computes the gravitational potential energy of a particle in an
* isothermal potential.
* isothermal potential.
*
*
* phi =
-
0.5 * vrot^2 * ln(r^2 + epsilon^2)
* phi = 0.5 * vrot^2 * ln(r^2 + epsilon^2)
*
*
* @param time The current time (unused here).
* @param time The current time (unused here).
* @param potential The #external_potential used in the run.
* @param potential The #external_potential used in the run.
...
@@ -154,7 +154,7 @@ external_gravity_get_potential_energy(
...
@@ -154,7 +154,7 @@ external_gravity_get_potential_energy(
const
float
dy
=
g
->
x
[
1
]
-
potential
->
x
[
1
];
const
float
dy
=
g
->
x
[
1
]
-
potential
->
x
[
1
];
const
float
dz
=
g
->
x
[
2
]
-
potential
->
x
[
2
];
const
float
dz
=
g
->
x
[
2
]
-
potential
->
x
[
2
];
return
potential
->
vrot
*
potential
->
vrot
*
return
0
.
5
f
*
potential
->
vrot
*
potential
->
vrot
*
logf
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
+
potential
->
epsilon2
);
logf
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
+
potential
->
epsilon2
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment