<div dir="ltr">Dear All,<div><br></div><div>I am trying to solve Ax = b in parallel using MUMPS, where x is composed of velocity, pressure, and temperature. There is a null space due to the homogeneous Neumann pressure boundary conditions. </div><div><br></div><div>1. Without explicitly removing the null space, the solution is bounded and robust, and I am able to iterate in time, although I need to check if the solution is physically correct. I am not sure if MUMPS is able to detect the null space in this case. </div><div><br></div><div>2. However, when I explicitly use MatSetNullSpace as shown below, the solution blows up in 2-3 temporal iterations, resulting in nan. Could you please share your thoughts regarding this problem?</div><div><br></div><div>Thanks,</div><div>Bhargav</div><div><br></div><div>---------------</div><div>Output for -pc_type svd -pc_svd_monitor </div><div><div>SVD: condition number 3.159257564649e+16, 1 of 1080 singular values are (nearly) zero<br> SVD: smallest singular values: 3.693890048955e-17 2.902795363876e-10 2.902795486255e-10 2.902796682780e-10 7.614221123356e-10<br> SVD: largest singular values : 1.166981958972e+00 1.166981958972e+00 1.166995008014e+00 1.166995008014e+00 1.166995008014e+00</div></div><div>-----------------</div><div>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-s1" style="color:rgb(0,80,50)">PetscErrorCode</span> <b style="">SetNullVector</b>(<span class="gmail-s1" style="color:rgb(0,80,50)">Mat</span> MatGlobalLinear,<span class="gmail-s1" style="color:rgb(0,80,50)">Mesh</span> mesh,<span class="gmail-s1" style="color:rgb(0,80,50)">Equations</span> eq){</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-s1" style="color:rgb(0,80,50)">Vec</span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>NullVector;</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-s1" style="color:rgb(0,80,50)">PetscInt</span> <span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>numNullVectors,disp,i,j;</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-s1" style="color:rgb(0,80,50)">PetscScalar</span> <span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>constantValue = 1.0,nrm;</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-s1" style="color:rgb(0,80,50)">MatNullSpace</span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>NullSp = NULL;</p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,80,50)"><span class="gmail-s2" style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></span>PetscErrorCode<span class="gmail-s2" style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr;</span></p>
<p class="gmail-p3" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;min-height:19px"><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>PetscFunctionBeginUser;</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>numNullVectors = 1;</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>disp = mesh.<span class="gmail-s3" style="color:rgb(0,0,192)">numLayers</span>*mesh.<span class="gmail-s3" style="color:rgb(0,0,192)">numEdges</span> + (eq.<span class="gmail-s3" style="color:rgb(0,0,192)">pressure</span>-1)*mesh.<span class="gmail-s3" style="color:rgb(0,0,192)">numCells</span>;</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>MatCreateVecs</b></span>(MatGlobalLinear,&NullVector,NULL);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-s5" style="color:rgb(127,0,85)"><b>for</b></span>(i=0; i<mesh.<span class="gmail-s3" style="color:rgb(0,0,192)">numLayers</span>; i++){</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-s5" style="color:rgb(127,0,85)"><b>for</b></span>(j=0; j<mesh.<span class="gmail-s3" style="color:rgb(0,0,192)">numCells</span>; j++){</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = VecSetValue(NullVector,j + i*mesh.<span class="gmail-s3" style="color:rgb(0,0,192)">numCells</span> + disp,constantValue,<span class="gmail-s3" style="color:rgb(0,0,192)"><i>INSERT_VALUES</i></span>);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>}</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>}</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>VecAssemblyBegin</b></span>(NullVector);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>VecAssemblyEnd</b></span>(NullVector);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>VecNorm</b></span>(NullVector,<span class="gmail-s3" style="color:rgb(0,0,192)"><i>NORM_2</i></span>,&nrm);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>VecScale</b></span>(NullVector,1.0/nrm);CHKERRQ(ierr);</p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(63,127,95)"><span class="gmail-s2" style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></span>/* set null space */</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>MatNullSpaceCreate</b></span>(MPI_COMM_WORLD,<span class="gmail-s3" style="color:rgb(0,0,192)"><i>PETSC_FALSE</i></span>,numNullVectors,&NullVector,&NullSp);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>MatSetNullSpace</b></span>(MatGlobalLinear,NullSp);CHKERRQ(ierr);</p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(63,127,95)"><span class="gmail-s2" style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></span>/* clean up */</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>MatNullSpaceDestroy</b></span>(&NullSp);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ierr = <span class="gmail-s4" style="color:rgb(100,40,128)"><b>VecDestroy</b></span>(&NullVector);CHKERRQ(ierr);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>PetscFunctionReturn(0);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo">}</p></div><div>-----------------<br></div><div><br></div></div>
<br>
<div><hr></div><font face="Arial" size="1">This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email.</font>