Re: [petsc-users] questions about the SNES Function Norm

2014-05-04 Thread Barry Smith
You will need to work your way through the code in SNESSolve_VINEWTONRSLS() which is in src/snes/impls/vi/rs http://www.mcs.anl.gov/petsc/petsc-dev/src/snes/impls/vi/rs/virs.c.html It is not a trivial algorithm but it is reasonably straightforward. Barry On May 4, 2014, at 3:32 PM

Re: [petsc-users] questions about the SNES Function Norm

2014-05-04 Thread Xiangdong
On Fri, May 2, 2014 at 4:10 PM, Matthew Knepley wrote: > On Fri, May 2, 2014 at 12:53 PM, Xiangdong wrote: >> >> On Thu, May 1, 2014 at 10:21 PM, Barry Smith wrote: >> >>> >>> On May 1, 2014, at 9:12 PM, Xiangdong wrote: >>> >>> > I came up with a simple example to demonstrate this "eliminatin

Re: [petsc-users] questions about the SNES Function Norm

2014-05-02 Thread Matthew Knepley
On Fri, May 2, 2014 at 12:53 PM, Xiangdong wrote: > > On Thu, May 1, 2014 at 10:21 PM, Barry Smith wrote: > >> >> On May 1, 2014, at 9:12 PM, Xiangdong wrote: >> >> > I came up with a simple example to demonstrate this "eliminating row" >> behavior. It happens when the solution x to the lineariz

Re: [petsc-users] questions about the SNES Function Norm

2014-05-02 Thread Xiangdong
On Thu, May 1, 2014 at 10:21 PM, Barry Smith wrote: > > On May 1, 2014, at 9:12 PM, Xiangdong wrote: > > > I came up with a simple example to demonstrate this "eliminating row" > behavior. It happens when the solution x to the linearized equation Ax=b is > out of the bound set by SNESVISetVariab

Re: [petsc-users] questions about the SNES Function Norm

2014-05-01 Thread Barry Smith
On May 1, 2014, at 9:12 PM, Xiangdong wrote: > I came up with a simple example to demonstrate this "eliminating row" > behavior. It happens when the solution x to the linearized equation Ax=b is > out of the bound set by SNESVISetVariableBounds(); > > In the attached example, I use snes to so

Re: [petsc-users] questions about the SNES Function Norm

2014-05-01 Thread Xiangdong
I came up with a simple example to demonstrate this "eliminating row" behavior. It happens when the solution x to the linearized equation Ax=b is out of the bound set by SNESVISetVariableBounds(); In the attached example, I use snes to solve a simple function x-b=0. When you run it, it outputs the

Re: [petsc-users] questions about the SNES Function Norm

2014-05-01 Thread Xiangdong
Here is the order of functions I called: DMDACreate3d(); SNESCreate(); SNESSetDM(); (DM with dof=2); DMSetApplicationContext(); DMDASNESSetFunctionLocal(); SNESVISetVariableBounds(); DMDASNESetJacobianLocal(); SNESSetFromOptions(); SNESSolve(); SNESGetKSP(); KSPGetSolution(); KSPGetRhs()

Re: [petsc-users] questions about the SNES Function Norm

2014-05-01 Thread Barry Smith
On May 1, 2014, at 10:32 AM, Xiangdong wrote: > Under what condition, SNESGetFunctionNorm() will output different results > from SENEGetFunction + VecNorm (with NORM_2)? > > For most of my test cases, it is the same. However, when I have some special > (trivial) initial guess to the SNES pro

Re: [petsc-users] questions about the SNES Function Norm

2014-05-01 Thread Xiangdong
Under what condition, SNESGetFunctionNorm() will output different results from SENEGetFunction + VecNorm (with NORM_2)? For most of my test cases, it is the same. However, when I have some special (trivial) initial guess to the SNES problem, I see different norms. Another phenomenon I noticed wit

Re: [petsc-users] questions about the SNES Function Norm

2014-04-29 Thread Matthew Knepley
On Tue, Apr 29, 2014 at 2:09 PM, Xiangdong wrote: > It turns out to a be a bug in my FormFunctionLocal(DMDALocalInfo > *info,PetscScalar **x,PetscScalar **f,AppCtx *user). I forgot to initialize > the array f. Zero the array f solved the problem and gave consistent result. > > Just curious, why

Re: [petsc-users] questions about the SNES Function Norm

2014-04-29 Thread Xiangdong
It turns out to a be a bug in my FormFunctionLocal(DMDALocalInfo *info,PetscScalar **x,PetscScalar **f,AppCtx *user). I forgot to initialize the array f. Zero the array f solved the problem and gave consistent result. Just curious, why does not petsc initialize the array f to zero by default insi

Re: [petsc-users] questions about the SNES Function Norm

2014-04-28 Thread Barry Smith
On Apr 28, 2014, at 3:23 PM, Xiangdong wrote: > Hello everyone, > > When I run snes program, what SNES program”? > it outputs "SNES Function norm 1.23456789e+10". It seems that this norm is > different from residue norm (even if solving F(x)=0) Please send the full ou

[petsc-users] questions about the SNES Function Norm

2014-04-28 Thread Xiangdong
Hello everyone, When I run snes program, it outputs "SNES Function norm 1.23456789e+10". It seems that this norm is different from residue norm (even if solving F(x)=0) and also differ from norm of the Jacobian. What is the definition of this "SNES Function Norm"? Thank you. Best, Xiangdong