Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-27 Thread Fande Kong
Thanks, Barry, On Sat, Jan 27, 2018 at 3:10 PM, Smith, Barry F. wrote: > > Fande, > > I have done something similar in the branch > https://bitbucket.org/petsc/petsc/pull-requests/845/added- > matsnesmfsetreusebase-at-request-of/diff attached is your test case. > I

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-27 Thread Smith, Barry F.
Fande, I have done something similar in the branch https://bitbucket.org/petsc/petsc/pull-requests/845/added-matsnesmfsetreusebase-at-request-of/diff attached is your test case. I don't think a command line option makes sense for this functionality. Barry I didn't do it with a

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-27 Thread Fande Kong
Hi Barry, Thanks so much! Does this requires us to attach a shell function "MatAssemblyEnd_SNESMF"? We need to maintain "MatAssemblyEnd_SNESMF" in the moose side? Could we just add a flag into the original routine "MatAssemblyEnd_SNESMF" in PETSc? *static PetscErrorCode

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-26 Thread Smith, Barry F.
Thanks, I now understand the situation. I have a tentative solution for you that does not require complex new APIs. I have added one function to the master branch MatSNESMFGetSNES() and attach a modified example that utilizes this to avoid the extra function evaluations. Please let

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-26 Thread Alexander Lindsay
We are doing something non-standard. We set different functions for snes and mffd. When a function is called through snes, we know we are doing a non-linear residual evaluation and we allow an update of our mechanical contact nodes. When a function is called through mffd, we know we are within

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-26 Thread Kong, Fande
Hi Barry, I made minor changes on src/snes/examples/tutorials/ex2.c to demonstrate this issue. Please see the attachment. ./ex2 -snes_monitor -ksp_monitor -snes_mf_operator 1 *atol=1e-50, rtol=1e-08, stol=1e-08, maxit=50, maxf=1 FormFunction is called 0 SNES

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-26 Thread Smith, Barry F.
So you are doing something non-standard? Are you not just using -snes_mf or -snes_mf_operator? Can you send me a sample code that has the extra function evaluations? Because if you run through regular usage with the debugger you will see there is no extra evaluation. Barry > On Jan

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-26 Thread Kong, Fande
On Fri, Jan 26, 2018 at 3:10 PM, Smith, Barry F. wrote: > > > > On Jan 26, 2018, at 2:15 PM, Kong, Fande wrote: > > > > > > > > On Mon, Jan 8, 2018 at 2:15 PM, Smith, Barry F. > wrote: > > > > > > > On Jan 8, 2018, at 2:59 PM,

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-26 Thread Smith, Barry F.
> On Jan 26, 2018, at 2:15 PM, Kong, Fande wrote: > > > > On Mon, Jan 8, 2018 at 2:15 PM, Smith, Barry F. wrote: > > > > On Jan 8, 2018, at 2:59 PM, Alexander Lindsay > > wrote: > > > > Is there any elegant way to tell

Re: [petsc-users] Context behind SNESComputeFunction call

2018-01-08 Thread Smith, Barry F.
> On Jan 8, 2018, at 2:59 PM, Alexander Lindsay > wrote: > > Is there any elegant way to tell whether SNESComputeFunction is being called > under different conceptual contexts? > > E.g. non-linear residual evaluation vs. Jacobian formation from finite >

[petsc-users] Context behind SNESComputeFunction call

2018-01-08 Thread Alexander Lindsay
Is there any elegant way to tell whether SNESComputeFunction is being called under different conceptual contexts? E.g. non-linear residual evaluation vs. Jacobian formation from finite differencing vs. Jacobian-vector products from finite differencing? Alex