<div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks for your reply. <div>I am using DMPLEX to read GMSH. And it seems I have to use </div><div>DMGetCoordinatesLocal();</div><div>VecGetArray(veccords, &coords);//it seems coords has to be defined by complex either.</div><div><br></div><div>2) Store the coordinates in coords with imaginary part equal to zero. </div><div>I got the coordinates from above function <b>VecGetArray</b>, therefore will this reduce the memory? </div><div><br></div><div>3) is a good way to work around that. </div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 11, 2023 at 11:40 AM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Not really. PetscScalar (and entries of vectors etc) are either real or complex, they cannot be mixed. <br>
<br>
What parts of PETSc are you using, DM? <br>
<br>
You can <br>
<br>
1) store the coordinates in arrays and not use Vec for them. (of if you are not using DM)<br>
2) sore them in Vec but with imaginary part 0 <br>
3) rewrite your complex systems as real systems (with twice as many unknowns, but only real ones)<br>
<br>
Barry<br>
<br>
<br>
> On Jul 11, 2023, at 11:34 AM, neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:<br>
> <br>
> Dear Petsc developers,<br>
> <br>
> My computation involves both real and complex numbers. <br>
> For example, my coordinate is real, but my matrix is complex. <br>
> <br>
> 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. <br>
> <br>
> Is there some ways to work around this if I understood correctly ?<br>
> <br>
> Thanks, <br>
> <br>
> Xiaodong <br>
> <br>
> <br>
> <br>
<br>
</blockquote></div>