Skip to content

Native gas chemistry qualification

A single native mechanism drives NumPy and resident CUDA integration for closed, irreversible gas reactions at prescribed temperature. Three synthetic experiments isolate different errors: assigning the wrong storage column, confusing mass with molar concentration, and losing precision in the stiff solver. The numerical implementation was qualified at revision 4825b85fbd with Python 3.12.12, NumPy 2.3.4, SciPy 1.16.2 and Warp 1.11.1 on an NVIDIA GeForce RTX 5060. Mechanism guide

For closed A → B with equal molar masses and s⁻¹, A follows and B gains the missing A mass. The regression checks both species, inert gas, and extensive mass in boxes of 1 and 2 m³. In the worked example an independent pulse adds A at 4 s and ventilation dilutes all gases at 0.05 s⁻¹. The pre-pulse reading is at 4 s. The first post-pulse reading is at 4.5 s. The full 41-point trajectories used 0.25 s process intervals and were checked against analytical concentrations with rtol=2e-9, atol=1e-20 kg/m³ and A+B inventories with rtol=1e-12, atol=1e-22 kg.

Backend Maximum absolute A or B error (kg/m³) Added mass in boxes 1 and 2 (kg)
NumPy 1.7272 × 10⁻²⁰ 3 × 10⁻⁹, 2 × 10⁻⁹
CUDA 1.7261 × 10⁻²⁰ 3 × 10⁻⁹, 2 × 10⁻⁹

Restarted and uninterrupted histories and source ledgers matched bit for bit within each backend. Each run has a prescribed intervention at 4 s. The experiment snapshots the pre-pulse state, applies the external dose on the host, and begins the next segment at 4 s. The restart variants resume the pre-pulse checkpoint and another checkpoint at 4.5 s. Rate evaluations, trial decisions and linear solves stay on the selected backend. Executed example and figure

A + B → C uses molar masses 0.01, 0.02 and 0.03 kg/mol. Initially A and B have equal molar concentrations (1 and 2 mol/m³ in the respective boxes). At 298 and 318 K the rate coefficient is m³/mol/s. The two reactants follow , and the product gains one mole for each mole of A lost. RK23 and ROS3 match the analytical concentrations with relative tolerance 10⁻⁷. The inert gas retains its exact value. These tests run on NumPy, Warp CPU and CUDA. Loading JSON and YAML into permuted gas layouts and rebinding produces exactly matching physical concentrations. Stale layouts, incompatible masses, duplicate bindings and failed elemental balances have dedicated rejection tests.

For the Robertson test use normalized initial state (1, 0, 0), concentration scale 1 mol/m³ and time scale 1 s. Declare equal 0.1 kg/mol molar masses for the three synthetic species. The test integrates from zero independently to 10⁻⁴, 10⁻², 1 and 100 s. The reference uses the Stage 2A right-hand side with independent Radau and BDF integrations; both agree within rtol=1e-8, atol=1e-14. The production solution must agree with each reference at tight settings within rtol=2e-6, atol=1e-12, with a separate comparison for every species. Robertson benchmark · KPP ROS3 method

Backend Relative tolerance Maximum absolute errors in A, B, C (mol/m³) Accepted / rejected Factorizations / solves
NumPy 10⁻⁵ 5.84 × 10⁻⁹, 1.17 × 10⁻¹¹, 5.84 × 10⁻⁹ 1064 / 11 1075 / 9675
CUDA 10⁻⁵ 5.84 × 10⁻⁹, 1.17 × 10⁻¹¹, 5.84 × 10⁻⁹ 1064 / 11 1075 / 9675
NumPy 10⁻⁸ 2.40 × 10⁻¹³, 8.04 × 10⁻¹⁵, 2.43 × 10⁻¹³ 13582 / 11 13593 / 122337
CUDA 10⁻⁸ 2.35 × 10⁻¹³, 8.04 × 10⁻¹⁵, 2.47 × 10⁻¹³ 13582 / 11 13593 / 122337

The work counts sum the four independent integrations for the first box. Absolute tolerance is 10⁻¹⁴ mol/m³. Every accepted endpoint is nonnegative and normalized total concentration is conserved to relative tolerance 10⁻¹² in this equal-mass case. Tightening the tolerance reduced error in all three species. Using full-precision device tableau constants matters: intermediate rounding of those constants to float32 produced an error floor near 8 × 10⁻⁹ mol/m³ for A and C during development. A dedicated device regression checks the refined solution. This study establishes no GPU speedup or large-network scaling claim.

The converter tests an A → C exponential and an A + B → C bimolecular trajectory at 298 and 318 K. The source documents use nonzero temperature exponents, per-molecule activation energy or its kelvin equivalent, and a different species order from the simulation. Rates from the imported and independently authored native mechanisms meet the 10⁻¹² relative bound. Both boxes meet the analytical trajectory and inventory checks on NumPy, Warp CPU and an RTX 5060. Fifteen conversion cases passed. A known imbalance in reacting molecular weights rejected before export even when an inert weight was absent. The rejection preserved the existing destination file. The pinned NCAR full example also rejected its unsupported emissions section.

The source comparison runs all seven gas options through one CPU solver. Starting with 1 µmol m⁻³ each of NO and O₃, the 298 K NO remaining after 60 s is 0.586070 µmol m⁻³ for WACCM, E3SM, WRF-Chem, CMAQ and PMCAMx, 0.594653 for CAMx and 0.615928 for MCM. Across all four gas species and all three temperatures, the largest absolute concentration error was 2.47 × 10⁻⁹ µmol m⁻³ against the analytical solution. The separate SOAP comparison checks the CG20→CG19 gain of 1.075 in the base archive and 1.000 in the alternative. Prescribed OH, host rate inputs, yields and partitioning require additional modeling before running SOAP as a particle chemistry process. Reproduce the qualification · PMCAMx-SR source archives

Both model readers select one unit system for the entire gas rate deck. For CAMx 7.20, readchm.f counts rows of absolute type 2 or 3. A first parameter above 1 counts toward ppm, and a value at or below 1 counts toward molecular units. The archived PMCAMx-SR reader applies the same comparison to positive types 2 and 3. Both select ppm only when it has more votes, choose molecular on a nonempty tie, and report failure when there are no votes. This reconstructs the host’s interpretation. The physical provenance of an unlabelled local or reduced deck can still be ambiguous. CAMx 7.20 reader · PMCAMx-SR archive, PMCAMx-SR-CB05/readchm.f, lines 1047–1096

Exact input pinned in the catalog Molecular / ppm votes Independent check for NO + O₃ at 298 K
EPA CAMx 7.20 CB6r5_CF2E 96 / 3 Row 3 gives 1.887 × 10⁻¹⁴ cm³ molecule⁻¹ s⁻¹ from the IUPAC expression reported by Silvern et al.
PMCAMx-SR v1.0 CB05 73 / 2 The header explicitly declares molecular units. Row 3 gives 1.955 × 10⁻¹⁴ cm³ molecule⁻¹ s⁻¹ from the JPL expression reported in the same study.

For reaction order n, the molecular system uses (cm³ molecule⁻¹)ⁿ⁻¹ s⁻¹ and the mixing-ratio system uses ppm¹⁻ⁿ min⁻¹. For type 3, the source activation parameter and reference temperature are in kelvin. The host builds an internal table in ppm¹⁻ⁿ h⁻¹. Its conversion uses order and temperature/pressure scaling, with a reference state of 298 K and 1013 mb. The catalog retains the original input parameters. Its native compiler accepts verified molecular inputs and reports an explicit conversion requirement for declared ppm inputs. The literature comparison checks one channel independently of the deck-level evidence. CAMx 7.20 guide, §3.1, Table 3-3b · CAMx rate-table implementation · Silvern et al. (2018)

The PMCAMx-SR aerosol module has its own unit contract. In both archived SOAP/soachem.f files, the precursor prefactor is cm³ molecule⁻¹ s⁻¹ and the exponential parameter is in kelvin. The module uses pressure (mb) and temperature (K) to convert the precursor rate to ppm⁻¹ h⁻¹ before multiplying by oxidant mixing ratio (ppm) and integrating in hours. It labels the raw low/high-NOₓ yields ppm/ppm and applies density scaling during production. The aging rate argument has units ppm⁻¹ h⁻¹ at the call site, as follows from its product with OH in ppm and elapsed time in hours. Records from the two verified files expose these distinctions. PMCAMx-SR base and alternative sources · Model and VBS study

The ROS3 back substitution uses an explicit read, divide and store for its three-dimensional work array. Warp 1.19.0 rejected the earlier in-place division during kernel compilation. All 32 chemistry and chamber tests passed with Warp 1.11.1 and again with 1.19.0 on the RTX 5060 host, including the Warp CPU and CUDA cases.

The sparse resident update at revision b90bab07a9 reproduced all four Robertson refinement rows and both chamber errors reported above. Stiff ensemble timing and workspace

From the checked-out repository in a CUDA-capable environment:

Terminal window
python -m pytest particula/dynamics/chemistry/tests examples_tests/native_gas_chemistry_test.py -q -Werror --no-cov
python -m scripts.assess_gas_chemistry
python scripts/docs_examples.py refresh native-gas-chemistry

The assessment prints the component errors and work counts. CUDA qualification requires an actual device; check the device selection and pytest skip summary. The pulse example saves its figure and numerical data.

Explore this topic: Scientific and numerical correctness