Also look at
https://petsc.org/release/manualpages/KSP/KSPSetPCSide/#kspsetpcside and
https://petsc.org/release/manualpages/KSP/KSPSetNormType/#kspsetnormtype in
PETSc different Krylov solvers have different default values for this.
> On Jul 2, 2023, at 1:47 AM, 王赫萌 wrote:
>
> Dear
%90%8C=wanghemeng%40163.com=https%3A%2F%2Fmail-online.nosdn.127.net%2Fqiyelogo%2FdefaultAvatar.png=%5B%22wanghemeng%40163.com%22%5D>
> ---- Replied Message ----
> From Matthew Knepley
> Date 7/2/2023 20:32
> To 王赫萌
> Cc PETSc
> Subject Re: [petsc-users] Question about residu
t; Replied Message
> From Matthew Knepley
> Date 7/2/2023 20:10
> To 王赫萌
> Cc PETSc
> Subject Re: [petsc-users] Question about residue norm in PETSc
> On Sun, Jul 2, 2023 at 8:05 AM Matthew Knepley wrote:
>
>> On Sun, Jul 2, 2023 at 7:53 AM 王赫萌 wrote:
>&
uilt your code, but you did not send the matrix and rhs.
I suggest using
PetscCall(VecAXPY(u, -1.0, b));
instead so that you do not change b, and keep the residual in u.
Thanks,
Matt
Thanks,
Matt
> Thanks,
>
> Matt
>
>
>> Best regards!
>> Hemeng
the output
2) You are asking why you calculate a different residual? I will have to
run your code.
Thanks,
Matt
> Best regards!
> Hemeng Wang
>
>
> Replied Message
> From Matthew Knepley
> Date 7/2/2023 18:51
> To 王赫萌
> Cc petsc-users@mcs.anl.gov
>
On Sun, Jul 2, 2023 at 2:24 AM 王赫萌 wrote:
> Dear PETSc Team,
>
> Sorry to bother! My name is Hemeng Wang, and I am currently learning the
> use of PETSc software package. I am confused while calculating the norm of
> residue.
>
> I calculated residue norm by myself with:
> ```
>
Dear PETSc Team,
Sorry to bother! My name is Hemeng Wang, and I am currently learning the use of
PETSc software package. I am confused while calculating the norm of residue.
I calculated residue norm by myself with:
```
PetscCall(VecNorm(b, NORM_2, _b)); // (main.c, line 74)