Source-linked AI summary
KROME - a package to embed chemistry in astrophysical simulations
T. Grassi, S. Bovino, D. R. G. Schleicher, J. Prieto, D. Seifried, E. Simoncini, F. A. Gianturco
TL;DR
Astrophysical simulations need chemistry because it regulates gas cooling and thermal properties, but incorporating chemical networks efficiently into 3D hydrodynamics is challenging. KROME generates embeddable chemical-rate subroutines and integrates connected thermal and dust processes, then tests them across one-zone, 1D, cosmological, and 3D simulations. The results are consistent with previous studies and show that KROME can be efficiently applied in hydrodynamical simulations.
Problem
Chemical networks are needed to model astrophysical gas, but incorporating moderate-sized networks into 3D hydrodynamical simulations requires numerical techniques that are both accurate and efficient.
Method
KROME uses a pre-processor to generate chemical-rate-equation subroutines for user-supplied networks, with connected cooling, heating, photochemistry, dust, and other physical processes.
Results
KROME's extensive tests and applications in Enzo, Ramses, and Flash are consistent with previous studies and show efficient application in hydrodynamical simulations.
Takeaways & Limitations
KROME provides a general framework for embedding diverse chemical networks and associated thermal processes in astrophysical numerical simulations.
Takeaways & Limitations
At densities above 10^10 cm^-3, gas-dust thermal exchange increases ODE stiffness and can influence solver stability; addressing this was deferred to a future release.
Abstract
from arXiv · showhide
Chemistry plays a key role in many astrophysical situations regulating the cooling and the thermal properties of the gas, which are relevant during gravitational collapse, the evolution of disks and the fragmentation process. In order to simplify the usage of chemical networks in large numerical simulations, we present the chemistry package KROME, consisting of a Python pre-processor which generates a subroutine for the solution of chemical networks which can be embedded in any numerical code. For the solution of the rate equations, we make use of the high-order solver DLSODES, which was shown to be both accurate and efficient for sparse networks, which are typical in astrophysical applications. KROME also provides a large set of physical processes connected to chemistry, including photochemistry, cooling, heating, dust treatment, and reverse kinetics. The package presented here already contains a network for primordial chemistry, a small metal network appropriate for the modelling of low metallicities environments, a detailed network for the modelling of molecular clouds, a network for planetary atmospheres, as well as a framework for the modelling of the dust grain population. In this paper, we present an extended test suite ranging from one-zone and 1D-models to first applications including cosmological simulations with ENZO and RAMSES and 3D collapse simulations with the FLASH code. The package presented here is publicly available at http://kromepackage.org/ and https://bitbucket.org/krome/krome_stable
1 INTRODUCTION
Astrophysical chemistry regulates gas cooling, collapse, disk stability, fragmentation, and observable line emission, making chemical models necessary in numerical simulations. KROME addresses the computational and implementation barriers by generating embeddable chemical solvers and supporting diverse chemistry-related processes and networks.
- Chemistry regulates cooling and thereby influences gravitational collapse, disk stability, fragmentation, and the line emission of astrophysical objects.
- Large simulations face substantial costs from chemical kinetics and from constructing ODEs, Jacobians, and sparsity structures for networks containing roughly 150 to over 6000 reactions.
- Existing network-preprocessing and chemistry codes are often unavailable, proprietary, unmaintained, or limited to their own frameworks.
- KROME provides a pre-processor that generates subroutines for solving user-supplied chemical networks and can embed them in numerical simulations.
- The package includes primordial, low-metallicity, molecular-cloud, and planetary-atmosphere networks, plus thermal processes, dust physics, cosmic-ray ionization, and DLSODES-based rate-equation solving.
- The paper presents physical modelling, computational-framework details, and an extensive test suite spanning molecular clouds, collapse models, shocks, dust, planetary atmospheres, and embedded simulations.
2.1 Rate equations
KROME represents chemical evolution as a coupled system of ordinary differential equations whose species abundances are updated from formation and destruction reactions. Because astrophysical networks are commonly stiff and may couple to temperature evolution, the solver must handle multiple timescales and linked physical variables.
- The abundance evolution of each species is represented by an ordinary differential equation within a Cauchy problem.
- Formation reactions contribute positively to a species differential, while destruction reactions contribute negatively through separate reaction sets.
- Table 1 lists indicative chemical and physical processes across environments, with applicability depending on parameters including metallicity as well as temperature and density.
- Reaction rate coefficients commonly depend on gas temperature and have units cm3(n−1) s−1 for reactions involving n reactants.
- The system is usually stiff because dependent variables evolve over two or more substantially different timescales, requiring a solver tailored to stiff problems.
2.2 Photoionisation and photodissociation
KROME includes photoionization, photodissociation, and cosmic-ray processes through rate formulations tied to radiation, cross sections, optical depth, and ionizing-species abundance. To reduce computational cost, the release adopts simplified radiation assumptions and does not include self-shielding.
- Photoionization applies to atoms or atomic ions, whereas photodissociation applies to molecules or molecular ions and produces two generic products.
- The photoionization rate uses the ionization potential, photon-energy distribution, process cross section, gas optical depth, and photon energy.
- KROME supplies default atomic and ionic cross sections while allowing users to select molecular cross-section functions.
- The radiation flux is parameterized using a spectral slope coefficient and J21, defined relative to 10−21 erg s−1 Hz−1 str−1.
- For faster integration, the tests assume time-constant incident flux and neglect frequency dependence in optical depth, while allowing users to modify the approximation.
- The current KROME version includes cosmic-ray ionization and dissociation processes but no self-shielding model.
2.3 Thermal evolution
Krome couples gas-temperature evolution to chemical abundances through heating and cooling terms, while providing multiple cooling models for primordial, molecular, metal-enriched, and optically thick gas. Its thermal treatment includes atomic, molecular, HD, CIE, continuum, metal, and chemical cooling processes with documented validity conditions and approximations.
- Thermal evolution: Krome adds a temperature ODE whose heating and cooling terms depend on gas temperature and species abundances.The temperature equation is coupled to the chemical rate equations because rate coefficients depend on temperature, while abundances determine heating and cooling.
- Cooling processes: The thermal model includes atomic, H2, HD, metal, chemical, CIE, and continuum cooling processes.Atomic cooling covers collisional ionisation, recombination, excitation, and bremsstrahlung; molecular and metal processes use dedicated treatments and fits.
- Molecular cooling: H2 cooling is implemented with Galli & Palla (1998) and Glover & Abel (2008) models, while HD cooling follows Lipovka, N´u˜nez-L´opez & Avila-Reese (2005).The H2 models share the same high-density limit but use different low-density limits and temperature ranges; the HD fit depends on temperature and density and is extended below 100 K.
- Opacity and continuum: Optically thick H2 cooling is treated with an opacity correction, while continuum cooling includes opacity processes such as absorption and scattering.The optically thin approach applies only below approximately n ≳ 10^10 cm−3; the continuum treatment uses Planck opacity and a Jeans-length-dependent formulation.
- Validity limits: The CIE implementation should be used cautiously because its fit was tested for H2 fractions near 0.5 and may fail in extremely dissociated media.The paper also notes substantial differences between the adopted approximation and a more detailed treatment at high densities.
- Opacity and continuum: Krome replaces a problematic Lenzuni, Chernoff & Salpeter (1991) opacity fit with a simpler density-dependent fit valid for T ⩽ 3 × 10^4 K.The original fit can produce non-physical results; the replacement is assumed valid above ρg > 10−12 g cm−3 and extrapolated to 0.5 g cm−3.
2.4 Dust
Krome provides a simplified dust model covering grain growth, destruction, temperature coupling, and H2 catalysis across size-binned carbonaceous and silicate grains.
- Dust model: Krome models dust formation through grain growth by accretion and destruction through thermal sputtering, using size bins with an MRN distribution.The default grain-size range is 5–2500 Å, and the distribution includes PAHs at small sizes.
- Dust model: The dust population is divided into carbon-based and silicon-based grains, with user-extensible grain types but limited support for advanced dust models.The first release omits detailed grain-grain shattering and vaporisation processes.
- Grain growth: The grain accretion rate depends on gas and dust temperatures, grain cross section, gas-partner density, dust density, seed density, thermal speed, and a delay factor.The model uses nseed = 10^-12 cm^-3 and cd ≈ 10^-3; the delay factor represents evaporation and grain-grain collision effects.
- Grain growth: The sticking coefficient fit applies for 10 < T < 1000 K and 10 < Td < 300 K, while α = 0.3 approximates it in low-gas-temperature environments.The fit was developed for carbon atoms on carbon lattices but is assumed applicable to silicates; Figure 4 plots its temperature dependence.
- Dust destruction: Thermal sputtering uses collision probabilities, fitted impact yields valid for T > 10^5 K, and a simplified treatment applied to all dust types and colliding species.The release notes that the full Nozawa et al. model is more complex than this implementation.
- Dust temperature: Dust temperature is obtained by root-finding a radiative balance involving emission, absorbed radiation, and the CMB, with Td(a) = TCMB when I(ν) = 0.Gas-dust thermal exchange is included, but at n > 10^10 cm^-3 it increases ODE stiffness and can affect solver stability.
3 THE COMPUTATIONAL FRAMEWORK
Krome uses a modular Python-to-Fortran framework that embeds chemical, thermal, dust, and user-defined ODE processes in external simulation codes.
- Framework structure: A Python pre-processor generates Fortran files for chemical evolution, cooling, heating, and selected physical processes from a user-defined reaction-rate list.An external framework code calls Krome to compute chemical evolution using a selected network.
- Framework structure: Krome’s main module interfaces the framework program with the solver, while separate modules organize constants, parameters, variables, cooling, heating, dust, and utilities.Figure 5 depicts MAIN as the framework program and KROME as the central module.
- Framework structure: The solver subsystem uses DLSODES or DVODE together with FEX, JEX, and COE, while heating, cooling, and dust modules contribute terms to the differential equations.FEX obtains rates from COE, temperature evolution from HEATING and COOLING, and dust-bin evolution from DUST.
- The ODE system: The core ODE system includes molecular and atomic species, dust bins, gas temperature, and constant photon, cosmic-ray, and dummy species used for compatibility or implicit schemes.The total system contains N differentials, with Figure 6 showing the corresponding groups.
- ODE evaluation: Krome supports explicit and implicit construction of ODE right-hand sides, while DLSODES itself remains an implicit BDF solver.The explicit scheme translates reaction expressions directly into Fortran; the implicit scheme loops over reactions and updates reactants and products.
- Extra ODEs: Users can add extra ODEs from a Fortran expression file alongside chemical equations, and the included Lotka–Volterra test reproduces expected predator-prey evolution.This supports coupled models whose additional equations do not arise directly from the chemical network.
- Sparsity structure: Precomputed Jacobian sparsity can retain false nonzero elements when variables or rates become zero, reducing speed-up and sometimes adding overhead.The results remain unaffected, but the trade-off depends on the chemical system and is difficult to assess during preprocessing.
3.5 Parsing chemical species
Krome parses chemical species and reaction data automatically, validates conservation properties, and can generate reverse reactions from thermochemical information.
- Species parsing: Krome extracts each species’ mass, charge, and constituent atoms from the network file and supports isotope notation such as [14C].It also accepts unit-mass test species using the FK_i notation.
- Species parsing: The parser recognizes selected excited molecular levels, atomic excited states, neutral and charged grains, and PAH species with predefined mass conventions.Special grain species include GRAIN0, GRAIN+, and GRAIN−; PAHs are represented by PAH, PAH+, and PAH−.
- Validation: Krome checks mass and charge conservation and bracket balancing during preprocessing, but it does not validate the supplied Fortran syntax.Unrecognized or missing data can trigger warnings during preprocessing.
- Reverse kinetics: The package can generate reverse reactions from forward reactions using thermodynamic equilibrium constants and species Gibbs-energy data.The conversion includes concentration-unit correction factors involving (kb · T)^Δn or (R · T)^Δn.
- Reverse kinetics: A Zel’dovich thermal NO test shows that Krome reproduces NO evolution and correctly derives the corresponding reverse reactions.The test uses two forward reactions and their reverse reactions, with forward and reverse rate coefficients compared against published values.
4 THE TEST SUITE
The test suite exercises Krome across molecular-cloud chemistry, one-zone collapse, UV-irradiated collapse, dust evolution, shocks, diffusion, and slow-manifold kinetics. These tests reproduce reference behavior while illustrating how chemistry and thermal processes shape astrophysical evolution.
- Chemistry in molecular clouds: Krome reproduces the reference evolution of carbon, OH, HC3N, and O2 over 10^8 yr in a molecular-cloud test.The test uses the osu_01_2007 network and Wakelam & Herbst initial conditions, with constant T = 10 K and H2 density 10^4 cm−3.
- Cloud collapse (one-zone): The primordial collapse model heats by compression near n ∼10 cm−3, cools through H2 near n ∼10^2–10^4 cm−3, and later evolves adiabatically after becoming opaque.The gas temperature drops to ∼200 K near n ∼10^4 cm−3; three-body reactions, optical thickness, and collisional-induced emission shape the subsequent evolution.
- Cloud collapse (one-zone): Metal cooling strengthens the low-density cooling regime and remains important above 10^6 cm−3 through SiII and FeII, while changing metal abundances alters the thermal history.CI dominates initially, CII follows, and carbon depletion into CO creates an interval without metal cooling before SiII–FeII cooling becomes effective.
- Cloud collapse under UV radiation: A UV background increases H2 dissociation and low-density temperatures; at J21 = 10^5, the gas rapidly reaches ∼8000 K and H2 cooling is strongly reduced.For J21 < 10^5, enough H2 remains for cooling to operate.
- Additional tests: The suite also tests dust evolution, cooling effects in shocks, coupled chemistry and diffusion, and convergence toward a common slow-manifold equilibrium.The slow-manifold test reaches (H2, H, O2, O, H2O, OH) = (0.27, 0.05, 0.135, 0.02, 0.7, 0.01) from altered initial conditions as well.
5 Krome EMBEDDED IN 3D
Krome is embedded in Enzo, Ramses, and Flash to test chemistry in cosmological and collapse simulations. These applications reproduce expected chemical and thermal behavior, while exposing solver-cost trade-offs and turbulence effects.
- Krome interfaces with Enzo, Ramses, and Flash, with patches included in the current release.
- Krome in Ramses: At ρ/mH ≈0.3 cm−3, H2 cooling lowers the gas to T ≈250 K after the temperature reaches a maximum near the halo virial temperature.The phase-plane result is reported at the simulation’s final redshift.
- Krome in Enzo: 1000 K is the consistent temperature produced across three minihalos and resolutions J64 and J128 in optically thin Enzo tests.The Krome chemistry shows no dependence on the resolution parameters in these tests.
- Performance: DLSODES is slower than Enzo’s first-order BDF method, although explicit Jacobian and sparsity information could improve performance.The implementation also retains interface overhead, and the more converged solution carries a computational cost.
- Krome in Ramses and Flash: Ramses and Flash show almost perfect agreement for density, temperature, velocity, H2, H−, and e−.The agreement also extends to other species not shown.
- Krome in Flash: Above 10−13 g cm−3, the optically thick correction keeps temperature increasing, unlike runs without the correction.Non-turbulent 1D and 3D results are almost indistinguishable, while turbulence produces shocks and lower H2 fractions.
- Performance: In Flash 3D runs, chemistry and self-gravity each require about 45% of the total computational time.The per-cell chemistry time is approximately unchanged by turbulence or the optically thick cooling term, without applied optimization.
- Krome in Flash: Sod shock-tube and collapse tests show that Krome works within Flash and produces reliable results.
6 SUMMARY AND OUTLOOK
The paper presents Krome as a general chemistry package with standard networks, connected thermal and dust processes, and broad validation. Its scope is wide, but three-dimensional applications still require chemical-network reduction.
- Krome combines a Python pre-processor with Fortran subroutines for solving user-specified chemical rate equations.
- Standard networks cover primordial chemistry, low-metallicity gas, molecular clouds, and planetary atmospheres, with modules for photodissociation, heating, cooling, and dust.
- Tests and applications: The test suite spans one-zone, shock, dust, planetary-atmosphere, slow-manifold, Enzo, Ramses, and Flash applications.
- Conclusion: Results are consistent with previous studies and show that Krome can be efficiently applied in hydrodynamical simulations.
- Scope and outlook: Three-dimensional simulations require reducing chemical complexity and selecting the main reactions governing chemical and thermal structure.
- Scope and outlook: Future releases plan to incorporate reduction techniques, while the current release already accepts literature networks through the Python pre-processor.
APPENDIX A: VALUES ADOPTED FOR H2 COOLING
Appendix A identifies the fitting coefficients used for the H2 cooling function adopted from Glover and Abel (2008).
- The H2 cooling-rate fitting coefficients are listed in Table A1.
APPENDIX B: VALUES ADOPTED FOR METAL COOLING
Appendix B documents the data and transitions used for fine-structure metal cooling in Krome.
- Krome’s fine-structure metal-cooling data come from published sources and include transitions illustrated in Figures B1–B4.
- Atomic data and rate coefficients for several colliders are reported in Tables B1–B4.
- Figures B2 and B3 provide pictorial views of oxygen and silicon line transitions.
APPENDIX C: REACTION RATES EMPLOYED IN THE PRIMORDIAL NETWORK
Appendix C identifies the reaction rates used in the primordial chemical network. The complete reaction list is provided in Table C1.
- Table C1 lists the reactions and rates included in the primordial chemical network.
- The appendix directs readers to Table C1 for the primordial network’s reaction-rate data.
- The listed rates are documented as part of the primordial chemistry network used in the paper.
APPENDIX D: REACTION FILE FORMAT
Krome reaction files use configurable format strings to describe reactants, products, temperature limits, and rate coefficients. Users can combine multiple formats and add comments, variables, and reaction-specific temperature operators.
- Reaction-file structure: A default reaction-file template specifies indices, reactants, products, temperature limits, and reaction rates.
- Reaction-file structure: Format strings begin with @format: and define how reaction entries are parsed.
- Flexible formats: Multiple format strings can appear in one reaction file, supporting different field orders and numbers of reactants or products.
- Flexible formats: The example formats encode either two reactants and one product or two reactants and two products, alongside temperature limits and rate coefficients.
- Additional controls: Reaction files may include comments, variables, and individual temperature operators applied to specific reactions.