<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0cm;
background:white;
font-size:9.0pt;
font-family:Menlo;
color:black;}
p.p2, li.p2, div.p2
{mso-style-name:p2;
margin:0cm;
background:white;
font-size:9.0pt;
font-family:Menlo;
color:black;}
p.p3, li.p3, div.p3
{mso-style-name:p3;
margin:0cm;
background:white;
font-size:9.0pt;
font-family:Menlo;
color:#6C36A9;}
span.s1
{mso-style-name:s1;
color:#3900A0;}
span.s3
{mso-style-name:s3;
color:#6C36A9;}
span.s5
{mso-style-name:s5;
color:#643820;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.s2
{mso-style-name:s2;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="p1"><span class="apple-converted-space"> Hello,<o:p></o:p></span></p>
<p class="p1"><span class="apple-converted-space"><o:p> </o:p></span></p>
<p class="p1"><span class="apple-converted-space"> I tried to solve a (FE discretized) Poisson equation using PCLU. For some reason I am getting different solutions while running the problem on one and two cores. I have attached the output file (out.txt)
from both the runs. I am printing A, b and x from both the runs – while A and b are the same but the solution seems is different.<o:p></o:p></span></p>
<p class="p1"><span class="apple-converted-space"><o:p> </o:p></span></p>
<p class="p1"><span class="apple-converted-space">I am not sure what I doing wrong.<o:p></o:p></span></p>
<p class="p1"><span class="apple-converted-space"><o:p> </o:p></span></p>
<p class="p1"><span class="apple-converted-space">Below is my matrix, vector, and solve setup.
<o:p></o:p></span></p>
<p class="p1"><span class="apple-converted-space"><o:p> </o:p></span></p>
<p class="p1"><span class="apple-converted-space"><o:p> </o:p></span></p>
<p class="p1"><span class="apple-converted-space"> </span> <span style="color:#3900A0">Mat</span> A;<span style="color:#3900A0"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#3900A0;mso-fareast-language:EN-GB">Vec</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> b, x;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> <o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> ierr =
</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">MatCreate</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">PETSC_COMM_WORLD</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">,
&A); </span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(ierr);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> ierr =
</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">MatSetType</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(A,
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">MATMPIAIJ</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">);
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(ierr);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> ierr =
</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">MatSetSizes</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(A,
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">PETSC_DECIDE</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">,
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">PETSC_DECIDE</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">, N, N);
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(ierr);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> ierr =
</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">MatMPIAIJSetPreallocation</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(A,d_nz,
</span><b><span style="font-size:9.0pt;font-family:Menlo;color:#9B2393;mso-fareast-language:EN-GB">NULL</span></b><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">, o_nz,
</span><b><span style="font-size:9.0pt;font-family:Menlo;color:#9B2393;mso-fareast-language:EN-GB">NULL</span></b><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">);
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(ierr);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB"> ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">(ierr);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"> ierr =
</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">MatCreateVecs</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(A, &b, &x);
</span><span style="font-size:9.0pt;font-family:Menlo;color:#643820;mso-fareast-language:EN-GB">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(ierr);<o:p></o:p></span></p>
<p class="p1"><o:p> </o:p></p>
<p class="p2"><span class="apple-converted-space"> </span><span class="s1">KSP</span>
<span class="apple-converted-space"> </span>ksp;</p>
<p class="p2"><span class="apple-converted-space"> </span><span class="s1">PC</span><span class="apple-converted-space">
</span>pc;</p>
<p class="p3"><span class="apple-converted-space"> </span>KSPCreate<span class="s2">(</span>PETSC_COMM_WORLD<span class="s2">, &ksp);</span></p>
<p class="p2"><span class="apple-converted-space"> </span><span class="s3">KSPSetOperators</span>(ksp, A, A);</p>
<p class="p2"><span class="apple-converted-space"> </span>ierr = <span class="s3">
KSPSetType</span>(ksp,<span class="s5">KSPPREONLY</span>);<span class="s5">CHKERRQ</span>(ierr);</p>
<p class="p2"><span class="apple-converted-space"> </span>ierr = <span class="s3">
KSPGetPC</span>(ksp,&pc);<span class="s5">CHKERRQ</span>(ierr);</p>
<p class="p2"><span class="apple-converted-space"> </span>ierr = <span class="s3">
PCSetType</span>(pc,<span class="s5">PCLU</span>);<span class="s5">CHKERRQ</span>(ierr);</p>
<p class="p3"><span class="apple-converted-space"> </span><span class="s2">ierr =
</span>PCFactorSetMatSolverType<span class="s2">(pc,</span><span class="s5">MATSOLVERMUMPS</span><span class="s2">);</span><span class="s5">CHKERRQ</span><span class="s2">(ierr);</span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#6C36A9;mso-fareast-language:EN-GB">KSPSolve</span><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">(ksp, b, x);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">Thank you for your help.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Menlo;color:black;mso-fareast-language:EN-GB">Karhik.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p><span style="font-size: 6pt;">This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. </span></p></body>
</html>