Yes. To be precise this is the set of functions I call: ierr = MatNullSpaceCreate(mpicomm, PETSC_FALSE, 1, &null_space, &A_null_space); CHKERRXX(ierr);
ierr = MatSetNullSpace(A, A_null_space); CHKERRXX(ierr); ierr = KSPSetNullSpace(ksp, A_null_space); CHKERRXX(ierr); ierr = MatNullSpaceRemove(A_null_space, rhs_, NULL); CHKERRXX(ierr); ierr = KSPSolve(ksp, rhs_, solution); CHKERRXX(ierr); On Thu, Mar 6, 2014 at 3:33 PM, Matthew Knepley <[email protected]> wrote: > On Thu, Mar 6, 2014 at 5:24 PM, Mohammad Mirzadeh <[email protected]>wrote: > >> Hi guys, >> >> I have a discretization of Poisson equation with Neumann bc for embedded >> boundary grids in such a way that that nullspace is not the usual constant >> vector. Instead the nullspace is constant in the domain of interest and >> zero elsewhere. >> >> I compute this nullspace myself and have checked it against MATLAB by >> dumping the matrix and computing the nullspace explicitly using null >> function -- they match and there is only this single vector. Then I take >> this calculated vector and subtract it off the matrix and rhs. >> > > "subtract it off the matrix" does not make sense to me. Are you calling > KSPSetNullSpace()? > > Matt > > >> However, I am having convergence issues. For instance this is the output >> of ksp_monitor_true_residual for one particular run: >> >> 0 KSP preconditioned resid norm 3.033840960250e+02 true resid norm >> 2.332886580745e-01 ||r(i)||/||b|| 1.000000000000e+00 >> 1 KSP preconditioned resid norm 1.018974811826e+01 true resid norm >> 1.941629896918e-02 ||r(i)||/||b|| 8.322864527335e-02 >> 2 KSP preconditioned resid norm 5.450493684941e-02 true resid norm >> 1.029339589324e-02 ||r(i)||/||b|| 4.412300185615e-02 >> 3 KSP preconditioned resid norm 3.944064039516e-02 true resid norm >> 1.030277925024e-02 ||r(i)||/||b|| 4.416322394443e-02 >> 4 KSP preconditioned resid norm 6.286181172600e-05 true resid norm >> 1.030243055045e-02 ||r(i)||/||b|| 4.416172923059e-02 >> 5 KSP preconditioned resid norm 4.349133658643e-06 true resid norm >> 1.030239080406e-02 ||r(i)||/||b|| 4.416155885630e-02 >> 6 KSP preconditioned resid norm 9.279429568232e-08 true resid norm >> 1.030239169298e-02 ||r(i)||/||b|| 4.416156266666e-02 >> 7 KSP preconditioned resid norm 3.032522248740e-09 true resid norm >> 1.030239175066e-02 ||r(i)||/||b|| 4.416156291393e-02 >> 8 KSP preconditioned resid norm 6.533747246875e-09 true resid norm >> 1.030239175718e-02 ||r(i)||/||b|| 4.416156294184e-02 >> 9 KSP preconditioned resid norm 6.083185162500e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292220e-02 >> 10 KSP preconditioned resid norm 5.510319622225e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02 >> 11 KSP preconditioned resid norm 5.456758524534e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02 >> 12 KSP preconditioned resid norm 5.456756081783e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02 >> 13 KSP preconditioned resid norm 5.456755930952e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02 >> 14 KSP preconditioned resid norm 5.456755930949e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02 >> 15 KSP preconditioned resid norm 5.456755930949e-12 true resid norm >> 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02 >> >> >> As you can see, the true residual is quite large and moreover it does not >> reduce beyond a certain point. This is using hypre as preconditioner, but >> the situation is equally bad with several other preconditioner (ilu, sor, >> jacobi, or even none). As for the solution itself, the error has poor to >> none convergence under grid refinement. All this suggests that the linear >> system is not converging in my case. >> >> >> Do you have any idea/suggestions why this is happening and how I can avoid >> it? >> >> >> Thanks >> >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener >
