TARDIS Plasma Module
Plasma Structure
NetworkX - Plasma Graphs
The plasma is structured as a network of calculations. Each quantity (temperature, ionization, optical depth, etc.) is a “property.” Properties depend on one another, and TARDIS connects them into a graph so that when one value changes, only the downstream values get recalculated in the correct order.
The plasma lives in the class BasePlasma, defined in plasma/base.py.
There are two types of properties:
Input properties — values fed in from the model or config. They have outputs but no inputs, so they are the starting points of the graph.
Processing properties — values that get calculated. TARDIS reads the argument names of their
calculatefunction to learn what inputs they need.
For example, PhiSahaLTE (defined in
plasma/properties/ion_population.py) has the function:
calculate(g_electron, beta_rad, partition_function, ionization_data)
Its inputs are those four names and its output is phi. Connections are
made by matching names — an output called phi automatically links to
any calculation that has an argument called phi.
Building the Graph
TARDIS builds the graph inside _build_graph in three steps:
Add one node for every property.
Mark the input properties as starting points (they have no inputs).
For each calculated property, find what it needs, locate the property that produces each name, and draw an arrow from producer to consumer. If a property needs something that nothing produces, TARDIS raises an error immediately, catching broken or incomplete setups.
When an input changes (for example, the temperature), TARDIS finds everything downstream of that change and recalculates in topological order, so each property is updated only after the values it depends on are fresh.
For a guide on how to display a plasma graph, see How to Generate the Plasma Graph.
Plasma Solver Factory
The PlasmaSolverFactory class, defined in plasma/assembly/base.py,
initializes, configures, and assembles the plasma used in TARDIS runs. It
has two key methods:
prepare_factory— accepts specific property collections, which are collections of classes that define plasma properties.assemble— returns an instance of theBasePlasmaclass.
There is also an assemble_plasma function defined in two locations:
plasma/assembly/legacy_assembly.pyplasma/standard_plasmas.py
The active assemble_plasma function used by the TARDIS simulation
class is the one defined in plasma/assembly/legacy_assembly.py. It
returns an assembled plasma by:
Defining a
PlasmaSolverFactoryinstance.Calling the
prepare_factorymethod.Calling the
assemblemethod.
Plasma Properties
The plasma properties used throughout the plasma module are defined in
legacy_property_collections.py. A separate property_collections.py
file exists but is not imported by the main plasma solver factory and is
therefore not active during standard TARDIS runs. The standard plasma solver
imports its property collections from legacy_property_collections.py.
Property Categories
The following describes the property categories defined in
legacy_property_collections.py. Properties that are inactive,
uncovered, or not exercised by integration tests are noted inline.
Adiabatic Cooling Properties
AdiabaticCoolingRate
Basic Inputs
DilutePlanckianRadFieldNumberDensityTimeExplosionAtomicDataJBluesLinkTRadTElectronHeliumTreatmentContinuumInteractionSpecies— Not exercised by any current integration test. The associated continuum interaction properties are scoped to Type II supernova plasmas and are not activated in standard Type Ia simulation configs.NLTEIonizationSpeciesNLTEExcitationSpecies
Basic Properties
BetaRadiationDilutionFactorElectronTemperatureGElectronIonizationDataLevelsLinesLinesLowerLevelIndexLinesUpperLevelIndexPartitionFunctionSelectedAtomsStimulatedEmissionTRadiativeTauSobolev
Continuum Interaction Inputs
PhotoIonRateCoeffStimRecombRateFactorBfHeatingRateCoeffEstimatorStimRecombCoolingRateCoeffEstimatorYgData— Tested directly inplasma/equilibrium/tests/test_collisional_transitions.pyandplasma/tests/test_plasma_continuum.py, but not wired into the main plasma solver factory and therefore not built during standard TARDIS runs.
Continuum Interaction Properties
BoundFreeOpacityCollDeexcRateCoeff— Defined in two files:plasma/equilibrium/rates/collision_strengths.pyandplasma/properties/continuum_processes/rates.py. The active class is the one imported into the property collection fromrates.py. The class incollision_strengths.pyis not covered by the test suite.CollExcRateCoeff— Same as above.CollIonRateCoeffSeatonCollRecombRateCoeffContinuumInteractionHandlerCorrPhotoIonRateCoeffFreeBoundCoolingRateFreeBoundEmissionCDFFreeFreeCoolingRateLevelIdxs2LineIdxLevelIdxs2TransitionIdxLevelNumberDensityLTEMarkovChainIndexMarkovChainTransProbsMarkovChainTransProbsCollectorMonteCarloTransProbsNonContinuumTransProbsMaskNonMarkovChainTransitionProbabilitiesPhotoIonBoltzmannFactorPhotoIonizationData— Registered in the plasma solver factory but not exercised by any current integration test configuration.RawCollIonTransProbsRawCollisionTransProbsRawPhotoIonTransProbsRawRadBoundBoundTransProbsRawRecombTransProbsSahaFactorSpontRecombCoolingRateCoeffSpontRecombRateCoeff— Defined in the property collection but not referenced by the main plasma solver factory. Developers extending continuum interaction support should note this class requires explicit wiring to become active.StimRecombRateCoeffThermalGElectronThermalLTEPartitionFunctionThermalLevelBoltzmannFactorLTEThermalPhiSahaLTEYgInterpolator
Dilute LTE Excitation Properties
LevelBoltzmannFactorDiluteLTE
Helium LTE Properties
LevelNumberDensityIonNumberDensity
Helium NLTE Properties
HeliumNLTERadiationFieldCorrectionZetaDataBetaElectronLevelNumberDensityHeNLTEIonNumberDensityHeNLTE
Helium Numerical NLTE Properties
HeliumNumericalNLTE— Requires a specific numerical NLTE solver and a specific atomic dataset. Neither are distributed with TARDIS. This class is not activated in standard simulation runs.
LTE Excitation Properties
LevelBoltzmannFactorLTE
LTE Ionization Properties
PhiSahaLTE
Nebular Ionization Properties
PhiSahaNebularZetaDataBetaElectronRadiationFieldCorrection
NLTE LU Solver Properties
NLTEIndexHelperNLTEPopulationSolverLU— Tested intest_nlte_solverbut not exercised in full integration tests. This solver is not activated in standard simulation configurations.
NLTE Properties
LevelBoltzmannFactorNLTENLTEDataPreviousElectronDensitiesPreviousBetaSobolevBetaSobolev
NLTE Root Solver Properties
NLTEIndexHelperNLTEPopulationSolverRoot— Tested intest_nlte_solverbut not exercised in full integration tests. This solver is not activated in standard simulation configurations.
Non NLTE Properties
LevelBoltzmannFactorNoNLTE
Two Photon Properties
RawTwoPhotonTransProbsTwoPhotonDataTwoPhotonEmissionCDFTwoPhotonFrequencySampler
Equilibrium
The tardis/plasma/equilibrium/rates/ folder contains an alternative
plasma implementation based on RateSolver classes. This implementation
is independent of the NetworkX-based plasma module used in standard TARDIS
simulations and is not invoked during normal runs. The rate solver classes
have dedicated unit tests and are retained for future development.
Developer Notes: Inactive and Partially Covered Modules
The following plasma module files are not invoked during standard TARDIS simulation runs. Developers modifying the plasma module should be aware of their status.
tardis/plasma/standard_plasmas.pyNot covered by the plasma test suite and not called during standard TARDIS runs. This module is used exclusively by
grotrian_mockup.ipynb. The active plasma assembly entry point isassemble_plasmainplasma/assembly/legacy_assembly.py.tardis/plasma/properties/property_collections.pyAn alternative property collection used by
standard_plasmas.py. Not imported by the main plasma solver factory and therefore inactive during normal simulation runs. Developers should uselegacy_property_collections.pyas the authoritative reference for active plasma properties.tardis/plasma/properties/nlte_excitation_data.pyDefines
NLTEExcitationData, which is not referenced elsewhere in the active codebase and is the existing implementation relevant to future NLTE excitation work.tardis/plasma/properties/hydrogen_continuum.pyNot activated by any current simulation configuration and not covered by the plasma test suite.
tardis/plasma/properties/continuum_processes/fast_array_util.pyProvides two Numba-accelerated integration utilities:
numba_cumulative_trapezoid— Used byTwoPhotonEmissionCDFintardis/plasma/properties/continuum_processes/rates.py.cumulative_integrate_array_by_blocks— Used by the same class.
Both functions are not exercised by the plasma test suite, as
TwoPhotonEmissionCDFis not activated in standard simulation configurations.
Developer Reference: Test Coverage and Plasma Graphs
Test Coverage
The plasma module test suite provides a practical way to identify which
properties are exercised by standard plasma configurations.
Running the plasma module tests with coverage enabled allows developers
to verify which property calculate methods are exercised by the
current set of simulation configurations.
Key architectural notes for developers:
plasma/standard_plasmas.pyis not covered by the plasma test suite. The active assembly entry point isplasma/assembly/legacy_assembly.py.Continuum interaction properties in
PlasmaSolverFactory(plasma/assembly/base.py) are not activated by any current integration test configuration. Continuum interactions are not used in standard Type Ia supernova simulations.
hydrogen_continuum.pyis not activated by any current simulation configuration and is not covered by the plasma test suite.
To determine whether a specific property class is active, inspect its
calculate method under coverage. For example:
LinesLowerLevelIndexhas full coverage, confirming it is calculated in every standard plasma configuration built bytest_complete_plasmas.
SpontRecombRateCoeff, defined incontinuum_interactions_properties, has no coverage intest_complete_plasmas, confirming it is not built by any current standard simulation configuration.
Coverage analysis of test_complete_plasmas can be used to:
Identify which property classes require additional unit tests.
Determine which features are scoped to Type II plasma and should not be assumed available in Type Ia runs.
Identify property classes that are candidates for removal or consolidation.
Plasma Graph Generation
TARDIS can generate diagrams of the plasma property graph, showing which properties depend on one another. Generating graphs across multiple simulation configurations is a practical method for identifying which plasma properties are relevant to standard simulation runs.
Useful resources:
TARDIS configs repository: tardis-sn/tardis-configs
How to draw plasma graphs: How to Generate the Plasma Graph