On Tue, Dec 10, 2024 at 4:32 AM David Jiawei LUO LIANG < 12431...@mail.sustech.edu.cn> wrote:
> Hello PETSc, > > I want to substitute the existing nonlinear solver codes with SNES. > > The existing code is Parallel computing. > > My FormFunction and FormJacobian is attached in file Res_Jac.cpp. > > The global tangent matrix assembly and residual function assembly are both > implemented by invoking user pointers. > > The following is the message, we can find that SNES just iterate once. > > > I think the problem is input solution Vec y doesn't link to Residual Vec > f, because my update is stored in the user variables. > If I use > const PetscScalar *yy; > VecGetArrayRead(y, &yy); > the value of yy is not identical to Vec y, because there are multi thread. > > So, my problem is how to assembly residual and tangent in parallel > environment? > I am having trouble understanding your question. 1) Can you run with -snes_monitor -snes_converged_reason -ksp_monitor_true_residual -ksp_converged_reason -snes_view and send the output? 2) You have the line VecCopy(user->gassem_ptr->G, f); which looks like it puts the values of your G into f, so I am not sure what the problem is. THanks, Matt > > David Jiawei LUO LIANG > > 南方科技大学/学生/研究生/2024 > > 广东省深圳市南山区学苑大道1088号 > > -- 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 https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!awWXPHw1GNXswCx9rANXgow3jupJ1On7I9qTmMvSDr0WuSRayb_cCkSj1qvn6spDBOJX-GVhIvjDx8-R6uqs$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!awWXPHw1GNXswCx9rANXgow3jupJ1On7I9qTmMvSDr0WuSRayb_cCkSj1qvn6spDBOJX-GVhIvjDx8xw7ziW$ >