# [petsc-users] Solving Linear Systems with Scalar Real and Complex

Pierpaolo Minelli pierpaolo.minelli at cnr.it
Fri Jul 20 07:54:40 CDT 2018

```Thanks a lot for the helpful tips.

Pierpaolo

> Il giorno 20 lug 2018, alle ore 14:08, Matthew Knepley <knepley at gmail.com> ha scritto:
>
> On Fri, Jul 20, 2018 at 8:01 AM Pierpaolo Minelli <pierpaolo.minelli at cnr.it <mailto:pierpaolo.minelli at cnr.it>> wrote:
> Hi,
>
> in my code I have to solve both a system in the field of real numbers and in the field of complex numbers.
> My approach has been as follows.
> First I configured PETSc with the --with-scalar-type=complex option.
> Using this option I have unfortunately lost the possibility to use the two preconditioners ML and Hypre.
> I later created two subspaces of Krylov and tried to solve the two systems as I used to when solving the only equation in the real numbers field.
> In order to correctly solve the system in the field of real numbers I had to transform the coefficients from real to complex with an imaginary part equal to zero.
>
> Is there a possibility to use a different and better approach to solve my problem?
>
> Perhaps an approach where you can continue to use ML and Hypre for system solving in the real numbers field or where you don't need to use complex numbers when real numbers would actually suffice?
>
> Yes, any linear system in complex numbers can be converted to a system twice as large in real numbers. So far,
> I think this is the best way to handle it, especially the elliptic ones.
>
>   Thanks,
>
>      Matt
>
>
> Pierpaolo
>
>
>
> --
> 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.caam.rice.edu/~mk51/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180720/3d912e9b/attachment.html>
```