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
b2b90476
Commit
b2b90476
authored
8 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
don't skip the task-building on empty drifts.
parent
f65482d3
No related branches found
No related tags found
1 merge request
!267
Mark tasks in drift2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runner.c
+65
-62
65 additions, 62 deletions
src/runner.c
with
65 additions
and
62 deletions
src/runner.c
+
65
−
62
View file @
b2b90476
...
...
@@ -84,7 +84,8 @@ const double runner_shift[13][3] = {
{
0
.
0
,
7.071067811865475e-01
,
7.071067811865475e-01
},
{
0
.
0
,
1
.
0
,
0
.
0
},
{
0
.
0
,
7.071067811865475e-01
,
-
7.071067811865475e-01
},
{
0
.
0
,
0
.
0
,
1
.
0
},
};
{
0
.
0
,
0
.
0
,
1
.
0
},
};
/* Does the axis need flipping ? */
const
char
runner_flip
[
27
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
...
...
@@ -724,9 +725,6 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
/* Do we need to drift ? */
if
(
!
e
->
drift_all
&&
!
cell_is_drift_needed
(
c
,
ti_current
))
return
;
/* Check that we are actually going to move forward. */
if
(
ti_current
==
ti_old
)
return
;
/* Drift from the last time the cell was drifted to the current time */
const
double
dt
=
(
ti_current
-
ti_old
)
*
timeBase
;
...
...
@@ -738,78 +736,83 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
/* No children? */
if
(
!
c
->
split
)
{
/* Loop over all the g-particles in the cell */
const
size_t
nr_gparts
=
c
->
gcount
;
for
(
size_t
k
=
0
;
k
<
nr_gparts
;
k
++
)
{
/* Check that we are actually going to move forward. */
if
(
ti_current
>=
ti_old
)
{
/* Get a handle on the gpart. */
struct
gpart
*
const
gp
=
&
gparts
[
k
];
/* Loop over all the g-particles in the cell */
const
size_t
nr_gparts
=
c
->
gcount
;
for
(
size_t
k
=
0
;
k
<
nr_gparts
;
k
++
)
{
/*
Drift..
. */
drift_gpart
(
gp
,
dt
,
timeBase
,
ti_old
,
ti_current
)
;
/*
Get a handle on the gpart
. */
struct
gpart
*
const
gp
=
&
gparts
[
k
]
;
/* Compute (square of) motion since last cell construction */
const
float
dx2
=
gp
->
x_diff
[
0
]
*
gp
->
x_diff
[
0
]
+
gp
->
x_diff
[
1
]
*
gp
->
x_diff
[
1
]
+
gp
->
x_diff
[
2
]
*
gp
->
x_diff
[
2
];
dx2_max
=
(
dx2_max
>
dx2
)
?
dx2_max
:
dx2
;
}
/* Drift... */
drift_gpart
(
gp
,
dt
,
timeBase
,
ti_old
,
ti_current
);
/* Loop over all the particles in the cell (more work for these !) */
const
size_t
nr_parts
=
c
->
count
;
for
(
size_t
k
=
0
;
k
<
nr_parts
;
k
++
)
{
/* Compute (square of) motion since last cell construction */
const
float
dx2
=
gp
->
x_diff
[
0
]
*
gp
->
x_diff
[
0
]
+
gp
->
x_diff
[
1
]
*
gp
->
x_diff
[
1
]
+
gp
->
x_diff
[
2
]
*
gp
->
x_diff
[
2
];
dx2_max
=
(
dx2_max
>
dx2
)
?
dx2_max
:
dx2
;
}
/*
Get a handle on the part.
*/
struct
part
*
const
p
=
&
parts
[
k
]
;
struct
xpart
*
const
xp
=
&
xparts
[
k
];
/*
Loop over all the particles in the cell (more work for these !)
*/
const
size_t
nr_parts
=
c
->
count
;
for
(
size_t
k
=
0
;
k
<
nr_parts
;
k
++
)
{
/* Drift... */
drift_part
(
p
,
xp
,
dt
,
timeBase
,
ti_old
,
ti_current
);
/* Get a handle on the part. */
struct
part
*
const
p
=
&
parts
[
k
];
struct
xpart
*
const
xp
=
&
xparts
[
k
];
/* Compute (square of) motion since last cell construction */
const
float
dx2
=
xp
->
x_diff
[
0
]
*
xp
->
x_diff
[
0
]
+
xp
->
x_diff
[
1
]
*
xp
->
x_diff
[
1
]
+
xp
->
x_diff
[
2
]
*
xp
->
x_diff
[
2
];
dx2_max
=
(
dx2_max
>
dx2
)
?
dx2_max
:
dx2
;
/* Drift... */
drift_part
(
p
,
xp
,
dt
,
timeBase
,
ti_old
,
ti_current
);
/* Maximal smoothing length */
h_max
=
(
h_max
>
p
->
h
)
?
h_max
:
p
->
h
;
/* Compute (square of) motion since last cell construction */
const
float
dx2
=
xp
->
x_diff
[
0
]
*
xp
->
x_diff
[
0
]
+
xp
->
x_diff
[
1
]
*
xp
->
x_diff
[
1
]
+
xp
->
x_diff
[
2
]
*
xp
->
x_diff
[
2
];
dx2_max
=
(
dx2_max
>
dx2
)
?
dx2_max
:
dx2
;
/* Now collect quantities for statistics */
/* Maximal smoothing length */
h_max
=
(
h_max
>
p
->
h
)
?
h_max
:
p
->
h
;
const
float
half_dt
=
(
ti_current
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
double
x
[
3
]
=
{
p
->
x
[
0
],
p
->
x
[
1
],
p
->
x
[
2
]};
const
float
v
[
3
]
=
{
xp
->
v_full
[
0
]
+
p
->
a_hydro
[
0
]
*
half_dt
,
xp
->
v_full
[
1
]
+
p
->
a_hydro
[
1
]
*
half_dt
,
xp
->
v_full
[
2
]
+
p
->
a_hydro
[
2
]
*
half_dt
};
/* Now collect quantities for statistics */
const
float
m
=
hydro_get_mass
(
p
);
const
float
half_dt
=
(
ti_current
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
double
x
[
3
]
=
{
p
->
x
[
0
],
p
->
x
[
1
],
p
->
x
[
2
]};
const
float
v
[
3
]
=
{
xp
->
v_full
[
0
]
+
p
->
a_hydro
[
0
]
*
half_dt
,
xp
->
v_full
[
1
]
+
p
->
a_hydro
[
1
]
*
half_dt
,
xp
->
v_full
[
2
]
+
p
->
a_hydro
[
2
]
*
half_dt
};
/* Collect mass */
mass
+=
m
;
const
float
m
=
hydro_get_mass
(
p
);
/* Collect momentum */
mom
[
0
]
+=
m
*
v
[
0
];
mom
[
1
]
+=
m
*
v
[
1
];
mom
[
2
]
+=
m
*
v
[
2
];
/* Collect mass */
mass
+=
m
;
/* Collect
angular
momentum */
ang_
mom
[
0
]
+=
m
*
(
x
[
1
]
*
v
[
2
]
-
x
[
2
]
*
v
[
1
])
;
ang_
mom
[
1
]
+=
m
*
(
x
[
2
]
*
v
[
0
]
-
x
[
0
]
*
v
[
2
])
;
ang_
mom
[
2
]
+=
m
*
(
x
[
0
]
*
v
[
1
]
-
x
[
1
]
*
v
[
0
])
;
/* Collect momentum */
mom
[
0
]
+=
m
*
v
[
0
]
;
mom
[
1
]
+=
m
*
v
[
1
]
;
mom
[
2
]
+=
m
*
v
[
2
]
;
/* Collect
energies.
*/
e_kin
+=
0
.
5
*
m
*
(
v
[
0
]
*
v
[
0
]
+
v
[
1
]
*
v
[
1
]
+
v
[
2
]
*
v
[
2
]);
e_pot
+=
0
.
;
e_int
+=
m
*
hydro_get_internal_energy
(
p
,
half_dt
);
/* Collect
angular momentum
*/
ang_mom
[
0
]
+=
m
*
(
x
[
1
]
*
v
[
2
]
-
x
[
2
]
*
v
[
1
]);
ang_mom
[
1
]
+=
m
*
(
x
[
2
]
*
v
[
0
]
-
x
[
0
]
*
v
[
2
])
;
ang_mom
[
2
]
+=
m
*
(
x
[
0
]
*
v
[
1
]
-
x
[
1
]
*
v
[
0
]
);
/* Collect entropy */
entropy
+=
m
*
hydro_get_entropy
(
p
,
half_dt
);
}
/* Collect energies. */
e_kin
+=
0
.
5
*
m
*
(
v
[
0
]
*
v
[
0
]
+
v
[
1
]
*
v
[
1
]
+
v
[
2
]
*
v
[
2
]);
e_pot
+=
0
.;
e_int
+=
m
*
hydro_get_internal_energy
(
p
,
half_dt
);
/* Collect entropy */
entropy
+=
m
*
hydro_get_entropy
(
p
,
half_dt
);
}
/* Now, get the maximal particle motion from its square */
dx_max
=
sqrtf
(
dx2_max
);
/* Now, get the maximal particle motion from its square */
dx_max
=
sqrtf
(
dx2_max
);
}
/* Check that we are actually going to move forward. */
}
/* Otherwise, aggregate data from children. */
...
...
@@ -859,12 +862,12 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
/* If we aren't going to do anything with this cell, we can stop here. */
if
(
c
->
ti_end_min
>
ti_current
)
return
;
/* Un-skip the density tasks involved with this cell. */
for
(
struct
link
*
l
=
c
->
density
;
l
!=
NULL
;
l
=
l
->
next
)
{
struct
task
*
t
=
l
->
t
;
const
struct
cell
*
ci
=
t
->
ci
;
const
struct
cell
*
cj
=
t
->
cj
;
const
struct
cell
*
ci
=
t
->
ci
;
const
struct
cell
*
cj
=
t
->
cj
;
t
->
skip
=
0
;
if
(
t
->
type
==
task_type_pair
)
{
if
(
!
(
ci
->
sorted
&
(
1
<<
t
->
flags
)))
{
...
...
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