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
23f1178d
Commit
23f1178d
authored
Jan 28, 2017
by
Matthieu Schaller
Browse files
Code formatting
parent
3c31b2e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cooling/const_lambda/cooling.h
View file @
23f1178d
...
...
@@ -91,7 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/* Integrate cooling equation to enforce energy floor */
/* Factor of 1.5 included since timestep could potentially double */
if
(
u_old
+
(
hydro_du_dt
+
cooling_du_dt
)
*
1
.
5
f
*
dt
<
u_floor
)
{
cooling_du_dt
=
-
(
u_old
+
1
.
5
f
*
dt
*
hydro_du_dt
-
u_floor
)
/
(
1
.
5
f
*
dt
);
cooling_du_dt
=
-
(
u_old
+
1
.
5
f
*
dt
*
hydro_du_dt
-
u_floor
)
/
(
1
.
5
f
*
dt
);
}
/* Update the internal energy time derivative */
...
...
src/hydro/Gadget2/hydro.h
View file @
23f1178d
...
...
@@ -334,6 +334,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
/* Predict the entropy */
p
->
entropy
+=
p
->
entropy_dt
*
dt
;
/* Re-compute the pressure */
const
float
pressure
=
gas_pressure_from_entropy
(
p
->
rho
,
p
->
entropy
);
...
...
@@ -376,12 +377,12 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{
/* Do not decrease the entropy by more than a factor of 2 */
if
(
p
->
entropy_dt
<
-
0
.
5
f
*
xp
->
entropy_full
/
dt
){
message
(
"Warning! Limiting entropy_dt. Possible cooling error.
\n
entropy_full = %g
\n
entropy_dt * dt =%g
\n
"
,
xp
->
entropy_full
,
p
->
entropy_dt
*
dt
);
p
->
entropy_dt
=
-
0
.
5
f
*
xp
->
entropy_full
/
dt
;
}
if
(
p
->
entropy_dt
<
-
0
.
5
f
*
xp
->
entropy_full
/
dt
)
{
/* message("Warning! Limiting entropy_dt. Possible cooling error.\n
*
entropy_full = %g \n entropy_dt * dt =%g \n",
*/
/*
xp->entropy_full,p->entropy_dt * dt);
*/
p
->
entropy_dt
=
-
0
.
5
f
*
xp
->
entropy_full
/
dt
;
}
xp
->
entropy_full
+=
p
->
entropy_dt
*
dt
;
/* Compute the pressure */
...
...
@@ -411,6 +412,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
/* We read u in the entropy field. We now get S from u */
xp
->
entropy_full
=
gas_entropy_from_internal_energy
(
p
->
rho
,
p
->
entropy
);
p
->
entropy
=
xp
->
entropy_full
;
/* Compute the pressure */
const
float
pressure
=
gas_pressure_from_entropy
(
p
->
rho
,
p
->
entropy
);
...
...
tests/benchmarkInteractions.c
View file @
23f1178d
...
...
@@ -68,8 +68,8 @@
*separation.
* @param partId The running counter of IDs.
*/
struct
part
*
make_particles
(
size_t
count
,
double
*
offset
,
double
spacing
,
double
h
,
long
long
*
partId
)
{
struct
part
*
make_particles
(
size_t
count
,
double
*
offset
,
double
spacing
,
double
h
,
long
long
*
partId
)
{
struct
part
*
particles
;
if
(
posix_memalign
((
void
**
)
&
particles
,
part_align
,
...
...
@@ -279,7 +279,7 @@ void test_interactions(struct part test_part, struct part *parts, size_t count,
}
const
ticks
tic
=
getticks
();
/* Perform serial interaction */
/* Perform serial interaction */
#ifdef __ICC
#pragma novector
#endif
...
...
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