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
d5e142f0
Commit
d5e142f0
authored
Feb 13, 2016
by
Matthieu Schaller
Browse files
h_dt not part of the force sub-structure anymore
parent
aaf537a9
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
d5e142f0
...
...
@@ -1731,13 +1731,15 @@ void engine_init_particles(struct engine *e) {
TIMER_TOC
(
timer_runners
);
//
message("\n0th ENTROPY CONVERSION\n");
/*
message("\n0th ENTROPY CONVERSION\n");
*/
space_map_cells_pre
(
s
,
1
,
cell_convert_hydro
,
NULL
);
/
/
printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts);
/
/
printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
/
*
printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts);
*/
/
*
printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
*/
// exit(0);
/* Ready to go */
e
->
step
=
-
1
;
}
...
...
@@ -1808,7 +1810,7 @@ if ( e->nodeID == 0 )
message( "nr_parts=%i." , nr_parts ); */
#endif
/
/
message("\nDRIFT\n");
/
*
message("\nDRIFT\n");
*/
/* Move forward in time */
e
->
timeOld
=
e
->
time
;
...
...
@@ -1819,12 +1821,12 @@ if ( e->nodeID == 0 )
/* Drift everybody */
engine_launch
(
e
,
e
->
nr_threads
,
1
<<
task_type_drift
,
0
);
/
/
printParticle(e->s->parts, e->s->xparts, 1000, e->s->nr_parts);
/
/
printParticle(e->s->parts, e->s->xparts, 515050, e->s->nr_parts);
/
*
printParticle(e->s->parts, e->s->xparts, 1000, e->s->nr_parts);
*/
/
*
printParticle(e->s->parts, e->s->xparts, 515050, e->s->nr_parts);
*/
// if(e->step == 2) exit(0);
/
/
message("\nACCELERATION AND KICK\n");
/
*
message("\nACCELERATION AND KICK\n");
*/
/* Re-distribute the particles amongst the nodes? */
if
(
e
->
forcerepart
)
engine_repartition
(
e
);
...
...
@@ -1850,8 +1852,11 @@ if ( e->nodeID == 0 )
((
double
)
timers
[
timer_count
-
1
])
/
CPU_TPS
*
1000
);
fflush
(
stdout
);
// printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts);
// printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
/* printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts); */
/* printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts); */
/* if(e->step == 2) */
/* exit(0); */
}
/**
...
...
src/hydro/Default/hydro.h
View file @
d5e142f0
...
...
@@ -31,8 +31,8 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
float
dt_cfl
=
const_cfl
*
p
->
h
/
p
->
force
.
v_sig
;
/* Limit change in h */
float
dt_h_change
=
(
p
->
force
.
h_dt
!=
0
.
0
f
)
?
fabsf
(
const_ln_max_h_change
*
p
->
h
/
p
->
force
.
h_dt
)
float
dt_h_change
=
(
p
->
h_dt
!=
0
.
0
f
)
?
fabsf
(
const_ln_max_h_change
*
p
->
h
/
p
->
h_dt
)
:
FLT_MAX
;
/* Limit change in u */
...
...
@@ -159,7 +159,7 @@ __attribute__((always_inline))
/* Reset the time derivatives. */
p
->
force
.
u_dt
=
0
.
0
f
;
p
->
force
.
h_dt
=
0
.
0
f
;
p
->
h_dt
=
0
.
0
f
;
p
->
force
.
v_sig
=
0
.
0
f
;
}
...
...
@@ -197,10 +197,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_force
(
struct
part
*
p
)
{
p
->
force
.
h_dt
*=
p
->
h
*
0
.
333333333
f
;
}
INLINE
static
void
hydro_end_force
(
struct
part
*
p
)
{}
/**
* @brief Kick the additional variables
...
...
src/hydro/Default/hydro_iact.h
View file @
d5e142f0
...
...
@@ -447,8 +447,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
pj
->
force
.
u_dt
+=
mi
*
tc
*
(
pj
->
u
-
pi
->
u
);
/* Get the time derivative for h. */
pi
->
force
.
h_dt
-=
mj
*
dvdr
/
rhoj
*
wi_dr
;
pj
->
force
.
h_dt
-=
mi
*
dvdr
/
rhoi
*
wj_dr
;
pi
->
h_dt
-=
mj
*
dvdr
/
rhoj
*
wi_dr
;
pj
->
h_dt
-=
mi
*
dvdr
/
rhoi
*
wj_dr
;
/* Update the signal velocity. */
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
...
...
@@ -656,8 +656,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_vec_force(
for
(
k
=
0
;
k
<
VEC_SIZE
;
k
++
)
{
pi
[
k
]
->
force
.
u_dt
+=
piu_dt
.
f
[
k
];
pj
[
k
]
->
force
.
u_dt
+=
pju_dt
.
f
[
k
];
pi
[
k
]
->
force
.
h_dt
-=
pih_dt
.
f
[
k
];
pj
[
k
]
->
force
.
h_dt
-=
pjh_dt
.
f
[
k
];
pi
[
k
]
->
h_dt
-=
pih_dt
.
f
[
k
];
pj
[
k
]
->
h_dt
-=
pjh_dt
.
f
[
k
];
pi
[
k
]
->
force
.
v_sig
=
vi_sig
.
f
[
k
];
pj
[
k
]
->
force
.
v_sig
=
vj_sig
.
f
[
k
];
for
(
j
=
0
;
j
<
3
;
j
++
)
{
...
...
@@ -758,7 +758,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
pi
->
force
.
u_dt
+=
mj
*
tc
*
(
pi
->
u
-
pj
->
u
);
/* Get the time derivative for h. */
pi
->
force
.
h_dt
-=
mj
*
dvdr
/
rhoj
*
wi_dr
;
pi
->
h_dt
-=
mj
*
dvdr
/
rhoj
*
wi_dr
;
/* Update the signal velocity. */
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
...
...
@@ -957,7 +957,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_vec_force(
/* Store the forces back on the particles. */
for
(
k
=
0
;
k
<
VEC_SIZE
;
k
++
)
{
pi
[
k
]
->
force
.
u_dt
+=
piu_dt
.
f
[
k
];
pi
[
k
]
->
force
.
h_dt
-=
pih_dt
.
f
[
k
];
pi
[
k
]
->
h_dt
-=
pih_dt
.
f
[
k
];
pi
[
k
]
->
force
.
v_sig
=
vi_sig
.
f
[
k
];
pj
[
k
]
->
force
.
v_sig
=
vj_sig
.
f
[
k
];
for
(
j
=
0
;
j
<
3
;
j
++
)
pi
[
k
]
->
a
[
j
]
-=
pia
[
j
].
f
[
k
];
...
...
src/hydro/Default/hydro_part.h
View file @
d5e142f0
...
...
@@ -46,6 +46,9 @@ struct part {
/* Particle cutoff radius. */
float
h
;
/* Change in smoothing length over time. */
float
h_dt
;
/* Particle time of beginning of time-step. */
float
t_begin
;
...
...
@@ -95,9 +98,6 @@ struct part {
/* Change in particle energy over time. */
float
u_dt
;
/* Change in smoothing length over time. */
float
h_dt
;
/* Signal velocity */
float
v_sig
;
...
...
src/hydro/Gadget2/hydro.h
View file @
d5e142f0
...
...
@@ -147,7 +147,7 @@ __attribute__((always_inline))
p
->
a_hydro
[
1
]
=
0
.
0
f
;
p
->
a_hydro
[
2
]
=
0
.
0
f
;
p
->
force
.
h_dt
=
0
.
0
f
;
p
->
h_dt
=
0
.
0
f
;
/* Reset the time derivatives. */
p
->
entropy_dt
=
0
.
0
f
;
...
...
src/hydro/Gadget2/hydro_debug.h
View file @
d5e142f0
...
...
@@ -32,6 +32,6 @@ __attribute__((always_inline))
p
->
h
,
(
int
)
p
->
density
.
wcount
,
p
->
mass
,
p
->
rho_dh
,
p
->
rho
,
p
->
force
.
pressure
,
p
->
entropy
,
p
->
entropy_dt
,
p
->
force
.
soundspeed
,
p
->
div_v
,
p
->
force
.
curl_v
,
p
->
density
.
rot_v
[
0
],
p
->
density
.
rot_v
[
1
],
p
->
density
.
rot_v
[
2
],
p
->
force
.
v_sig
,
p
->
force
.
h_dt
,
p
->
density
.
rot_v
[
1
],
p
->
density
.
rot_v
[
2
],
p
->
force
.
v_sig
,
p
->
h_dt
,
p
->
t_begin
,
p
->
t_end
);
}
src/hydro/Gadget2/hydro_iact.h
View file @
d5e142f0
...
...
@@ -281,8 +281,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
pj
->
a_hydro
[
2
]
+=
acc
*
dx
[
2
];
/* Get the time derivative for h. */
pi
->
force
.
h_dt
-=
mj
*
dvdr
*
r_inv
/
rhoj
*
wi_dr
;
pj
->
force
.
h_dt
-=
mi
*
dvdr
*
r_inv
/
rhoi
*
wj_dr
;
pi
->
h_dt
-=
mj
*
dvdr
*
r_inv
/
rhoj
*
wi_dr
;
pj
->
h_dt
-=
mi
*
dvdr
*
r_inv
/
rhoi
*
wj_dr
;
/* Update the signal velocity. */
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
...
...
@@ -371,7 +371,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
pi
->
a_hydro
[
2
]
-=
acc
*
dx
[
2
];
/* Get the time derivative for h. */
pi
->
force
.
h_dt
-=
mj
*
dvdr
*
r_inv
/
rhoj
*
wi_dr
;
pi
->
h_dt
-=
mj
*
dvdr
*
r_inv
/
rhoj
*
wi_dr
;
/* Update the signal velocity. */
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
...
...
src/hydro/Gadget2/hydro_part.h
View file @
d5e142f0
...
...
@@ -44,6 +44,9 @@ struct part {
/* Particle cutoff radius. */
float
h
;
/* Time derivative of the smoothing length */
float
h_dt
;
/* Particle time of beginning of time-step. */
float
t_begin
;
...
...
@@ -82,10 +85,7 @@ struct part {
}
density
;
struct
{
/* Time derivative of the smoothing length */
float
h_dt
;
/* Velocity curl norm*/
float
curl_v
;
...
...
src/runner.c
View file @
d5e142f0
...
...
@@ -734,14 +734,14 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
p
->
v
[
2
]
+=
p
->
a_hydro
[
2
]
*
dt
;
/* Predict smoothing length */
w
=
p
->
force
.
h_dt
*
h_inv
*
dt
;
w
=
p
->
h_dt
*
h_inv
*
dt
;
if
(
fabsf
(
w
)
<
0
.
2
f
)
p
->
h
*=
approx_expf
(
w
);
/* 4th order expansion of exp(w) */
else
p
->
h
*=
expf
(
w
);
/* Predict density */
w
=
-
3
.
0
f
*
p
->
force
.
h_dt
*
h_inv
*
dt
;
w
=
-
3
.
0
f
*
p
->
h_dt
*
h_inv
*
dt
;
if
(
fabsf
(
w
)
<
0
.
2
f
)
p
->
rho
*=
approx_expf
(
w
);
/* 4th order expansion of exp(w) */
else
...
...
@@ -759,7 +759,7 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
/* p->v[0], */
/* p->v[1], */
/* p->v[2], */
/* p->
force.
h_dt * h_inv * dt, */
/* p->h_dt * h_inv * dt, */
/* 0.333333f * p->div_v * dt); */
/* Compute motion since last cell construction */
...
...
@@ -852,7 +852,7 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
if
(
is_fixdt
||
p
->
t_end
<=
t_current
)
{
/* First, finish the force loop */
p
->
force
.
h_dt
*=
p
->
h
*
0
.
333333333
f
;
p
->
h_dt
*=
p
->
h
*
0
.
333333333
f
;
/* And do the same of the extra variable */
hydro_end_force
(
p
);
...
...
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