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
09f6effd
Commit
09f6effd
authored
Jul 25, 2016
by
Matthieu Schaller
Browse files
Don't move the entropy_dt variable into the force sub-structure
parent
d2c4261f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/hydro/Gadget2/hydro.h
View file @
09f6effd
...
...
@@ -139,9 +139,9 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
const
float
abs_div_v
=
fabsf
(
p
->
density
.
div_v
);
/* Compute the pressure */
const
float
dt
=
(
ti_current
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
float
half_
dt
=
(
ti_current
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
float
pressure
=
(
p
->
entropy
+
p
->
force
.
entropy_dt
*
dt
)
*
pow_gamma
(
p
->
rho
);
(
p
->
entropy
+
p
->
entropy_dt
*
half_
dt
)
*
pow_gamma
(
p
->
rho
);
const
float
irho
=
1
.
f
/
p
->
rho
;
...
...
@@ -178,7 +178,7 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
p
->
a_hydro
[
2
]
=
0
.
0
f
;
/* Reset the time derivatives. */
p
->
force
.
entropy_dt
=
0
.
0
f
;
p
->
entropy_dt
=
0
.
0
f
;
p
->
force
.
h_dt
=
0
.
0
f
;
/* Reset maximal signal velocity */
...
...
@@ -201,7 +201,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
/* Drift the pressure */
const
float
dt_entr
=
(
t1
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
float
pressure
=
(
p
->
entropy
+
p
->
force
.
entropy_dt
*
dt_entr
)
*
pow_gamma
(
p
->
rho
);
(
p
->
entropy
+
p
->
entropy_dt
*
dt_entr
)
*
pow_gamma
(
p
->
rho
);
const
float
irho
=
1
.
f
/
p
->
rho
;
...
...
@@ -228,8 +228,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_force(
p
->
force
.
h_dt
*=
p
->
h
*
0
.
333333333
f
;
p
->
force
.
entropy_dt
*=
hydro_gamma_minus_one
*
pow_minus_gamma_minus_one
(
p
->
rho
);
p
->
entropy_dt
*=
hydro_gamma_minus_one
*
pow_minus_gamma_minus_one
(
p
->
rho
);
}
/**
...
...
@@ -245,15 +244,15 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
float
half_dt
)
{
/* Do not decrease the entropy (temperature) by more than a factor of 2*/
const
float
entropy_change
=
p
->
force
.
entropy_dt
*
dt
;
const
float
entropy_change
=
p
->
entropy_dt
*
dt
;
if
(
entropy_change
>
-
0
.
5
f
*
p
->
entropy
)
p
->
entropy
+=
entropy_change
;
else
p
->
entropy
*=
0
.
5
f
;
/* Do not 'overcool' when timestep increases */
if
(
p
->
entropy
+
0
.
5
f
*
p
->
force
.
entropy_dt
*
dt
<
0
.
5
f
*
p
->
entropy
)
p
->
force
.
entropy_dt
=
-
0
.
5
f
*
p
->
entropy
/
dt
;
if
(
p
->
entropy
+
0
.
5
f
*
p
->
entropy_dt
*
dt
<
0
.
5
f
*
p
->
entropy
)
p
->
entropy_dt
=
-
0
.
5
f
*
p
->
entropy
/
dt
;
}
/**
...
...
@@ -279,7 +278,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
__attribute__
((
always_inline
))
INLINE
static
float
hydro_get_internal_energy
(
const
struct
part
*
restrict
p
,
float
dt
)
{
const
float
entropy
=
p
->
entropy
+
p
->
force
.
entropy_dt
*
dt
;
const
float
entropy
=
p
->
entropy
+
p
->
entropy_dt
*
dt
;
return
entropy
*
pow_gamma_minus_one
(
p
->
rho
)
*
hydro_one_over_gamma_minus_one
;
}
src/hydro/Gadget2/hydro_debug.h
View file @
09f6effd
...
...
@@ -30,7 +30,7 @@ __attribute__((always_inline)) INLINE static void hydro_debug_particle(
xp
->
v_full
[
1
],
xp
->
v_full
[
2
],
p
->
a_hydro
[
0
],
p
->
a_hydro
[
1
],
p
->
a_hydro
[
2
],
p
->
h
,
p
->
density
.
wcount
,
p
->
density
.
wcount_dh
,
p
->
mass
,
p
->
rho_dh
,
p
->
rho
,
p
->
force
.
P_over_rho2
*
p
->
rho
*
p
->
rho
/
p
->
rho_dh
,
p
->
force
.
P_over_rho2
,
p
->
entropy
,
p
->
force
.
entropy_dt
,
p
->
force
.
soundspeed
,
p
->
density
.
div_v
,
p
->
entropy
,
p
->
entropy_dt
,
p
->
force
.
soundspeed
,
p
->
density
.
div_v
,
p
->
density
.
rot_v
[
0
],
p
->
density
.
rot_v
[
1
],
p
->
density
.
rot_v
[
2
],
p
->
force
.
balsara
,
p
->
force
.
v_sig
,
p
->
force
.
h_dt
,
p
->
ti_begin
,
p
->
ti_end
);
}
src/hydro/Gadget2/hydro_iact.h
View file @
09f6effd
...
...
@@ -469,8 +469,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
pj
->
force
.
v_sig
=
fmaxf
(
pj
->
force
.
v_sig
,
v_sig
);
/* Change in entropy */
pi
->
force
.
entropy_dt
+=
0
.
5
f
*
mj
*
visc_term
*
dvdr
;
pj
->
force
.
entropy_dt
-=
0
.
5
f
*
mi
*
visc_term
*
dvdr
;
pi
->
entropy_dt
+=
0
.
5
f
*
mj
*
visc_term
*
dvdr
;
pj
->
entropy_dt
-=
0
.
5
f
*
mi
*
visc_term
*
dvdr
;
}
/**
...
...
@@ -566,7 +566,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
/* Change in entropy */
pi
->
force
.
entropy_dt
+=
0
.
5
f
*
mj
*
visc_term
*
dvdr
;
pi
->
entropy_dt
+=
0
.
5
f
*
mj
*
visc_term
*
dvdr
;
}
/**
...
...
src/hydro/Gadget2/hydro_part.h
View file @
09f6effd
...
...
@@ -58,7 +58,10 @@ struct part {
/* Particle entropy. */
float
entropy
;
/* Derivative of the density with respect to smoothing length. */
/* Entropy time derivative */
float
entropy_dt
;
/* Derivative of the density with respect to smoothing length. */
float
rho_dh
;
union
{
...
...
@@ -93,9 +96,6 @@ struct part {
/* Signal velocity. */
float
v_sig
;
/* Entropy time derivative */
float
entropy_dt
;
/* Time derivative of the smoothing length */
float
h_dt
;
...
...
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