# Diff of /trunk/paso/src/NewtonGMRES.c

revision 1803 by ksteube, Fri Sep 19 01:37:09 2008 UTC revision 1804 by gross, Wed Sep 24 07:52:19 2008 UTC
# Line 72  err_t Paso_Solver_NewtonGMRES( Line 72  err_t Paso_Solver_NewtonGMRES(
72       /*       /*
73        * initial evaluation of F        * initial evaluation of F
74        */        */
75       Paso_FunctionCall(F,f,x);       Paso_FunctionCall(F,f,x,pp);
76       norm_f=Paso_l2(n,f,F->mpi_info);       norm_f=Paso_l2(n,f,F->mpi_info);
77       /*       /*
78        * stoping criterium:        * stoping criterium:
79        */        */
80       stop_tol=atol + rtol*norm_f;       stop_tol=atol + rtol*norm_f;
81       iteration_count=1;       if (stop_tol<=0) {
82       if (debug) printf("Start Jacobi-free Newton scheme:\n\ttolerance = %e\n\tstopping tolerance = %e\n",rtol,stop_tol);         Status=SOLVER_INPUT_ERROR;
83       /*         if (debug) printf("zero tolerance given.\n");
84        *  main iteration loop       } else {
85        */         iteration_count=1;
86       while (! (convergeFlag || maxIterFlag || breakFlag)) {         if (debug) printf("Start Jacobi-free Newton scheme:\n\ttolerance = %e\n\tstopping tolerance = %e\n",rtol,stop_tol);
87           /*
88            *  main iteration loop
89            */
90           while (! (convergeFlag || maxIterFlag || breakFlag)) {
91           /*           /*
92            * keep track of the ratio (reduction_f = norm_f/frnmo) of successive residual norms and            * keep track of the ratio (reduction_f = norm_f/frnmo) of successive residual norms and
93            * the iteration counter (iteration_count)            * the iteration counter (iteration_count)
# Line 105  err_t Paso_Solver_NewtonGMRES( Line 109  err_t Paso_Solver_NewtonGMRES(
109               */               */
110              norm_fo=norm_f;              norm_fo=norm_f;
111              Paso_Update(n,1.,x,1.,step);              Paso_Update(n,1.,x,1.,step);
112              Paso_FunctionCall(F,f,x);              Paso_FunctionCall(F,f,x,pp);
113              iteration_count++;              iteration_count++;
114              norm_f=Paso_l2(n,f,F->mpi_info);              norm_f=Paso_l2(n,f,F->mpi_info);
115              reduction_f=norm_f/norm_fo;              reduction_f=norm_f/norm_fo;
# Line 124  err_t Paso_Solver_NewtonGMRES( Line 128  err_t Paso_Solver_NewtonGMRES(
128              breakFlag=TRUE;              breakFlag=TRUE;
129           }           }
130           maxIterFlag = (iteration_count > maxit);           maxIterFlag = (iteration_count > maxit);
131             }
132             if (debug) {
133                  if (convergeFlag) printf("convergence reached after %d steps with residual %e.\n",iteration_count,norm_f);
134                  if (breakFlag)  printf("iteration break down after %d steps.\n",iteration_count);
135                  if (maxIterFlag)  printf("maximum number of iteration step %d is reached.\n",maxit);
136             }
137            if (breakFlag) Status=SOLVER_BREAKDOWN;
138            if (maxIterFlag) Status=SOLVER_MAXITER_REACHED;
139        }        }
if (debug) {
if (convergeFlag) printf("convergence reached after %d steps with residual %e.\n",iteration_count,norm_f);
if (breakFlag)  printf("iteration break down after %d steps.\n",iteration_count);
if (maxIterFlag)  printf("maximum number of iteration step %d is reached.\n",maxit);
}
if (breakFlag) Status=SOLVER_BREAKDOWN;
if (maxIterFlag) Status=SOLVER_MAXITER_REACHED;
140    }    }
141    TMPMEMFREE(f);    TMPMEMFREE(f);
142    TMPMEMFREE(step);    TMPMEMFREE(step);

Legend:
 Removed from v.1803 changed lines Added in v.1804