API reference#

The complete curated top-level public API, generated from aquakin.__all__. Each domain also exposes its full surface as a subpackage (aquakin.plant, aquakin.integrate, aquakin.utils).

Classes#

aquakin.ActivatedSludgeSizing

The reactor volume and flows that realise an SRT/HRT design target.

aquakin.Aeration

Aeration / dissolved-oxygen spec for a CSTRUnit.

aquakin.AerationDesignPoint

Sizing summary for one tank at one kLa (a design point).

aquakin.AerationSystem

Diffuser + blower design for the mechanistic aeration energy / airflow.

aquakin.AlgebraicTemperature

Instantaneous flow-weighted temperature (the default, historic behaviour).

aquakin.BSM1Evaluation

Headline BSM1 performance indices from a solved plant.

aquakin.BSM2Evaluation

Headline BSM2 performance indices from a solved plant.

aquakin.BatchReactor

Stateless 0-D (batch) reactor.

aquakin.BatchSolution

Solution returned by BatchReactor.solve().

aquakin.BiofilmReactor

Stateless 1-D layered biofilm reactor (diffusion--reaction over depth).

aquakin.BiofilmSolution

Solution returned by BiofilmReactor.solve().

aquakin.CFDReactor

Vectorised batch reactor for CFD operator-splitting.

aquakin.CSTRUnit

A single continuous-flow stirred tank with kinetics + aeration.

aquakin.CalibrationResult

Result of calibrate().

aquakin.CarbonFootprint

A plant's greenhouse-gas footprint as a CO₂-equivalent mass flow.

aquakin.ChlorineContactUnit

A chlorine contact tank: CT-driven log-removal with residual decay.

aquakin.CompiledModel

Runtime representation of a reaction model.

aquakin.ComponentBalance

The closure of one conserved component over the simulation window.

aquakin.Constraint

An inequality constraint on a design optimization.

aquakin.CostFactors

Unit prices for monetising a plant's operating cost.

aquakin.DGSMResult

Result of dgsm().

aquakin.DifferentiationConfig

How a gradient / sensitivity flows through a solve.

aquakin.Event

A located discontinuity in a solve: a time or state trigger + a reset.

aquakin.EventedResult

Output of solve_with_events().

aquakin.FitResult

Result of fit().

aquakin.ForwardSensitivityResult

Result of forward_sensitivity().

aquakin.FreeICConfig

Free-initial-condition settings for calibration.

aquakin.HeatBalanceTemperature

Per-unit dynamic temperature via a completely-mixed first-order heat balance.

aquakin.IdentityTranslator

Pass-through translator for when source and target models are the same — the only kind of translator BSM1 needs.

aquakin.InfluentFractions

Fractionation parameters for characterize_influent() / fractionate().

aquakin.InfluentSeries

A time-series of influent data.

aquakin.IntegratorConfig

The integrator / step-size configuration for a solve.

aquakin.KPIComparison

A side-by-side KPI table over several named results.

aquakin.LaplaceConfig

Laplace-posterior settings.

aquakin.MassBalance

Per-component closure of a plant over a simulation window.

aquakin.MixerUnit

Combines two or more input streams into a single output stream by mass balance: Q_out = sum(Q_in_i), C_out = sum(Q_in_i * C_in_i) / Q_out.

aquakin.MonteCarloResult

Result of monte_carlo(): the sampled input/output ensemble.

aquakin.NoDigesterError

The plant has no ADM1 anaerobic digester, so it has no biogas.

aquakin.OperatingConditions

Operating conditions for the 0-D (single stirred tank) case.

aquakin.OperatingCost

A plant's monetised cost as a per-day breakdown.

aquakin.OptimizeResult

Result of optimize_design().

aquakin.OptimizerConfig

Optimiser and multistart settings for calibration.

aquakin.PFRSolution

Solution returned by PlugFlowReactor.solve().

aquakin.ParticleTrackReactor

Integrate chemistry along a single particle track.

aquakin.Plant

A plant flowsheet of Unit components.

aquakin.PlantCheck

Result of Plant.check() -- a pre-solve wiring report.

aquakin.PlantSolution

Result of Plant.solve().

aquakin.PlugFlowReactor

Steady-state plug-flow reactor.

aquakin.PredictiveBand

Posterior-predictive band from CalibrationResult.predictive_band().

aquakin.ProfileResult

Result of profile_likelihood().

aquakin.RatioSplitter

Splits the inlet flow into fixed fractions: each output gets ratio * Q_in, the fractions summing to 1.

aquakin.ScenarioComparison

Result of compare_scenarios(): KPIs per named scenario.

aquakin.SensitivityResult

Gradients of a scalar output with respect to parameters and conditions.

aquakin.SetpointSplitter

Splits the inlet flow into fixed absolute setpoint flows plus a remainder.

aquakin.SludgeMetrics

Activated-sludge operating metrics achieved by a solved plant.

aquakin.SpatialConditions

Container for spatially varying condition fields.

aquakin.SpeciationUnitsWarning

Advisory: a speciation: / precipitation: molar_mass looks dimensionally inconsistent with the referenced species' declared units.

aquakin.StateTranslator

Maps a concentration vector from one model's species ordering to another's.

aquakin.Stream

A flow stream — bulk volumetric rate plus a concentration vector.

aquakin.TemperatureModel

Strategy for how a plant resolves unit temperatures.

aquakin.ThresholdSplitter

Diverts inlet flow above a threshold, passing the rest through.

aquakin.Track

A single particle track: condition fields sampled at successive times.

aquakin.TrackSolution

Solution returned by ParticleTrackReactor.solve().

aquakin.UVUnit

A UV disinfection reactor (stateless): dose-driven log-inactivation.

aquakin.Unit

A plant unit operation.

aquakin.UnitWarning

One dimensional-consistency finding for a rate expression.

aquakin.UnknownPortError

A known unit has no input/output port of the requested name.

aquakin.UnknownUnitError

A referenced unit name is not present in the plant.

aquakin.WiringError

A structurally invalid connection or an unsupported unit request.

Functions#

aquakin.aeration_energy

Aeration energy (kWh/d) per Copp 2002 eq.

aquakin.blower_airflow_total

Time-averaged total air flow over the window (m³/d), summed across tanks.

aquakin.blower_energy

Aeration energy (kWh/d) from the blower model, the mechanistic replacement for aquakin.plant.metrics.aeration_energy().

aquakin.blower_power_kw

Blower shaft+motor power (kW) to compress airflow_m3_per_d from the inlet pressure to the diffuser discharge pressure (adiabatic).

aquakin.calibrate

MAP fit with optional Laplace posterior approximation.

aquakin.canonical_content

Per-species canonical content vector for one component, shape (n_species,).

aquakin.carbon_footprint

Assemble a CarbonFootprint from energy use and gas emissions.

aquakin.carbon_mass

External-carbon mass dose (kg COD/d), time-averaged.

aquakin.characterize_influent

Build a constant InfluentSeries from influent measurements.

aquakin.check_conservation

Return the list of conservation violations (reaction, quantity, residual).

aquakin.check_finite_gradient

Raise a friendly RuntimeError if value is non-finite.

aquakin.check_model_units

Run check_rate_units() over every reaction in a compiled model.

aquakin.check_nitrogen

Return nitrogen-balance violations (reaction, residual) above tol.

aquakin.clear_model_cache

Clear the built-in-model cache (see load_model()).

aquakin.co2e_from_energy

Indirect CO₂e from electricity use (kg CO₂e/d).

aquakin.compare_scenarios

Run fn under several named scenarios and tabulate the outputs.

aquakin.compile_model

Build a CompiledModel from a validated ModelSpec.

aquakin.composition_table

The shipped COD / N / P composition table for a model.

aquakin.ct_log_removal

Log-removal from a CT value by a CT-based credit (Chick–Watson form).

aquakin.ct_value

CT = disinfectant residual × T10 contact time (e.g. mg·min/L).

aquakin.derived_BOD

BOD₅ proxy = 0.25 × (SS + XS + (1 - f_P) × (XB_H + XB_A)), Copp 2002.

aquakin.derived_COD

Total COD = SI + SS + XI + XS + XB_H + XB_A + XP.

aquakin.derived_TKN

Total Kjeldahl Nitrogen = S_NH + S_ND + X_ND + i_XB × (XB_H + XB_A) + i_XP × (XP + XI).

aquakin.derived_TSS

Total suspended solids from ASM1 particulate species.

aquakin.design_summary

Size the air flow and blower power for one tank at a steady kLa.

aquakin.dgsm

Derivative-based global sensitivity measure via autodiff + Sobol QMC.

aquakin.direct_n2o_emission

Direct N₂O stripped from the activated-sludge reactors (kg N₂O-N/d).

aquakin.effluent_averages

Time-flow-weighted average effluent concentrations.

aquakin.effluent_quality_index

EQI per Copp 2002 / Alex 2008.

aquakin.esdirk_adjoint_solve

Cap-free reverse-mode gradient through a high-order ESDIRK solve.

aquakin.evaluate_bsm1

Compute the BSM1 performance indices from a solved plant.

aquakin.evaluate_bsm2

Compute the BSM2 performance indices from a solved plant.

aquakin.fit

Least-squares fit of selected parameters to time-series observations.

aquakin.forward_adjoint

Return the diffrax adjoint that supports forward-mode autodiff.

aquakin.forward_sensitivity

Forward-sensitivity solve through any reactor exposing solve_sensitivity.

aquakin.fractionate

Split influent aggregate measurements into ASM1 state values.

aquakin.heating_energy

Digester sludge-heating energy (kWh/d) per Gernaey et al. 2014.

aquakin.implicit_euler_adjoint_solve

Integrate over t_span with a cap-free discrete-adjoint reverse-mode rule.

aquakin.integrate_ensemble

Integrate the model along an ensemble of particle tracks.

aquakin.kpi_comparison

Tabulate KPIs from several named report objects side by side.

aquakin.load_model

Load a built-in model shipped with aquakin.

aquakin.load_model_from_file

Load a model from a YAML file on disk.

aquakin.mass_balance

Results-level mass-balance closure for a solved plant.

aquakin.methane_to_co2e

CO₂e of a methane mass flow (kg CO₂e/d).

aquakin.mixing_energy

Mixing energy (kWh/d) per Gernaey et al. 2014.

aquakin.monte_carlo

Propagate uncertain inputs through fn and return the output ensemble.

aquakin.n2o_n_to_co2e

CO₂e of an N₂O emission given as an N₂O-N mass flow (kg CO₂e/d).

aquakin.operating_cost

Monetise a plant's operating cost from its physical flows.

aquakin.operational_cost_index

OCI (BSM1 form):

aquakin.operational_cost_index_bsm2

Full BSM2 OCI (Gernaey et al. 2014):.

aquakin.optimize_design

Minimise (or maximise) an objective over a bounded design space subject to inequality constraints, using autodiff gradients.

aquakin.parse_rate_expression

Parse a rate-expression string into an AST.

aquakin.parse_units

Parse a unit string into a Dimension, or None if unknown.

aquakin.profile_likelihood

Profile-likelihood analysis of one parameter or initial condition.

aquakin.pumping_energy

Pumping energy (kWh/d) per Copp 2002 eq.

aquakin.pumping_energy_bsm2

Pumping energy (kWh/d) for the full BSM2 pump set.

aquakin.read_influent_csv

Read a CSV influent file.

aquakin.required_airflow

Air flow rate (m³/d) that produces kLa in a tank of volume m³.

aquakin.sensitivity

Compute gradients of a scalar output with respect to parameters and condition fields, via autodiff through reactor.solve.

aquakin.size_activated_sludge

Size an activated-sludge basin from SRT / HRT design targets.

aquakin.sludge_metrics

Achieved SRT / HRT / F:M from a solved activated-sludge plant.

aquakin.solve_with_events

Integrate rhs from t0 to t1 with located events + state resets.

aquakin.stripped_n2o

Time-averaged N₂O stripped from the aerated reactors (kg N₂O-N/d).

aquakin.t10_from_baffling

T10 contact time from the baffling factor: T10 = baffling·V/Q.

aquakin.t10_from_rtd

T10 contact time from a measured/simulated residence-time distribution.

aquakin.time_average

Trapezoidal time-average of integrand over the window [t0, t1].

aquakin.uv_dose

UV dose (fluence) = average fluence rate × exposure time.

aquakin.uv_log_inactivation

Log-inactivation from a UV dose by a log-linear dose-response.