[petsc-users] Inquiry about the PetscScalar in Petsc.

Barry Smith bsmith at petsc.dev
Tue Jul 11 10:40:35 CDT 2023


  Not really. PetscScalar (and entries of vectors etc) are either real or complex, they cannot be mixed. 

  What parts of PETSc are you using, DM? 

  You can 

1) store the coordinates in arrays and not use Vec for them. (of if you are not using DM)
2) sore them in Vec but with imaginary part 0 
3) rewrite your complex systems as real systems (with twice as many unknowns, but only real ones)

  Barry


> On Jul 11, 2023, at 11:34 AM, neil liu <liufield at gmail.com> wrote:
> 
> Dear Petsc developers,
> 
> My computation involves both real and complex numbers. 
> For example, my coordinate is real, but my matrix is complex. 
> 
> I use VecGetArray to get the coordinates. But it seems coordinates have to be defined in a complex manner to be consistent with complex matrix. 
> 
> Is there some ways to work around this if I understood correctly ?
> 
> Thanks, 
> 
> Xiaodong 
> 
> 
> 



More information about the petsc-users mailing list