Skip to content

chemistry_presets

chemistry_presets

Chemistry / deposition presets and utilities.

Built on top of input_generator.ChemistryOptions / ChemistryMethod and the deposition dataclasses. Provides:

  • Ready-made ChemistryOptions bundles for the common NO2 modeling setups (OLM / PVMRM / PVMRM2 / GRSM) with sensible defaults.
  • Deposition velocity tables / presets for SO2, NOx, PM2.5, PM10, Hg.
  • suggest_chemistry_for — heuristic for picking a chemistry method given a project's pollutant and source count.
  • deposition_diagnostics — flags mismatched dry/wet / gas/particle configurations on a project's sources.

These are intentionally small, explicit dataclasses rather than a plugin system — regulatory protocols change and every project lists the exact chemistry configuration in its modeling plan.

PollutantDepositionDefaults dataclass

Per-pollutant deposition-parameter defaults (typical literature).

olm_preset

olm_preset(*, ozone_ppb: Optional[float] = None, ozone_file: Optional[str] = None, in_stack_no2_ratio: float = 0.1) -> ChemistryOptions

OLM (Ozone-Limiting Method) configuration.

Typical use: secondary NO2 modeling when only a single background ozone value or hourly ozone record is available.

Either ozone_ppb (uniform) or ozone_file must be provided.

pvmrm_preset

pvmrm_preset(*, ozone_ppb: Optional[float] = None, ozone_file: Optional[str] = None, in_stack_no2_ratio: float = 0.1) -> ChemistryOptions

PVMRM (Plume Volume Molar Ratio Method) configuration.

Preferred over OLM when multiple sources need to compete for a shared oxidant pool. Same ozone-data requirements as OLM.

arm2_preset

arm2_preset(in_stack_no2_ratio: float = 0.1) -> ChemistryOptions

ARM2 (Ambient Ratio Method 2) configuration.

Default-case NO2 fallback when no ozone data is available. Uses AERMOD's built-in NO2/NOx ratio curve. Not accepted by Appendix W for new submittals.

grsm_preset

grsm_preset(*, ozone_file: Optional[str] = None, ozone_ppb: Optional[float] = None, nox_background_file: Optional[str] = None, in_stack_no2_ratio: float = 0.1) -> ChemistryOptions

GRSM (Generic Reaction Set Method) configuration.

Appropriate for multi-source NOx modeling with background ozone + optionally a NOx background file. Preferred over OLM/PVMRM in Appendix W 2023 where documented.

suggest_chemistry_for

suggest_chemistry_for(pollutant: PollutantType, n_sources: int, has_ozone_data: bool, has_nox_background: bool = False) -> str

Return the short name of the recommended chemistry method.

Decision logic: - Only NO2 needs secondary-formation chemistry. Other pollutants return "NONE". - With ozone AND >= 5 sources -> PVMRM. - With ozone AND NOx background -> GRSM. - With ozone AND few sources -> OLM. - Without ozone data -> ARM2 (fallback; not Appendix-W-compliant).

deposition_defaults_for

deposition_defaults_for(pollutant: str) -> PollutantDepositionDefaults

Look up canonical deposition defaults by pollutant name.

deposition_diagnostics

deposition_diagnostics(project: Any) -> List[str]

Return warning strings about inconsistent deposition setup.

Flags: - Sources with deposition_method set but no gas/particle params. - Sources with both gas AND particle params (only one makes sense). - CONTROL's calculate_dry_deposition=True but zero sources have gas or particle params set.

apply_chemistry

apply_chemistry(project: Any, options: ChemistryOptions, *, olm_source_group_names: Optional[List[str]] = None) -> List[str]

Install a ChemistryOptions on a project's ControlPathway.

Returns a human-readable list of changes made — useful for logging / CI diffs — following the same convention as :meth:RegulatoryProfile.apply.

If olm_source_group_names is provided and the chemistry method is OLM (or PVMRM), the listed source groups are wired into options.olm_groups; existing SourceGroupDefinition objects on the project are reused when the name matches so we don't duplicate.

apply_deposition_defaults

apply_deposition_defaults(project: Any, pollutant: Optional[str] = None, *, include_source_ids: Optional[List[str]] = None, exclude_source_ids: Optional[List[str]] = None, overwrite: bool = False) -> List[str]

Auto-populate per-source deposition parameters from DEPOSITION_DEFAULTS.

Looks up the pollutant (defaults to the project's control.pollutant_id) and sets gas_deposition OR particle_deposition + deposition_method on each applicable source. Sources that already have one of those fields populated are left alone unless overwrite=True.

include_source_ids / exclude_source_ids restrict the set of sources touched; pass either one, not both.

Returns a change-log list.