[petsc-users] VecConcatenate vs VecCreateNest for coupled problems
Miguel Molinos
m.molinos at upm.es
Fri Mar 6 05:35:31 CST 2026
Dear all,
I am solving a nonlinear system with SNES that comes from the stationary conditions of a scalar functional (L):
\frac{\partial L}{\partial F} = 0,
\frac{\partial L}{\partial \sigma_q} = 0
where (F) has size 3 and (\sigma_q) contains (N) particle variables, so the global unknown vector has size (3*N_rank + N). And, locally, each rank has a local vector (3+N_local). I am currently using SNES with GMRES to solve the problem since I can not compute the Jacobian analytically.
I have a couple of questions:
I originally constructed the solution vector as a single contiguous vector (effectively [F | sigma]) with VecConcatenate, but I recently switched to VecCreateNest to represent the block structure. However, the solver seems to perform better with VecConcatenate. Is this expected when using GMRES, if no block preconditioner is used?
The system has a known null space associated with the (sigma) variables. Since I am not assembling the Jacobian explicitly, what is the recommended way to provide this null space to the solver? Should it still be attached to the operator with MatSetNullSpace when using -snes_mf?
Any advice or best practices would be very helpful.
Best regards,
Miguel

Miguel Molinos
Escuela de Ingenieros de Caminos, Canales y Puertos
Dep. Mecánica Medios Continuos y Teoría de Estructuras
Prof. Aranguren, 3 - Ciudad Universitaria.
Planta 9. 28040, Madrid
✉ m.molinos at upm.es <mailto:m.molinos at upm.es>
✆ +34 910 67 44 28
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260306/e53b425a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: upm.png
Type: image/png
Size: 9335 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260306/e53b425a/attachment.png>
More information about the petsc-users
mailing list