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.
This commit is contained in:
@@ -133,7 +133,7 @@ namespace gridfire::diagnostics {
|
||||
const double T9,
|
||||
const double rho
|
||||
) {
|
||||
engine.generateJacobianMatrix(comp, T9, rho);
|
||||
const NetworkJacobian jac = engine.generateJacobianMatrix(comp, T9, rho);
|
||||
const auto& species_list = engine.getNetworkSpecies();
|
||||
|
||||
double max_diag = 0.0;
|
||||
@@ -143,7 +143,7 @@ namespace gridfire::diagnostics {
|
||||
|
||||
for (const auto& rowSpecies : species_list) {
|
||||
for (const auto& colSpecies : species_list) {
|
||||
const double val = std::abs(engine.getJacobianMatrixEntry(rowSpecies, colSpecies));
|
||||
const double val = std::abs(jac(rowSpecies, colSpecies));
|
||||
if (rowSpecies == colSpecies) {
|
||||
if (val > max_diag) { max_diag = val; max_diag_species = colSpecies; }
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user