How use scalar type and complex type at the same time?

Lisandro Dalcin dalcinl at
Wed Aug 20 10:16:28 CDT 2008

I believe the only way you can handle this is by using separate
programs linked with different PETSc configurations for the time
domain solver and the frequency domain solver. Of course, this
requires that both problems are somewhat "uncoupled" and that you use
some MPI-2 features (dynamic process management)  to make your two
programs "chat" each other.

If you have some knowledge of Python, I can offer you a rather simple
solution based on mpi4py (MPI for Python). You write a "master" Python
script communicating with each of your programs and managing the
interchange of data using MPI calls. With a bit of luck, you will not
need to add too much to your current code. Of course, you can skip the
Python way and code all the "master" part in C/C++/Fortran. Just let
me know if you are interested in this approach.

On Wed, Aug 20, 2008 at 9:19 AM, Zhifeng Sheng <z.sheng at> wrote:
> Dear all
> I am working on a FEM program, which can be used to solve time domain and
> frequency domain EM problems. I finished the time domain solver part and now
> I need to implement the frequency domain solver.... So I built Petsc with
> --scalar-type = complex, and then my time domain solver can not be compiled,
> it says " can not convert double to PetscScalar".
> Is there any way that I can handle both real matrix and complex matrix at
> the same time? (without changing my old code too much?)
> Thanks
> Best regards
> Zhifeng Sheng

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-users mailing list