Skip to content

Bound SKIP_PHOTOCHEMFLUX-derived photon flux attenuation #2121

Description

@coderabbitai

Summary

In SKIP_PHOTOCHEMFLUX builds, src/radiation/photochemistry.hpp derives the chem-band flux attenuation factor from n_gamma_final / n_gamma_initial. The final photon density is floored to small_x, but the stored initial photon density is not. This can produce an attenuation factor greater than 1 for initially positive sub-floor values, or after a solver overshoot.

Required changes

  • Store the initial chem-band photon number density using the same small_x floor used for the final value, or apply that floor when using it as the denominator.
  • Bound the derived flux_factor to a maximum of 1.
  • Preserve the existing zero/nonpositive-initial-density behavior (attenuation factor of 0).

Rationale

A flux factor above one amplifies the radiation flux and can make the computed absorbed momentum (dMom*) negative. The attenuation factor should not increase flux during the chemistry update.

Affected area

  • src/radiation/photochemistry.hpp
    • SKIP_PHOTOCHEMFLUX initialization of n_gamma_initial
    • Later algebraic flux_factor calculation during chem-band state updates

Acceptance criteria

  • For an initial photon density below small_x, an unchanged burn does not increase any chem-band flux.
  • Solver output above the initial photon density cannot produce flux_factor > 1.
  • Nonpositive initial photon density continues to yield a zero flux factor.
  • The non-SKIP_PHOTOCHEMFLUX path remains unchanged.

Requested by: @chongchonghe

Backlinks:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions