|
GridFire 0.0.1a
General Purpose Nuclear Network
|
Functor for solving QSE abundances using Eigen's nonlinear optimization. More...
Public Types | |
| enum | { InputsAtCompileTime = Eigen::Dynamic , ValuesAtCompileTime = Eigen::Dynamic } |
| using | InputType = Eigen::Matrix<double, Eigen::Dynamic, 1> |
| using | OutputType = Eigen::Matrix<double, Eigen::Dynamic, 1> |
| using | JacobianType = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> |
Public Member Functions | |
| EigenFunctor (MultiscalePartitioningEngineView &view, const std::vector< size_t > &qse_solve_indices, const std::vector< double > &Y_full_initial, const double T9, const double rho, const Eigen::VectorXd &Y_scale) | |
| Constructs an EigenFunctor. | |
| int | values () const |
| Gets the number of output values from the functor (size of the residual vector). | |
| int | inputs () const |
| Gets the number of input values to the functor (size of the variable vector). | |
| int | operator() (const InputType &v_qse, OutputType &f_qse) const |
Evaluates the functor's residual vector f_qse = dY_alg/dt. | |
| int | df (const InputType &v_qse, JacobianType &J_qse) const |
Evaluates the Jacobian of the functor, J_qse = d(f_qse)/d(v_qse). | |
Public Attributes | |
| MultiscalePartitioningEngineView * | m_view |
| Pointer to the MultiscalePartitioningEngineView instance. | |
| const std::vector< size_t > & | m_qse_solve_indices |
| Indices of the species to solve for in the QSE group. | |
| const std::vector< double > & | m_Y_full_initial |
| Initial abundances of all species in the full network. | |
| const double | m_T9 |
| Temperature in units of 10^9 K. | |
| const double | m_rho |
| Density in g/cm^3. | |
| const Eigen::VectorXd & | m_Y_scale |
| Scaling factors for the species abundances, used to improve solver stability. | |
Functor for solving QSE abundances using Eigen's nonlinear optimization.
@purpose This struct provides the objective function (operator()) and its Jacobian (df) to Eigen's Levenberg-Marquardt solver. The goal is to find the abundances of algebraic species that make their time derivatives (dY/dt) equal to zero.
@how
operator(): Takes a vector v_qse (scaled abundances of algebraic species) as input. It constructs a full trial abundance vector y_trial, calls the base engine's calculateRHSAndEnergy, and returns the dY/dt values for the algebraic species. The solver attempts to drive this return vector to zero.df: Computes the Jacobian of the objective function. It calls the base engine's generateJacobianMatrix and extracts the sub-matrix corresponding to the algebraic species. It applies the chain rule to account for the asinh scaling used on the abundances.The abundances are scaled using asinh to handle the large dynamic range and ensure positivity.
Definition at line 729 of file engine_multiscale.h.
| using gridfire::MultiscalePartitioningEngineView::EigenFunctor::InputType = Eigen::Matrix<double, Eigen::Dynamic, 1> |
Definition at line 730 of file engine_multiscale.h.
| using gridfire::MultiscalePartitioningEngineView::EigenFunctor::JacobianType = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> |
Definition at line 732 of file engine_multiscale.h.
| using gridfire::MultiscalePartitioningEngineView::EigenFunctor::OutputType = Eigen::Matrix<double, Eigen::Dynamic, 1> |
Definition at line 731 of file engine_multiscale.h.
| anonymous enum |
| Enumerator | |
|---|---|
| InputsAtCompileTime | |
| ValuesAtCompileTime | |
Definition at line 733 of file engine_multiscale.h.
|
inline |
Constructs an EigenFunctor.
| view | The MultiscalePartitioningEngineView instance. |
| qse_solve_indices | Indices of the species to solve for in the QSE group. |
| Y_full_initial | Initial abundances of all species. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
| Y_scale | Scaling factors for the species abundances. |
Definition at line 773 of file engine_multiscale.h.
| int gridfire::MultiscalePartitioningEngineView::EigenFunctor::df | ( | const InputType & | v_qse, |
| JacobianType & | J_qse ) const |
Evaluates the Jacobian of the functor, J_qse = d(f_qse)/d(v_qse).
| v_qse | The input vector of scaled algebraic abundances. |
| J_qse | The output Jacobian matrix. |
Definition at line 1525 of file engine_multiscale.cpp.
|
inlinenodiscard |
Gets the number of input values to the functor (size of the variable vector).
Definition at line 797 of file engine_multiscale.h.
| int gridfire::MultiscalePartitioningEngineView::EigenFunctor::operator() | ( | const InputType & | v_qse, |
| OutputType & | f_qse ) const |
Evaluates the functor's residual vector f_qse = dY_alg/dt.
| v_qse | The input vector of scaled algebraic abundances. |
| f_qse | The output residual vector. |
Definition at line 1503 of file engine_multiscale.cpp.
|
inlinenodiscard |
Gets the number of output values from the functor (size of the residual vector).
Definition at line 792 of file engine_multiscale.h.
| const std::vector<size_t>& gridfire::MultiscalePartitioningEngineView::EigenFunctor::m_qse_solve_indices |
Indices of the species to solve for in the QSE group.
Definition at line 745 of file engine_multiscale.h.
| const double gridfire::MultiscalePartitioningEngineView::EigenFunctor::m_rho |
Density in g/cm^3.
Definition at line 757 of file engine_multiscale.h.
| const double gridfire::MultiscalePartitioningEngineView::EigenFunctor::m_T9 |
Temperature in units of 10^9 K.
Definition at line 753 of file engine_multiscale.h.
| MultiscalePartitioningEngineView* gridfire::MultiscalePartitioningEngineView::EigenFunctor::m_view |
Pointer to the MultiscalePartitioningEngineView instance.
Definition at line 741 of file engine_multiscale.h.
| const std::vector<double>& gridfire::MultiscalePartitioningEngineView::EigenFunctor::m_Y_full_initial |
Initial abundances of all species in the full network.
Definition at line 749 of file engine_multiscale.h.
| const Eigen::VectorXd& gridfire::MultiscalePartitioningEngineView::EigenFunctor::m_Y_scale |
Scaling factors for the species abundances, used to improve solver stability.
Definition at line 761 of file engine_multiscale.h.