-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ILU preconditioner error #228
Comments
This error usually means what it says: the system matrix A has zero somewhere on the diagonal. The ILU implementation in amgcl does not have pivoting, so it can not cope with this situation. |
Thanks for the reply. For the system matrix |
How are you using amgcl then? If you set up ILU0 for a matrix |
I overwrite the namespace amgcl {
namespace backend {
template <class Alpha, class DATA, class Vector1, class Beta, class Vector2>
struct spmv_impl<Alpha, Linear_Solver<DATA>, Vector1, Beta, Vector2> {
static void apply(Alpha alpha, const Linear_Solver<DATA> &A, const Vector1 &x, Beta beta, Vector2 &y)
{
vector<arcomplex<DATA>> t(y.size());
A.linear_solver_lhs(&t[0], &x[0]);
//// This should implement operation y = beta * y + alpha * A * x
//// you can probably adjust implementation of your `lhs_gmres_solver_complex()` function,
//// but right now you would need a temporary vector to do this:
//std::vector<std::complex<T>> t(y.size());
for (int i = 0; i < y.size(); ++i) {
y[i] = beta * y[i] + alpha * t[i];
}
}
};
template <class DATA, class Vector1, class Vector2, class Vector3>
struct residual_impl<
Linear_Solver<DATA>, Vector1, Vector2, Vector3
>
{
static void apply(
const Vector1 &rhs,
const LLG_Linear_Solver<DATA> &A,
const Vector2 &x,
Vector3 &res
)
{
A.linear_solver_lhs(&res[0], &x[0]);
for (int p = 0; p < x.size(); p++)
{
res[p] = rhs[p] - res[p];
}
}
};
} // namespace backend
} //namespace amgcl where typedef amgcl::backend::builtin< std::complex<data_type> > Backend;
typedef amgcl::make_solver<
amgcl::relaxation::as_preconditioner<Backend, relaxation::ilu0>,
amgcl::solver::fgmres<Backend>
> Solver;
this->solve = new Solver(std::tie(mat_size, preconditioner_ia,
preconditioner_ja, preconditioner_a), prm);
std::tie(iters, error_out) = (*(this->solve))(*this, x, y); |
Ok, I see (sorry for not getting it from the first time). So it looks like your preconditioner matrix ( |
Thanks for your reply. I have double-checked my preconditioner matrix However, when I switched to the typedef amgcl::backend::builtin< std::complex<data_type> > Backend;
typedef amgcl::make_solver<
amgcl::relaxation::as_preconditioner<Backend, relaxation::ilut>,
amgcl::solver::fgmres<Backend>
> Solver; all other codes remain same. In this case, the preconditioner part doesn't fail but the solver fails, it quits in the first iteration with I also trited |
The ILUt is somewhat tricky, as it often requires manual tuning of its |
Hi I am trying to solve a complex number system with the ILU0 preconditioner (single level), the declaration is
the
preconditioner_ia, preconditioner_ja, preconditioner_a
are the row, column, and value array of the crs format preconditioner matrixP
. I make sure that diagonal elements ofP
is non-zero. When solving the system, in some case this throws the error`
Zero pivot in ILU
No diagonal value in system matrix
`
I tracked the error message in the amgcl source codes, the error message comes from the codes in
ilu0.hpp
:It seems to me that in the preconditioner matrix
P
, it cannot contains element that has column numberc
greater than the row numberi
. Am I correct? And what should I do to solve this issue? Should I modify theP
to remove the element withc>i
? Thanks in advance for any help!The text was updated successfully, but these errors were encountered: