<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.
<divclass="center"><iframescrolling="no"frameborder="0"src="classgridfire_1_1_multiscale_partitioning_engine_view__inherit__graph.svg"width="334"height="214"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
Collaboration diagram for gridfire::MultiscalePartitioningEngineView:</div>
<divclass="dyncontent">
<divclass="center"><divclass="zoom"><iframescrolling="no"frameborder="0"src="classgridfire_1_1_multiscale_partitioning_engine_view__coll__graph.svg"width="100%"height="600"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
<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:a1b3720628b22f038391949fffe6fc962"><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:a5c1ab19bc3394a5d29241ef02073c4cb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculates the right-hand side (dY/dt) and energy generation. <br/></td></tr>
<trclass="memdesc:a99f9116d5a18afcbf0e808ef111d1be8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculate the derivatives of the energy generation rate with respect to T and rho. <br/></td></tr>
<trclass="memdesc:ab9f71bc9a1c0f98ec9cc1c7da00fd975"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Generates the Jacobian matrix for the current state. <br/></td></tr>
<trclass="memdesc:a31e636745b8c427cee0319e6c61039be"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Generates the Jacobian matrix for a subset of active species. <br/></td></tr>
<trclass="memdesc:ac683ef0ba25356bc587749b69a582286"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Generates the Jacobian matrix using a sparsity pattern. <br/></td></tr>
<trclass="memdesc:a586da5402750151fee5db2666785b6e4"><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="memdesc:a7140384baaaa0bd05ca448a0d8fec471"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets an entry from the stoichiometry matrix. <br/></td></tr>
<trclass="memdesc:a87687a960f263a4e1bc035e4d0a345db"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculates the molar reaction flow for a given reaction. <br/></td></tr>
<trclass="memdesc:a253e51d6dc7226a863a123683049af61"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the set of logical reactions in the network. <br/></td></tr>
<trclass="memdesc:af99f5e4871808188d00379c1c35868fe"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the set of logical reactions in the network. <br/></td></tr>
<trclass="memdesc:aea2c3d2ae6ddf77bd4a9b07b86f3306b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Computes timescales for all species in the network. <br/></td></tr>
<trclass="memdesc:accbbe1bd96672e74919d00387673f180"><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:a05e45017bbb772c586f483bd527004ee"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Analyzes the connectivity of timescale pools. <br/></td></tr>
<trclass="memdesc:a3c327a40d7c667043826002975baa2b4"><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:a2e3c7d6320cd0fdc51b3a40d1ec6b262"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Exports the network to a DOT file for visualization. <br/></td></tr>
<trclass="memdesc:a8db21995e6878f4043f3a5a45bf36d5e"><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:a2f0c45d4e2b2f9de5d961088f3ab0a9a"><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="memdesc:a7056e235c56be39e2a672988962b3948"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Collect the composition from this and sub engines. <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:a7aa4eb7a0d6e6d04b3e1aa1b1fb7f3f6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Partitions the network by timescale. <br/></td></tr>
<trclass="memdesc:ad94c6fa2281d9104471631c6b90f411e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Validates candidate QSE groups using flux analysis. <br/></td></tr>
<trclass="memdesc:a40ce2c18063cd56cffd58419b9ae96bf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Solves for the QSE abundances of the algebraic species in a given state. <br/></td></tr>
<trclass="memdesc:a70f4a0c4123b7f78305f64eb11beeeeb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Identifies the pool with the slowest mean timescale. <br/></td></tr>
<trclass="memdesc:a5d1c11f3c0883385833462dd088f6f89"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Builds a connectivity graph from a species pool. <br/></td></tr>
<trclass="memdesc:aaabaae8e33ca8a05a2aa1f374e792795"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs candidate QSE groups from connected timescale pools. <br/></td></tr>
<trclass="memdesc:a999b68226d658c9df2f4a3b890b9e5d1"><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:a4656c05b8235dbf4ec698b03a716a8c8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Species that are treated as algebraic (in QSE) in the QSE groups. <br/></td></tr>
<trclass="memdesc:a3af2b37ce21829d9554d702cad074470"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Map from species to their calculated abundances in the QSE state. <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="#a3c327a40d7c667043826002975baa2b4"title="Partitions the network into dynamic and algebraic (QSE) groups based on timescales.">partitionNetwork()</a></code> and <code><aclass="el"href="#a2f0c45d4e2b2f9de5d961088f3ab0a9a"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:99</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:180</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">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>
<dlclass="section return"><dt>Returns</dt><dd>An unordered map representing the adjacency list of the connectivity graph.</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 return"><dt>Returns</dt><dd><aclass="el"href="structgridfire_1_1_energy_derivatives.html">EnergyDerivatives</a> containing dEps/dT and dEps/dRho.</dd></dl>
<p>This method computes the partial derivatives of the specific nuclear energy generation rate with respect to temperature and density for the current state. </p>
<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>
<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="#a2f0c45d4e2b2f9de5d961088f3ab0a9a"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>Collect the composition from this and sub engines. </p>
<p>This method operates by injecting the current equilibrium abundances for algebraic species into the composition object so that they can be bubbled up to the caller. </p><dlclass="params"><dt>Parameters</dt><dd>
<dlclass="section return"><dt>Returns</dt><dd>New composition which is comp + any edits from lower levels + the equilibrium abundances of all algebraic species. </dd></dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname">BadCollectionError</td><td>if there is a species in the algebraic species set which does not show up in the reported composition from the base engine.:w </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">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 return"><dt>Returns</dt><dd>A new composition object with the equilibrated abundances.</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="#a3c327a40d7c667043826002975baa2b4"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="#a40ce2c18063cd56cffd58419b9ae96bf"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 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 engine's internal partition is updated. A new composition object 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>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>
<p>Generates the Jacobian matrix using a sparsity pattern. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">comp</td><td>The current composition. </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>
<tr><tdclass="paramname">sparsityPattern</td><td>The sparsity pattern to use for the Jacobian.</td></tr>
</table>
</dd>
</dl>
<dlclass="section user"><dt>Purpose</dt><dd>To compute the Jacobian matrix while leveraging a known sparsity pattern for efficiency. This is effectively a lower level version of the active species method.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>It first checks the QSE cache. On a hit, it delegates to the base engine's <code>generateJacobianMatrix</code> method with the provided sparsity pattern.</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 according to the sparsity pattern.</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. </td></tr>
<p>Generates the Jacobian matrix for a subset of active species. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">comp</td><td>The current composition. </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>
<tr><tdclass="paramname">activeSpecies</td><td>The subset of species to include in the Jacobian.</td></tr>
</table>
</dd>
</dl>
<dlclass="section user"><dt>Purpose</dt><dd>To compute a reduced Jacobian matrix for implicit solvers that only consider a subset of species.</dd></dl>
<dlclass="section user"><dt>How</dt><dd>Similar to the full Jacobian generation, it first checks the QSE cache. On a hit, it calls the base engine's <code>generateJacobianMatrix</code> with the specified active species. The returned Jacobian still reflects the full network, but only for the active species subset.</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 for the active species.</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. </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="#a3c327a40d7c667043826002975baa2b4"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="#a3c327a40d7c667043826002975baa2b4"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="#ab9f71bc9a1c0f98ec9cc1c7da00fd975"title="Generates the Jacobian matrix for the current state.">generateJacobianMatrix()</a></code> must have been called for the current state. </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>A const reference to the <code>LogicalReactionSet</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>
<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="#a8db21995e6878f4043f3a5a45bf36d5e"title="Gets the index of a species in the full network.">getSpeciesIndex()</a></code>. </dd></dl>
<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>
<tr><tdclass="paramname">species</td><td>Species to look up stoichiometry for. </td></tr>
<tr><tdclass="paramname">reaction</td><td><aclass="el"href="classgridfire_1_1_reaction.html"title="Represents a single nuclear reaction from a specific data source.">Reaction</a> to find. </td></tr>
<dlclass="section user"><dt>How</dt><dd>This method delegates directly to the base engine's <code><aclass="el"href="#a7140384baaaa0bd05ca448a0d8fec471"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>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>Partitions the network based on timescales from a <code><aclass="el"href="structgridfire_1_1_net_in.html">NetIn</a></code> struct. </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 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>
<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>If the cache misses, it calls <code><aclass="el"href="#a2f0c45d4e2b2f9de5d961088f3ab0a9a"title="Equilibrates the network by partitioning and solving for QSE abundances.">equilibrateNetwork()</a></code>.</li>
<li><code><aclass="el"href="#a2f0c45d4e2b2f9de5d961088f3ab0a9a"title="Equilibrates the network by partitioning and solving for QSE abundances.">equilibrateNetwork()</a></code> in turn calls <code><aclass="el"href="#a3c327a40d7c667043826002975baa2b4"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="#a40ce2c18063cd56cffd58419b9ae96bf"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>