<div dir="ltr"><div class="gmail_default"><div class="gmail_default"><font color="#000000">Hi all,</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">We develop a CFD code using the PETSc library that solves the Navier-Stokes equations using the fractional-step method from Perot (1993).</font></div><div class="gmail_default"><font color="#000000">At each time-step, we solve two systems: one for the velocity field, the other, a Poisson system, for the pressure field.</font></div><div class="gmail_default"><span style="color:rgb(0,0,0)">One of our test-cases is a 2D lid-driven cavity flow (Re=100) on a 20x20 grid using 1 or 2 procs.</span><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">For the Poisson system, we usually use CG preconditioned with GAMG.</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">So far, we have been using PETSc-3.5.4, and we would like to update the code with the latest release: 3.7.4.</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">As suggested in the changelog of 3.6, we replaced the routine `KSPSetNullSpace()` with `MatSetNullSpace()`.</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">Here is the list of options we use to configure the two solvers:</font></div><div class="gmail_default"><font color="#000000">* Velocity solver: prefix `-velocity_`</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_type bcgs</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_rtol 1.0E-08</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_atol 0.0</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_max_it 10000</font></div><div class="gmail_default"><font color="#000000"> -velocity_pc_type jacobi</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_view</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_monitor_true_residual</font></div><div class="gmail_default"><font color="#000000"> -velocity_ksp_converged_reason</font></div><div class="gmail_default"><font color="#000000">* Poisson solver: prefix `-poisson_`</font></div><div class="gmail_default"><font color="#000000"> -poisson_ksp_type cg</font></div><div class="gmail_default"><font color="#000000"> -poisson_ksp_rtol 1.0E-08</font></div><div class="gmail_default"><font color="#000000"> -poisson_ksp_atol 0.0</font></div><div class="gmail_default"><font color="#000000"> -poisson_ksp_max_it 20000</font></div><div class="gmail_default"><font color="#000000"> -poisson_pc_type gamg</font></div><div class="gmail_default"><font color="#000000"> -poisson_pc_gamg_type agg</font></div><div class="gmail_default"><font color="#000000"> -poisson_pc_gamg_agg_nsmooths 1</font></div><div class="gmail_default"><font color="#000000"> -poissonksp_view</font></div><div class="gmail_default"><font color="#000000"> -poisson_ksp_monitor_true_residual</font></div><div class="gmail_default"><font color="#000000"> -poisson_ksp_converged_reason</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">With 3.5.4, the case runs normally on 1 or 2 procs.</font></div><div class="gmail_default"><font color="#000000">With 3.7.4, the case runs normally on 1 proc but not on 2.</font></div><div class="gmail_default"><font color="#000000">Why? The Poisson solver diverges because of an indefinite preconditioner (only with 2 procs).</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">We also saw that the routine `MatSetNullSpace()` was already available in 3.5.4.</font></div><div class="gmail_default"><font color="#000000">With 3.5.4, replacing `KSPSetNullSpace()` with `MatSetNullSpace()` led to the Poisson solver diverging because of an indefinite matrix (on 1 and 2 procs).</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">Thus, we were wondering if we needed to update something else for the KSP, and not just modifying the name of the routine?</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">I have attached the output files from the different cases:</font></div><div class="gmail_default"><font color="#000000">* `run-petsc-3.5.4-n1.log` (3.5.4, `KSPSetNullSpace()`, n=1)</font></div><div class="gmail_default"><font color="#000000">* `run-petsc-3.5.4-n2.log`</font></div><div class="gmail_default"><font color="#000000">* `run-petsc-3.5.4-nsp-n1.log` (3.5.4, `MatSetNullSpace()`, n=1)</font></div><div class="gmail_default"><font color="#000000">* `run-petsc-3.5.4-nsp-n2.log`</font></div><div class="gmail_default"><font color="#000000">* `run-petsc-3.7.4-n1.log` (3.7.4, `MatSetNullSpace()`, n=1)</font></div><div class="gmail_default"><font color="#000000">* `run-petsc-3.7.4-n2.log`</font></div><div class="gmail_default"><font color="#000000"><br></font></div><div class="gmail_default"><font color="#000000">Thank you for your help,</font></div><div class="gmail_default"><font color="#000000">Olivier</font></div></div>
</div>