Skip to content
GitLab
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
20d99103
Commit
20d99103
authored
Oct 21, 2016
by
Matthieu Schaller
Browse files
External potentials add to the acceleration. They don't overwrite it.
parent
da35a19a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cooling/const_lambda/cooling.h
View file @
20d99103
...
...
@@ -48,7 +48,7 @@ __attribute__((always_inline)) INLINE static float cooling_rate(
const
struct
cooling_function_data
*
cooling
,
const
struct
part
*
p
)
{
/* Get particle density */
const
float
rho
=
p
->
rho
;
const
float
rho
=
hydro_get_density
(
p
)
;
/* Get cooling function properties */
const
float
X_H
=
cooling
->
hydrogen_mass_abundance
;
...
...
@@ -91,6 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
}
else
{
u_new
=
u_floor
;
}
/* Update the internal energy */
hydro_set_internal_energy
(
p
,
u_new
);
...
...
src/cooling/const_lambda/cooling_struct.h
View file @
20d99103
...
...
@@ -28,7 +28,7 @@
*/
struct
cooling_function_data
{
/*! Cooling rate in
cgs units. Defined by 'rho * du/dt = -lambda * n_H^2'
*/
/*! Cooling rate in
internal units
*/
double
lambda
;
/*! Fraction of gas mass that is Hydrogen. Used to calculate n_H */
...
...
src/potential/isothermal/potential.h
View file @
20d99103
...
...
@@ -107,13 +107,13 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
const
float
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
float
dz
=
g
->
x
[
2
]
-
potential
->
z
;
const
float
rinv2
=
1
.
/
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
const
float
rinv2
=
1
.
f
/
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
const
double
term
=
-
potential
->
vrot2_over_G
*
rinv2
;
g
->
a_grav
[
0
]
=
term
*
dx
;
g
->
a_grav
[
1
]
=
term
*
dy
;
g
->
a_grav
[
2
]
=
term
*
dz
;
g
->
a_grav
[
0
]
+
=
term
*
dx
;
g
->
a_grav
[
1
]
+
=
term
*
dy
;
g
->
a_grav
[
2
]
+
=
term
*
dz
;
}
/**
...
...
src/potential/softened_isothermal/potential.h
View file @
20d99103
...
...
@@ -118,9 +118,9 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
const
double
term
=
-
potential
->
vrot2_over_G
*
r2_plus_epsilon2_inv
;
g
->
a_grav
[
0
]
=
term
*
dx
;
g
->
a_grav
[
1
]
=
term
*
dy
;
g
->
a_grav
[
2
]
=
term
*
dz
;
g
->
a_grav
[
0
]
+
=
term
*
dx
;
g
->
a_grav
[
1
]
+
=
term
*
dy
;
g
->
a_grav
[
2
]
+
=
term
*
dz
;
}
/**
...
...
src/runner.c
View file @
20d99103
...
...
@@ -52,7 +52,6 @@
#include
"hydro_properties.h"
#include
"kick.h"
#include
"minmax.h"
#include
"potential.h"
#include
"scheduler.h"
#include
"sourceterms.h"
#include
"space.h"
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment