<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear Petsc developer:           </div><div dir="ltr">Hi,</div><div dir="ltr">Thank you very much for your previous reply. I feel that I have learned a lot about the matrix-free method.            </div><div dir="ltr">I was studying the example /src/snes/example/tutorials/ex28.c recently. One of its tests is as follows: <br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div>-u_da_grid_x 20 -snes_converged_reason -snes_monitor_short -ksp_monitor_short -problem_type 2 -snes_mf_operator -pack_dm_mat_type {{aij nest}} -pc_type fieldsplit -pc_fieldsplit_dm_splits -pc_fieldsplit_type additive -fieldsplit_u_ksp_type gmres -fieldsplit_k_pc_type jacobi</div></div></div></blockquote>The example is calculated by the Matrix-free method, and the precondition matrix is divided by FieldSplit. There are several questions in the procedure that make me feel uncertain.</div><div dir="ltr">1. The program uses the Matrixfree method by the command "-snes_mf_operator", but the form of Jacobian matrix is not defined as MATMFFD in the program. Does the program automatically set the Jacobian matrix to the form of MATMFFD after opening the command? <br></div><div dir="ltr"><br></div><div dir="ltr">Both Jacobian matrix and precondition matrix are defined as B in the program, and matrix elements are provided by Jacobian evaluation program. But the Jacobian matrix in the Matrixfree method is in the form of MATMFFD. You mentioned earlier that adding elements to the matrix with type MATMFFD can cause program errors, but why does the program work in this example? The procedures are as follows:<br></div></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div><div><div><div>ierr = SNESSetFunction(snes,F,FormFunction_All,user);CHKERRQ(ierr);</div></div></div></div></div></div><div><div><div><div><div><div>ierr = SNESSetJacobian(snes,B,B,FormJacobian_All,user);CHKERRQ(ierr);</div></div></div></div></div></div></blockquote><br><div>2.Can we use DMCompositeScatter to scatter ghost value into local vectors? I didn't seem to mention the documentation. The program only uses the following functions, but can use ghost value. </div><div><div>    ierr = DMCompositeScatter(user->pack,X,Uloc,Kloc);CHKERRQ(ierr);</div><div>    ierr = DMDAVecGetArray(dau,Uloc,&u);CHKERRQ(ierr);</div><div>    ierr = DMDAVecGetArray(dak,Kloc,&k);CHKERRQ(ierr);</div></div><div><br></div><div>Greatly appreciated your reply and attention.</div><div>Thanks,</div><div>Yingjie <br></div><div><br></div></div></div></div></div></div></div></div>