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
8190b0e1
Commit
8190b0e1
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned-up ghost task
parent
9f114949
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!79
First version of the multiple time-stepping
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runner.c
+22
-30
22 additions, 30 deletions
src/runner.c
with
22 additions
and
30 deletions
src/runner.c
+
22
−
30
View file @
8190b0e1
...
@@ -542,9 +542,9 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -542,9 +542,9 @@ void runner_doghost(struct runner *r, struct cell *c) {
struct
part
*
p
,
*
parts
=
c
->
parts
;
struct
part
*
p
,
*
parts
=
c
->
parts
;
struct
xpart
*
xp
,
*
xparts
=
c
->
xparts
;
struct
xpart
*
xp
,
*
xparts
=
c
->
xparts
;
struct
cell
*
finger
;
struct
cell
*
finger
;
int
i
,
k
,
redo
,
count
=
c
->
count
,
num_reruns
;
int
redo
,
count
=
c
->
count
;
int
*
pid
;
int
*
pid
;
float
h
,
ih
,
ih2
,
ih4
,
h_corr
,
rho
,
wcount
,
rho_dh
,
wcount_dh
,
u
,
fc
;
float
h_corr
,
rho
,
wcount
,
rho_dh
,
wcount_dh
,
u
,
fc
;
float
normDiv_v
,
normCurl_v
;
float
normDiv_v
,
normCurl_v
;
#ifndef LEGACY_GADGET2_SPH
#ifndef LEGACY_GADGET2_SPH
float
alpha_dot
,
tau
,
S
;
float
alpha_dot
,
tau
,
S
;
...
@@ -553,11 +553,9 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -553,11 +553,9 @@ void runner_doghost(struct runner *r, struct cell *c) {
TIMER_TIC
;
TIMER_TIC
;
// message("start");
/* Recurse? */
/* Recurse? */
if
(
c
->
split
)
{
if
(
c
->
split
)
{
for
(
k
=
0
;
k
<
8
;
k
++
)
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
runner_doghost
(
r
,
c
->
progeny
[
k
]);
if
(
c
->
progeny
[
k
]
!=
NULL
)
runner_doghost
(
r
,
c
->
progeny
[
k
]);
return
;
return
;
}
}
...
@@ -565,19 +563,17 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -565,19 +563,17 @@ void runner_doghost(struct runner *r, struct cell *c) {
/* Init the IDs that have to be updated. */
/* Init the IDs that have to be updated. */
if
((
pid
=
(
int
*
)
alloca
(
sizeof
(
int
)
*
count
))
==
NULL
)
if
((
pid
=
(
int
*
)
alloca
(
sizeof
(
int
)
*
count
))
==
NULL
)
error
(
"Call to alloca failed."
);
error
(
"Call to alloca failed."
);
for
(
k
=
0
;
k
<
count
;
k
++
)
pid
[
k
]
=
k
;
for
(
int
k
=
0
;
k
<
count
;
k
++
)
pid
[
k
]
=
k
;
/* While there are particles that need to be updated... */
/* While there are particles that need to be updated... */
for
(
num_reruns
=
0
;
count
>
0
&&
num_reruns
<
const_smoothing_max_iter
;
for
(
int
num_reruns
=
0
;
count
>
0
&&
num_reruns
<
const_smoothing_max_iter
;
num_reruns
++
)
{
num_reruns
++
)
{
// message("count=%d redo=%d", count, redo);
/* Reset the redo-count. */
/* Reset the redo-count. */
redo
=
0
;
redo
=
0
;
/* Loop over the parts in this cell. */
/* Loop over the parts in this cell. */
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
/* Get a direct pointer on the part. */
/* Get a direct pointer on the part. */
p
=
&
parts
[
pid
[
i
]];
p
=
&
parts
[
pid
[
i
]];
...
@@ -587,10 +583,10 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -587,10 +583,10 @@ void runner_doghost(struct runner *r, struct cell *c) {
if
(
p
->
t_end
<=
t_end
)
{
if
(
p
->
t_end
<=
t_end
)
{
/* Some smoothing length multiples. */
/* Some smoothing length multiples. */
h
=
p
->
h
;
const
float
h
=
p
->
h
;
ih
=
1
.
0
f
/
h
;
const
float
ih
=
1
.
0
f
/
h
;
ih2
=
ih
*
ih
;
const
float
ih2
=
ih
*
ih
;
ih4
=
ih2
*
ih2
;
const
float
ih4
=
ih2
*
ih2
;
/* Final operation on the density. */
/* Final operation on the density. */
p
->
rho
=
rho
=
ih
*
ih2
*
(
p
->
rho
+
p
->
mass
*
kernel_root
);
p
->
rho
=
rho
=
ih
*
ih2
*
(
p
->
rho
+
p
->
mass
*
kernel_root
);
...
@@ -600,10 +596,6 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -600,10 +596,6 @@ void runner_doghost(struct runner *r, struct cell *c) {
wcount_dh
=
wcount_dh
=
p
->
density
.
wcount_dh
*
ih
*
(
4
.
0
f
/
3
.
0
*
M_PI
*
kernel_gamma3
);
p
->
density
.
wcount_dh
*
ih
*
(
4
.
0
f
/
3
.
0
*
M_PI
*
kernel_gamma3
);
;
// if(p->id==1000)
// message("wcount_dh=%f", wcount_dh);
/* If no derivative, double the smoothing length. */
/* If no derivative, double the smoothing length. */
if
(
wcount_dh
==
0
.
0
f
)
h_corr
=
p
->
h
;
if
(
wcount_dh
==
0
.
0
f
)
h_corr
=
p
->
h
;
...
@@ -623,17 +615,17 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -623,17 +615,17 @@ void runner_doghost(struct runner *r, struct cell *c) {
/* Ok, correct then */
/* Ok, correct then */
p
->
h
+=
h_corr
;
p
->
h
+=
h_corr
;
// message("Not converged: wcount=%f", p->density.wcount);
/* And flag for another round of fun */
/* And flag for another round of fun */
pid
[
redo
]
=
pid
[
i
];
pid
[
redo
]
=
pid
[
i
];
redo
+=
1
;
redo
+=
1
;
p
->
density
.
wcount
=
0
.
0
;
p
->
density
.
wcount
=
0
.
f
;
p
->
density
.
wcount_dh
=
0
.
0
;
p
->
density
.
wcount_dh
=
0
.
f
;
p
->
rho
=
0
.
0
;
p
->
rho
=
0
.
f
;
p
->
rho_dh
=
0
.
0
;
p
->
rho_dh
=
0
.
f
;
p
->
density
.
div_v
=
0
.
0
;
p
->
density
.
div_v
=
0
.
f
;
for
(
k
=
0
;
k
<
3
;
k
++
)
p
->
density
.
curl_v
[
k
]
=
0
.
0
;
p
->
density
.
curl_v
[
0
]
=
0
.
f
;
p
->
density
.
curl_v
[
1
]
=
0
.
f
;
p
->
density
.
curl_v
[
2
]
=
0
.
f
;
continue
;
continue
;
}
}
...
@@ -678,8 +670,10 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -678,8 +670,10 @@ void runner_doghost(struct runner *r, struct cell *c) {
#endif
#endif
/* Reset the acceleration. */
/* Reset the acceleration. */
for
(
k
=
0
;
k
<
3
;
k
++
)
p
->
a
[
k
]
=
0
.
0
f
;
p
->
a
[
0
]
=
0
.
0
f
;
p
->
a
[
1
]
=
0
.
0
f
;
p
->
a
[
2
]
=
0
.
0
f
;
/* Reset the time derivatives. */
/* Reset the time derivatives. */
p
->
force
.
u_dt
=
0
.
0
f
;
p
->
force
.
u_dt
=
0
.
0
f
;
p
->
force
.
h_dt
=
0
.
0
f
;
p
->
force
.
h_dt
=
0
.
0
f
;
...
@@ -694,8 +688,6 @@ void runner_doghost(struct runner *r, struct cell *c) {
...
@@ -694,8 +688,6 @@ void runner_doghost(struct runner *r, struct cell *c) {
count
=
redo
;
count
=
redo
;
if
(
count
>
0
)
{
if
(
count
>
0
)
{
// message("count=%d", count);fflush(stdout);
/* Climb up the cell hierarchy. */
/* Climb up the cell hierarchy. */
for
(
finger
=
c
;
finger
!=
NULL
;
finger
=
finger
->
parent
)
{
for
(
finger
=
c
;
finger
!=
NULL
;
finger
=
finger
->
parent
)
{
...
...
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