Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sten Delos
Gadget4
Commits
e0bd04bf
Commit
e0bd04bf
authored
Oct 07, 2020
by
Volker Springel
Browse files
small fix for cosmological big sphere set-up and clean ups
parent
dc4c95d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cooling_sfr/starformation.cc
View file @
e0bd04bf
...
...
@@ -192,7 +192,7 @@ void coolsfr::sfr_create_star_particles(simparticles *Sp)
else
rate
=
0
;
/* compute the cumulative mass of stars
(->>> CHECK ME!!!)
*/
/* compute the cumulative mass of stars */
cum_mass_stars
+=
total_sum_mass_stars
;
/* convert to solar masses per yr */
...
...
src/gravity/gravity.cc
View file @
e0bd04bf
...
...
@@ -78,7 +78,9 @@ void sim::compute_grav_accelerations(int timebin)
else
{
GravTree
.
DoPM
=
0
;
#if defined(PERIODIC)
GravTree
.
DoEwald
=
1
;
#endif
}
#else
/* here no PM acceleration is used */
...
...
@@ -272,25 +274,34 @@ void sim::gravity_set_oldacc(int timebin)
}
}
/* CHECK: shoukd this function still contain the communication of the forces in in Tree.ResultsActiveImported? */
void
sim
::
gravity_comoving_factors
(
int
timebin
)
{
particle_data
*
P
=
Sp
.
P
;
#ifndef PERIODIC
#ifndef PMGRID
if
(
All
.
ComovingIntegrationOn
)
{
/* here we carry out an integration in comoving coordinates but in a non-periodic space (i.e. the 'big sphere setup') */
double
fac
=
0.5
*
All
.
Hubble
*
All
.
Hubble
*
All
.
Omega0
/
All
.
G
;
for
(
int
i
=
0
;
i
<
Sp
.
TimeBinsGravity
.
NActiveParticles
;
i
++
)
{
int
target
=
Sp
.
TimeBinsGravity
.
ActiveParticleList
[
i
];
double
pos
[
3
];
Sp
.
intpos_to_pos
(
P
[
target
].
IntPos
,
pos
);
/* converts the integer distance to floating point */
for
(
int
j
=
0
;
j
<
3
;
j
++
)
P
[
target
].
GravAccel
[
j
]
+=
fac
*
P
[
target
].
IntPos
[
j
];
P
[
target
].
GravAccel
[
j
]
+=
fac
*
pos
[
j
];
#ifdef EVALPOTENTIAL
double
r2
=
0
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
r2
+=
pos
[
k
]
*
pos
[
k
];
P
[
target
].
Potential
-=
fac
*
r2
;
#endif
}
}
#endif
#endif
/* muliply by G */
...
...
@@ -341,46 +352,30 @@ void sim::gravity_comoving_factors(int timebin)
#endif
#endif
if
(
All
.
ComovingIntegrationOn
)
if
(
All
.
ComovingIntegrationOn
==
0
&&
All
.
OmegaLambda
!=
0
)
{
#ifndef PERIODIC
#ifdef EVALPOTENTIAL
double
fac
=
-
0.5
*
All
.
Omega0
*
All
.
Hubble
*
All
.
Hubble
;
#ifdef PERIODIC
Terminate
(
"You specified a periodic simulation in physical coordinates but with a non-zero cosmological constant - this can't be "
"run"
);
#endif
/* Finally, the following factor allows a computation of a cosmological simulation
with vacuum energy in physical coordinates */
double
pos
[
3
];
Sp
.
intpos_to_pos
(
P
[
target
].
IntPos
,
pos
);
/* converts the integer distance to floating point */
double
r2
=
0
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
r2
+=
pos
[
k
]
*
pos
[
k
];
P
[
target
].
Potential
+=
fac
*
r2
;
#endif
#endif
}
else
{
if
(
All
.
OmegaLambda
!=
0
)
{
#ifndef PERIODIC
/* Finally, the following factor allows a computation of a cosmological simulation
with vacuum energy in physical coordinates */
double
fac
=
All
.
OmegaLambda
*
All
.
Hubble
*
All
.
Hubble
;
double
pos
[
3
];
Sp
.
intpos_to_pos
(
P
[
target
].
IntPos
,
pos
);
/* converts the integer distance to floating point */
double
fac
=
All
.
OmegaLambda
*
All
.
Hubble
*
All
.
Hubble
;
for
(
int
j
=
0
;
j
<
3
;
j
++
)
Sp
.
P
[
target
].
GravAccel
[
j
]
+=
fac
*
pos
[
j
];
for
(
int
j
=
0
;
j
<
3
;
j
++
)
Sp
.
P
[
target
].
GravAccel
[
j
]
+=
fac
*
pos
[
j
];
#ifdef EVALPOTENTIAL
double
r2
=
0
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
r2
+=
pos
[
k
]
*
pos
[
k
];
P
[
target
].
Potential
-=
0.5
*
fac
*
r2
;
#endif
double
r2
=
0
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
r2
+=
pos
[
k
]
*
pos
[
k
];
P
[
target
].
Potential
-=
0.5
*
fac
*
r2
;
#endif
}
}
}
}
...
...
src/tree/tree.cc
View file @
e0bd04bf
...
...
@@ -231,7 +231,6 @@ int tree<node, partset, point_data, foreign_point_data>::treebuild_construct(voi
nfreep
->
level
=
0
;
nfreep
->
sibling_shmrank
=
TreeSharedMem_ThisTask
;
nfreep
->
nextnode_shmrank
=
TreeSharedMem_ThisTask
;
nfreep
->
father_shmrank
=
TreeSharedMem_ThisTask
;
for
(
int
j
=
0
;
j
<
3
;
j
++
)
nfreep
->
center
[
j
]
=
((
MyIntPosType
)
1
)
<<
(
BITS_FOR_POSITIONS
-
1
);
...
...
@@ -579,7 +578,6 @@ int tree<node, partset, point_data, foreign_point_data>::treebuild_insert_group_
nfreep
->
center
[
1
]
=
((
subintpos
[
i
][
1
]
&
centermask
)
|
mask
);
nfreep
->
center
[
2
]
=
((
subintpos
[
i
][
2
]
&
centermask
)
|
mask
);
nfreep
->
father_shmrank
=
TreeSharedMem_ThisTask
;
nfreep
->
nextnode_shmrank
=
TreeSharedMem_ThisTask
;
nfreep
->
sibling_shmrank
=
TreeSharedMem_ThisTask
;
...
...
@@ -746,7 +744,6 @@ int tree<node, partset, point_data, foreign_point_data>::create_empty_nodes(
TopNodes
[
no
].
sibling_shmrank
=
TreeSharedMem_ThisTask
;
TopNodes
[
no
].
nextnode_shmrank
=
TreeSharedMem_ThisTask
;
TopNodes
[
no
].
father_shmrank
=
TreeSharedMem_ThisTask
;
}
/* loop over daughter nodes */
...
...
src/tree/tree.h
View file @
e0bd04bf
...
...
@@ -64,7 +64,6 @@ struct basenode
unsigned
char
level
;
/**< hold the tree level, used to store the side length of node in space efficient way */
unsigned
char
sibling_shmrank
;
unsigned
char
nextnode_shmrank
;
unsigned
char
father_shmrank
;
// CHECK: can be deleted
std
::
atomic_flag
access
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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