[petsc-users] VecAXPY

Matthew Knepley knepley at gmail.com
Fri Aug 16 12:15:51 CDT 2019


On Fri, Aug 16, 2019 at 12:57 PM José Lorenzo <joslorgom at gmail.com> wrote:

> I tried that one as well but the result was the same as using eta-eta_old
> when calling VecAXPY.
>

Do you think you could send a small example of getting different answers?
We are fairly confident of the
correctness, so something else must be going on.

  Thanks,

    Matt


> Thank you.
>
> El vie., 16 ago. 2019 18:26, Matthew Knepley <knepley at gmail.com> escribió:
>
>> On Fri, Aug 16, 2019 at 12:22 PM José Lorenzo via petsc-users <
>> petsc-users at mcs.anl.gov> wrote:
>>
>>> Hello,
>>>
>>> I am struggling with a strange error when using VecAXPY. I have a ghost
>>> vector H that needs to be updated as
>>>
>>> H = H + eta * dH - eta_old * dH
>>>
>>> However, for some reason I obtain different results when using
>>>
>>> call VecAXPY(H, eta - eta_old, dH, ierr)
>>>
>>> instead of
>>>
>>> call VecAXPY(H, - eta_old, dH, ierr)
>>>
>>> call VecAXPY(H, eta, dH, ierr)
>>>
>>> where eta and eta_old are PetscScalars.
>>>
>>> The first option seems to provide a wrong output, but I do not
>>> understand what can go wrong in such simple operation.
>>>
>> Fortran is really unforgiving about inputs. Try declaring a new
>> PetscScalar diff = eta - eta_old and trying the first option with that.
>>
>>   Thanks,
>>
>>     Matt
>>
>>> Thank you.
>>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190816/f542f720/attachment.html>


More information about the petsc-users mailing list