[petsc-users] Increasing norm with finer mesh

Fande Kong fdkong.jd at gmail.com
Tue Oct 16 20:54:52 CDT 2018


Use -ksp_view to confirm the options are actually set.

Fande 

Sent from my iPhone

> On Oct 16, 2018, at 7:40 PM, Ellen M. Price <ellen.price at cfa.harvard.edu> wrote:
> 
> Maybe a stupid suggestion, but sometimes I forget to call the
> *SetFromOptions function on my object, and then get confused when
> changing the options has no effect. Just a thought from a fellow grad
> student.
> 
> Ellen
> 
> 
>> On 10/16/2018 09:36 PM, Matthew Knepley wrote:
>> On Tue, Oct 16, 2018 at 9:14 PM Weizhuo Wang <weizhuo2 at illinois.edu
>> <mailto:weizhuo2 at illinois.edu>> wrote:
>> 
>>    I just tried both, neither of them make a difference. I got exactly
>>    the same curve with either combination.
>> 
>> 
>> I have a hard time believing you. If you make the residual tolerance
>> much finer, your error will definitely change.
>> I run tests every day that do exactly this. You can run them too, since
>> they are just examples.
>> 
>>   Thanks,
>> 
>>      Matt
>>  
>> 
>>    Thanks!
>> 
>>    Wang weizhuo
>> 
>>    On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley <knepley at gmail.com
>>    <mailto:knepley at gmail.com>> wrote:
>> 
>>        On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang
>>        <weizhuo2 at illinois.edu <mailto:weizhuo2 at illinois.edu>> wrote:
>> 
>>            Hello again!
>> 
>>            After some tweaking the code is giving right answers now.
>>            However it start to disagree with MATLAB results
>>            ('traditional' way using matrix inverse) when the grid is
>>            larger than 100*100. My PhD advisor and I suspects that the
>>            default dimension of the Krylov subspace is 100 in the test
>>            case we are running. If so, is there a way to increase the
>>            size of the subspace?
>> 
>> 
>>        1) The default subspace size is 30, not 100. You can increase
>>        the subspace size using
>> 
>>               -ksp_gmres_restart n
>> 
>>        2) The problem is likely your tolerance. The default solver
>>        tolerance is 1e-5. You can change it using
>> 
>>               -ksp_rtol 1e-9
>> 
>>          Thanks,
>> 
>>             Matt
>>         
>> 
>> 
>>            Disagrees.png
>> 
>>            Thanks!
>> 
>>            Wang Weizhuo
>> 
>>            On Tue, Oct 9, 2018 at 2:50 AM Mark Adams <mfadams at lbl.gov
>>            <mailto:mfadams at lbl.gov>> wrote:
>> 
>>                To reiterate what Matt is saying, you seem to have the
>>                exact solution on a 10x10 grid. That makes no sense
>>                unless the solution can be represented exactly by your
>>                FE space (eg, u(x,y) = x + y).
>> 
>>                On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley
>>                <knepley at gmail.com <mailto:knepley at gmail.com>> wrote:
>> 
>>                    On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang
>>                    <weizhuo2 at illinois.edu
>>                    <mailto:weizhuo2 at illinois.edu>> wrote:
>> 
>>                        The code is attached in case anyone wants to
>>                        take a look, I will try the high frequency
>>                        scenario later.
>> 
>> 
>>                    That is not the error. It is superconvergence at the
>>                    vertices. The real solution is trigonometric, so your
>>                    linear interpolants or whatever you use is not going
>>                    to get the right value in between mesh points. You
>>                    need to do a real integral over the whole interval
>>                    to get the L_2 error.
>> 
>>                      Thanks,
>> 
>>                         Matt
>>                     
>> 
>>                        On Mon, Oct 8, 2018 at 7:58 PM Mark Adams
>>                        <mfadams at lbl.gov <mailto:mfadams at lbl.gov>> wrote:
>> 
>> 
>> 
>>                            On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang
>>                            <weizhuo2 at illinois.edu
>>                            <mailto:weizhuo2 at illinois.edu>> wrote:
>> 
>>                                The first plot is the norm with the flag
>>                                -pc_type lu with respect to number of
>>                                grids in one axis (n), and the second
>>                                plot is the norm without the flag
>>                                -pc_type lu. 
>> 
>> 
>>                            So you are using the default PC w/o LU. The
>>                            default is ILU. This will reduce high
>>                            frequency effectively but is not effective
>>                            on the low frequency error. Don't expect
>>                            your algebraic error reduction to be at the
>>                            same scale as the residual reduction (what
>>                            KSP measures). 
>>                             
>> 
>> 
>> 
>>                        -- 
>>                        Wang Weizhuo
>> 
>> 
>> 
>>                    -- 
>>                    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/
>>                    <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cse.buffalo.edu_-7Eknepley_&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=hsLktHsuxNfF6zyuWGCN8x-6ghPYxhx4cV62Hya47oo&m=EFM29ATgv4U8PjXEtfgMkuxKr5DGscMlH-j769W5W_4&s=grgSL2LaDCthvYvvFITmeOOWPCwgmNfYRPs94N8kmOs&e=>
>> 
>> 
>> 
>>            -- 
>>            Wang Weizhuo
>> 
>> 
>> 
>>        -- 
>>        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/%7Eknepley/>
>> 
>> 
>> 
>>    -- 
>>    Wang Weizhuo
>> 
>> 
>> 
>> -- 
>> 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/%7Eknepley/>


More information about the petsc-users mailing list