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
8d045eef
Commit
8d045eef
authored
1 month ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Fixes and improvements to h_max_active
parent
172fcaaa
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2135
Fixes and improvements to h_max_active
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cell_drift.c
+3
-1
3 additions, 1 deletion
src/cell_drift.c
src/runner_ghost.c
+26
-5
26 additions, 5 deletions
src/runner_ghost.c
src/runner_recv.c
+7
-3
7 additions, 3 deletions
src/runner_recv.c
with
36 additions
and
9 deletions
src/cell_drift.c
+
3
−
1
View file @
8d045eef
...
@@ -588,6 +588,7 @@ void cell_drift_spart(struct cell *c, const struct engine *e, int force,
...
@@ -588,6 +588,7 @@ void cell_drift_spart(struct cell *c, const struct engine *e, int force,
const
int
periodic
=
e
->
s
->
periodic
;
const
int
periodic
=
e
->
s
->
periodic
;
const
double
dim
[
3
]
=
{
e
->
s
->
dim
[
0
],
e
->
s
->
dim
[
1
],
e
->
s
->
dim
[
2
]};
const
double
dim
[
3
]
=
{
e
->
s
->
dim
[
0
],
e
->
s
->
dim
[
1
],
e
->
s
->
dim
[
2
]};
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
int
with_rt
=
(
e
->
policy
&
engine_policy_rt
);
const
float
stars_h_max
=
e
->
hydro_properties
->
h_max
;
const
float
stars_h_max
=
e
->
hydro_properties
->
h_max
;
const
float
stars_h_min
=
e
->
hydro_properties
->
h_min
;
const
float
stars_h_min
=
e
->
hydro_properties
->
h_min
;
const
integertime_t
ti_old_spart
=
c
->
stars
.
ti_old_part
;
const
integertime_t
ti_old_spart
=
c
->
stars
.
ti_old_part
;
...
@@ -753,7 +754,8 @@ void cell_drift_spart(struct cell *c, const struct engine *e, int force,
...
@@ -753,7 +754,8 @@ void cell_drift_spart(struct cell *c, const struct engine *e, int force,
rt_init_spart
(
sp
);
rt_init_spart
(
sp
);
/* Update the maximal active smoothing length in the cell */
/* Update the maximal active smoothing length in the cell */
cell_h_max_active
=
max
(
cell_h_max_active
,
sp
->
h
);
if
(
feedback_is_active
(
sp
,
e
)
||
with_rt
)
cell_h_max_active
=
max
(
cell_h_max_active
,
sp
->
h
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/runner_ghost.c
+
26
−
5
View file @
8d045eef
...
@@ -99,7 +99,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
...
@@ -99,7 +99,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
/* Running value of the maximal smoothing length */
/* Running value of the maximal smoothing length */
float
h_max
=
c
->
stars
.
h_max
;
float
h_max
=
c
->
stars
.
h_max
;
float
h_max_active
=
c
->
stars
.
h_max_active
;
float
h_max_active
=
0
.
f
;
TIMER_TIC
;
TIMER_TIC
;
...
@@ -297,6 +297,13 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
...
@@ -297,6 +297,13 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
rt_props
,
phys_const
,
us
);
rt_props
,
phys_const
,
us
);
}
}
if
(
feedback_is_active
(
sp
,
e
)
||
with_rt
)
{
/* Check if h_max has increased */
h_max
=
max
(
h_max
,
sp
->
h
);
h_max_active
=
max
(
h_max_active
,
sp
->
h
);
}
/* Ok, we are done with this particle */
/* Ok, we are done with this particle */
continue
;
continue
;
}
}
...
@@ -561,7 +568,9 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
...
@@ -561,7 +568,9 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
if
(
h
>
c
->
stars
.
h_max
)
if
(
h
>
c
->
stars
.
h_max
)
error
(
"Particle has h larger than h_max (id=%lld)"
,
sp
->
id
);
error
(
"Particle has h larger than h_max (id=%lld)"
,
sp
->
id
);
if
(
spart_is_active
(
sp
,
e
)
&&
h
>
c
->
stars
.
h_max_active
)
if
(
spart_is_active
(
sp
,
e
)
&&
(
feedback_is_active
(
sp
,
e
)
||
with_rt
)
&&
(
h
>
c
->
stars
.
h_max_active
))
error
(
"Active particle has h larger than h_max_active (id=%lld)"
,
sp
->
id
);
error
(
"Active particle has h larger than h_max_active (id=%lld)"
,
sp
->
id
);
}
}
#endif
#endif
...
@@ -602,7 +611,7 @@ void runner_do_black_holes_density_ghost(struct runner *r, struct cell *c,
...
@@ -602,7 +611,7 @@ void runner_do_black_holes_density_ghost(struct runner *r, struct cell *c,
/* Running value of the maximal smoothing length */
/* Running value of the maximal smoothing length */
float
h_max
=
c
->
black_holes
.
h_max
;
float
h_max
=
c
->
black_holes
.
h_max
;
float
h_max_active
=
c
->
black_holes
.
h_max_active
;
float
h_max_active
=
0
.
f
;
TIMER_TIC
;
TIMER_TIC
;
...
@@ -721,6 +730,10 @@ void runner_do_black_holes_density_ghost(struct runner *r, struct cell *c,
...
@@ -721,6 +730,10 @@ void runner_do_black_holes_density_ghost(struct runner *r, struct cell *c,
black_holes_reset_feedback
(
bp
);
black_holes_reset_feedback
(
bp
);
/* Check if h_max has increased */
h_max
=
max
(
h_max
,
bp
->
h
);
h_max_active
=
max
(
h_max_active
,
bp
->
h
);
/* Ok, we are done with this particle */
/* Ok, we are done with this particle */
continue
;
continue
;
}
}
...
@@ -1125,7 +1138,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
...
@@ -1125,7 +1138,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
/* Running value of the maximal smoothing length */
/* Running value of the maximal smoothing length */
float
h_max
=
c
->
hydro
.
h_max
;
float
h_max
=
c
->
hydro
.
h_max
;
float
h_max_active
=
c
->
hydro
.
h_max_active
;
float
h_max_active
=
0
.
f
;
TIMER_TIC
;
TIMER_TIC
;
...
@@ -1327,6 +1340,10 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
...
@@ -1327,6 +1340,10 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
rt_reset_part
(
p
,
cosmo
);
rt_reset_part
(
p
,
cosmo
);
}
}
/* Check if h_max has increased */
h_max
=
max
(
h_max
,
p
->
h
);
h_max_active
=
max
(
h_max_active
,
p
->
h
);
/* Ok, we are done with this particle */
/* Ok, we are done with this particle */
continue
;
continue
;
}
}
...
@@ -1749,7 +1766,7 @@ void runner_do_sinks_density_ghost(struct runner *r, struct cell *c,
...
@@ -1749,7 +1766,7 @@ void runner_do_sinks_density_ghost(struct runner *r, struct cell *c,
/* Running value of the maximal smoothing length */
/* Running value of the maximal smoothing length */
float
h_max
=
c
->
sinks
.
h_max
;
float
h_max
=
c
->
sinks
.
h_max
;
float
h_max_active
=
c
->
sinks
.
h_max_active
;
float
h_max_active
=
0
.
f
;
TIMER_TIC
;
TIMER_TIC
;
...
@@ -1887,6 +1904,10 @@ void runner_do_sinks_density_ghost(struct runner *r, struct cell *c,
...
@@ -1887,6 +1904,10 @@ void runner_do_sinks_density_ghost(struct runner *r, struct cell *c,
if
(((
sp
->
h
>=
sinks_h_max
)
&&
(
f
<
0
.
f
))
||
if
(((
sp
->
h
>=
sinks_h_max
)
&&
(
f
<
0
.
f
))
||
((
sp
->
h
<=
sinks_h_min
)
&&
(
f
>
0
.
f
)))
{
((
sp
->
h
<=
sinks_h_min
)
&&
(
f
>
0
.
f
)))
{
/* Check if h_max has increased */
h_max
=
max
(
h_max
,
sp
->
h
);
h_max_active
=
max
(
h_max_active
,
sp
->
h
);
/* Ok, we are done with this particle */
/* Ok, we are done with this particle */
continue
;
continue
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/runner_recv.c
+
7
−
3
View file @
8d045eef
...
@@ -31,7 +31,9 @@
...
@@ -31,7 +31,9 @@
#include
"runner.h"
#include
"runner.h"
/* Local headers. */
/* Local headers. */
#include
"active.h"
#include
"engine.h"
#include
"engine.h"
#include
"feedback.h"
#include
"timers.h"
#include
"timers.h"
/**
/**
...
@@ -225,10 +227,11 @@ void runner_do_recv_spart(struct runner *r, struct cell *c, int clear_sorts,
...
@@ -225,10 +227,11 @@ void runner_do_recv_spart(struct runner *r, struct cell *c, int clear_sorts,
#ifdef WITH_MPI
#ifdef WITH_MPI
const
struct
engine
*
e
=
r
->
e
;
const
int
with_rt
=
(
e
->
policy
&
engine_policy_rt
);
const
integertime_t
ti_current
=
e
->
ti_current
;
struct
spart
*
restrict
sparts
=
c
->
stars
.
parts
;
struct
spart
*
restrict
sparts
=
c
->
stars
.
parts
;
const
size_t
nr_sparts
=
c
->
stars
.
count
;
const
size_t
nr_sparts
=
c
->
stars
.
count
;
const
integertime_t
ti_current
=
r
->
e
->
ti_current
;
const
timebin_t
max_active_bin
=
r
->
e
->
max_active_bin
;
TIMER_TIC
;
TIMER_TIC
;
...
@@ -258,7 +261,8 @@ void runner_do_recv_spart(struct runner *r, struct cell *c, int clear_sorts,
...
@@ -258,7 +261,8 @@ void runner_do_recv_spart(struct runner *r, struct cell *c, int clear_sorts,
time_bin_max
=
max
(
time_bin_max
,
sparts
[
k
].
time_bin
);
time_bin_max
=
max
(
time_bin_max
,
sparts
[
k
].
time_bin
);
h_max
=
max
(
h_max
,
sparts
[
k
].
h
);
h_max
=
max
(
h_max
,
sparts
[
k
].
h
);
sparts
[
k
].
gpart
=
NULL
;
sparts
[
k
].
gpart
=
NULL
;
if
(
sparts
[
k
].
time_bin
<=
max_active_bin
)
if
(
spart_is_active
(
&
sparts
[
k
],
e
)
&&
(
feedback_is_active
(
&
sparts
[
k
],
e
)
||
with_rt
))
h_max_active
=
max
(
h_max_active
,
sparts
[
k
].
h
);
h_max_active
=
max
(
h_max_active
,
sparts
[
k
].
h
);
}
}
...
...
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