<ahref="classgridfire_1_1_multiscale_partitioning_engine_view-members.html">List of all members</a></div>
<divclass="headertitle"><divclass="title">gridfire::MultiscalePartitioningEngineView Class Reference<spanclass="mlabels"><spanclass="mlabel final">final</span></span></div></div>
</div><!--header-->
<divclass="contents">
<p>An engine view that partitions the reaction network into multiple groups based on timescales.
<areahref="classgridfire_1_1_dynamic_engine.html"title="Abstract class for engines supporting Jacobian and stoichiometry operations."alt="gridfire::DynamicEngine"shape="rect"coords="0,56,246,80"/>
<areahref="classgridfire_1_1_engine.html"title="Abstract base class for a reaction network engine."alt="gridfire::Engine"shape="rect"coords="0,0,246,24"/>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Functor for solving QSE abundances using Eigen's nonlinear optimization. <ahref="structgridfire_1_1_multiscale_partitioning_engine_view_1_1_eigen_functor.html#details">More...</a><br/></td></tr>
<trclass="memdesc:a0df457c0f0f6f403a295335c84fd828f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs a <aclass="el"href="classgridfire_1_1_multiscale_partitioning_engine_view.html"title="An engine view that partitions the reaction network into multiple groups based on timescales.">MultiscalePartitioningEngineView</a>. <br/></td></tr>
<trclass="memdesc:a696f74f5135bbd62169b6577f92fee80"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the list of species in the network. <br/></td></tr>
<trclass="memdesc:a716d7357e944e8394d8b8e0b5e7625eb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculates the right-hand side (dY/dt) and energy generation. <br/></td></tr>
<trclass="memdesc:acdf5ad8765290ea2b78170235aea391d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Generates the Jacobian matrix for the current state. <br/></td></tr>
<trclass="memitem:ac961484383e86d9712a424728e068633"id="r_ac961484383e86d9712a424728e068633"><tdclass="memItemLeft"align="right"valign="top">double </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="#ac961484383e86d9712a424728e068633">getJacobianMatrixEntry</a> (int i_full, int j_full) const override</td></tr>
<trclass="memdesc:ac961484383e86d9712a424728e068633"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets an entry from the previously generated Jacobian matrix. <br/></td></tr>
<trclass="memdesc:abe76a46784b1ebc8ad67a9eec40d369a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Generates the stoichiometry matrix for the network. <br/></td></tr>
<trclass="memitem:a510b920dea726aef859ac1f6d051807e"id="r_a510b920dea726aef859ac1f6d051807e"><tdclass="memItemLeft"align="right"valign="top">int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="#a510b920dea726aef859ac1f6d051807e">getStoichiometryMatrixEntry</a> (int speciesIndex, int reactionIndex) const override</td></tr>
<trclass="memdesc:a510b920dea726aef859ac1f6d051807e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets an entry from the stoichiometry matrix. <br/></td></tr>
<trclass="memdesc:a79eb9c108d694a27ec913ed0143aa044"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculates the molar reaction flow for a given reaction. <br/></td></tr>
<trclass="memdesc:ad751f2c1306895ee74a61f2071ca96eb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the set of logical reactions in the network. <br/></td></tr>
<trclass="memdesc:acb5fa7f03cd89b8c1b6b9ffdf3abb12e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the set of logical reactions in the network. <br/></td></tr>
<trclass="memdesc:a560612347bbd5b7b380e990624d01105"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Computes timescales for all species in the network. <br/></td></tr>
<trclass="memdesc:aa38c367ef3c74d012ccd10521cd5a727"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Computes destruction timescales for all species in the network. <br/></td></tr>
<trclass="memdesc:a6bee75b5a6e508e6eebf83f0d48c50b8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Updates the internal state of the engine, performing partitioning and QSE equilibration. <br/></td></tr>
<trclass="memdesc:ae7847959fc5af2b83f5446dd73567b46"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if the engine's internal state is stale relative to the provided conditions. <br/></td></tr>
<trclass="memdesc:a1a0c0a0ade632eb10f0eecab828a059f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the electron screening model. <br/></td></tr>
<trclass="memdesc:a7bfb4e6fec2f337a1dea69e3d4f1fc82"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the current electron screening model. <br/></td></tr>
<trclass="memdesc:af13e764c118a6cc51847384e9c70e05b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Analyzes the connectivity of timescale pools. <br/></td></tr>
<trclass="memdesc:a7d26945df5395b9317552a3989c42d1c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Partitions the network into dynamic and algebraic (QSE) groups based on timescales. <br/></td></tr>
<trclass="memdesc:a98b11ffe498846f5a3a72f08504346b7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Partitions the network based on timescales from a <code><aclass="el"href="structgridfire_1_1_net_in.html">NetIn</a></code> struct. <br/></td></tr>
<trclass="memdesc:acff59a15abac30eee16e9fa7b355fb18"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Exports the network to a DOT file for visualization. <br/></td></tr>
<trclass="memdesc:a91d32b7197fcb27ee697d5bfde960f3f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the index of a species in the full network. <br/></td></tr>
<trclass="memdesc:aada497e8df74a295fdf5df7d7cdf64e0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Maps a <code><aclass="el"href="structgridfire_1_1_net_in.html">NetIn</a></code> struct to a molar abundance vector for the full network. <br/></td></tr>
<trclass="memdesc:a05730ced13ac5331060ca011f0da6235"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Primes the engine with a specific species. <br/></td></tr>
<trclass="memdesc:a3c82e4e082d1c82b1b090ac9847c7c5e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the fast species in the network. <br/></td></tr>
<trclass="memdesc:a1e04e8cb8c84b1bd033ac599accf0888"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the dynamic species in the network. <br/></td></tr>
<trclass="memdesc:a4bc879246c6fbd8633b05052858df51d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Equilibrates the network by partitioning and solving for QSE abundances. <br/></td></tr>
<trclass="memdesc:a1b17f94386882ea1524147782b7a1ddc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Equilibrates the network using QSE from a <code><aclass="el"href="structgridfire_1_1_net_in.html">NetIn</a></code> struct. <br/></td></tr>
<trclass="inherit_header pub_methods_classgridfire_1_1_dynamic_engine"><tdcolspan="2"onclick="javascript:dynsection.toggleInherit('pub_methods_classgridfire_1_1_dynamic_engine')"><imgsrc="closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="classgridfire_1_1_dynamic_engine.html">gridfire::DynamicEngine</a></td></tr>
<trclass="memdesc:a04317b66ef14d519264bc30ee69f5bf9 inherit pub_methods_classgridfire_1_1_dynamic_engine"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the depth of the network. <br/></td></tr>
<trclass="memdesc:a4e2c8b896661b7a89beffe0066cb21cf inherit pub_methods_classgridfire_1_1_dynamic_engine"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Rebuild the network with a specified depth. <br/></td></tr>
<trclass="inherit_header pub_methods_classgridfire_1_1_engine"><tdcolspan="2"onclick="javascript:dynsection.toggleInherit('pub_methods_classgridfire_1_1_engine')"><imgsrc="closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="classgridfire_1_1_engine.html">gridfire::Engine</a></td></tr>
<trclass="inherit_header pub_methods_classgridfire_1_1_engine_view"><tdcolspan="2"onclick="javascript:dynsection.toggleInherit('pub_methods_classgridfire_1_1_engine_view')"><imgsrc="closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="classgridfire_1_1_engine_view.html">gridfire::EngineView< DynamicEngine ></a></td></tr>
<trclass="memdesc:a34b5fdb2078e748edfbe6846ecadd681"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Type alias for a QSE partition. <br/></td></tr>
<trclass="memdesc:ad4d29ee55f89384807616d1068797067"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Partitions the network by timescale. <br/></td></tr>
<trclass="memdesc:aae0865e361dfeb23984d70409fdd9f39"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Builds a connectivity graph from a set of fast reaction indices. <br/></td></tr>
<trclass="memdesc:aa55ed182301d216264daae3e6dfd8917"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Validates candidate QSE groups using flux analysis. <br/></td></tr>
<trclass="memdesc:a3c5fcb8e3396d74359fd601554c9ffa9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Solves for the QSE abundances of the algebraic species in a given state. <br/></td></tr>
<trclass="memdesc:a54ca8004fbd8d6d3ea6f67efeb5dbc8d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Identifies the pool with the slowest mean timescale. <br/></td></tr>
<trclass="memdesc:ae3875c61dc916c0982ed122c2e272d94"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Builds a connectivity graph from a species pool. <br/></td></tr>
<trclass="memdesc:ac206840057bac65b7f7738e6dfd1047a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs candidate QSE groups from connected timescale pools. <br/></td></tr>
<trclass="memdesc:a0437c51f94bf834a11adf481b2afad93"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The base engine to which this view delegates calculations. <br/></td></tr>
<trclass="memdesc:a1b4aa04a1e641204e4fd82361b0e39c6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The list of identified equilibrium groups. <br/></td></tr>
<trclass="memdesc:aec6126b5c4a397d090790d7b75f9f70f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The simplified set of species presented to the solver (the "slow" species). <br/></td></tr>
<trclass="memdesc:a38b4f0373c3bd81503889650c0bb69bb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Indices mapping the dynamic species back to the base engine's full species list. <br/></td></tr>
<trclass="memdesc:a4656c05b8235dbf4ec698b03a716a8c8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Species that are treated as algebraic (in QSE) in the QSE groups. <br/></td></tr>
<trclass="memdesc:a53862719dd73f98bc69eecde090cf655"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Indices of algebraic species in the full network. <br/></td></tr>
<trclass="memdesc:a57d97b11e80fa78ab5f509fce1f156b8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Indices of all species considered active in the current partition (dynamic + algebraic). <br/></td></tr>
<trclass="memdesc:a445d7447f2cf18f755fc8b8b288e68cb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Indices of all reactions involving only active species. <br/></td></tr>
<trclass="memdesc:a707e46d2f72993c206210f81b35b884e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Cache for QSE abundances based on T9, rho, and Y. <br/></td></tr>
<trclass="memdesc:aa81057b96cf46986151a5e8ef99a017a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Statistics for the QSE abundance cache. <br/></td></tr>
<dlclass="section user"><dt>Purpose</dt><dd>This class is designed to accelerate the integration of stiff nuclear reaction networks. It identifies species that react on very short timescales ("fast" species) and treats them as being in Quasi-Steady-State Equilibrium (QSE). Their abundances are solved for algebraically, removing their stiff differential equations from the system. The remaining "slow" or "dynamic" species are integrated normally. This significantly improves the stability and performance of the solver.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>The core logic resides in the <code><aclass="el"href="#a7d26945df5395b9317552a3989c42d1c"title="Partitions the network into dynamic and algebraic (QSE) groups based on timescales.">partitionNetwork()</a></code> and <code><aclass="el"href="#a4bc879246c6fbd8633b05052858df51d"title="Equilibrates the network by partitioning and solving for QSE abundances.">equilibrateNetwork()</a></code> methods. The partitioning process involves:<oltype="1">
<li><b>Timescale Analysis:</b> Using <code>getSpeciesDestructionTimescales</code> from the base engine, all species are sorted by their characteristic timescales.</li>
<li><b>Gap Detection:</b> The sorted list of timescales is scanned for large gaps (e.g., several orders of magnitude) to create distinct "timescale pools".</li>
<li><b>Connectivity Analysis:</b> Each pool is analyzed for internal reaction connectivity to form cohesive groups.</li>
<li><b>Flux Validation:</b> Candidate QSE groups are validated by comparing the total reaction flux <em>within</em> the group to the flux <em>leaving</em> the group. A high internal-to-external flux ratio indicates a valid QSE group.</li>
<li><b>QSE Solve:</b> For valid QSE groups, <code>solveQSEAbundances</code> uses a Levenberg-Marquardt nonlinear solver (<code>Eigen::LevenbergMarquardt</code>) to find the equilibrium abundances of the "algebraic" species, holding the "seed" species constant.</li>
<p>All calculations are cached using <code><aclass="el"href="structgridfire_1_1_q_s_e_cache_key.html"title="Key struct for the QSE abundance cache.">QSECacheKey</a></code> to avoid re-partitioning and re-solving for similar thermodynamic conditions.</p>
<dlclass="section user"><dt>Usage Example:</dt><dd><divclass="fragment"><divclass="line"><spanclass="comment">// 1. Create a base engine (e.g., GraphEngine)</span></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html">gridfire::GraphEngine</a></div><divclass="ttdoc">A reaction network engine that uses a graph-based representation.</div><divclass="ttdef"><b>Definition</b> engine_graph.h:100</div></div>
<divclass="ttc"id="aclassgridfire_1_1_multiscale_partitioning_engine_view_html"><divclass="ttname"><ahref="classgridfire_1_1_multiscale_partitioning_engine_view.html">gridfire::MultiscalePartitioningEngineView</a></div><divclass="ttdoc">An engine view that partitions the reaction network into multiple groups based on timescales.</div><divclass="ttdef"><b>Definition</b> engine_multiscale.h:182</div></div>
<p>Constructs a <aclass="el"href="classgridfire_1_1_multiscale_partitioning_engine_view.html"title="An engine view that partitions the reaction network into multiple groups based on timescales.">MultiscalePartitioningEngineView</a>. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">baseEngine</td><td>The underlying <aclass="el"href="classgridfire_1_1_graph_engine.html"title="A reaction network engine that uses a graph-based representation.">GraphEngine</a> to which this view delegates calculations. It must be a <code><aclass="el"href="classgridfire_1_1_graph_engine.html"title="A reaction network engine that uses a graph-based representation.">GraphEngine</a></code> and not a more general <code><aclass="el"href="classgridfire_1_1_dynamic_engine.html"title="Abstract class for engines supporting Jacobian and stoichiometry operations.">DynamicEngine</a></code> because this view relies on its specific implementation details. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<p>Analyzes the connectivity of timescale pools. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">timescale_pools</td><td>A vector of vectors of species indices, where each inner vector represents a timescale pool. </td></tr>
<tr><tdclass="paramname">Y</td><td>Vector of current molar abundances for the full network. </td></tr>
<tr><tdclass="paramname">T9</td><td>Temperature in units of 10^9 K. </td></tr>
<tr><tdclass="paramname">rho</td><td>Density in g/cm^3. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A vector of vectors of species indices, where each inner vector represents a single connected component.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To merge timescale pools that are strongly connected by reactions, forming cohesive groups for QSE analysis.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>For each pool, it builds a reaction connectivity graph using <code>buildConnectivityGraph</code>. It then finds the connected components within that graph using a Breadth-First Search (BFS). The resulting components from all pools are collected and returned. </dd></dl>
<p>Builds a connectivity graph from a set of fast reaction indices. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">fast_reaction_indices</td><td>A set of indices for reactions considered "fast". </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>An unordered map representing the adjacency list of the connectivity graph, where keys are species indices and values are vectors of connected species indices.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To represent the reaction pathways among a subset of reactions.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It iterates through the specified fast reactions. For each reaction, it creates a two-way edge in the graph between every reactant and every product, signifying that mass can flow between them. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To find reaction connections within a specific group of species.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It iterates through all reactions in the base engine. If a reaction involves at least two distinct species from the input <code>species_pool</code> (one as a reactant and one as a product), it adds edges between all reactants and products from that reaction that are also in the pool. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To compute the net rate of a single reaction.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It first checks the QSE cache. On a hit, it retrieves the cached equilibrium abundances for the algebraic species. It creates a mutable copy of <code>Y_full</code>, overwrites the algebraic species abundances with the cached equilibrium values, and then calls the base engine's <code>calculateMolarReactionFlow</code> with this modified abundance vector.</dd></dl>
<p>Calculates the right-hand side (dY/dt) and energy generation. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">Y_full</td><td>Vector of current molar abundances for all species in the base engine. </td></tr>
<tr><tdclass="paramname">T9</td><td>Temperature in units of 10^9 K. </td></tr>
<tr><tdclass="paramname">rho</td><td>Density in g/cm^3. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A <code>std::expected</code> containing <code><aclass="el"href="structgridfire_1_1_step_derivatives.html"title="Structure holding derivatives and energy generation for a network step.">StepDerivatives</a><double></code> on success, or a <code>StaleEngineError</code> if the engine's QSE cache does not contain a solution for the given state.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To compute the time derivatives for the ODE solver. This implementation modifies the derivatives from the base engine to enforce the QSE condition.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It first performs a lookup in the QSE abundance cache (<code>m_qse_abundance_cache</code>). If a cache hit occurs, it calls the base engine's <code>calculateRHSAndEnergy</code>. It then manually sets the time derivatives (<code>dydt</code>) of all identified algebraic species to zero, effectively removing their differential equations from the system being solved.</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd>The engine must have been updated via <code><aclass="el"href="#a6bee75b5a6e508e6eebf83f0d48c50b8"title="Updates the internal state of the engine, performing partitioning and QSE equilibration.">update()</a></code> or <code><aclass="el"href="#a4bc879246c6fbd8633b05052858df51d"title="Equilibrates the network by partitioning and solving for QSE abundances.">equilibrateNetwork()</a></code> for the current thermodynamic conditions, so that a valid entry exists in the QSE cache. </dd></dl>
<dlclass="section post"><dt>Postcondition</dt><dd>The returned derivatives will have <code>dydt=0</code> for all algebraic species.</dd></dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname">StaleEngineError</td><td>If the QSE cache does not contain an entry for the given (T9, rho, Y_full). This indicates <code><aclass="el"href="#a6bee75b5a6e508e6eebf83f0d48c50b8"title="Updates the internal state of the engine, performing partitioning and QSE equilibration.">update()</a></code> was not called recently enough. </td></tr>
<p>Constructs candidate QSE groups from connected timescale pools. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">candidate_pools</td><td>A vector of vectors of species indices, where each inner vector represents a connected pool of species with similar fast timescales. </td></tr>
<tr><tdclass="paramname">Y</td><td>Vector of current molar abundances. </td></tr>
<tr><tdclass="paramname">T9</td><td>Temperature in units of 10^9 K. </td></tr>
<tr><tdclass="paramname">rho</td><td>Density in g/cm^3. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A vector of <code><aclass="el"href="structgridfire_1_1_multiscale_partitioning_engine_view_1_1_q_s_e_group.html"title="Struct representing a QSE group.">QSEGroup</a></code> structs, ready for flux validation.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>For each input pool, it identifies "bridge" reactions that connect the pool to species outside the pool. The reactants of these bridge reactions that are <em>not</em> in the pool are identified as "seed" species. The original pool members are the "algebraic" species. It then bundles the seed and algebraic species into a <code><aclass="el"href="structgridfire_1_1_multiscale_partitioning_engine_view_1_1_q_s_e_group.html"title="Struct representing a QSE group.">QSEGroup</a></code> struct.</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd>The <code>candidate_pools</code> should be connected components from <code>analyzeTimescalePoolConnectivity</code>. </dd></dl>
<dlclass="section post"><dt>Postcondition</dt><dd>A list of candidate <code><aclass="el"href="structgridfire_1_1_multiscale_partitioning_engine_view_1_1_q_s_e_group.html"title="Struct representing a QSE group.">QSEGroup</a></code> objects is returned. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>A convenience overload for <code>equilibrateNetwork</code>.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It unpacks the <code>netIn</code> struct into <code>Y</code>, <code>T9</code>, and <code>rho</code> and then calls the primary <code>equilibrateNetwork</code> method. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>A convenience method to run the full QSE analysis and get an equilibrated composition object as a result.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It first calls <code><aclass="el"href="#a7d26945df5395b9317552a3989c42d1c"title="Partitions the network into dynamic and algebraic (QSE) groups based on timescales.">partitionNetwork()</a></code> with the given state to define the QSE groups. Then, it calls <code><aclass="el"href="#a3c5fcb8e3396d74359fd601554c9ffa9"title="Solves for the QSE abundances of the algebraic species in a given state.">solveQSEAbundances()</a></code> to compute the new equilibrium abundances for the algebraic species. Finally, it packs the resulting full abundance vector into a new <code>fourdst::composition::Composition</code> object and returns it.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To visualize the partitioned network graph.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates the DOT file export to the base engine. It does not currently add any partitioning information to the output graph. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To compute the Jacobian matrix required by implicit ODE solvers.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It first performs a QSE cache lookup. On a hit, it delegates the full Jacobian calculation to the base engine. While this view could theoretically return a modified, sparser Jacobian reflecting the QSE constraints, the current implementation returns the full Jacobian from the base engine. The solver is expected to handle the algebraic constraints (e.g., via <code>dydt=0</code> from <code>calculateRHSAndEnergy</code>).</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd>The engine must have a valid QSE cache entry for the given state. </dd></dl>
<dlclass="section post"><dt>Postcondition</dt><dd>The base engine's internal Jacobian is updated.</dd></dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname"><aclass="el"href="classgridfire_1_1exceptions_1_1_stale_engine_error.html">exceptions::StaleEngineError</a></td><td>If the QSE cache misses, as it cannot proceed without a valid partition. </td></tr>
<dlclass="section user"><dt>Purpose</dt><dd>To prepare the stoichiometry matrix for later queries.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#abe76a46784b1ebc8ad67a9eec40d369a"title="Generates the stoichiometry matrix for the network.">generateStoichiometryMatrix()</a></code>. The stoichiometry is based on the full, unpartitioned network. </dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd><code><aclass="el"href="#a7d26945df5395b9317552a3989c42d1c"title="Partitions the network into dynamic and algebraic (QSE) groups based on timescales.">partitionNetwork()</a></code> must have been called. </dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd><code><aclass="el"href="#a7d26945df5395b9317552a3989c42d1c"title="Partitions the network into dynamic and algebraic (QSE) groups based on timescales.">partitionNetwork()</a></code> must have been called. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To provide Jacobian entries to an implicit solver.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method directly delegates to the base engine's <code>getJacobianMatrixEntry</code>. It does not currently modify the Jacobian to reflect the QSE algebraic constraints, as these are handled by setting <code>dY/dt = 0</code> in <code>calculateRHSAndEnergy</code>.</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd><code><aclass="el"href="#acdf5ad8765290ea2b78170235aea391d"title="Generates the Jacobian matrix for the current state.">generateJacobianMatrix()</a></code> must have been called for the current state. </dd></dl>
<p>Gets the set of logical reactions in the network. </p>
<dlclass="section return"><dt>Returns</dt><dd>A const reference to the <code><aclass="el"href="namespacegridfire_1_1reaction.html#aa86f08712565f278adacc7cd2361eb31"title="A set of logical reactions.">LogicalReactionSet</a></code> from the base engine, containing all reactions in the full network. </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>A const reference to the vector of <code>Species</code> objects representing all species in the underlying base engine. This view does not alter the species list itself, only how their abundances are evolved. </dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#a7bfb4e6fec2f337a1dea69e3d4f1fc82"title="Gets the current electron screening model.">getScreeningModel()</a></code>. </dd></dl>
<p>Computes destruction timescales for all species in the network. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">Y</td><td>Vector of current molar abundances for the full network. </td></tr>
<tr><tdclass="paramname">T9</td><td>Temperature in units of 10^9 K. </td></tr>
<tr><tdclass="paramname">rho</td><td>Density in g/cm^3. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A <code>std::expected</code> containing a map from <code>Species</code> to their characteristic destruction timescales (s) on success, or a <code>StaleEngineError</code> on failure.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To get the timescale for species destruction, which is used as the primary metric for network partitioning.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It delegates the calculation to the base engine. For any species identified as algebraic (in QSE), it manually sets their timescale to 0.0.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#a91d32b7197fcb27ee697d5bfde960f3f"title="Gets the index of a species in the full network.">getSpeciesIndex()</a></code>. </dd></dl>
<p>Computes timescales for all species in the network. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">Y</td><td>Vector of current molar abundances for the full network. </td></tr>
<tr><tdclass="paramname">T9</td><td>Temperature in units of 10^9 K. </td></tr>
<tr><tdclass="paramname">rho</td><td>Density in g/cm^3. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A <code>std::expected</code> containing a map from <code>Species</code> to their characteristic timescales (s) on success, or a <code>StaleEngineError</code> on failure.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To get the characteristic timescale <code>Y / (dY/dt)</code> for each species.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It delegates the calculation to the base engine. For any species identified as algebraic (in QSE), it manually sets their timescale to 0.0 to signify that they equilibrate instantaneously on the timescale of the solver.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To query the stoichiometric relationship between a species and a reaction.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#a510b920dea726aef859ac1f6d051807e"title="Gets an entry from the stoichiometry matrix.">getStoichiometryMatrixEntry()</a></code>.</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd><code><aclass="el"href="#abe76a46784b1ebc8ad67a9eec40d369a"title="Generates the stoichiometry matrix for the network.">generateStoichiometryMatrix()</a></code> must have been called. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To identify the core set of dynamic species that will not be part of any QSE group.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It calculates the geometric mean of the destruction timescales for all species in each pool and returns the index of the pool with the maximum mean timescale. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To determine if <code><aclass="el"href="#a6bee75b5a6e508e6eebf83f0d48c50b8"title="Updates the internal state of the engine, performing partitioning and QSE equilibration.">update()</a></code> needs to be called.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It creates a <code><aclass="el"href="structgridfire_1_1_q_s_e_cache_key.html"title="Key struct for the QSE abundance cache.">QSECacheKey</a></code> from the <code>netIn</code> data and checks for its existence in the <code>m_qse_abundance_cache</code>. A cache miss indicates the engine is stale because it does not have a valid QSE partition for the current conditions. It also queries the base engine's <code><aclass="el"href="#ae7847959fc5af2b83f5446dd73567b46"title="Checks if the engine's internal state is stale relative to the provided conditions.">isStale()</a></code> method. </dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#aada497e8df74a295fdf5df7d7cdf64e0"title="Maps a NetIn struct to a molar abundance vector for the full network.">mapNetInToMolarAbundanceVector()</a></code>. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To group species into "pools" based on their destruction timescales.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It retrieves all species destruction timescales from the base engine, sorts them, and then iterates through the sorted list, creating a new pool whenever it detects a gap between consecutive timescales that is larger than a predefined threshold (e.g., a factor of 100). </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>A convenience overload for <code>partitionNetwork</code>.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It unpacks the <code>netIn</code> struct into <code>Y</code>, <code>T9</code>, and <code>rho</code> and then calls the primary <code>partitionNetwork</code> method. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To perform the core partitioning logic that identifies which species are "fast" (and can be treated algebraically) and which are "slow" (and must be integrated dynamically).</dd></dl>
<li><b><code>partitionByTimescale</code></b>: Gets species destruction timescales from the base engine, sorts them, and looks for large gaps to create timescale "pools".</li>
<li><b><code>identifyMeanSlowestPool</code></b>: The pool with the slowest average timescale is designated as the core set of dynamic species.</li>
<li><b><code>analyzeTimescalePoolConnectivity</code></b>: The other (faster) pools are analyzed for reaction connectivity to form cohesive groups.</li>
<li><b><code>constructCandidateGroups</code></b>: These connected groups are processed to identify "seed" species (dynamic species that feed the group) and "algebraic" species (the rest).</li>
<li><b><code>validateGroupsWithFluxAnalysis</code></b>: The groups are validated by ensuring their internal reaction flux is much larger than the flux connecting them to the outside network.</li>
</ol>
<dlclass="section pre"><dt>Precondition</dt><dd>The input state (Y, T9, rho) must be a valid physical state. </dd></dl>
<dlclass="section post"><dt>Postcondition</dt><dd>The internal member variables <code>m_qse_groups</code>, <code>m_dynamic_species</code>, and <code>m_algebraic_species</code> (and their index maps) are populated with the results of the partitioning. </dd></dl>
<p>Primes the engine with a specific species. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">netIn</td><td>A struct containing the current network input. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A <code><aclass="el"href="structgridfire_1_1_priming_report.html"title="Captures the result of a network priming operation.">PrimingReport</a></code> struct containing information about the priming process.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To prepare the network for ignition or specific pathway studies.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#a05730ced13ac5331060ca011f0da6235"title="Primes the engine with a specific species.">primeEngine()</a></code>. The multiscale view does not currently interact with the priming process. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To modify the reaction network.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This operation is not supported by the <code><aclass="el"href="classgridfire_1_1_multiscale_partitioning_engine_view.html"title="An engine view that partitions the reaction network into multiple groups based on timescales.">MultiscalePartitioningEngineView</a></code> as it would invalidate the partitioning logic. It logs a critical error and throws an exception. <aclass="el"href="classgridfire_1_1_network.html">Network</a> modifications should be done on the base engine before it is wrapped by this view.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#a1a0c0a0ade632eb10f0eecab828a059f"title="Sets the electron screening model.">setScreeningModel()</a></code>. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To find the equilibrium abundances of the algebraic species that satisfy the QSE conditions.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It uses the Levenberg-Marquardt algorithm via Eigen's <code>LevenbergMarquardt</code> class. The problem is defined by the <code><aclass="el"href="structgridfire_1_1_multiscale_partitioning_engine_view_1_1_eigen_functor.html"title="Functor for solving QSE abundances using Eigen's nonlinear optimization.">EigenFunctor</a></code> which computes the residuals and Jacobian for the QSE equations.</dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>This is the main entry point for preparing the multiscale engine for use. It triggers the network partitioning and solves for the initial QSE abundances, caching the result.</dd></dl>
<li>It first checks the QSE cache. If a valid entry already exists for the input state, it returns the input composition, as no work is needed.</li>
<li>If the cache misses, it calls <code><aclass="el"href="#a4bc879246c6fbd8633b05052858df51d"title="Equilibrates the network by partitioning and solving for QSE abundances.">equilibrateNetwork()</a></code>.</li>
<li><code><aclass="el"href="#a4bc879246c6fbd8633b05052858df51d"title="Equilibrates the network by partitioning and solving for QSE abundances.">equilibrateNetwork()</a></code> in turn calls <code><aclass="el"href="#a7d26945df5395b9317552a3989c42d1c"title="Partitions the network into dynamic and algebraic (QSE) groups based on timescales.">partitionNetwork()</a></code> to define the dynamic and algebraic species sets.</li>
<li>It then calls <code><aclass="el"href="#a3c5fcb8e3396d74359fd601554c9ffa9"title="Solves for the QSE abundances of the algebraic species in a given state.">solveQSEAbundances()</a></code> to compute the equilibrium abundances.</li>
<li>The resulting equilibrium abundances for the algebraic species are stored in the <code>m_qse_abundance_cache</code>.</li>
<li>A new <code>fourdst::composition::Composition</code> object reflecting the equilibrated state is created and returned.</li>
</ol>
<dlclass="section pre"><dt>Precondition</dt><dd>The <code>netIn</code> struct should contain a valid physical state. </dd></dl>
<dlclass="section post"><dt>Postcondition</dt><dd>The engine is partitioned (<code>m_dynamic_species</code>, <code>m_algebraic_species</code>, etc. are populated). The <code>m_qse_abundance_cache</code> is populated with the QSE solution for the given state. The returned composition reflects the new equilibrium. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>To ensure that a candidate QSE group is truly in equilibrium by checking that the reaction fluxes <em>within</em> the group are much larger than the fluxes <em>leaving</em> the group.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>For each candidate group, it calculates the sum of all internal reaction fluxes and the sum of all external (bridge) reaction fluxes. If the ratio of internal to external flux exceeds a configurable threshold, the group is considered valid and is added to the returned vector. </dd></dl>
<dlclass="section user"><dt>Purpose</dt><dd>This is the core of the caching mechanism. It stores the results of QSE solves to avoid re-computation. The key is a <code><aclass="el"href="structgridfire_1_1_q_s_e_cache_key.html"title="Key struct for the QSE abundance cache.">QSECacheKey</a></code> which hashes the thermodynamic state, and the value is the vector of solved molar abundances for the algebraic species. </dd></dl>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.13.2 </li>