From u1472208 at utah.edu Thu Apr 2 17:46:20 2026 From: u1472208 at utah.edu (Alberto Cattaneo) Date: Thu, 2 Apr 2026 22:46:20 +0000 Subject: [petsc-users] Image usage permission Message-ID: Greetings I hope this email finds you well. I was wondering if it would be possible to use the first image on the following website https://urldefense.us/v3/__https://petsc.org/main/overview/nutshell/__;!!G_uCfscf7eWS!bVFcRz9jDoEX9OS6fAGpMk8-PJCwX59sxehz7YY8WEYmtWgDR-JBHxiGjnEQtyQIWskd-7PckTZbVpO4AEkEeazA$ In a paper I am writing. Obviously, it would be cited and credited. The paper is about accelerating the development of finite-element-analysis using PETSc. Having that image in the paper would just make it easier to explain what tools are available when using the package. I understand of course if that is not possible, however. Respectfully: Alberto Cattaneo -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Apr 2 20:16:22 2026 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 2 Apr 2026 21:16:22 -0400 Subject: [petsc-users] Image usage permission In-Reply-To: References: Message-ID: On Thu, Apr 2, 2026 at 6:46?PM Alberto Cattaneo via petsc-users < petsc-users at mcs.anl.gov> wrote: > Greetings > I hope this email finds you well. I was wondering if it would be possible > to use the first image on the following website > > https://urldefense.us/v3/__https://petsc.org/main/overview/nutshell/__;!!G_uCfscf7eWS!fxTOc41DeYQ-iblR-5gxDQTqar600HZKj6pgWJY4Ag8y1SLwET_dZvHs9dT_gz8W_5PznQk6QmuBU2Jt9WuW$ > > > In a paper I am writing. Obviously, it would be cited and credited. The > paper is about accelerating the development of finite-element-analysis > using PETSc. Having that image in the paper would just make it easier to > explain what tools are available when using the package. I understand of > course if that is not possible, however. > Definitely, that would be great. I think you can just use the manual bibtex for that, although you might include the URL. Thanks! Matt > Respectfully: > Alberto Cattaneo > > -- 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!fxTOc41DeYQ-iblR-5gxDQTqar600HZKj6pgWJY4Ag8y1SLwET_dZvHs9dT_gz8W_5PznQk6QmuBU8nImwbd$ -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.molinos at upm.es Sat Apr 4 12:14:36 2026 From: m.molinos at upm.es (Miguel Molinos) Date: Sat, 4 Apr 2026 19:14:36 +0200 Subject: [petsc-users] DMPlex SF Message-ID: <8C28DBFD-8A94-4824-874E-EBD0F9107F0F@upm.es> Dear all, For a given cell in a local patch of a distributed DMPlex mesh, is there a way to retrieve the list of ranks that share that same cell? Thanks, Miguel -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfadams at lbl.gov Sat Apr 4 12:27:58 2026 From: mfadams at lbl.gov (Mark Adams) Date: Sat, 4 Apr 2026 13:27:58 -0400 Subject: [petsc-users] DMPlex SF In-Reply-To: <8C28DBFD-8A94-4824-874E-EBD0F9107F0F@upm.es> References: <8C28DBFD-8A94-4824-874E-EBD0F9107F0F@upm.es> Message-ID: I think you want to start by getting closure (vertices, which is what you mean by share) Now get the processor that owns each vertex in the closure. DMPlexGetPointRank Thanks, Mark On Sat, Apr 4, 2026 at 1:15?PM Miguel Molinos wrote: > Dear all, > > For a given cell in a local patch of a distributed DMPlex mesh, is there > a way to retrieve the list of ranks that share that same cell? > > Thanks, > > Miguel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sat Apr 4 16:58:08 2026 From: knepley at gmail.com (Matthew Knepley) Date: Sat, 4 Apr 2026 17:58:08 -0400 Subject: [petsc-users] DMPlex SF In-Reply-To: <8C28DBFD-8A94-4824-874E-EBD0F9107F0F@upm.es> References: <8C28DBFD-8A94-4824-874E-EBD0F9107F0F@upm.es> Message-ID: On Sat, Apr 4, 2026 at 1:15?PM Miguel Molinos wrote: > Dear all, > > For a given cell in a local patch of a distributed DMPlex mesh, is there > a way to retrieve the list of ranks that share that same cell? > It is somewhat involved. Each process that does not own the cell will know the owner. You will know how many processes also have the cell using PetscSFComputeRootDegree(), however you will not have the rank. You can use PetscSFGather() to get the ranks, and then Bcast that to the leaf processes. This pattern creates the two-sided information. We do this inside VecScatter, and I guess we could expose that. Junchao would know that better than I would. Thanks, Matt > Thanks, > > Miguel > -- 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!fjhAfMA8h9hZzCgvz4iznQxyS7LjROeErvhtCzSaipXSDj5Wt_5y5NXymhXO6lEeh0EUSEzlX4jdHDYIsE2i$ -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.molinos at upm.es Tue Apr 7 01:43:20 2026 From: m.molinos at upm.es (Miguel Molinos) Date: Tue, 7 Apr 2026 08:43:20 +0200 Subject: [petsc-users] DMPlex SF In-Reply-To: References: <8C28DBFD-8A94-4824-874E-EBD0F9107F0F@upm.es> Message-ID: Thank you, I?ll have a look inside VecScatter. PetscSFGather seem promising. Thanks, Miguel > On Apr 4, 2026, at 11:58?PM, Matthew Knepley wrote: > > PetscSFComputeRootDegree -------------- next part -------------- An HTML attachment was scrubbed... URL: From guenther5 at llnl.gov Thu Apr 9 19:26:52 2026 From: guenther5 at llnl.gov (Guenther, Stefanie) Date: Fri, 10 Apr 2026 00:26:52 +0000 Subject: [petsc-users] TSAdjointSolve using MatShell for RHSJacobianP Message-ID: Hi, I want to use the TS adjoint solve to backpropagate gradients within a linear ODE of the form \dot u(t)= A(p,t)u(t). I want to use a MatShell for the RHSJacobianP function, representing the rectangular matrix dA(p,t)/dp * u. However, I only have the MatMultTranspose function available for this, not a MatMult. Is the MatMult strictly required for this shell? As far as I know, the back propagation should only be using the MatMultTranspose anyways, to apply (dRHS/dp)^T * ubar, so I would think it should work without the MatMult, is that correct? Thank you very much! Stefanie -------------- next part -------------- An HTML attachment was scrubbed... URL: From hongzhang at anl.gov Thu Apr 9 23:16:05 2026 From: hongzhang at anl.gov (Zhang, Hong) Date: Fri, 10 Apr 2026 04:16:05 +0000 Subject: [petsc-users] TSAdjointSolve using MatShell for RHSJacobianP In-Reply-To: References: Message-ID: Stefanie, Your understanding is correct. The Adjoint solvers do not require MatMult(). Only MatMultTranspose() is needed for your JacP matrix. Hong ________________________________ From: petsc-users on behalf of Guenther, Stefanie via petsc-users Sent: Thursday, April 9, 2026 7:26 PM To: petsc-users at mcs.anl.gov Subject: [petsc-users] TSAdjointSolve using MatShell for RHSJacobianP Hi, I want to use the TS adjoint solve to backpropagate gradients within a linear ODE of the form \dot u(t)= A(p,t)u(t). I want to use a MatShell for the RHSJacobianP function, representing the rectangular matrix dA(p,t)/dp * u. However, I only have the MatMultTranspose function available for this, not a MatMult. Is the MatMult strictly required for this shell? As far as I know, the back propagation should only be using the MatMultTranspose anyways, to apply (dRHS/dp)^T * ubar, so I would think it should work without the MatMult, is that correct? Thank you very much! Stefanie -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Apr 15 13:46:16 2026 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 15 Apr 2026 14:46:16 -0400 Subject: [petsc-users] PETSc/Firedrake Annual Meeting 2026 Registration Deadline April 27th Message-ID: Note that there are two weeks left to register for the PETSc Meeting, and one week to submit an abstract. Key Dates 20 April 2026: Abstract submission deadline *27 April 2026*: Registration deadline Registration is available here: https://urldefense.us/v3/__https://cvent.me/lqGoPm__;!!G_uCfscf7eWS!cz57jONPsn4WMtz0JTygTB6ro3-2rVsJFzXcXbFUdnTUMA98t-moifoAzY6HL77OU0I1uC9Du2IlRPVRp7lE$ 1?3 June 2026: PETSc User Meeting 3?5 June 2026: Firedrake ?26 Meeting We are pleased to announce that the Firedrake Annual Meeting and the PETSc Annual User Meeting will be held jointly this year in Oxford, from Monday 1 June to Friday 5 June. The PETSc meeting will run from Monday morning to Wednesday at noon, followed by the Firedrake meeting, which will begin on Wednesday early afternoon and continue until Friday evening. While we encourage participants to attend both events, registration is available separately for each meeting, or jointly for both. Further information about the event can be found at: https://urldefense.us/v3/__https://petsc.org/release/community/meetings/2026__;!!G_uCfscf7eWS!cz57jONPsn4WMtz0JTygTB6ro3-2rVsJFzXcXbFUdnTUMA98t-moifoAzY6HL77OU0I1uC9Du2IlRHdK5SZp$ https://urldefense.us/v3/__https://www.firedrakeproject.org/firedrake_26.html__;!!G_uCfscf7eWS!cz57jONPsn4WMtz0JTygTB6ro3-2rVsJFzXcXbFUdnTUMA98t-moifoAzY6HL77OU0I1uC9Du2IlRAe38FoT$ For any questions, please contact Connor Ward at c.ward20 at imperial.ac.uk. Thanks, PETSc and Firedrake Teams -- 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!cz57jONPsn4WMtz0JTygTB6ro3-2rVsJFzXcXbFUdnTUMA98t-moifoAzY6HL77OU0I1uC9Du2IlRD35uNBf$ -------------- next part -------------- An HTML attachment was scrubbed... URL: From aldo.bonfiglioli at unibas.it Mon Apr 20 08:35:54 2026 From: aldo.bonfiglioli at unibas.it (Aldo Bonfiglioli) Date: Mon, 20 Apr 2026 15:35:54 +0200 Subject: [petsc-users] Question about Pseudo Time Stepping In-Reply-To: <4DD4EF03-30EF-48A7-87DC-70E35E97FCC8@icloud.com> References: <85e1d3ad-6a32-444e-94dd-b5ebb6cba819@unibas.it> <4DD4EF03-30EF-48A7-87DC-70E35E97FCC8@icloud.com> Message-ID: <2c3ac765-daf4-460a-b93d-436e64582e57@unibas.it> On 8/31/25 05:18, Barry Smith wrote: > > ? I always like a challenge. > > ? The MR https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/8675__;!!G_uCfscf7eWS!fSXpVkczcuYe90b4FecJoyBEJfrf0l19hyR_OWi9XPSUnhoSQyzSjcwtb3wgdBcTWxs5uVJnWLeGe-8xyu-XTRFBhS9R13eNP5U$ ?should > eliminate both redundant TSComputeRHSFunction() calls in your code and > thus decrease its run time. > > ?Thanks for bringing the performance bug to our attention > > ? Barry > > >> On Aug 30, 2025, at 5:42?PM, Aldo Bonfiglioli >> wrote: >> >> Barry, >> thank you for the update. >> Aldo >> >> >> *Aldo Bonfiglioli* >> Professore associato di Fluidodinamica settore scientifico >> disciplinare IIND-01/F >> Dipartimento di Ingegneria >> Viale dell'Ateneo Lucano, 10 85100 Potenza >> Tel: 0971.205203 >> >> >> Il ven 29 ago 2025, 20:52 Barry Smith ha >> scritto: >> >> >> ? Aldo, >> >> ? ??I understand the situation you are facing. >> >> ? ? With pseudo-continuation, when you provide an RHS function, >> SNES is computing udot - >> F(u). Inside the SNESSolve(), specifically >> in?TSComputeIFunction(), with the lines >> >> ? ? if (!ts->ops->ifunction) { >> ? ? ? ierr = TSComputeRHSFunction(ts,t,X,Y);CHKERRQ(ierr); >> ? ? ? ierr = VecAYPX(Y,-1,Xdot);CHKERRQ(ierr); >> >> But for the original system, we care about the norm for F(u). So >> in TSStep_Pseudo(), after the nonlinear solve >> there is the line >> >> ? ? pseudo->fnorm = -1; /* The current norm is no longer valid, >> monitor must recompute it. */ >> >> and further down >> >> ? if (pseudo->fnorm < 0) { >> PetscCall(VecZeroEntries(pseudo->xdot)); >> ? ? PetscCall(TSComputeIFunction(ts, ts->ptime, ts->vec_sol, >> pseudo->xdot, pseudo->func, PETSC_FALSE)); >> ? ? PetscCall(VecNorm(pseudo->func, NORM_2, &pseudo->fnorm)); >> >> this norm is needed to determine of the nonlinear system has >> converged satisfactory (or if more pseudo time steps are needed). >> >> Hence, your FormRHSFunction gets called twice with identical input. >> >> To make matters even worse your FormRHSFunction is actually being >> called THREE times with identical input. Because at the start of >> TSStep_Pseudo() it calls?TSPseudoComputeTimeStep(ts, >> &next_time_step) which by default uses?TSPseudoTimeStepDefault() >> which has the same chunk of code >> >> ?PetscCall(VecZeroEntries(pseudo->xdot)); >> ? PetscCall(TSComputeIFunction(ts, ts->ptime, ts->vec_sol, >> pseudo->xdot, pseudo->func, PETSC_FALSE)); >> ? PetscCall(VecNorm(pseudo->func, NORM_2, &pseudo->fnorm)); >> >> And the same norm is also recomputed. >> >> Now the diff >> >> diff --git a/src/ts/impls/pseudo/posindep.c >> b/src/ts/impls/pseudo/posindep.c >> index 7c013435f98..813a28311e7 100644 >> --- a/src/ts/impls/pseudo/posindep.c >> +++ b/src/ts/impls/pseudo/posindep.c >> @@ -660,9 +660,11 @@ PetscErrorCode TSPseudoTimeStepDefault(TS >> ts, PetscReal *newdt, void *dtctx) >> ? ?PetscReal ?inc ? ?= pseudo->dt_increment; >> ? ?PetscFunctionBegin; >> - ?PetscCall(VecZeroEntries(pseudo->xdot)); >> - ?PetscCall(TSComputeIFunction(ts, ts->ptime, ts->vec_sol, >> pseudo->xdot, pseudo->func, PETSC_FALSE)); >> - ?PetscCall(VecNorm(pseudo->func, NORM_2, &pseudo->fnorm)); >> + ?if (pseudo->fnorm < 0.0) { >> + ?PetscCall(VecZeroEntries(pseudo->xdot)); >> + ? ?PetscCall(TSComputeIFunction(ts, ts->ptime, ts->vec_sol, >> pseudo->xdot, pseudo->func, PETSC_FALSE)); >> + ? ?PetscCall(VecNorm(pseudo->func, NORM_2, &pseudo->fnorm)); >> + ?} >> ? ?if (pseudo->fnorm_initial < 0) { >> ? ? ?/* first time through so compute initial function norm */ >> ? ? ?pseudo->fnorm_initial ?= pseudo->fnorm >> >> will prevent the THIRD computation of the same function >> evaluation. So this is a good optimization >> >> But eliminating the second computation is not so trivial. To >> review, deep inside the TS code there is >> >> TSComputeRHSFunction(ts,t,X,Y); >> VecAYPX(Y,-1,Xdot); >> >> This code knows nothing about TSPPseudo etc. >> >> Then later in the Pseudo code >> >> ?PetscCall(VecZeroEntries(pseudo->xdot)); >> ?PetscCall(TSComputeIFunction(ts, ts->ptime, ts->vec_sol, >> pseudo->xdot, pseudo->func, PETSC_FALSE)); >> ?PetscCall(VecNorm(pseudo->func, NORM_2, &pseudo->fnorm)); >> >> ?again calls TSComputeRHSFunction(ts,t,X,Y); with the same X. >> ?(since Xdot is not used directly by TSComputeRHSFunction()). >> >> Now if all the code was custom for Pseudo we could simply put in >> a line >> >> TSComputeRHSFunction(ts,t,X,Y); >> VecNorm(Y,NORM_2, &pseudo->fnorm) >> VecAYPX(Y,-1,Xdot); >> >> into TSComputeIFunction() and have the norm available later for >> pseudo. >> >> It is not clear that there is any definitive benefit for pseudo >> to utilize the TS framework. It possibly gets some code reuse >> from TS but at the cost of extra code that won't be needed if >> written directly. Plus this performance hit. >> >> Anyways I will make a merge request to remove the third redundant >> computation of FormRHSFunction but will await input from others >> on if anything else could be done to remove the inefficiency. >> >> Thanks for reporting this challenging problem. >> >> ?Barry >> >> Note: I don't think providing the Jacobian improves the >> efficiency, it is just better at hiding the redundant computation. >> >> >> >> >> >> >> >>> On Aug 26, 2025, at 4:21?AM, Aldo Bonfiglioli >>> wrote: >>> >>> Hi there, >>> >>> I am using -ts_type pseudo to find steady solutions of the >>> Euler/NS PDEs. >>> >>> It looks like FormRHSFunction is called twice with the exactly >>> same value of the dependent variable (u) >>> >>> before invoking TSRHSJacobianFn and then solving the linear >>> system with KSP (u is then updated) >>> >>> >>>> 1 TS dt 0.141197 time 0.141197 >>>> Calling FormRHSFunction; ||u|| = ???60.489405479528003 >>>> ???????463.15635675129079 ???????62.813532026019146 >>>> ???????5.9789502719351155 >>>> Calling FormRHSFunction; ||u|| = ???60.489405479528003 >>>> ???????463.1563567512907962.8135320260191465.9789502719351155 >>>> Calling TSRHSJacobianFn with ||u|| = ???60.489405479528003 >>>> ???????463.15635675129079 ???????62.813532026019146 >>>> ???????5.9789502719351155 >>>> ?????Linear solve converged due to CONVERGED_RTOL iterations 9 >>>> Calling FormRHSFunction; ||u|| = >>>> ???60.489405476878737463.1563567560218662.8135320316169655.9789502710519811 >>>> 2 TS dt 0.155917 time 0.297115 >>>> Calling FormRHSFunction; ||u|| = >>>> ???60.489405476878737463.1563567560218662.8135320316169655.9789502710519811 >>>> Calling FormRHSFunction; ||u|| = >>>> ???60.489405476878737463.1563567560218662.8135320316169655.9789502710519811 >>>> Calling TSRHSJacobianFn with ||u|| = >>>> ???60.489405476878737463.1563567560218662.8135320316169655.9789502710519811 >>>> >>> Why is it so? Am I possibly misusing (or missing) some options? >>> months a >>> >>> My .petscrc file is attached. >>> >>> Thank you, >>> >>> Aldo >>> >>> -- >>> Dr. Aldo Bonfiglioli >>> Associate professor of Fluid Mechanics >>> Dipartimento di Ingegneria >>> Universita' della Basilicata >>> V.ledell'Ateneo Lucano, 10 85100 Potenza ITALY >>> tel:+39.0971.205203 fax:+39.0971.205215 >>> web:https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!fSXpVkczcuYe90b4FecJoyBEJfrf0l19hyR_OWi9XPSUnhoSQyzSjcwtb3wgdBcTWxs5uVJnWLeGe-8xyu-XTRFBhS9RCdKy2vs$ >> > Dear all, I am sorry to bring back an issue raised months ago, but I still see what looks a redundant (there where three, now seem to be two) evaluation of f(u) in -ts_type pseudo. I modified petsc/src/ts/tutorials/ex1.c (here enclosed) to print the norm of the unknown each time FormFunction is invoked. > timestep 0 time 0. ||u|| norm 0.989743 > TS 0 dt 0.125 time 0. fnorm 0.207564 > timestep 0 time 0.125 ||u|| norm 0.989743 > timestep 0 time 0. ||u|| norm 1.01305<-------------- > TS 1 dt 0.1375 time 0.125 fnorm 0.186587| > timestep 1 time 0.2625 ||u|| norm 1.01305<---------- > timestep 1 time 0.125 ||u|| norm 1.0359<--------------- > TS 2 dt 0.169687 time 0.2625 fnorm 0.166314| > timestep 2 time 0.432187 ||u|| norm 1.0359<------------ > timestep 2 time 0.2625 ||u|| norm 1.06045<--------------- > TS 3 dt 0.214308 time 0.432187 fnorm 0.144855| > timestep 3 time 0.646495 ||u|| norm 1.06045<------------- > timestep 3 time 0.432187 ||u|| norm 1.08663 > TS 4 dt 0.279101 time 0.646495 fnorm 0.12235 > timestep 4 time 0.925595 ||u|| norm 1.08663 > timestep 4 time 0.646495 ||u|| norm 1.11421 > TS 5 dt 0.379191 time 0.925595 fnorm 0.0990599 > timestep 5 time 1.30479 ||u|| norm 1.11421 > timestep 5 time 0.925595 ||u|| norm 1.14273 > TS 6 dt 0.547645 time 1.30479 fnorm 0.0754483 > timestep 6 time 1.85243 ||u|| norm 1.14273 > timestep 6 time 1.30479 ||u|| norm 1.17125 > TS 7 dt 0.86876 time 1.85243 fnorm 0.0523169 > timestep 7 time 2.72119 ||u|| norm 1.17125 > timestep 7 time 1.85243 ||u|| norm 1.19803 > TS 8 dt 1.61069 time 2.72119 fnorm 0.03104 ex1 has been run using -ts_monitor_pseudo -ts_type pseudo Thanks, Aldo -- Dr. Aldo Bonfiglioli Associate professor of Fluid Mechanics Dipartimento di Ingegneria Universita' della Basilicata V.le dell'Ateneo Lucano, 10 85100 Potenza ITALY tel:+39.0971.205203 fax:+39.0971.205215 web:https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!fSXpVkczcuYe90b4FecJoyBEJfrf0l19hyR_OWi9XPSUnhoSQyzSjcwtb3wgdBcTWxs5uVJnWLeGe-8xyu-XTRFBhS9RCdKy2vs$ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ex1.c Type: text/x-csrc Size: 10709 bytes Desc: not available URL: From daniel.pino_munoz at minesparis.psl.eu Sat Apr 25 13:05:31 2026 From: daniel.pino_munoz at minesparis.psl.eu (Daniel PINO MUNOZ) Date: Sat, 25 Apr 2026 18:05:31 +0000 Subject: [petsc-users] Understanding the structure of SNES matrix-free jacobian Message-ID: Dear all, I am struggling to understand how I should set up a SNES solver where the Newton Raphson iterations can be computed using a matrix-free method. This is what I would like to do : * I want to solve F(x) = 0 * The Newton Raphson iteration J(x) dx = -F(x) should be computed using a matrix-free method * Then classic Newton Raphson update x = x + dx The first question I would have is whether this can be done using SNES ? If not, I can always this done using a classic matrix-free product and implementing the Newton Raphson iterations myself. What I have tried, without success is the following : ?SNESCreate(PETSC_COMM_WORLD, &snes); SNESSetApplicationContext(snes, (void *)(&userCtx)); SNESSetFunction(snes, r, FormFunction1, (void *)&userCtx); MatCreateSNESMF(snes, &J); MatShellSetOperation(J, MATOP_MULT, (void(*)(void))mult); MatSetFromOptions(J); MatSetUp(J); SNESSetJacobian(snes, J, J, MFJacobianVectorProduct, (void *)&userCtx); ?SNESSetFromOptions(snes); SNESSetUseMatrixFree(snes, PETSC_FALSE, PETSC_TRUE); ... * The function 'mult' implements the matrix-free multiplication, say A y = b * But how do I get the point at which A is computed ? Since A is supposed to be the Jacobian it is something like A(x) * To try to do that, I added a method 'MFJacobianVectorProduct' where I store in the SNES Application Context the point 'x' at which the jacobian should be computed, then in the 'mult' function I try to get the context of 'J' and use it to compute the matrix-free product I am probably misunderstanding something since the code runs, but the Jacobian is simply computed using finite differences and my "matrix-free" Jacobian product implementation is not called. If you have an example, I would be happy to look into it. Thank you in advance, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: