<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear Barry,</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
thank you for your reply. Now everything works fine.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Samuele</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Da:</b> Barry Smith <bsmith@petsc.dev><br>
<b>Inviato:</b> mercoledì 5 novembre 2025 15:47<br>
<b>A:</b> Samuele Ferri <sale987@live.com><br>
<b>Cc:</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Oggetto:</b> Re: [petsc-users] Two SNES on the same DM not working</font>
<div> </div>
</div>
<div style="line-break:after-white-space">
<div><br>
</div>
This is not supported. Duplicate your DM.<br id="x_lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Nov 5, 2025, at 9:17 AM, Samuele Ferri <sale987@live.com> wrote:</div>
<br class="x_Apple-interchange-newline">
<div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
Dear petsc users,</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
in petsc version 3.24, I'm trying to create two snes over the same DM, but with different functions and jacobians. Despite making different calls to SNESSetFunction it happens the second snes uses the same function of the first.</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
Can you help me finding the problem, please?</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
Here below there is a minimal working example showing the issue:</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-family:Helvetica; font-size:18px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="x_elementToProof" style="line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
static char help[] = "Test SNES.\n";</div>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
#include <petscsys.h></div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
#include <petscdmda.h></div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
#include <petscsnes.h><br>
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscErrorCode Jac_1(SNES<span class="x_Apple-converted-space"> </span><i>snes</i>, Vec<span class="x_Apple-converted-space"> </span><i>x</i>, Mat<span class="x_Apple-converted-space"> </span><i>J</i>, Mat<span class="x_Apple-converted-space"> </span><i>B</i>,
void *){</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionBegin;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("Jac 1\n");</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionReturn(PETSC_SUCCESS);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
}</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscErrorCode Function_1(SNES<span class="x_Apple-converted-space"> </span><i>snes</i>, Vec<span class="x_Apple-converted-space"> </span><i>x</i>, Vec<span class="x_Apple-converted-space"> </span><i>f</i>, void *){</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionBegin;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("Function 1\n");</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionReturn(PETSC_SUCCESS);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
}</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscErrorCode Jac_2(SNES<span class="x_Apple-converted-space"> </span><i>snes</i>, Vec<span class="x_Apple-converted-space"> </span><i>x</i>, Mat<span class="x_Apple-converted-space"> </span><i>J</i>, Mat<span class="x_Apple-converted-space"> </span><i>B</i>,
void *){</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionBegin;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("Jac 2\n");</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionReturn(PETSC_SUCCESS);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
}</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscErrorCode Function_2(SNES<span class="x_Apple-converted-space"> </span><i>snes</i>, Vec<span class="x_Apple-converted-space"> </span><i>x</i>, Vec<span class="x_Apple-converted-space"> </span><i>f</i>, void *){</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionBegin;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("Function 2\n");</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionReturn(PETSC_SUCCESS);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
}<br>
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
int main(int<span class="x_Apple-converted-space"> </span><i>argc</i>, char **<i>argv</i>) {</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionBeginUser;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(PetscInitialize(&<i>argc</i>, &<i>argv</i>, NULL, help));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
DM dm;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, 100, 1, 1, NULL, &dm));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMSetFromOptions(dm));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMSetUp(dm));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
SNES snes1, snes2;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
Vec r1,r2;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
Mat J1, J2;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMCreateGlobalVector(dm, &r1));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMCreateGlobalVector(dm, &r2))</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMCreateMatrix(dm, &J1));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(DMCreateMatrix(dm, &J2));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESCreate(PETSC_COMM_WORLD, &snes1));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESCreate(PETSC_COMM_WORLD, &snes2));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetType(snes1, SNESNEWTONLS));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetType(snes2, SNESNEWTONLS));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetFromOptions(snes1));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetFromOptions(snes2));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetFunction(snes1, r1, Function_1, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetFunction(snes2, r2, Function_2, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetJacobian(snes1, J1, J1, Jac_1, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetJacobian(snes2, J2, J2, Jac_2, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetDM(snes1, dm));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSetDM(snes2, dm));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSolve(snes1, NULL, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESSolve(snes2, NULL, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("snes1 %p; snes2 %p\n", snes1, snes2);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
SNESFunctionFn *p;</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESGetFunction(snes1, NULL, &p, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("snes1: pointer %p, true function %p\n", *p, Function_1);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(SNESGetFunction(snes2, NULL, &p, NULL));</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
printf("snes2: pointer %p, true function %p\n", *p, Function_2);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscCall(PetscFinalize());</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
PetscFunctionReturn(PETSC_SUCCESS);</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-height:22px; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
}</div>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>