Commit Graph

30 Commits

Author SHA1 Message Date
442d4ed86c feat(KINSOL): Switch from Eigen to KINSOL
Previously QSE solving was done using Eigen. While this worked we were
limited in the ability to use previous iterations to speed up later
steps. We have switched to KINSOL, from SUNDIALS, for linear solving.
This has drastically speed up the process of solving for QSE abundances,
primarily because the jacobian matrix does not need to be generated
every single time time a QSE abundance is requested.
2025-11-19 12:06:21 -05:00
80dba50330 perf(EigenFunctor): Jacobian Cachine
FOr QSE solving the Jacobian does not change meaninfully between steps.
We have introduced caching so that it does not need to be reevaluated
every step
2025-11-19 07:17:57 -05:00
8b1b7c3034 feat(MultiscalePartitioningEngineView): New check for log abundance normalized flow
We added one new check to the partitioning stage for
MultiscalePartitioningEngine view which, after group validation, prunes
any species only connected by reactions with a log(flow/mean involved
species abundance) less than -30. Currently this is a magic number and
will need to be adjusted. These pruned groups succsessfully prevent
light elements getting vacumed up into QSE groups due to their overall
weak couplings to the entire network. This is important else the
conditioning of the QSE systems falls apart.
2025-11-18 08:15:34 -05:00
47c446a0a2 fix(engine_multiscale): Eigen status 2025-11-15 09:08:24 -05:00
b5d76e3728 feat(jacobian): Added regularization
There are times when the jacobian matrix has infinities or nans. If
these cases correspond to species (rows or columns) which have
effectivley zero abundance (i.e. if Y(Cl-32) ~ 1e-310 and
(dY(H-2)/dt)/dY(Cl-32) is inf) then it is safe to regularize these
entries to 0. If this is not done then the solver will end up finding
NaN values for the molar abundances on subsequent steps. This has been
implimented through a small regularization function in the
CVODE_solver_strategy file.
2025-11-14 18:49:29 -05:00
9417b79a32 feat(Jacobian): Jacobian generation is now stateless.
Previously Jacobians were stored by engines and accessed through engine
accessors (e.g getJacobianMatrixEntry); however, this resulted in
desynced jacobian states. We have changed to a pattern of Engine creates
a jacobian and returns it to the caller. The caller can then do what
they will with it. Because of this the getJacobianMatrixEntry method has
been removed.

BREAKING CHANGE:
    - There is no longer any getJacobianMatrixEntry method on
DynamicEngine classes
    - the generateJacobian method signature has changed to return a
NetworkJacobian object. Internally this uses an Eigen Sparse Matrix to
store its data.
2025-11-14 10:51:40 -05:00
81cca35130 fix(MultiscalePartitioningEngineView): began work to call the QSE solver every timestep
one major issue was that QSE solving was only running at each partition. This was creating effectivley infinite sources of partitioned species. Now we partition when engine updates are triggered, however, solveQSEAbundance is called every timestep. This has major performance implications and so has required a lot of optimization to make it even somewhat viable. For now construction is much slower. Time per iteration is still slower than it was before; however, it is tractable. There is also currently too much stiffness in the network. This is likeley a bug that was introduced in this refactoring which will be addressed soon.
2025-11-12 16:54:12 -05:00
a7a4a30028 feat(Comoposition-Tracking): updated GridFire to use new, molar-abundance based, version of libcomposition (v2.0.6)
This entailed a major rewrite of the composition handling from each engine and engine view along with the solver and primer. The intent here is to let Compositions be constructed from the same extensive property which the solver tracks internally. This addressed C0 discontinuity issues in the tracked molar abundances of species which were introduced by repeadidly swaping from molar abundance space to mass fraction space and back. This also allowed for a simplification of the primeNetwork method. Specifically the mass borrowing system was dramatically simplified as molar abundances are extensive.
2025-11-10 10:40:03 -05:00
70ebe151ba fix(gcc-builds): fixed signedness warnings on gcc builds 2025-11-03 08:53:56 -05:00
86d7a283a1 feat(GraphEngine): More robust reaction type selection at network construction
Added new ways to select exactly what types of reactions (strong, beta+, beta-, electron capture, positron capture, or any combination thereof) can be turned on at network construction time. There are a few quality of life masks added as well such as weak which addes all weak type reactions, and all which adds weak + strong reactions. The default is to just add strong reactions for now.
2025-11-03 08:38:21 -05:00
7fded59814 fix(python-bindings): Updated python bindings to new interface
The python bindings now work with the polymorphic reaction class and the CVODE solver
2025-10-30 15:05:08 -04:00
66b2471c13 fix(LogicalReaclibReaction): fixed bug where reaclib reverse reactions were being included in forward reaction sets erroneously
Previously, due to a indexing issue, reverse rates were sometimes included in the forward rates for strong reactions. This lead to erroneously high molar reaction flows for some reactions. This has been resolved so now each logical reaction set is guareteed to include only either forward reactions or reverse reactions (not both)
2025-10-28 07:35:38 -04:00
c94740f08f fix(CVODE_solver_strategy): solved a bug wherein mass fractions were not being properly computed from molar abundances. 2025-10-26 15:15:03 -04:00
3fac6390e6 perf(graph_engine): refactored recordEpsTape to reduce repeated work
previously recordADTape was duplicating a lot of work which recordEpsTape also needed to do. Now all derivs are being recorded into m_rhsADFun so that only one tape recording phase is needed per network build stage.
2025-10-24 14:47:21 -04:00
98db2b1d43 perf(graph_engine): finished sparsity system for jacobian, major preformance win, roughly 20x faster
essentially all callers can now inform the graph engine about which species they hold active and graph engine then uses those to define a sparsity pattern and only calculate the jacobian along that sparsity pattern
2025-10-24 11:17:22 -04:00
ced29d2f63 fix(engine_multiscale): resolved bug which prevented proper equilibrium abundances from being found
this was done by adjusting the scaling of the QSE operator() residuals from r = dy/dt to r=(dy/dt)/y
2025-10-22 09:54:10 -04:00
3b8a0a1f33 fix(engine_multiscale): resolved a major species index ordering bug
All jacobian calculations were broken because the indexing used to record the AD tape was broken (see not parallel to) the indexing used by the composition object. A fix for this was to sort the network species by mass. However, more generally we should introduce a mechanism to ensure these two indexed sets always remain parallel
2025-10-14 13:37:48 -04:00
25393f2470 refactor(engine_multiscale): removed debug output 2025-10-12 07:58:12 -04:00
bc666ff783 docs(engine_multiscale): improved error message when Eigen failes to converge to a solution for QSE solver 2025-10-12 07:52:30 -04:00
2f1077c02d fix(weakRates): major progress in resolving bugs
bigs were introduced by the interface change from accepting raw molar abundance vectors to using the composition vector. This commit resolves many of these, including preformant ways to report that a species is not present in the composition and unified index lookups using composition object tooling.

BREAKING CHANGE:
2025-10-10 09:12:40 -04:00
13e2ea9ffa feat(weak-reactions): brought weak reaction code up to a point where it will compile (NOT YET TESTED) 2025-10-08 11:17:35 -04:00
8a0b5b2c36 feat(weak): major weak rate progress
Major weak rate progress which includes: A refactor of many of the public interfaces for GridFire Engines to use composition objects as opposed to raw abundance vectors. This helps prevent index mismatch errors. Further, the weak reaction class has been expanded with the majority of an implimentation, including an atomic_base derived class to allow for proper auto diff tracking of the interpolated table results. Some additional changes are that the version of fourdst and libcomposition have been bumped to versions with smarter caching of intermediate vectors and a few bug fixes.
2025-10-07 15:16:03 -04:00
4f1c260444 feat(trigger): added working robust repartitioning trigger system
more work is needed to identify the most robust set of criteria to trigger on but the system is now very easy to exend, probe, and use.
2025-09-29 13:35:48 -04:00
4c91f8c525 feat(CVODE_Solver_Strategy): added non negative constraint to CVODE based abundance solver
this prevents abundance values from going negative which is non physical
2025-09-22 11:15:14 -04:00
813e62bdd6 feat(dynamic-engine): added derivitves for energy generation rate. dε/dT and dε/dρ have been added to NetOut and computed with auto diff 2025-09-19 15:14:46 -04:00
ed1c5a1ac7 feat(solver): added CVODE solver from SUNDIALS 2025-08-15 12:11:32 -04:00
0b77f2e269 refactor(reaction): refactored to an abstract reaction class in prep for weak reactions 2025-08-14 13:33:46 -04:00
cc3708fda5 build(GridFire): building on gcc and clang
resolved some issues preventing GridFire from building on both gcc and clang. Also resolved all warnings on both compilers.
2025-07-24 10:20:44 -04:00
c3bc75a7f4 docs(GridFire): added loads of docs and supressed yaml-cpp shadow warnings 2025-07-24 08:37:52 -04:00
f20bffc411 feat(python): added robust python bindings covering the entire codebase 2025-07-23 16:26:30 -04:00