Commit 8935b955 authored by Volker Springel's avatar Volker Springel
Browse files

small fix in potential energy for external Hernquist potential

parent 95a4b613
......@@ -56,7 +56,7 @@ void sim::gravity_external(void)
Sp.P[target].GravAccel += (-All.G * m / (r * r * r)) * pos;
#if defined(EVALPOTENTIAL) || defined(OUTPUT_POTENTIAL)
Sp.P[target].ExtPotential += (-All.G * m / (r + All.A_StaticHQHalo));
Sp.P[target].ExtPotential += (-All.G * All.Mass_StaticHQHalo / (r + All.A_StaticHQHalo));
#endif
}
#endif
......
......@@ -584,13 +584,7 @@ void logs::compute_global_quantities_of_system(void)
#endif
#if defined(EXTERNALGRAVITY) && defined(EVALPOTENTIAL)
#if defined(SELFGRAVITY)
sys.EnergyPotComp[P[i].getType()] +=
0.5 * P[i].getMass() * P[i].ExtPotential; // note: ExtPotential already included on P[].p.Potential, that's why only 0.5 is
// needed here to recover the rest
#else
sys.EnergyPotComp[P[i].getType()] += 1.0 * P[i].getMass() * P[i].ExtPotential;
#endif
sys.EnergyPotComp[P[i].getType()] += P[i].getMass() * P[i].ExtPotential;
#endif
double vel[3] = {0, 0, 0};
......
Markdown is supported
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