SNES problem
JoaoFlavio Vasconcellos
joaoflavio.vasconcellos at jcu.edu.au
Wed Oct 3 00:11:59 CDT 2007
Hello
I'm trying to use SNES to solve a problem. I wrote the code above to evaluate the residual of the linear system. In this routine norm_2 of F is different from zero but outside of this routine norm_2 of F is zero.
#undef __FUNCT__
#define __FUNCT__ "FormFunction1"
PetscErrorCode FormFunction1(SNES snes, Vec X, Vec F, void *_simulator) {
Simulator *simulator = (Simulator*) _simulator;
PetscErrorCode ierr;
VecView (X, 0);
ierr = simulator->CalculateMatrixCoefficient(X); CHKERRQ(ierr);
ierr = simulator->CalculateSourceTerm(X); CHKERRQ(ierr);
ierr = simulator->CalculateResidual (X, &F); CHKERRQ(ierr);
cout << "Residual " << endl;
VecView (F, 0); // norm_2 of F is != zero
return 0;
}
// End of routine
Messages from -snes_view:
0 SNES Function norm 0.000000000000e+00
SNES Object:
type: ls
line search variant: SNESLineSearchCubic
alpha=0.0001, maxstep=1e+08, steptol=1e-12
maximum iterations=50, maximum function evaluations=10000
tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
total number of linear solver iterations=0
total number of function evaluations=1
KSP Object:
type: gmres
GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
GMRES: happy breakdown tolerance 1e-30
maximum iterations=10000, initial guess is zero
tolerances: relative=1e-05, absolute=1e-50, divergence=10000
left preconditioning
PC Object:
type: ilu
ILU: 0 levels of fill
ILU: factor fill ratio allocated 1
ILU: tolerance for zero pivot 1e-12
out-of-place factorization
matrix ordering: natural
// end of message
I dont know why "SNES Function norm 0.000000000000e+00" if
F's norm_2 inside my routine is not. Has anyone that could sugest how to fix this problem ?
Thank you in advance.
Joao Flavio Vieira de Vasconcellos
School of Engineering
James Cook University
Phone: +61 7 4781 4340
Fax: +61 7 4775 1184
Email: jflavio at iprj.uerj.br
joaoflavio.vasconcellos at jcu.edu.au
skype: jflavio_vasconcellos
msn: jf_vasconcellos at hotmail.com
More information about the petsc-users
mailing list