<div dir="ltr"><div><div><div><div>Hi all,<br><br></div>I adapted ex13.c from .../ts/examples/tutorials/ex13.c to solve a 1D TD PDE (swift-hohenberg).<br></div><div><i>Long story short</i>: the function which sets the Jacobian is never being called despite being assigned by <span style="font-family:tahoma,sans-serif">TSSetRHSJacobian()</span>.<br></div><div><br></div>I create the TS environment with the following commands (omitting some code before and after -- Full code attached):<br><br><span style="font-family:tahoma,sans-serif">---------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>  ierr = DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, 15, 1, 1, NULL, &da); CHKERRQ(ierr);<br><br>  /*==================================================================                                                                                                                                                                        <br>    Let DMDA create vector                                                                                                                                                                                                                    <br>    ==================================================================*/<br><br>  ierr = DMCreateGlobalVector(da, &x);CHKERRQ(ierr);<br><br>  /*==================================================================                                                                                                                                                                        <br>    Create timestepper context which will use Euler Method                                                                                                                                                                                            <br>    ==================================================================*/<br><br>  ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);<br>  ierr = TSSetDM(ts, da);CHKERRQ(ierr);<br>  ierr = TSSetType(ts, TSEULER);CHKERRQ(ierr);<br><br>  ierr = TSSetRHSFunction(ts, x, RHSFunction, NULL);CHKERRQ(ierr);<br><br>  /*=================================================================                                                                                                                                                                         <br>    Create Jacobian for Euler Method                                                                                                                                                                                                          <br>    =================================================================*/<br>  ierr = DMSetMatType(da, MATAIJ);CHKERRQ(ierr);<br>  ierr = DMCreateMatrix(da,&J);CHKERRQ(ierr);<br>  ierr = TSSetRHSJacobian(ts,J,J,RHSJacobian,NULL); CHKERRQ(ierr)<br>---------------------------------------------------------------------------------------------------------------------------------------------------------------------</span><br><br></div>I define the function <span style="font-family:tahoma,sans-serif">RHSJacobian</span> later, <span style="font-family:tahoma,sans-serif">PetscPrintf(PETSC_COMM_WORLD, "Jacobian function called")</span> is used to see if the function is ever called.<br><br></div><div>Neither is the message ever called, nor is the Jacobian matrix ever non-zero. The J matrix is checked with MatView( ). No error messages are produced either at compiling nor runtime.<br><br></div><div>Has anyone else run into such an issue or have any advice of how best to probe the problem? <br></div><div>Thanks so much!<br></div><div>-Scott Dossa<br></div><div><br><br></div></div>