majordome.plug#

Chain of reactors#

class majordome.plug.PlugFlowChainCantera(mechanism: str, phase: str, z: ndarray, V: ndarray, K: float = 1.0, smoot_flux: bool = True)#

Plug-flow reactor as a chain of 0-D reactors with Cantera.

Parameters:
mechanism: str

Name or path to Cantera mechanism to be used.

phase: str

Name of phase to simulate (not inferred, even if a single is present!).

z: np.ndarray

Spatial coordinates of reactor cells [m].

V: np.ndarray

Volumes of reactor cells [m³].

K: float = 1.0

Valve response constant (do not use unless simulation fails).

smoot_flux: bool = True

Apply a smoot transition function when internal stepping is performed; this is intended to avoid unphysical steady state approximations.

property contents: Solution#

Provides direct access to reactor contents.

property failures: list[str]#

List of failures encountered during last loop.

loop(m_source: ndarray, h_source: ndarray, Y_source: ndarray, Q: ndarray = None, save_history: bool = False, **opts) DataFrame | None#

Loop over the slices of the plug-flow reactor.

In case of solver failure, one might try the following configurations; it is recommended to start by reducing max_time_step before tweaking other parameters.

`python pfc.network.atol = 1.0e-12 pfc.network.rtol = 1.0e-06 pfc.network.max_time_step = 0.1 pfc.network.linear_solver_type = "GMRES" pfc.network.max_err_test_fails = 10 pfc.network.max_order = 5 pfc.network.max_steps = 2000 `

property n_reactors: int#

Number of reactors in mechanism.

property n_species: int#

Number of species in mechanism.

property network: ReactorNet#

Provides access to the reactor network.

property states: SolutionArray#

Provides access to the states of the reactor.

update(source: PlugFlowAxialSources, **kwargs)#

Wraps call to loop when using a data structure.

Utilities#

class majordome.plug.PlugFlowAxialSources(n_reactors: int, n_species: int)#

Provides a data structure for use with PlugFlowChainCantera.

Helper data class for use with the solution method loop of the plug-flow reactor implementation. It provides the required memory for storage of source terms distributed along the reactor.

Parameters:
n_reactors: int

Number of reactors in chain.

n_species: int

Number of species in mechanism.

Attributes:
Q: NDArray[np.float64]

Array of external heat source [W].

m: NDArray[np.float64]

Array of axial mass source terms [kg/s].

h: NDArray[np.float64]

Array of enthalpy of axial mass source terms [J/kg].

Y: NDArray[np.float64, np.float64]

Array of mass fractions of axial mass source terms [-].

majordome.plug.get_reactor_data(pfr: PlugFlowChainCantera) PlugFlowAxialSources#

Wrapper to allocate properly dimensioned solver data.