Skip to content

Commit 989d3e5

Browse files
authored
Catch solver error (#152)
1 parent 32b46d7 commit 989d3e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/algebra/SparseSystem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ void SparseSystem::update_jacobian(double time_coeff_ydot,
100100

101101
void SparseSystem::solve() {
102102
solver->factorize(jacobian);
103+
if (solver->info() != Eigen::Success) {
104+
throw std::runtime_error(
105+
"System is singular. Check your model (connections, boundary "
106+
"conditions, parameters).");
107+
}
103108
dydot.setZero();
104109
dydot += solver->solve(residual);
105110
}

0 commit comments

Comments
 (0)