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
1873154b
Commit
1873154b
authored
Mar 11, 2018
by
Matthieu Schaller
Browse files
Convert the velocities to the internal frame when initialising everything.
parent
e0b2ecee
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/space.c
View file @
1873154b
...
...
@@ -2646,9 +2646,16 @@ void space_first_init_parts(struct space *s,
const
size_t
nr_parts
=
s
->
nr_parts
;
struct
part
*
restrict
p
=
s
->
parts
;
struct
xpart
*
restrict
xp
=
s
->
xparts
;
const
struct
cosmology
*
cosmo
=
s
->
e
->
cosmology
;
const
float
a_factor_vel
=
cosmo
->
a
*
cosmo
->
a
;
for
(
size_t
i
=
0
;
i
<
nr_parts
;
++
i
)
{
/* Convert velocities to internal units */
p
[
i
].
v
[
0
]
*=
a_factor_vel
;
p
[
i
].
v
[
1
]
*=
a_factor_vel
;
p
[
i
].
v
[
2
]
*=
a_factor_vel
;
#ifdef HYDRO_DIMENSION_2D
p
[
i
].
x
[
2
]
=
0
.
f
;
p
[
i
].
v
[
2
]
=
0
.
f
;
...
...
@@ -2684,9 +2691,16 @@ void space_first_init_gparts(struct space *s,
const
size_t
nr_gparts
=
s
->
nr_gparts
;
struct
gpart
*
restrict
gp
=
s
->
gparts
;
const
struct
cosmology
*
cosmo
=
s
->
e
->
cosmology
;
const
float
a_factor_vel
=
cosmo
->
a
*
cosmo
->
a
;
for
(
size_t
i
=
0
;
i
<
nr_gparts
;
++
i
)
{
/* Convert velocities to internal units */
gp
[
i
].
v_full
[
0
]
*=
a_factor_vel
;
gp
[
i
].
v_full
[
1
]
*=
a_factor_vel
;
gp
[
i
].
v_full
[
2
]
*=
a_factor_vel
;
#ifdef HYDRO_DIMENSION_2D
gp
[
i
].
x
[
2
]
=
0
.
f
;
gp
[
i
].
v_full
[
2
]
=
0
.
f
;
...
...
@@ -2715,9 +2729,16 @@ void space_first_init_sparts(struct space *s) {
const
size_t
nr_sparts
=
s
->
nr_sparts
;
struct
spart
*
restrict
sp
=
s
->
sparts
;
const
struct
cosmology
*
cosmo
=
s
->
e
->
cosmology
;
const
float
a_factor_vel
=
cosmo
->
a
*
cosmo
->
a
;
for
(
size_t
i
=
0
;
i
<
nr_sparts
;
++
i
)
{
/* Convert velocities to internal units */
sp
[
i
].
v
[
0
]
*=
a_factor_vel
;
sp
[
i
].
v
[
1
]
*=
a_factor_vel
;
sp
[
i
].
v
[
2
]
*=
a_factor_vel
;
#ifdef HYDRO_DIMENSION_2D
sp
[
i
].
x
[
2
]
=
0
.
f
;
sp
[
i
].
v
[
2
]
=
0
.
f
;
...
...
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