Commit 8d220698 authored by Rainer Weinberger's avatar Rainer Weinberger

minor edits in comments and documentation; changed check criterion in example...

minor edits in comments and documentation; changed check criterion in example cosmo_zoom_gravity_only_3d
parent f67a5e5d
......@@ -433,6 +433,7 @@ Gravitational force accuracy
**ErrTolForceAcc**
The accuracy parameter for the relative opening criterion for the tree walk.
Only used if ``ErrTolTheta 0``.
-----
......
......@@ -143,22 +143,28 @@ for i_file, z in enumerate(Redshifts):
fig.savefig(simulation_directory+'/plots/haloStructure_z%.1d.pdf'%z, dpi=300)
## comparison to reference run (sorted list of SubhaloMass)
if i_file != 0:
if i_file > 3:
SubhaloMass_ref = np.loadtxt(simulation_directory+"/Masses_z%.1g.txt"% z)
minLen = np.min([len(SubhaloMass), len(SubhaloMass_ref)])
i_select2 = np.arange(minLen)
delta = np.array(SubhaloMass[i_select2]-SubhaloMass_ref[i_select2], dtype=np.float64)
tolerance_average = 3e10
tolerance_std = 1e11
if np.abs(np.average(delta)) > tolerance_average or np.abs(np.std(delta)) > tolerance_std:
delta = np.array((SubhaloMass[i_select2]-SubhaloMass_ref[i_select2]) / np.sqrt(0.5 * (SubhaloMass[i_select2]+SubhaloMass_ref[i_select2]) ), dtype=np.float64)
delta = np.abs(delta)
tolerance = 5e4 ## corresponds to 5e11 Msun for 1e14 Msun halo and 5e10 for 2e12 Msun subhalo
## typical average delta values (empirically determined by varying
## the number of MPI ranks) is around 3e4
if np.abs(np.average(delta)) > tolerance:
status = 1
print("ERROR: z=%g difference in subhalo masses exceeding limits!" % z)
print("mass error (=delta)")
print(delta)
print("average (tolerance: %g)" % tolerance_average)
print("average mass error/sqrt(mass) (=delta)")
print(np.average(delta))
print("stddev (tolerance: %g)" % tolerance_std)
print(np.std(delta))
print("tolerance: %g" % tolerance)
print("Individual error values:")
for element in delta:
print(element)
## if everything is ok: 0 else: 1
sys.exit(status)
......@@ -267,6 +267,7 @@ int force_treeevaluate(gravdata_in * in, gravdata_out * out, int target, int mod
continue;
}
// note that aold is strictly speaking |acceleration| / G
#ifdef ACTIVATE_MINIMUM_OPENING_ANGLE
if(mass * len2 > r2 * r2 * aold && len2 > r2 * (0.4 * 0.4))
#else /* #ifdef ACTIVATE_MINIMUM_OPENING_ANGLE */
......
......@@ -162,6 +162,7 @@ void cooling_and_starformation(void)
{
unew = SphP[i].Utherm;
// put (cold) star forming cells on the effective equation of state
if(SphP[i].Utherm < egyeff)
{
unew = egyeff;
......@@ -510,7 +511,7 @@ void set_units_sfr(void)
* \param[in, out] ne Fractional electron density.
* \param[out] x Fraction cold gas within model.
* \param[out] tsfr Star formation timescale.
* \param[out] factorEVP FactorEVP for given density.
* \param[out] factorEVP Supernova evaporation factor for given density.
*/
double calc_egyeff(int i, double gasdens, double *ne, double *x, double *tsfr, double *factorEVP)
{
......
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