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
f3b24f49
Commit
f3b24f49
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Compute a new dithering vector at each rebuild.
parent
900b183c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!952
Gravity dithering
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/space.c
+27
-0
27 additions, 0 deletions
src/space.c
src/space.h
+3
-0
3 additions, 0 deletions
src/space.h
with
30 additions
and
0 deletions
src/space.c
+
27
−
0
View file @
f3b24f49
...
@@ -1166,6 +1166,30 @@ void space_rebuild(struct space *s, int repartitioned, int verbose) {
...
@@ -1166,6 +1166,30 @@ void space_rebuild(struct space *s, int repartitioned, int verbose) {
/* Allocate extra space for particles that will be created */
/* Allocate extra space for particles that will be created */
if
(
s
->
with_star_formation
)
space_allocate_extras
(
s
,
verbose
);
if
(
s
->
with_star_formation
)
space_allocate_extras
(
s
,
verbose
);
if
(
s
->
dithering
)
{
/* Store the old dithering vector */
s
->
pos_dithering_old
[
0
]
=
s
->
pos_dithering
[
0
];
s
->
pos_dithering_old
[
1
]
=
s
->
pos_dithering
[
1
];
s
->
pos_dithering_old
[
2
]
=
s
->
pos_dithering
[
2
];
if
(
s
->
e
->
nodeID
==
0
)
{
/* Compute the new dithering vector */
s
->
pos_dithering
[
0
]
=
s
->
dithering_ratio
*
s
->
width
[
0
]
*
rand
()
/
((
double
)
RAND_MAX
);
s
->
pos_dithering
[
1
]
=
s
->
dithering_ratio
*
s
->
width
[
1
]
*
rand
()
/
((
double
)
RAND_MAX
);
s
->
pos_dithering
[
2
]
=
s
->
dithering_ratio
*
s
->
width
[
2
]
*
rand
()
/
((
double
)
RAND_MAX
);
#ifdef WITH_MPI
/* Tell everyone what value to use */
MPI_Bcast
(
s
->
pos_dithering
,
3
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
#endif
}
}
struct
cell
*
cells_top
=
s
->
cells_top
;
struct
cell
*
cells_top
=
s
->
cells_top
;
const
integertime_t
ti_current
=
(
s
->
e
!=
NULL
)
?
s
->
e
->
ti_current
:
0
;
const
integertime_t
ti_current
=
(
s
->
e
!=
NULL
)
?
s
->
e
->
ti_current
:
0
;
const
int
local_nodeID
=
s
->
e
->
nodeID
;
const
int
local_nodeID
=
s
->
e
->
nodeID
;
...
@@ -4650,6 +4674,9 @@ void space_init(struct space *s, struct swift_params *params,
...
@@ -4650,6 +4674,9 @@ void space_init(struct space *s, struct swift_params *params,
s
->
sum_bpart_vel_norm
=
0
.
f
;
s
->
sum_bpart_vel_norm
=
0
.
f
;
s
->
nr_queues
=
1
;
/* Temporary value until engine construction */
s
->
nr_queues
=
1
;
/* Temporary value until engine construction */
/* Initialise some randomness */
srand
(
42
);
/* Are we generating gas from the DM-only ICs? */
/* Are we generating gas from the DM-only ICs? */
if
(
generate_gas_in_ics
)
{
if
(
generate_gas_in_ics
)
{
space_generate_gas
(
s
,
cosmo
,
periodic
,
dim
,
verbose
);
space_generate_gas
(
s
,
cosmo
,
periodic
,
dim
,
verbose
);
...
...
This diff is collapsed.
Click to expand it.
src/space.h
+
3
−
0
View file @
f3b24f49
...
@@ -123,6 +123,9 @@ struct space {
...
@@ -123,6 +123,9 @@ struct space {
time (value at the previous rebuild) */
time (value at the previous rebuild) */
double
pos_dithering_old
[
3
];
double
pos_dithering_old
[
3
];
/*! Max dithering distance in units of the top-level cell sizes */
double
dithering_ratio
;
/*! The minimum top-level cell width allowed. */
/*! The minimum top-level cell width allowed. */
double
cell_min
;
double
cell_min
;
...
...
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