[petsc-users] reuse a real matrix for a second linear system with complex numbers

Matthew Knepley knepley at gmail.com
Fri May 14 05:00:01 CDT 2021


On Fri, May 14, 2021 at 4:23 AM feng wang <snailsoar at hotmail.com> wrote:

> Dear All,
>
> I am solving a coupled system. One system is AX=B. A, X and B are all real
> numbers and it is solved with GMRES in petsc. Now I need to solve a second
> linear system, it can be represented as (A+i*w)*Z=C. i is the imaginary
> unit.  Z and C are also complex numbers.
>
> So the Jacobian matrix of the second system is just A plus a diagonal
> contribution i*w.  I would like solve the second system with GMRES, could
> petsc handle this? any comments are welcome.
>

Mixing real and complex numbers in the same code is somewhat difficult now.
You have two obvious choices:

1) Configure for complex numbers and solve your first system as complex but
with 0 imaginary part. This will work fine, but uses more memory for that
system. However, since you will already
     use that much memory for the second system, it does not seem like a
big deal to me.

2) You could solve the second system in its equivalent real form

  / A  w \ /Zr\ = /Cr\
 \ -w  A / \Zi/     \Ci/

   This uses more memory for the second system, but does not require
reconfiguring.

  THanks,

     Matt

Thanks,
> Feng
>
-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210514/aae99d4a/attachment.html>


More information about the petsc-users mailing list