Skip to content

Bulge Radii Discrepancy #4

Description

@jaydewillingham

Bug: BulgeRadius not consistently updated when bulge mass is created or modified

Summary

During implementation of dynamical-time-dependent black hole accretion, a large number of galaxies were found to have non-zero BulgeMass but zero-valued BulgeRadius. This resulted in invalid dynamical timescales, propagation of NaNs through the black hole accretion calculation, and eventual simulation crashes.

Investigation suggests that the issue arises because BulgeRadius is not consistently recalculated when bulge properties are modified, particularly in disk-instability and minor-merger pathways.

The primary source appears to be the disk-instability pathway.

Disk Instability

In:

update_instability_bulge_radius()

(model_misc.c)

the instability bulge radius is updated:

galaxies[p].InstabilityBulgeRadius = R_new;

however the overall bulge radius is not subsequently recalculated.

As a result, bulge mass can be transferred into the instability bulge component while BulgeRadius remains stale or zero.

Further inspection suggests that the intended design is for get_bulge_radius() to recompute the composite bulge radius whenever either the merger-driven or instability-driven bulge components are modified.

Additional missing updates appear in the minor-merger logic (deal_with_galaxy_merger()).

In the disk-dominated minor merger branch:

if (is_disk_dominated)

the bulge radius is assumed to have been updated elsewhere, but the composite radius is not explicitly recomputed.

Similarly, some merger-driven bulge mass additions do not immediately trigger a recalculation of the total bulge radius.

Proposed Fix

1. Recompute BulgeRadius after instability radius updates

Replace:

galaxies[p].InstabilityBulgeRadius = R_new;

with:

galaxies[p].InstabilityBulgeRadius = R_new;
get_bulge_radius(p, galaxies, run_params);

inside:

update_instability_bulge_radius()

This ensures that any change to the instability bulge component propagates to the total bulge radius.

2. Recompute BulgeRadius after merger bulge radius updates

In the minor-merger spheroid branch:

galaxies[merger_centralgal].MergerBulgeRadius = new_merger_radius;

add:

get_bulge_radius(merger_centralgal, galaxies, run_params);

3. Recompute BulgeRadius after BCG bulge growth

Following merger-driven bulge mass additions:

galaxies[centralgal].MergerBulgeMass += ...

add:

get_bulge_radius(centralgal, galaxies, run_params);

4. Remove redundant triple assignments

Several locations currently contain:

galaxies[p].BulgeRadius = get_bulge_radius(...);
galaxies[p].MergerBulgeRadius = get_bulge_radius(...);
galaxies[p].InstabilityBulgeRadius = get_bulge_radius(...);

including:

  • core_build_model
  • portions of model_misc

Since get_bulge_radius() already updates the appropriate radius fields, these can be simplified to:

get_bulge_radius(p, galaxies, run_params);

This avoids redundant calculations and centralizes radius updates.

Expected Outcome

The proposed changes ensure that every modification to:

  • MergerBulgeMass
  • MergerBulgeRadius
  • InstabilityBulgeMass
  • InstabilityBulgeRadius

is immediately followed by a recalculation of the composite bulge radius.

This should eliminate the majority of cases where:

BulgeMass > 0
BulgeRadius == 0

and prevent NaNs in dynamical-time-based calculations.

Remaining Work

After implementing the proposed changes, the number of problematic galaxies decreases substantially but is not fully eliminated.

Additional investigation is required for a small residual population of galaxies with non-zero bulge mass and zero bulge radius. There are indications that a small number of pathways may still bypass the Shen fallback prescription or fail to trigger a bulge-radius update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions