<p>This tutorial walks you through installing GridFire’s Python bindings, choosing engines and views thoughtfully, running a simulation, and visualizing your results.</p>
<p>If you want the cutting-edge features or need to hack the C++ backend: </p><divclass="fragment"><divclass="line">git clone https://github.com/4DSTAR/GridFire.git</div>
<divclass="line">cd GridFire</div>
<divclass="line"># Create a virtualenv to isolate dependencies</div>
<divclass="line"># Install Python bindings (meson-python & pybind11 under the hood)</div>
<divclass="line">pip install .</div>
</div><!-- fragment --><p>You can also build manually with Meson (generally end users will not need to do this): </p><divclass="fragment"><divclass="line">meson setup build-python</div>
<p>GridFire’s design balances physical fidelity and performance. Here’s why we pick each component:</p>
<oltype="1">
<li><b>GraphEngine</b>: Constructs the <b>full</b> reaction network from Reaclib rates and composition. Use this when:<ul>
<li>You need maximum physical accuracy (no reactions are omitted). <br/>
</li>
<li>You are exploring new burning pathways or validating against literature. <br/>
</li>
</ul>
</li>
<li><b>MultiscalePartitioningEngineView</b>: Implements the Hix & Thielemann partitioning strategy:<ul>
<li><b>Fast reactions</b> vs <b>slow reactions</b> are split onto separate kernels. <br/>
</li>
<li>This reduces stiffness by isolating processes on very different timescales. <br/>
</li>
<li>Choose when your network spans orders of magnitude in timescales (e.g., rapid proton captures vs. slow beta decays). <br/>
</li>
</ul>
</li>
<li><b>AdaptiveEngineView</b>: Dynamically culls low-flow reactions at runtime:<ul>
<li>At each timestep, reactions with negligible contribution are temporarily removed. <br/>
</li>
<li>This greatly accelerates large networks without significant loss of accuracy. <br/>
</li>
<li>Ideal for long integrations where the active set evolves over time. <br/>
</li>
</ul>
</li>
<li><b>Leading-Edge Views</b>: <br/>
<ul>
<li><code>NetworkPrimingEngineView</code> to inject seed species and study ignition phenomena. <br/>
</li>
<li><code>DefinedEngineView</code> to freeze the network to a user-specified subset (e.g., focus on the CNO cycle). <br/>
</li>
</ul>
</li>
</ol>
<p>By composing these views in sequence, you can tailor accuracy vs performance for your scientific question. Commonly one might use a flow like <b>GraphEngine → Partitioning → Adaptive</b> to capture both full-network physics and manageable stiffness.</p>
<divclass="line">baseEngine.setUseReverseReactions(<spanclass="keyword">False</span>) <spanclass="comment"># At these temps we can turn off reverse reactions</span></div>
</div><!-- fragment --><p><b>Why these choices?</b><br/>
</p><ul>
<li><b>buildDepth=2</b>: In Emily’s preliminary tests, depth=2 captures key reaction loops without the overhead of a full network. <br/>
</li>
<li><b>Partition & Adaptive Views</b>: Partitioning reduces stiffness between rapid charged-particle captures and slower β-decays; adaptive culling keeps the working set minimal. <br/>
</li>
<li><b>Implicit solver</b>: Rosenbrock4 handles stiff systems robustly, letting you push to longer <code>tMax</code>.</li>
</div><!-- fragment --><p> For time-series data, record intermediates with an observer and save with pandas or numpy: </p><divclass="fragment"><divclass="line"><spanclass="keyword">import</span> pandas <spanclass="keyword">as</span> pd</div>
<divclass="line"></div>
<divclass="line"><spanclass="comment"># Build a DataFrame of time vs species fraction</span></div>
<li><b>Custom Partition Functions</b>: In Python, subclass <code><aclass="el"href="classgridfire_1_1partition_1_1_partition_function.html"title="Abstract interface for evaluating nuclear partition functions.">gridfire.partition.PartitionFunction</a></code>, override <code>evaluate</code>, <code>supports</code>, and <code>clone</code> to implement new weighting schemes. <br/>
</li>
<li><b>Parameter Studies</b>: Loop over <code>buildDepth</code>, solver tolerances, or initial compositions to get a sense of the sensitity of the network to input conditions or build a monte carlo grid. <br/>
<p>For full API details, consult the docstrings in <code>src/python/</code> and the C++ implementation in <code>src/lib/</code>. Enjoy exploring nuclear astrophysics with GridFire! </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>