<div dir="ltr"><div dir="ltr">On Fri, Aug 16, 2019 at 12:57 PM José Lorenzo <<a href="mailto:joslorgom@gmail.com">joslorgom@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="auto"><div>I tried that one as well but the result was the same as using eta-eta_old when calling VecAXPY.</div></div></blockquote><div><br></div><div>Do you think you could send a small example of getting different answers? We are fairly confident of the</div><div>correctness, so something else must be going on.</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 dir="auto"><div dir="auto">Thank you.<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">El vie., 16 ago. 2019 18:26, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> escribió:<br></div><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">On Fri, Aug 16, 2019 at 12:22 PM José Lorenzo via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" rel="noreferrer" target="_blank">petsc-users@mcs.anl.gov</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"><p>Hello,</p>
<p>I am struggling with a strange error when using VecAXPY. I have a ghost vector H that needs to be updated as</p>
<p>H = H + eta * dH - eta_old * dH</p>
<p>However, for some reason I obtain different results when using <br>
</p>
<p>call VecAXPY(H, eta - eta_old, dH, ierr)</p>
<p>instead of</p>
<p>call VecAXPY(H, - eta_old, dH, ierr)</p>
<p>call VecAXPY(H, eta, dH, ierr)</p>
<p>where eta and eta_old are PetscScalars.<br>
</p>
<p>The first option seems to provide a wrong output, but I do not understand what can go wrong in such simple operation.<br></p></div></blockquote><div>Fortran is really unforgiving about inputs. Try declaring a new PetscScalar diff = eta - eta_old and trying the first option with that.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt </div><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"><p>
</p>
<p>Thank you.</p></div></blockquote></div>-- <br><div dir="ltr" class="gmail-m_685385000519929687m_2772790380793674218gmail_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/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <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>