[petsc-dev] VecNest

Matthew Knepley knepley at gmail.com
Tue Jul 12 07:41:43 CDT 2022


On Tue, Jul 12, 2022 at 7:39 AM Pierre Jolivet <pierre at joliv.et> wrote:

>
>
> On 12 Jul 2022, at 2:32 PM, Matthew Knepley <knepley at gmail.com> wrote:
>
> On Mon, Jul 11, 2022 at 1:17 PM Pierre Jolivet <pierre at joliv.et> wrote:
>
>> Hello,
>> Could anyone help me understand what is going on in the following
>> example, please?
>> I have a VecNest.
>> I either: a) initialize all values to 0.0, then set a specific part of
>> the vector to nonzero or b) initialize a part of the vector to 0.0 and set
>> the other part to nonzero.
>> I don’t see why a) and b) produce different results.
>>
>> $ ./ex1111 -pc_type fieldsplit -ksp_monitor_true_residual
>> -ksp_converged_reason -fieldsplit_pc_type jacobi -ksp_pc_side right
>> -ksp_view_final_residual -nest_subvec true
>>   0 KSP unpreconditioned resid norm 8.375635517980e-01 true resid norm
>> 8.375635517980e-01 ||r(i)||/||b|| 1.000000000000e+00
>>   1 KSP unpreconditioned resid norm 4.748816884247e-01 true resid norm
>> 4.748816884247e-01 ||r(i)||/||b|| 5.669798875623e-01
>>   2 KSP unpreconditioned resid norm 4.713006778679e-01 true resid norm
>> 4.713006778679e-01 ||r(i)||/||b|| 5.627043784990e-01
>>   3 KSP unpreconditioned resid norm 7.092979927129e-02 true resid norm
>> 7.092979927129e-02 ||r(i)||/||b|| 8.468587144106e-02
>>   4 KSP unpreconditioned resid norm 1.457836310255e-02 true resid norm
>> 1.457836310255e-02 ||r(i)||/||b|| 1.740567992870e-02
>>   5 KSP unpreconditioned resid norm 1.625040500524e-14 true resid norm
>> 1.633468028779e-14 ||r(i)||/||b|| 1.950261595401e-14
>> Linear solve converged due to CONVERGED_RTOL iterations 5
>> KSP final norm of residual 1.63347e-14
>> $ ./ex1111 -pc_type fieldsplit -ksp_monitor_true_residual
>> -ksp_converged_reason -fieldsplit_pc_type jacobi -ksp_pc_side right
>> -ksp_view_final_residual -nest_subvec false
>>   0 KSP unpreconditioned resid norm 0.000000000000e+00 true resid norm
>> 8.375635517980e-01 ||r(i)||/||b||            inf
>> Linear solve converged due to CONVERGED_ATOL iterations 0
>> KSP final norm of residual 0.837564
>>
>
> I find if I assemble the vector, I get the same answers. Will try to
> figure out what assembly is doing.
>
>
> It’s probably reseting all these values
> https://petsc.org/main/src/vec/vec/interface/rvector.c.html#line511,
> which I believe are being used in VecNorm() inside VecNormalize().
> I guess any call to VecNestSubVec() should invalidate those as well,
> otherwise we get wrong cached norms.
> I will give this a go.
>

I believe the bug is the following:

  You change values in a subvector, which does StateIncrease on the
subvector, but not StateIncrease on the nest vector, so it has its cached
norm

I am not sure what to do about this, since how can the parent know you
pulled out the subvector? Will think.

   Matt


> Thanks,
> Pierre
>
>   Thanks,
>
>     Matt
>
>
>> Thanks,
>> Pierre
>>
>>
>
> --
> 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-dev/attachments/20220712/142760de/attachment.html>


More information about the petsc-dev mailing list