On Tue, May 11, 2021 at 4:03 PM Frederico Teixeira <teixeira@zmt.swiss> wrote:
Hi Mark,

I think so. The complex-valued linear system Ax = b, with A=T+Wi, u=x+yi, b=p+qi (i is the unit complex) can be transformed into a 2x2 real-valued system:
[ T  -W ] (x) = (p)
[ W   T ] (y)    (q)

Yes, this is ERF. 

Perhaps a bit more background can clarify things. System A stems from a Poisson equation with complex coefficients. There are ~130 piecewise constant coefficients ranging across 5 orders of magnitude.

I assume these are big jumps, are they?

You might be able to use GAMG or Hypre and tune the threshold to "see" these jumps if they are big enough.  In general large random coefficient jumps are hard with generic AMG. You have 130 patches so a coarse grid could in theory resolve this structure with a not too large "grid"

This may not be clear, but I would start with a real valued version of this and see if you can tune Hypre or GAMG to work OK. This could be done with, as I said, tuning the threshold parameter so that coarsening "sees" your jumps and respects them.

Next, use a coarse grid solve that is big enough to capture the geometry of your jumps, approximately, where an exact solver is used and it does not care about jumps.

As far as ERF, if you can translate it into a (complex) PetscScalar matrix somehow then you can use GAMG. I don't know about Hypre.

Or, I have used ERF with some success. A long time ago. You want to interleave the real and complex parts. How big is |W| / |T| ? If this is small it should work OK, but it is hard to be sure.
 
Most of the KSPs and PCs I managed to test take between 6000-9000 iterations to reach 10^-9. I hope to get some speed up with preconditioners that exploit the structure above.

Regards,
 Frederico.

Dr. Frederico Teixeira
Computational Modeler and Software Developer, ZMT (member of Zurich43)

P +41 44 245 9698
Zeughausstrasse 43, 8004 Zurich, Switzerland



From: "Mark Adams" <mfadams@lbl.gov>
To: "Frederico Teixeira" <teixeira@zmt.swiss>
Cc: "petsc-users" <petsc-users@mcs.anl.gov>
Sent: Tuesday, May 11, 2021 5:16:35 PM
Subject: Re: [petsc-users] Binary format in real vs. complex scalar type configurations



On Tue, May 11, 2021 at 9:30 AM Frederico Teixeira <teixeira@zmt.swiss> wrote:
Dear fellows,

I hope this message finds you safe and well.

I have a complex-valued matrix and its real/imaginary components in binary format. They were extracted from a solver that only works with "scalar-type=complex" configuration.
I am getting weird results when I load them into a small test program that's configured with "scalar-type=real", but I believe this is expected.
At the end of the day, I would like to have both real and imaginary components as real-valued matrices.
Is it possible to do it? I want to test preconditioners that are tailored for this sort of problem.

Do you mean you want what is called "equivalent real form" where the real and complex parts are stored as type 'double' for example and operations like multiply take two pairs of doubles, do a complex multiply manually, and return a real/complex pair of doubles?
 

Regards,
 Frederico.