File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1818#include " spar_mul.h"
1919
2020#include " Array3.h"
21+ #include " DebugMsg.h"
2122
2223#include < math.h>
2324
@@ -126,6 +127,9 @@ void gmres(fsi_linear_solver::FSILS_lhsType& lhs, fsi_linear_solver::FSILS_subLs
126127 #ifdef debug_gmres
127128 dmsg << " err(1): " << err[0 ];
128129 #endif
130+ if (err[0 ] == 0.0 ) {
131+ throw std::runtime_error (" FSILS: A zero matrix norm has been computed. This is probably caused by ill-posed boundary conditions." );
132+ }
129133
130134 if (l == 0 ) {
131135 eps = err[0 ];
@@ -309,6 +313,10 @@ void gmres_s(fsi_linear_solver::FSILS_lhsType& lhs, fsi_linear_solver::FSILS_sub
309313 u.set_col (0 , R - u_col);
310314
311315 err[0 ] = norm::fsi_ls_norms (mynNo, lhs.commu , u.col (0 ));
316+ if (err[0 ] == 0.0 ) {
317+ throw std::runtime_error (" FSILS: A zero matrix norm has been computed. This is probably caused by ill-posed boundary conditions." );
318+ }
319+
312320 u_col = u.col (0 ) / err[0 ];
313321 u.set_col (0 , u_col);
314322 #ifdef debug_gmres_s
@@ -487,6 +495,10 @@ void gmres_v(fsi_linear_solver::FSILS_lhsType& lhs, fsi_linear_solver::FSILS_sub
487495 }
488496
489497 err[0 ] = norm::fsi_ls_normv (dof, mynNo, lhs.commu , u.rslice (0 ));
498+ if (err[0 ] == 0.0 ) {
499+ throw std::runtime_error (" FSILS: A zero matrix norm has been computed. This is probably caused by ill-posed boundary conditions." );
500+ }
501+
490502 u_slice = u.rslice (0 ) / err[0 ];
491503 #ifdef debug_gmres_v
492504 dmsg << " err(1): " << err[0 ];
You can’t perform that action at this time.
0 commit comments