<div dir="ltr"><div dir="ltr">On Tue, Jul 11, 2023 at 11:48 AM neil liu <<a href="mailto:liufield@gmail.com">liufield@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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></div></div></blockquote><div><br></div><div>We just store them with real part 0.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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" target="_blank">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>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>