Commit e0bd04bf authored by Volker Springel's avatar Volker Springel
Browse files

small fix for cosmological big sphere set-up and clean ups

parent dc4c95d0
......@@ -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 */
......
......@@ -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,27 +352,13 @@ 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;
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
#ifdef PERIODIC
Terminate(
"You specified a periodic simulation in physical coordinates but with a non-zero cosmological constant - this can't be "
"run");
#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 */
......@@ -379,8 +376,6 @@ void sim::gravity_comoving_factors(int timebin)
r2 += pos[k] * pos[k];
P[target].Potential -= 0.5 * fac * r2;
#endif
#endif
}
}
}
}
......
......@@ -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 */
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment