<div dir="ltr"><div dir="ltr"><div class="gmail_default"><div class="gmail_default"><font face="comic sans ms, sans-serif">Hello PETSc Developers,</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"><br></font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">Thanks for the response!</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"><br></font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">To calculate error, I first calculate the analytical solution and put it inside vector s.</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">Then I took difference between analytical solution and numerical solution and put it inside vector x.</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">Then I calculate the NORM_2 of x.</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">The code is as follows:</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">/*</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> Check the error</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> */</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> for (i = 0; i < n; i++)</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> {</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> k1 = (float) (i+1)/(n+1);</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> k2 = -0.5 * k1 * k1 + 5.5 * k1 + 10;</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> </font><span style="font-family:"comic sans ms",sans-serif">ierr = VecSetValues(s, 1, &i, &k2, INSERT_VALUES);CHKERRQ(ierr);</span></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> }</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> </font><span style="font-family:"comic sans ms",sans-serif"> </span><span style="font-family:"comic sans ms",sans-serif">ierr = VecAXPY(x,-1.0,s);CHKERRQ(ierr);</span></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> </font><span style="font-family:"comic sans ms",sans-serif">ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);</span></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> </font><span style="font-family:"comic sans ms",sans-serif"> if (norm > tol) {</span></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> ierr = PetscPrintf(PETSC_COMM_WORLD,"Second Norm of error %g\n",(double)norm);CHKERRQ(ierr);</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"> }</font></div><div style="font-family:"comic sans ms",sans-serif"><br></div><div style="font-family:"comic sans ms",sans-serif">Thanks again.</div><div style="font-family:"comic sans ms",sans-serif">Sincerely,</div><div style="font-family:"comic sans ms",sans-serif">Huq</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 25, 2019 at 5:15 PM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
How are you computing the error norm? <br>
<br>
You need to use the L2 norm in the computations, not the l2 norm. <br>
<br>
Also you need to make sure the convergence criteria you use for the algebraic system is smaller than the descritzation error <br>
<br>
<br>
Barry<br>
<br>
<br>
> On Feb 25, 2019, at 1:55 PM, Fazlul Huq via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> Hello PETSc Developers,<br>
> <br>
> I have solved a very simple poisson problem with different matrix sizes (10 to 10^7).<br>
> But when I have compared error norm_2 for the solution, I got the attached curve.<br>
> It looks like error norm_2 increases with increasing matrix size. Shouldn't it decrease rather with increasing matrix size?<br>
> <br>
> Thanks.<br>
> <br>
> Sincerely,<br>
> Huq<br>
> -- <br>
> <br>
> Fazlul Huq<br>
> Graduate Research Assistant<br>
> Department of Nuclear, Plasma & Radiological Engineering (NPRE)<br>
> University of Illinois at Urbana-Champaign (UIUC)<br>
> E-mail: <a href="mailto:huq2090@gmail.com" target="_blank">huq2090@gmail.com</a><br>
> <Error norm_2_withoutJacobi.png><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br><div><font face="comic sans ms, sans-serif">Fazlul Huq</font></div><div><font face="comic sans ms, sans-serif">Graduate Research Assistant</font></div><div><font face="comic sans ms, sans-serif">Department of Nuclear, Plasma & Radiological Engineering (NPRE)</font></div><div><font face="comic sans ms, sans-serif">University of Illinois at Urbana-Champaign (UIUC)</font></div><div><font face="comic sans ms, sans-serif">E-mail: <a href="mailto:huq2090@gmail.com" target="_blank">huq2090@gmail.com</a></font></div></div></div></div></div></div></div>