How to use iterative solver to solve complex value problem?

41 views
Skip to first unread message

沈键

unread,
Jul 15, 2022, 9:35:59 AM7/15/22
to deal.II User Group
  In step58, it suggested to use iterative solver to improve performance. And I tried gmres, but program threw error: "solver_gmres.h:676:13: error: cannot convert ‘std::complex<double>’ to ‘double’ in assignment". My code is as follows:

void TEST_Solver_Complex::solve() {
  LogStream::Prefix p("Solve");
  deallog << "Solving linear system..." << std::endl;

  // SparseDirectUMFPACK direct_solver;
  // solution = system_rhs;
  // direct_solver.solve(system_matrix, solution);
  SolverControl   solver_control(std::max<std::size_t>(1000,
                                                       system_rhs.size() / 10),
                                 1e-10 * system_rhs.l2_norm());
  SolverGMRES<Vector<std::complex<double>>> solver(solver_control);
  PreconditionJacobi<SparseMatrix<std::complex<double>>> preconditioner;
  preconditioner.initialize(system_matrix, 1.0);
  solver.solve(system_matrix, solution, system_rhs, preconditioner);

  deallog << "Done." << std::endl;
}

Can anyone point out what's wrong with this code snip snippet? Thanks for your help.

Wolfgang Bangerth

unread,
Jul 15, 2022, 3:26:58 PM7/15/22
to dea...@googlegroups.com
On 7/15/22 07:35, 沈键 wrote:
> **
I don't think you're doing anything wrong. SolverGMRES is simply not
implemented for complex-valued linear systems.

If you wanted to go this route, you'd need to find the right papers that
describe how to implement GMRES for complex arithmetic, and then implement
that (or modify the existing GMRES implementation). Or you treat the linear
system as a 2x2 block system in real/non-complex variables (like in step-29)
for which one could come up with block preconditioners and then apply the
existing GMRES implementation.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages