bloc.reactors.base#

Design-oriented constant-pressure mole reactor base class.

Classes#

DesignIdealGasConstPressureMoleReactor

Design-oriented constant-pressure mole reactor with helper APIs.

Module Contents#

class bloc.reactors.base.DesignIdealGasConstPressureMoleReactor(gas, *args, **kwargs)#

Bases: cantera.ExtensibleIdealGasConstPressureMoleReactor

Design-oriented constant-pressure mole reactor with helper APIs.

Inherits from ExtensibleIdealGasConstPressureMoleReactor so that subclasses can intercept Cantera’s ODE callbacks without modifying C++ code.

The key hook used here is before_update_state(): CVODE calls updateState(y) before its very first eval, at which point y is still writable. By storing a pending initial condition in _pending_init and writing it into y on the first call, any subclass can override CVODE’s starting point — even though m_state (the C++ snapshot taken at construction) cannot be changed from Python.

Parameters:

gas – Cantera Solution object used to initialise the reactor.

before_update_state(y)#

Inject a pending initial state into CVODE’s y before the first eval.

Cantera’s Reactor::initialize() restores m_state (the state snapshot taken at construction time) via a direct C++ call that bypasses all Python delegates. The only reliable interception point is here: CVODE calls updateState(y) just before its first eval, and y is writable.

If _pending_init is set, this method overwrites y with values derived from the HP-corrected gas state and clears the flag. All subsequent updateState calls (driven by CVODE’s own stepping) are unaffected.

solve_adiabatic(mdot, power_kW, t_res_s, verbose=False)#

Solve an adiabatic constant-pressure reactor segment.

Uses this reactor as the ODE owner: applies an enthalpy jump from power_kW / mdot and integrates with a fresh type(self)(gas, clone=False) carrier for t_res_s.

switch_mechanism(gas, mechanism_path, htol, Xtol)#

Switch the active mechanism while conserving chemical enthalpy.

See switch_mechanism() for details.

external_coeffs(D_ext, L_reac, eps_wall, T_wall_hyp_C, T_amb_C)#

Return convective and radiative heat transfer coefficients at the wall.

heat_losses_linear(T_mean_C, T_amb_C, R_list)#

Compute linearized heat losses across a thermal resistance stack.

thermal_resistance(d_reac, L_reac, e_insul_list, cond_list, h_tot, S_ext)#

Build a radial-conduction plus external heat transfer resistance list.

mass_and_power(qm_torch, T_torch_input_C, X_torch, qm_2nd_inj, T_2nd_inj_C, X_2nd_inj, P_bar, T_amb_C, gas)#

Compute preheat recovery and residual heat based on reactor states.

mass_reactor(L_reac, d_reac, e_insul_list, density_list, verbose=False)#

Estimate reactor mass and volume from geometry and insulation layers.