Commit Graph

237 Commits

Author SHA1 Message Date
dfae8073bd log(CVODE_solver_strategy): Added new logging
Optional per step detailed logging has been enhanced to show the
timescales and status of each network species.
2025-11-18 08:16:33 -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
3f55676068 refactor(CVODE solver): log_step_diagnostic signature change
Added a new overload of log_step_diagnostic to allow for more granular
control over what is displayed. Also made some small teaks to relative
tolerance (absolute tolerance has remained unchaged)
2025-11-15 09:08:05 -05:00
b65626ca20 feat(NetworkJacobian): Rank caching, regularization, and CSV export
Comptuting the rank of a large matrix with QR factorization can be
expensive and the rank is often never needed. We have implimented a
caching system so that the rank is only computed when asked for, and
then only once. Further, the regularization method which was previously
in an anonomous namespace inside of a single translation unit has been
moved to the jacobian header and implimentation file. This allows all
parts of GridFire to access the same regularization method. Finally a
small CSV output method has been added which is useful for debugging
2025-11-15 09:05:41 -05:00
4a404f6e12 feat(diagnostics)
Improved CVODE step diagnostics to be able to save intermediate
jacobians and to be print which species are limiting the timestepping
2025-11-15 09:02:08 -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
2ed629e0bf feat(Table): Added table class for simpler logging
We have built a small table class in addition to the Column class which
allows for logging in a bit more straightforward manner
2025-11-14 10:55:38 -05:00
5fd42db394 feat(priming): Priming now uses solver to initialize species abundances
Instead of a complex system of identifying dominate channels and
approximating abundances based on that, priming now simply ignites a
basic network at 1e7K for 1e-15s. This is an effective approach to prime
relevant species while being short enough to not change the abundance of
any fuel species.
2025-11-14 10:55:03 -05:00
a9ef20f664 feat(policy network stack): Policies can now return the network stack
Policies can now return the network stack which allows the caller more
control over settings and running a solver against various levels of the
stack. Further, policies can return the partition function used as well
as a vector of enums which describe the structure of the network stack.
2025-11-14 10:53:38 -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
1500f863b6 fix(Reaction): resolved bug which prevented counting number of reactants and products properly
This bug was introduced when switching the internal tracking of products and reactants from a vector to a set. Initially we had done this to improve lookup performance. However, due to the uniquness of items in a set this broke counting methods. We have resolved this so that all old code will still work while maintaing the efficency gains by using an unordered map which stored species and counts. Further we have added countReactantOccurences and countProductOffurences methods to make this process more explicit and avalible to callers.
2025-11-14 10:45:45 -05:00
3335898979 feat(reaction_contribution_dashboard): added small web app to explore reaction contributions over time
This is a static webpage which will view JSON files in a format which I use (and will build into GridFire) and let users investigate the contributions each reaction at each timestep makes to the overall abundance of each species. This is invaluable when debugging a newtowk

BREAKING CHANGE:
2025-11-12 16:57:24 -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
741a11d256 feat(EnginePartitioningTrigger): update trigger
Engine Partitioning trigger now properly throws on both increased convergence failures and a timestep collapse (timestep collapsing more than a factor of 1/100th the average value for the past 10 steps)
2025-11-10 13:05:24 -05:00
8be36b9ce0 refactor(assets): removed old reaclib database from assets 2025-11-10 10:40:43 -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
534a44448b feat(policy): updateed policy system and added new reaction chains
Reacions chains now contain more information and are broken out in a more detailed fashion.
2025-11-06 09:18:23 -05:00
dbb6934fe6 docs(Doxygen): updated styling of inheritence to use dot for higher resolution 2025-11-06 09:17:01 -05:00
d7237e7367 docs(docs): rebuilt 2025-11-06 09:16:40 -05:00
ba306523d6 docs(docs): rebuilt 2025-11-05 18:38:07 -05:00
18d289da7e docs(policy): added doxygen docs to policy system 2025-11-05 18:37:31 -05:00
9fdbb57996 feat(policy): began addition of robust policy system
The policy system provides a way for users to ensure that they get a network with certain traits. For example being sure that the network they get has all of the proton proton reactions in its base reaction set. This is an extensible system which is intended to be used by researchers to build various determanistic network policies to make network results more reproducable
2025-11-05 12:48:08 -05:00
9bc6e9b0d4 feat(io): added ability to export the rate calculations of any engine to a python file
GridFire can now (to a very limited degree) approximate the abilities of pynucastro in so far as it can not just solve an engine but it can also export it to a python file. Currently only the rates are exported so no solver can yet be used (since things like the rest of the RHS and the jacobian are missing) but this is a step in that direction
2025-11-05 09:21:52 -05:00
7364eaafbd test(sandbox): some work on sandbox tests 2025-11-04 14:04:54 -05:00
77e6a918a5 docs(docs): rebuilt docs 2025-11-04 14:04:26 -05:00
e87206a4a3 docs(readme): updated readme to v0.7.0-alpha 2025-11-04 14:03:46 -05:00
d7e9597643 fix(python/solver): fidxed any cast issue with set_callback and moved initialization of solver context to before set callback 2025-11-04 13:24:29 -05:00
72a3f5bf4c feat(triggers): added ConvergenceFailureTrigger
added new trigger which throws on convergence failures. This also required adding a new "step" method for other triggers which gets called every step instead of every trigger throw. The ConvergenceFailureTrigger has sucsessgully let teh engine evolve to 10Gyr without any meaningful growth of convergence failures.
2025-11-04 13:22:57 -05:00
7f19143ff6 docs(construction): documented current default construction behavior 2025-11-04 13:20:46 -05:00
3c80ccc77f fix(python): added temporary patch to let python bindings work on mac
Mirroring what was done in fourdst (see fourdst/tree/v0.8.5) we have added a temporary patch to let python bindings work on mac while the meson-python folks resolve the duplicate rpath issue in the shared object file
2025-11-03 15:10:03 -05:00
0adc340767 fix(construction): removed std::optional arguments for weakRateInterpolator
Passing weak rate interpolator as an std::optional was resulting in use-after-free bugs due to std::optional making a copy of WeakRateInterpolator. This resulted in segfaults. Since we have the new construction semantics with flags this is no longer needed so the optional argument has been removed in favor of a simple const &
2025-11-03 09:43:36 -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
56f9342052 fix(AtomicWeakRate): added bool overrides for sparsity calculations
these allow the atomic weak rate to be used with the current sparsity code. Note also that this commit reintroduces the full weak reaction set which does introduce an enormouse degree of stiffness which will need to be filtered out. What this means is that this commit practically cannot evolve a network due to this stiffness
2025-10-31 07:38:04 -04:00
1af54132b8 fix(construction): added reaclib_reaction_is_weak call
previously I had neglected to actually call the heuristic removing weak reaclib reactions. This is now called properly. Therefore it is this commit which actually prevents weak reaclib reactions from getting registered
2025-10-31 07:08:54 -04:00
c40dd9d0f7 fix(network-construction): added check to reject reaclib weak reactions
reaclib provides a small number of weak reactions which allow for things like closing the CNO cycle. Howevever, they are not of the same quality as the WRL reactions. Therefore we ignore them during network construction through a simple heuristic (is the mass number the same on both sides and is there exactly 1 product and reactant (ignoring the beta +/- particle). This is one of the final steps before actually enabling weak reactions since withouty turning these off we would be double counting weak reactions.
2025-10-30 15:30:55 -04:00
6088fb9c12 test(graphnet_sandbox): updated graphnet sandbox to test full network stack 2025-10-30 15:06:59 -04: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
23df87f915 fix(graph_engine): fixed major bug with jacobian sparsity
previousl the sparsity calculations for the jacobian matrix were completly broken. The method subgraph_sparsity was returning that all derivities were only depenednt on temperature and density. It should have been reporting that they also depended on some of the abundances. This was resolved by switching to a different structural sparsity engine (for_jac_sparsity). This bug had turned the solver into a fixed point iteration solver which failed for the stiff system we have. Now that it is resolved the solver can once again evolved over Gyr timescales.
2025-10-29 14:47:11 -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
0581f69c48 perf(engine_multiscale): performance enhancments due to improved hashing, locality, and data structure optimization
This particular commit speeds up QSE solving for systems where reverse reactions and engine caching is disabled by about 24%
2025-10-22 15:08:49 -04:00
b20d3467fa build(libcomposition): version bump for fourdst to bring in libcomposition v1.9.1 whith major preformance enhancments
fourdst version v0.8.4
2025-10-22 15:06:11 -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
408f6d83a2 build(fourdst): version bump v0.8.2 -> v0.8.3
This fourdst version bump brings the libcomposition v1.9.0 which brings the abstract base class CompositionAbstract. This will allow us to impliment overrides which return specific molarAbundances skirting around Composition internal checks. This is for the purpose of allowing unrestricted molar flow when ccalculating the destruction rate constant for particular species.
2025-10-12 10:29:41 -04:00
25393f2470 refactor(engine_multiscale): removed debug output 2025-10-12 07:58:12 -04:00