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
23f1178d
Commit
23f1178d
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Code formatting
parent
3c31b2e2
No related branches found
No related tags found
1 merge request
!307
Fix cooling bug
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cooling/const_lambda/cooling.h
+1
-1
1 addition, 1 deletion
src/cooling/const_lambda/cooling.h
src/hydro/Gadget2/hydro.h
+8
-6
8 additions, 6 deletions
src/hydro/Gadget2/hydro.h
tests/benchmarkInteractions.c
+3
-3
3 additions, 3 deletions
tests/benchmarkInteractions.c
with
12 additions
and
10 deletions
src/cooling/const_lambda/cooling.h
+
1
−
1
View file @
23f1178d
...
@@ -91,7 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
...
@@ -91,7 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/* Integrate cooling equation to enforce energy floor */
/* Integrate cooling equation to enforce energy floor */
/* Factor of 1.5 included since timestep could potentially double */
/* 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
)
{
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 */
/* Update the internal energy time derivative */
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gadget2/hydro.h
+
8
−
6
View file @
23f1178d
...
@@ -334,6 +334,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
...
@@ -334,6 +334,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
/* Predict the entropy */
/* Predict the entropy */
p
->
entropy
+=
p
->
entropy_dt
*
dt
;
p
->
entropy
+=
p
->
entropy_dt
*
dt
;
/* Re-compute the pressure */
/* Re-compute the pressure */
const
float
pressure
=
gas_pressure_from_entropy
(
p
->
rho
,
p
->
entropy
);
const
float
pressure
=
gas_pressure_from_entropy
(
p
->
rho
,
p
->
entropy
);
...
@@ -376,12 +377,12 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
...
@@ -376,12 +377,12 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{
/* Do not decrease the entropy by more than a factor of 2 */
/* Do not decrease the entropy by more than a factor of 2 */
if
(
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
message
(
"Warning! Limiting entropy_dt. Possible cooling error.
\n
entropy_full = %g
\n
entropy_dt * dt =%g
\n
"
,
*
entropy_full = %g \n entropy_dt * dt =%g \n",
*/
xp
->
entropy_full
,
p
->
entropy_dt
*
dt
);
/*
xp->entropy_full,p->entropy_dt * dt);
*/
p
->
entropy_dt
=
-
0
.
5
f
*
xp
->
entropy_full
/
dt
;
p
->
entropy_dt
=
-
0
.
5
f
*
xp
->
entropy_full
/
dt
;
}
}
xp
->
entropy_full
+=
p
->
entropy_dt
*
dt
;
xp
->
entropy_full
+=
p
->
entropy_dt
*
dt
;
/* Compute the pressure */
/* Compute the pressure */
...
@@ -411,6 +412,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
...
@@ -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 */
/* 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
);
xp
->
entropy_full
=
gas_entropy_from_internal_energy
(
p
->
rho
,
p
->
entropy
);
p
->
entropy
=
xp
->
entropy_full
;
p
->
entropy
=
xp
->
entropy_full
;
/* Compute the pressure */
/* Compute the pressure */
const
float
pressure
=
gas_pressure_from_entropy
(
p
->
rho
,
p
->
entropy
);
const
float
pressure
=
gas_pressure_from_entropy
(
p
->
rho
,
p
->
entropy
);
...
...
This diff is collapsed.
Click to expand it.
tests/benchmarkInteractions.c
+
3
−
3
View file @
23f1178d
...
@@ -68,8 +68,8 @@
...
@@ -68,8 +68,8 @@
*separation.
*separation.
* @param partId The running counter of IDs.
* @param partId The running counter of IDs.
*/
*/
struct
part
*
make_particles
(
size_t
count
,
double
*
offset
,
double
spacing
,
double
h
,
struct
part
*
make_particles
(
size_t
count
,
double
*
offset
,
double
spacing
,
long
long
*
partId
)
{
double
h
,
long
long
*
partId
)
{
struct
part
*
particles
;
struct
part
*
particles
;
if
(
posix_memalign
((
void
**
)
&
particles
,
part_align
,
if
(
posix_memalign
((
void
**
)
&
particles
,
part_align
,
...
@@ -279,7 +279,7 @@ void test_interactions(struct part test_part, struct part *parts, size_t count,
...
@@ -279,7 +279,7 @@ void test_interactions(struct part test_part, struct part *parts, size_t count,
}
}
const
ticks
tic
=
getticks
();
const
ticks
tic
=
getticks
();
/* Perform serial interaction */
/* Perform serial interaction */
#ifdef __ICC
#ifdef __ICC
#pragma novector
#pragma novector
#endif
#endif
...
...
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