<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> Singular systems come up in solving PDEs almost always due to issues related to boundary conditions. For example all Neumann (natural) boundary conditions can produce singular systems. Direct factorizations generically will eventually hit a zero pivot in such cases and there is no universally acceptable approaches for what to do at that point to recover. If you think your operator is singular you should start by using MatSetNullSpace(), it won't "cure" the problem but is the tool we use to manage null spaces in operators.<div class=""><br class=""></div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 22, 2021, at 9:04 AM, Sepideh Kavousi <<a href="mailto:skavou1@lsu.edu" class="">skavou1@lsu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Hello,</div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">I want to solve PF solidification+Navier stokes using Finite different method, and I have a strange problem. My code runs fine for some system sizes and fails for some of the system sizes. When I run with the following options:</div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="background-color: rgb(0, 255, 0);" class="">mpirun -np 2 ./one.out -ts_monitor -snes_fd_color -ts_max_snes_failures -1 -ts_type bdf -ts_bdf_adapt -pc_type bjacobi -snes_linesearch_type l2 -snes_type ksponly -ksp_type gmres -ksp_gmres_restart 1001 -sub_pc_type ilu -sub_ksp_type preonly -snes_monitor -ksp_monitor -snes_linesearch_monitor -ksp_monitor_true_residual -ksp_converged_reason -log_view</span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="background-color: rgb(255, 255, 128);" class=""><br class=""></span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="background-color: rgb(255, 255, 255); color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span><span style="background-color: rgb(255, 255, 128);" class=""><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> PC_FAILED due to SUBPC_ERROR</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> PC_FAILED due to SUBPC_ERROR</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> PC_FAILED due to SUBPC_ERROR</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> PC_FAILED due to SUBPC_ERROR</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(12, 136, 42);" class="">^C Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> PC_FAILED due to SUBPC_ERROR</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> PC_FAILED due to SUBPC_ERROR</span></div><div class=""><span style="color: rgb(12, 136, 42);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div></span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="background-color: rgb(255, 128, 255);" class="">Even setting pc_type to LU does not solve the problem.</span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="color: rgb(237, 92, 87);" class="">0 TS dt 0.0001 time 0.</span><div class=""><span style="color: rgb(237, 92, 87);" class="">copy!</span></div><div class=""><span style="color: rgb(237, 92, 87);" class="">copy!</span></div><div class=""><span style="color: rgb(237, 92, 87);" class="">Write output at step= 0!</span></div><div class=""><span style="color: rgb(237, 92, 87);" class="">Write output at step= 0!</span></div><div class=""><span style="color: rgb(237, 92, 87);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(237, 92, 87);" class=""> 0 SNES Function norm 1.465357113711e+01</span></div><div class=""><span style="color: rgb(237, 92, 87);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><div class=""><span style="color: rgb(237, 92, 87);" class=""> PC_FAILED due to FACTOR_NUMERIC_ZEROPIVOT</span></div><div class=""><span style="color: rgb(237, 92, 87);" class=""> Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0</span></div><span style="color: rgb(237, 92, 87);" class=""> PC_FAILED due to FACTOR_NUMERIC_ZEROPIVOT</span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">I guess the problem is that in mass conservation I used forward discretization for u (velocity in x) and for the moment in x , I used forward discretization for p (pressure) to ensure non-zero terms on the diagonal of matrix. I tried to run it with valgrind but it did not output anything. <span class="Apple-converted-space"> </span><br class=""></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Does anyone have suggestions on how to solve this issue?<span class="Apple-converted-space"> </span><br class=""></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Best,</div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Sepideh</div></div></blockquote></div><br class=""></div></div></body></html>