Skip to content

Commit

Permalink
Remove the local copy of Jacobian matrix when doing LU decomposition (#…
Browse files Browse the repository at this point in the history
…646)

remove the local copy of jaocbian matrix in the LinFactor function
  • Loading branch information
sjsprecious authored Sep 4, 2024
1 parent 7c5f4bf commit 51f6942
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/micm/solver/rosenbrock.inl
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,9 @@ namespace micm
singular = false;
while (true)
{
auto jacobian = state.jacobian_;
double alpha = 1 / (H * gamma);
static_cast<Derived*>(this)->AlphaMinusJacobian(jacobian, alpha);
linear_solver_.Factor(jacobian, state.lower_matrix_, state.upper_matrix_, singular);
static_cast<Derived*>(this)->AlphaMinusJacobian(state.jacobian_, alpha);
linear_solver_.Factor(state.jacobian_, state.lower_matrix_, state.upper_matrix_, singular);
stats.decompositions_ += 1;

// if we are checking for singularity and the matrix is not singular, we can break the loop
Expand All @@ -260,6 +259,10 @@ namespace micm
if (++n_consecutive > 5)
break;
H /= 2;
// Reconstruct the Jacobian matrix if a substepping is performed here
state.jacobian_.Fill(0.0);
rates_.SubtractJacobianTerms(state.rate_constants_, number_densities, state.jacobian_);
stats.jacobian_updates_ += 1;
}
}

Expand Down

0 comments on commit 51f6942

Please sign in to comment.