[petsc-users] petsc-3.5.2: ex12 with Neumann BC

Matthew Knepley knepley at gmail.com
Thu Nov 6 00:14:16 CST 2014


On Mon, Nov 3, 2014 at 9:46 AM, Olivier Bonnefon <
olivier.bonnefon at avignon.inra.fr> wrote:

>  Hello,
>
> Thank for your answer, I'll explain my trouble:
>
> My problem is that the BC Neumann leads to wrong result.
>
> With Dirichlet BC, I get:
> -------------------------------
>
> > ./ex12 -run_type full -refinement_limit 0.0    -bc_type dirichlet
> -interpolate 0 -petscspace_order 1 -show_initial -show_solution
> -dm_plex_print_fem 1
> ...
> ...
> Solution
> Vec Object:potential 1 MPI processes
>   type: seq
> 0.5
>
> This result is correct.
>
> With Neuman BC, I get:
> --------------------------------
>
> > ./ex12 -run_type full -refinement_limit 0.0    -bc_type neumann
> -interpolate 1 -petscspace_order 1 -show_initial -dm_plex_print_fem 1
> -show_solution -bd_petscspace_order 1 -snes_linesearch_monitor
> -snes_monitor -ksp_monitor_true_residual -snes_converged_reason
> -ksp_converged_reason
> ....
> ....
>
>
> Solution
> Vec Object:potential 1 MPI processes
>   type: seq
> -0.75
> -0.583333
> 0.0833333
> -0.583333
> -0.333333
> 0.416667
> 0.0833333
> 0.416667
> 1.25
>
>
> That is not the values of the solution x*x+y*y.
>

Sorry, this is poor documentation on my part. I will fix it in the example.
The Naumann solution
explicitly discards the constant part, meaning

  \int_\Omega u = 0

If we look at my solution

  \int^1_0 dx \int^1_0 dy x^2 + y^2 = 2/3

However, this is for the continuum result, whereas we are enforcing this in
the discrete case.
Thus, what we really get is 0.75, since we are integrating linear patches
instead of quadratic
patches. After shifting by that, you still do not get exactly x^2 + y^2
since there is some
discretization error. If you run with P2 you should get the exact answer,
shifted down to eliminate
the DC component.

  Thanks,

     Matt


>
> I tried many ksp options.
> Moreover, the neumann BC with "-run_type full" is not cover in the list
> https://bitbucket.org/petsc/petsc/src/fced3c3f9e703542693913793d15321603e40fe6/config/builder.py?at=master#cl-257
>
> Do you know what is wrong ?
>
> Thanks,
>
> Olivier Bonnefon
>
> On 10/31/2014 06:50 PM, Matthew Knepley wrote:
>
>  On Fri, Oct 31, 2014 at 10:43 AM, Olivier Bonnefon <
> olivier.bonnefon at avignon.inra.fr> wrote:
>
>> Hello,
>>
>> I'm working on the snes/examples/tutorial/ex12 version 3.5.2.
>>
>> I didn't succed to run the simplest case with Neumann BC:
>>
>> ./ex12 -run_type full -refinement_limit 0.0    -bc_type neumann
>> -interpolate 1 -petscspace_order 1 -show_initial -dm_plex_print_fem 1
>> -show_solution -bd_petscspace_order 1 -snes_linesearch_monitor
>> -snes_monitor -ksp_monitor_true_residual -snes_converged_reason
>> -ksp_converged_reason
>>
>> This leads to dofs negatives values.
>>
>
>  I do not understand what you mean. Please always mail the full error
> message.
>
>
>> Do you know the options to get a correct result with Neumann BC ?
>>
>
>  There are some tests here:
>
>
> https://bitbucket.org/petsc/petsc/src/fced3c3f9e703542693913793d15321603e40fe6/config/builder.py?at=master#cl-257
>
>     Matt
>
>
>> Regards,
>> Olivier Bonnefon
>>
>>
>
>
>  --
> 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
>
>
>
> --
> Olivier Bonnefon
> INRA PACA-Avignon, Unité BioSP
> Tel: +33 (0)4 32 72 21 58
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141106/f1c80bd9/attachment.html>


More information about the petsc-users mailing list