docs(docs): reworked docs
This commit is contained in:
641
docs/index.html
641
docs/index.html
@@ -1,265 +1,390 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="scroll-smooth">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>GridFire: GridFire</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="navtreedata.js"></script>
|
||||
<script type="text/javascript" src="navtree.js"></script>
|
||||
<script type="text/javascript" src="resize.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>GridFire</title>
|
||||
|
||||
<!-- Tailwind CSS for styling -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<!-- Google Fonts: Inter -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
/* Define color variables for light and dark themes */
|
||||
:root {
|
||||
--bg-color: #f0f4f8;
|
||||
--text-color: #1a202c;
|
||||
--header-bg: transparent;
|
||||
--card-bg: #ffffff;
|
||||
--border-color: rgba(0, 0, 0, 0.1);
|
||||
--link-color: #2b6cb0;
|
||||
--link-hover-color: #2c5282;
|
||||
--modal-bg: #ffffff;
|
||||
--mobile-menu-bg: rgba(240, 248, 255, 0.95);
|
||||
}
|
||||
|
||||
html.dark {
|
||||
--bg-color: #0d1117;
|
||||
--text-color: #e2e8f0;
|
||||
--header-bg: transparent;
|
||||
--card-bg: #1e293b;
|
||||
--border-color: rgba(255, 255, 255, 0.1);
|
||||
--link-color: #63b3ed;
|
||||
--link-hover-color: #90cdf4;
|
||||
--modal-bg: #1e293b;
|
||||
--mobile-menu-bg: rgba(13, 17, 23, 0.95);
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: 'Inter', sans-serif;
|
||||
transition: background-color 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
/* Styling for header, cards, and modal to use CSS variables */
|
||||
.main-header {
|
||||
background-color: var(--header-bg);
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.content-card {
|
||||
background-color: var(--card-bg);
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.modal-card {
|
||||
background-color: var(--modal-bg);
|
||||
}
|
||||
|
||||
.mobile-menu-overlay {
|
||||
background-color: var(--mobile-menu-bg);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">GridFire<span id="projectnumber"> 0.0.1a</span>
|
||||
</div>
|
||||
<div id="projectbrief">General Purpose Nuclear Network</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() { codefold.init(0); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search',true);
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
<div id="nav-tree">
|
||||
<div id="nav-tree-contents">
|
||||
<div id="nav-sync" class="sync"></div>
|
||||
<body class="min-h-screen">
|
||||
|
||||
<!-- Hero Section with Canvas Background -->
|
||||
<div id="hero-section" class="relative h-[60vh] min-h-[400px] max-h-[600px] w-full overflow-hidden">
|
||||
<!-- The canvas element for the fusion simulation background -->
|
||||
<canvas id="fusionCanvas" class="absolute top-0 left-0 w-full h-full z-0"></canvas>
|
||||
|
||||
<!-- Header and Navigation -->
|
||||
<header class="absolute top-0 left-0 right-0 z-20 main-header">
|
||||
<nav class="container mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex items-center justify-between h-16">
|
||||
<div class="flex items-center">
|
||||
<a href="#home" class="font-bold text-xl">GridFire</a>
|
||||
</div>
|
||||
<div class="hidden sm:flex items-center space-x-6">
|
||||
<a href="#home" class="nav-link text-sm font-medium hover:text-[var(--link-hover-color)] transition-colors">Home</a>
|
||||
<a href="#intro" class="nav-link text-sm font-medium hover:text-[var(--link-hover-color)] transition-colors">Intro</a>
|
||||
<a href="https://github.com/4D-STAR/GridFire" target="_blank" class="text-sm font-medium hover:text-[var(--link-hover-color)] transition-colors">GitHub</a>
|
||||
<button id="funding-btn" class="text-sm font-medium hover:text-[var(--link-hover-color)] transition-colors">Funding</button>
|
||||
</div>
|
||||
<!-- Mobile Menu Button -->
|
||||
<div class="sm:hidden">
|
||||
<button id="mobile-menu-btn" class="p-2 rounded-md focus:outline-none">
|
||||
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
<div id="splitbar" style="-moz-user-select:none;"
|
||||
class="ui-resizable-handle">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function(){initNavTree('index.html',''); initResizable(true); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Mobile Menu, hidden by default -->
|
||||
<div id="mobile-menu" class="hidden sm:hidden fixed inset-0 z-40">
|
||||
<div class="mobile-menu-overlay absolute inset-0"></div>
|
||||
<div class="relative flex flex-col items-center justify-center h-full space-y-8">
|
||||
<button id="close-mobile-menu-btn" class="absolute top-5 right-5 p-2">
|
||||
<svg class="h-8 w-8" stroke="currentColor" fill="none" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<a href="#home" class="mobile-nav-link text-2xl font-bold">Home</a>
|
||||
<a href="#intro" class="mobile-nav-link text-2xl font-bold">Docs</a>
|
||||
<a href="https://github.com/4D-STAR/GridFire" target="_blank" class="mobile-nav-link text-2xl font-bold">GitHub</a>
|
||||
<button id="mobile-funding-btn" class="mobile-nav-link text-2xl font-bold">Funding</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">GridFire </div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p><a class="anchor" id="md_docs_2static_2mainpage"></a></p>
|
||||
<p><img src="../../assets/logo/GridFire.png" alt="GridFire Logo" class="inline"/></p>
|
||||
<h1><a class="anchor" id="autotoc_md0"></a>
|
||||
GridFire: A Nuclear Reaction Network Library</h1>
|
||||
<h2><a class="anchor" id="autotoc_md1"></a>
|
||||
Overview</h2>
|
||||
<p>GridFire is a C++ library for simulating nuclear reaction networks. It is designed to be flexible, performant, and easy to integrate into larger astrophysical simulations. GridFire provides a modular framework for defining, manipulating, and solving complex reaction networks, with a focus on providing different "engines" to suit various computational needs.</p>
|
||||
<p>This documentation provides a comprehensive overview of the GridFire library, its architecture, and its components.</p>
|
||||
<h2><a class="anchor" id="autotoc_md2"></a>
|
||||
Features</h2>
|
||||
<ul>
|
||||
<li><b>Modular Design:</b> The library is organized into distinct components for reactions, engines, and solvers, allowing for easy extension and customization.</li>
|
||||
<li><b>Multiple Engines:</b> GridFire offers several reaction network engines, including:<ul>
|
||||
<li>A <code>GraphEngine</code> for solving the full reaction network.</li>
|
||||
<li>An <code>AdaptiveEngine</code> that dynamically adjusts the network size at runtime for improved performance.</li>
|
||||
<li>A simplified <code>Approx8Engine</code> for testing and for scenarios where a full network is not required.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>REACLIB Integration:</b> GridFire can parse and utilize data from the REACLIB database, allowing for the use of standard, up-to-date reaction rates.</li>
|
||||
<li><b>High Performance:</b> The library is designed for performance, using modern C++ features and high-performance libraries like Eigen, Boost, and CppAD.</li>
|
||||
</ul>
|
||||
<h2><a class="anchor" id="autotoc_md3"></a>
|
||||
Directory Structure</h2>
|
||||
<p>The GridFire project is organized into the following main directories:</p>
|
||||
<ul>
|
||||
<li><code>src/</code>: Contains the source code for the GridFire library.<ul>
|
||||
<li><code>include/gridfire/</code>: Public header files for the library.<ul>
|
||||
<li><code>reaction/</code>: Header files related to defining and managing nuclear reactions.</li>
|
||||
<li><code>engine/</code>: Header files for the various reaction network engines.</li>
|
||||
<li><code>solver/</code>: Header files for the numerical solvers.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>lib/</code>: Source code for the implementation of the library components.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>subprojects/</code>: Contains external libraries and dependencies.</li>
|
||||
<li><code>tests/</code>: Unit tests for the GridFire library.</li>
|
||||
<li><code>docs/</code>: Directory for documentation, including this Doxygen homepage.</li>
|
||||
</ul>
|
||||
<h2><a class="anchor" id="autotoc_md4"></a>
|
||||
Core Components</h2>
|
||||
<p>The GridFire library is built around three main components: <b>Reactions</b>, <b>Engines</b>, and <b>Solvers</b>.</p>
|
||||
<h3><a class="anchor" id="autotoc_md5"></a>
|
||||
Reactions</h3>
|
||||
<p>The <code>reaction</code> component is responsible for defining and managing nuclear reactions. The key classes are:</p>
|
||||
<ul>
|
||||
<li><code><a class="el" href="classgridfire_1_1reaction_1_1_reaction.html" title="Represents a single nuclear reaction from a specific data source.">gridfire::reaction::Reaction</a></code>: Represents a single nuclear reaction, including its reactants, products, and rate coefficients.</li>
|
||||
<li><code><a class="el" href="classgridfire_1_1reaction_1_1_reaction_set.html" title="A collection of Reaction objects.">gridfire::reaction::ReactionSet</a></code>: A collection of <code>Reaction</code> objects, representing a full reaction network.</li>
|
||||
<li><code><a class="el" href="classgridfire_1_1reaction_1_1_logical_reaction.html" title="Represents a "logical" reaction that aggregates rates from multiple sources.">gridfire::reaction::LogicalReaction</a></code>: An abstraction that can represent a single reaction or a combination of multiple reactions (e.g., a forward and reverse reaction).</li>
|
||||
<li><code><a class="el" href="classgridfire_1_1reaction_1_1_logical_reaction_set.html" title="A collection of LogicalReaction objects.">gridfire::reaction::LogicalReactionSet</a></code>: A collection of <code>LogicalReaction</code> objects.</li>
|
||||
</ul>
|
||||
<p>GridFire can load reaction data from the REACLIB database via the <code>build_reaclib_nuclear_network</code> function, which is implemented in <code><a class="el" href="reaclib_8cpp.html">src/network/lib/reaction/reaclib.cpp</a></code>.</p>
|
||||
<h3><a class="anchor" id="autotoc_md6"></a>
|
||||
Engines</h3>
|
||||
<p>Engines are responsible for the low-level details of solving the reaction network equations. GridFire provides several engines, each with its own trade-offs in terms of accuracy and performance:</p>
|
||||
<ul>
|
||||
<li><b><code><a class="el" href="classgridfire_1_1_graph_engine.html" title="A reaction network engine that uses a graph-based representation.">gridfire::GraphEngine</a></code></b>: A full-network solver that represents the reaction network as a graph. It uses the CppAD library for automatic differentiation to compute the Jacobian matrix, which is essential for implicit solvers.</li>
|
||||
<li><b><code>gridfire::AdaptiveEngine</code></b>: A dynamic engine that adapts the size of the reaction network at runtime. It can add or remove reactions and species based on their importance, which can significantly improve performance in simulations with changing conditions.</li>
|
||||
<li><b><code>gridfire::Approx8Engine</code></b>: A simplified, 8-isotope network for hydrogen and helium burning. This engine is useful for testing and for simulations where a full network is not necessary. It includes the pp-chain and the CNO cycle.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" id="autotoc_md7"></a>
|
||||
Solvers</h3>
|
||||
<p>The <code>solver</code> component provides the numerical algorithms for solving the system of ordinary differential equations (ODEs) that describe the evolution of the species abundances. GridFire uses the <code>boost::numeric::odeint</code> library for its ODE solvers.</p>
|
||||
<p>The main solver class is <code><a class="el" href="classgridfire_1_1solver_1_1_q_s_e_network_solver.html" title="A network solver that uses a Quasi-Steady-State Equilibrium (QSE) approach.">gridfire::solver::QSENetworkSolver</a></code>, which implements a Quasi-Steady-State (QSE) solver.</p>
|
||||
<h2><a class="anchor" id="autotoc_md8"></a>
|
||||
Dependencies</h2>
|
||||
<p>GridFire relies on the following external libraries:</p>
|
||||
<ul>
|
||||
<li><b><a href="https://eigen.tuxfamily.org/">Eigen</a></b>: A C++ template library for linear algebra.</li>
|
||||
<li><b><a href="https://www.boost.org/">Boost</a></b>: A collection of peer-reviewed, high-quality C++ libraries. GridFire uses Boost for sparse matrices and numerical integration.</li>
|
||||
<li><b><a href="https://cppad.readthedocs.io/en/latest/">CppAD</a></b>: A C++ template library for automatic differentiation.</li>
|
||||
<li><b><a href="https://github.com/odygrd/quill">Quill</a></b>: A high-performance, asynchronous logging library.</li>
|
||||
<li><b><a href="https://github.com/jbeder/yaml-cpp">yaml-cpp</a></b>: A YAML parser and emitter for C++.</li>
|
||||
<li><b><a href="https://github.com/google/googletest">GoogleTest</a></b>: A unit testing framework for C++.</li>
|
||||
<li><b><a href="https://github.com/Cyan4973/xxHash">xxHash</a></b>: An extremely fast non-cryptographic hash algorithm.</li>
|
||||
</ul>
|
||||
<p>Aside from boost, all dependencies are automatically downloaded and built by the Meson build system. Boost must be installed on your system beforehand.</p>
|
||||
<h2><a class="anchor" id="autotoc_md9"></a>
|
||||
Building the Project</h2>
|
||||
<p>GridFire uses the <a href="https://mesonbuild.com/">Meson</a> build system. To build the project, you will need to have Meson and a C++ compiler (like g++ or clang++) installed.</p>
|
||||
<p>You can configure the build using the options listed in <code>meson_options.txt</code>.</p>
|
||||
<div class="fragment"><div class="line">meson setup builddir --prefix=/path/to/install --buildtype=release</div>
|
||||
<div class="line">meson compile -C builddir</div>
|
||||
<div class="line">meson install -C builddir</div>
|
||||
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md10"></a>
|
||||
How to Use</h2>
|
||||
<p>To use the GridFire library in your own project, you will need to link against the compiled library and include the necessary header files.</p>
|
||||
<p>Here is a simple example of how to use the library:</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="network_8h.html">gridfire/network.h</a>"</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="solver_8h.html">gridfire/solver/solver.h</a>"</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keywordtype">int</span> main() {</div>
|
||||
<div class="line"> <span class="comment">// 1. Create a Composition object with the initial abundances</span></div>
|
||||
<div class="line"> fourdst::composition::Composition comp;</div>
|
||||
<div class="line"> <span class="comment">// ... set initial abundances ...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 2. Create a reaction network engine</span></div>
|
||||
<div class="line"> <a class="code hl_class" href="classgridfire_1_1_graph_engine.html">gridfire::GraphEngine</a> engine(comp);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 3. Create a solver</span></div>
|
||||
<div class="line"> <a class="code hl_class" href="classgridfire_1_1solver_1_1_q_s_e_network_solver.html">gridfire::solver::QSENetworkSolver</a> solver(engine);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 4. Set the thermodynamic conditions</span></div>
|
||||
<div class="line"> <a class="code hl_struct" href="structgridfire_1_1_net_in.html">gridfire::NetIn</a> netIn;</div>
|
||||
<div class="line"> netIn.<a class="code hl_variable" href="structgridfire_1_1_net_in.html#a5be0f5195a5cd1dd177b9fc5ab83a7be">temperature</a> = 1.0e8; <span class="comment">// K</span></div>
|
||||
<div class="line"> netIn.<a class="code hl_variable" href="structgridfire_1_1_net_in.html#a06f0dff9f8927b7cf2da3004c8fa1577">density</a> = 1.0e4; <span class="comment">// g/cm^3</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 5. Solve the network</span></div>
|
||||
<div class="line"> <a class="code hl_struct" href="structgridfire_1_1_net_out.html">gridfire::NetOut</a> netOut = solver.evaluate(netIn);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line">}</div>
|
||||
<div class="ttc" id="aclassgridfire_1_1_graph_engine_html"><div class="ttname"><a href="classgridfire_1_1_graph_engine.html">gridfire::GraphEngine</a></div><div class="ttdoc">A reaction network engine that uses a graph-based representation.</div><div class="ttdef"><b>Definition</b> <a href="engine__graph_8h_source.html#l00086">engine_graph.h:86</a></div></div>
|
||||
<div class="ttc" id="aclassgridfire_1_1solver_1_1_q_s_e_network_solver_html"><div class="ttname"><a href="classgridfire_1_1solver_1_1_q_s_e_network_solver.html">gridfire::solver::QSENetworkSolver</a></div><div class="ttdoc">A network solver that uses a Quasi-Steady-State Equilibrium (QSE) approach.</div><div class="ttdef"><b>Definition</b> <a href="solver_8h_source.html#l00098">solver.h:98</a></div></div>
|
||||
<div class="ttc" id="anetwork_8h_html"><div class="ttname"><a href="network_8h.html">network.h</a></div></div>
|
||||
<div class="ttc" id="asolver_8h_html"><div class="ttname"><a href="solver_8h.html">solver.h</a></div></div>
|
||||
<div class="ttc" id="astructgridfire_1_1_net_in_html"><div class="ttname"><a href="structgridfire_1_1_net_in.html">gridfire::NetIn</a></div><div class="ttdef"><b>Definition</b> <a href="network_8h_source.html#l00053">network.h:53</a></div></div>
|
||||
<div class="ttc" id="astructgridfire_1_1_net_in_html_a06f0dff9f8927b7cf2da3004c8fa1577"><div class="ttname"><a href="structgridfire_1_1_net_in.html#a06f0dff9f8927b7cf2da3004c8fa1577">gridfire::NetIn::density</a></div><div class="ttdeci">double density</div><div class="ttdoc">Density in g/cm^3.</div><div class="ttdef"><b>Definition</b> <a href="network_8h_source.html#l00058">network.h:58</a></div></div>
|
||||
<div class="ttc" id="astructgridfire_1_1_net_in_html_a5be0f5195a5cd1dd177b9fc5ab83a7be"><div class="ttname"><a href="structgridfire_1_1_net_in.html#a5be0f5195a5cd1dd177b9fc5ab83a7be">gridfire::NetIn::temperature</a></div><div class="ttdeci">double temperature</div><div class="ttdoc">Temperature in Kelvin.</div><div class="ttdef"><b>Definition</b> <a href="network_8h_source.html#l00057">network.h:57</a></div></div>
|
||||
<div class="ttc" id="astructgridfire_1_1_net_out_html"><div class="ttname"><a href="structgridfire_1_1_net_out.html">gridfire::NetOut</a></div><div class="ttdef"><b>Definition</b> <a href="network_8h_source.html#l00065">network.h:65</a></div></div>
|
||||
</div><!-- fragment --><p> Linking can be done using the pkg-config tool:</p>
|
||||
<div class="fragment"><div class="line">pkg-config --cflags --libs gridfire</div>
|
||||
</div><!-- fragment --><p>Note that you will also need to tell the compiler where to find boost headers.</p>
|
||||
<p>A more detailed example of how to use an AdaptiveEngine can be found below </p><div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="network_8h.html">gridfire/network.h</a>"</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="solver_8h.html">gridfire/solver/solver.h</a>"</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keywordtype">int</span> main() {</div>
|
||||
<div class="line"> <span class="comment">// 1. Create a Composition object with the initial abundances</span></div>
|
||||
<div class="line"> fourdst::composition::Composition comp;</div>
|
||||
<div class="line"> <span class="comment">// ... set initial abundances ...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <a class="code hl_class" href="classgridfire_1_1_graph_engine.html">gridfire::GraphEngine</a> baseEngine(comp);</div>
|
||||
<div class="line"> <a class="code hl_class" href="classgridfire_1_1_adaptive_engine_view.html">gridfire::AdaptiveEngineView</a> adaptiveEngine(comp);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 3. Create a solver</span></div>
|
||||
<div class="line"> <a class="code hl_class" href="classgridfire_1_1solver_1_1_q_s_e_network_solver.html">gridfire::solver::QSENetworkSolver</a> solver(adaptiveEngine);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 4. Set the thermodynamic conditions</span></div>
|
||||
<div class="line"> <a class="code hl_struct" href="structgridfire_1_1_net_in.html">gridfire::NetIn</a> netIn;</div>
|
||||
<div class="line"> netIn.<a class="code hl_variable" href="structgridfire_1_1_net_in.html#a5be0f5195a5cd1dd177b9fc5ab83a7be">temperature</a> = 1.0e8; <span class="comment">// K</span></div>
|
||||
<div class="line"> netIn.<a class="code hl_variable" href="structgridfire_1_1_net_in.html#a06f0dff9f8927b7cf2da3004c8fa1577">density</a> = 1.0e4; <span class="comment">// g/cm^3</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// 5. Solve the network</span></div>
|
||||
<div class="line"> <a class="code hl_struct" href="structgridfire_1_1_net_out.html">gridfire::NetOut</a> netOut = solver.evaluate(netIn);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line">}</div>
|
||||
<div class="ttc" id="aclassgridfire_1_1_adaptive_engine_view_html"><div class="ttname"><a href="classgridfire_1_1_adaptive_engine_view.html">gridfire::AdaptiveEngineView</a></div><div class="ttdoc">An engine view that dynamically adapts the reaction network based on runtime conditions.</div><div class="ttdef"><b>Definition</b> <a href="engine__adaptive_8h_source.html#l00045">engine_adaptive.h:45</a></div></div>
|
||||
</div><!-- fragment --><p>Note how the adaptive engine is a view of the base engine. This allows the adaptive engine to dynamically adjust the network size at runtime based on the reactions that are active. </p>
|
||||
</div></div><!-- PageDoc -->
|
||||
<a href="doxygen_crawl.html"></a>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Main Content Area -->
|
||||
<main class="container mx-auto px-4 sm:px-6 lg:px-8 py-8 sm:py-12 space-y-12">
|
||||
<!-- Home Section -->
|
||||
<section id="home" class="pt-8 -mt-8">
|
||||
<div class="content-card rounded-xl p-8 max-w-3xl mx-auto shadow-lg">
|
||||
<h1 class="text-3xl sm:text-4xl font-bold mb-4">GridFire</h1>
|
||||
<h2 class="text-xl sm:text-lg font-bold mb-5">A General Purpose Nuclear Network</h2>
|
||||
<p class="mb-6 text-lg">A graph-first nuclear network supporting dynamic network topologies. GridFire is intended to be easy to use and very adaptable to a variety of physical situations.</p>
|
||||
<div class="flex space-x-4">
|
||||
<a href="html/index.html" class="nav-link-btn bg-[var(--link-color)] text-white px-5 py-2 rounded-lg font-semibold hover:bg-[var(--link-hover-color)] transition-colors">Read the Docs</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="intro" class="pt-8 -mt-8">
|
||||
<div class="content-card rounded-xl p-8 max-w-4xl mx-auto shadow-lg">
|
||||
<h1 class="text-3xl font-bold mb-6">Usage</h1>
|
||||
<h2 class="text-2xl font-semibold mb-3">Introduction</h2>
|
||||
<p class="mb-4">GridFire is written in C++ but we maintain a robust set of Python bindings. These call the underlying C++ code, meaning that they are nearly as performant as the raw C++. Here we provide a short demonstration of how to use GridFire in Python.</p>
|
||||
<h2 class="text-2xl font-semibold mb-3">Core Concepts</h2>
|
||||
<p class="mb-4">GridFire separates the network into four main parts.</p>
|
||||
<ul class="mb-4 list-disc list-inside space-y-2">
|
||||
<li><b>Species:</b> These represent individual isotopes, tracking things such as their mass, beta decay energy, quantum numbers, and half-life. </li>
|
||||
<li><b>Reactions:</b> These represent reactions. All reactions from REACLIB, which include only reactant species up to and including iron, are included. Each reaction can evaluate the reaction rate based on the REACLIB formula. </li>
|
||||
<li><b>Engines:</b> Engines encode the underlying physical network. These can be either simplified networks (like `approx8Engine`) or more robust but slower networks (like `GraphEngine`). Engines are not directly evaluated; rather, solvers use engines to find abundances and energies. </li>
|
||||
<li><b>Solvers:</b> Solvers take an engine and know how to integrate it through time. This can either be a simple evaluation of the network topology or it can include more complex approximations such as QSE. </li>
|
||||
</ul>
|
||||
<h2 class="text-2xl font-semibold mb-3">Python Example</h2>
|
||||
<pre class="bg-gray-800 dark:bg-gray-900 text-white p-4 rounded-md text-sm overflow-x-auto"><code>from gridfire import GraphEngine, DirectSolver, NetIn
|
||||
from gridfire.composition import Composition
|
||||
baseComposition = Composition(["H-1", "He-4"], [0.7, 0.3])
|
||||
engine = GraphEngine(baseComposition)
|
||||
solver = DirectSolver(engine)
|
||||
|
||||
inputParams = NetIn(composition, 0.1, 100, 0, 1e17, 1e-16) // (composition, T9, density, intialEnergy, tMax, dt0)
|
||||
results = solver.evaluate(inputParams)
|
||||
</code></pre>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="border-t border-[var(--border-color)] mt-12 py-8">
|
||||
<div class="container mx-auto text-center text-sm text-[var(--text-color)] opacity-70">
|
||||
<p>© <span id="footer-copyright-year"></span> 4D-STAR Collaboration. All Rights Reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Funding Modal -->
|
||||
<div id="funding-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-60 hidden">
|
||||
<div class="modal-card w-full max-w-lg m-4 p-8 rounded-xl shadow-2xl relative">
|
||||
<button id="close-modal-btn" class="absolute top-4 right-4 text-2xl font-bold hover:text-gray-500">×</button>
|
||||
<h2 class="text-2xl font-bold mb-4">Funding information</h2>
|
||||
<p class="mb-6">4D-STAR is funded by European Research Council (ERC) under the Horizon Europe programme (Synergy Grant agreement No. 101071505: 4D-STAR)</p>
|
||||
<p class="mb-6">Work for this project is funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research</p>
|
||||
<p class="mb-6">© <span id="modal-copyright-year"></span> 4D-STAR Collaboration. </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
// --- THEME SWITCHER ---
|
||||
const htmlEl = document.documentElement;
|
||||
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
|
||||
function applyTheme(isDark) {
|
||||
htmlEl.classList.toggle("dark", isDark);
|
||||
}
|
||||
|
||||
applyTheme(prefersDarkScheme.matches);
|
||||
prefersDarkScheme.addEventListener("change", (e) => applyTheme(e.matches));
|
||||
|
||||
|
||||
// --- PAGE NAVIGATION & MODAL ---
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const fundingBtn = document.getElementById('funding-btn');
|
||||
const modal = document.getElementById('funding-modal');
|
||||
const closeModalBtn = document.getElementById('close-modal-btn');
|
||||
|
||||
const mobileMenuBtn = document.getElementById('mobile-menu-btn');
|
||||
const mobileMenu = document.getElementById('mobile-menu');
|
||||
const closeMobileMenuBtn = document.getElementById('close-mobile-menu-btn');
|
||||
const mobileNavLinks = document.querySelectorAll('.mobile-nav-link');
|
||||
const mobileFundingBtn = document.getElementById('mobile-funding-btn');
|
||||
|
||||
// Dynamic Copyright Year
|
||||
const currentYear = new Date().getFullYear();
|
||||
document.getElementById('footer-copyright-year').textContent = currentYear;
|
||||
document.getElementById('modal-copyright-year').textContent = currentYear;
|
||||
|
||||
function openModal() { modal.classList.remove('hidden'); }
|
||||
function closeModal() { modal.classList.add('hidden'); }
|
||||
function openMobileMenu() { mobileMenu.classList.remove('hidden'); }
|
||||
function closeMobileMenu() { mobileMenu.classList.add('hidden'); }
|
||||
|
||||
// Desktop navigation
|
||||
fundingBtn.addEventListener('click', openModal);
|
||||
closeModalBtn.addEventListener('click', closeModal);
|
||||
modal.addEventListener('click', (e) => {
|
||||
if (e.target === modal) closeModal();
|
||||
});
|
||||
|
||||
// Mobile navigation
|
||||
mobileMenuBtn.addEventListener('click', openMobileMenu);
|
||||
closeMobileMenuBtn.addEventListener('click', closeMobileMenu);
|
||||
|
||||
mobileFundingBtn.addEventListener('click', () => {
|
||||
closeMobileMenu();
|
||||
openModal();
|
||||
});
|
||||
|
||||
// Smooth scrolling for all anchor links
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
if (!mobileMenu.classList.contains('hidden')) {
|
||||
closeMobileMenu();
|
||||
}
|
||||
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// --- PARTICLE SIMULATION SCRIPT ---
|
||||
const canvas = document.getElementById('fusionCanvas');
|
||||
const heroSection = document.getElementById('hero-section');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
const MAX_PARTICLES = 150;
|
||||
const SPAWN_RATE = 2;
|
||||
const PARTICLE_LIFETIME_MIN = 500;
|
||||
const PARTICLE_LIFETIME_MAX = 1000;
|
||||
|
||||
const PARTICLE_COLORS_DARK = ['#aedff7', '#d9faff', '#ffffff', '#fff4d6', '#ffdd75', '#ffc94e'];
|
||||
const PARTICLE_COLORS_LIGHT = ['#555555', '#444444', '#333333', '#222222', '#111111', '#000000'];
|
||||
|
||||
let particles = [];
|
||||
let particleIdCounter = 0;
|
||||
|
||||
function resizeCanvas() {
|
||||
canvas.width = heroSection.clientWidth;
|
||||
canvas.height = heroSection.clientHeight;
|
||||
}
|
||||
window.addEventListener('resize', resizeCanvas);
|
||||
resizeCanvas();
|
||||
|
||||
function random(min, max) { return Math.random() * (max - min) + min; }
|
||||
|
||||
function gaussianRandom(mean = 0, stdev = 1) {
|
||||
let u = 1 - Math.random();
|
||||
let v = Math.random();
|
||||
let z = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
|
||||
return z * stdev + mean;
|
||||
}
|
||||
|
||||
class Particle {
|
||||
constructor() {
|
||||
this.id = particleIdCounter++;
|
||||
const distribution = Math.min(canvas.width, canvas.height) / 4;
|
||||
this.x = gaussianRandom(0, distribution);
|
||||
this.y = gaussianRandom(0, distribution / 1.5);
|
||||
this.z = random(1, 6);
|
||||
this.vx = random(-0.4, 0.4);
|
||||
this.vy = random(-0.2, 0.2);
|
||||
this.vz = random(-0.01, 0.01);
|
||||
this.baseRadius = random(1.5, 3.5);
|
||||
this.components = [{ id: this.id, lifetime: random(PARTICLE_LIFETIME_MIN, PARTICLE_LIFETIME_MAX) }];
|
||||
}
|
||||
|
||||
project() {
|
||||
const scale = 1 / (this.z * 0.5 + 1);
|
||||
const projX = (this.x * scale) + canvas.width / 2;
|
||||
const projY = (this.y * scale) + canvas.height / 2;
|
||||
const radiusMultiplier = 1 + (this.components.length * 0.1);
|
||||
const projRadius = this.baseRadius * scale * radiusMultiplier;
|
||||
const opacity = Math.max(0, 1 - (this.z / 8));
|
||||
return { projX, projY, projRadius, opacity };
|
||||
}
|
||||
|
||||
update() {
|
||||
this.components.forEach(c => c.lifetime--);
|
||||
this.x += this.vx; this.y += this.vy; this.z += this.vz;
|
||||
if (this.z <= 0.5 || this.z >= 7) {
|
||||
this.vz *= -1;
|
||||
this.z = Math.max(0.51, Math.min(6.99, this.z));
|
||||
}
|
||||
const pullFactor = 0.0005;
|
||||
this.vx -= this.x * pullFactor;
|
||||
this.vy -= this.y * pullFactor;
|
||||
}
|
||||
|
||||
draw(ctx) {
|
||||
const { projX, projY, projRadius, opacity } = this.project();
|
||||
if (projRadius < 0.3 || opacity <= 0) return;
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
const colors = isDark ? PARTICLE_COLORS_DARK : PARTICLE_COLORS_LIGHT;
|
||||
const colorIndex = Math.min(this.components.length - 1, colors.length - 1);
|
||||
const color = colors[colorIndex];
|
||||
ctx.beginPath();
|
||||
ctx.arc(projX, projY, projRadius, 0, Math.PI * 2);
|
||||
ctx.globalAlpha = opacity;
|
||||
ctx.shadowColor = color;
|
||||
ctx.shadowBlur = projRadius * 3;
|
||||
ctx.fillStyle = color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
function handleSpawning() {
|
||||
for (let i = 0; i < SPAWN_RATE; i++) {
|
||||
if (particles.length < MAX_PARTICLES) particles.push(new Particle());
|
||||
}
|
||||
}
|
||||
|
||||
function handleCollisionsAndMerging() {
|
||||
for (let i = 0; i < particles.length; i++) {
|
||||
for (let j = i + 1; j < particles.length; j++) {
|
||||
const p1 = particles[i]; const p2 = particles[j];
|
||||
const p1Proj = p1.project(); const p2Proj = p2.project();
|
||||
const dx = p1Proj.projX - p2Proj.projX; const dy = p1Proj.projY - p2Proj.projY;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
if (distance < p1Proj.projRadius + p2Proj.projRadius) {
|
||||
const absorber = (p1.components.length > p2.components.length || (p1.components.length === p2.components.length && p1.z < p2.z)) ? p1 : p2;
|
||||
const absorbed = (absorber === p1) ? p2 : p1;
|
||||
const totalMass = absorber.components.length + absorbed.components.length;
|
||||
absorber.vx = (absorber.vx * absorber.components.length + absorbed.vx * absorbed.components.length) / totalMass;
|
||||
absorber.vy = (absorber.vy * absorber.components.length + absorbed.vy * absorbed.components.length) / totalMass;
|
||||
absorber.vz = (absorber.vz * absorber.components.length + absorbed.vz * absorbed.components.length) / totalMass;
|
||||
absorber.components.push(...absorbed.components);
|
||||
absorber.baseRadius += absorbed.baseRadius * 0.4;
|
||||
absorbed.components.forEach(c => c.lifetime = 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
ctx.globalAlpha = 1; ctx.shadowBlur = 0;
|
||||
|
||||
const bodyBgColor = getComputedStyle(document.documentElement).getPropertyValue('--bg-color').trim();
|
||||
const canvasBgColor = bodyBgColor.replace('rgb', 'rgba').replace(')', ', 0.25)');
|
||||
|
||||
ctx.fillStyle = canvasBgColor;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
handleSpawning();
|
||||
handleCollisionsAndMerging();
|
||||
|
||||
const nextParticles = [];
|
||||
for (let i = 0; i < particles.length; i++) {
|
||||
const p = particles[i];
|
||||
p.update();
|
||||
const shouldDespawn = p.components.some(c => c.lifetime <= 0);
|
||||
if (!shouldDespawn) {
|
||||
p.draw(ctx);
|
||||
nextParticles.push(p);
|
||||
}
|
||||
}
|
||||
particles = nextParticles;
|
||||
ctx.globalAlpha = 1; ctx.shadowBlur = 0;
|
||||
}
|
||||
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user