/[escript]/trunk/escript/py_src/pdetools.py
ViewVC logotype

Diff of /trunk/escript/py_src/pdetools.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2414 by jfenwick, Mon Mar 30 02:13:58 2009 UTC revision 2415 by gross, Wed May 13 02:48:39 2009 UTC
# Line 1608  class HomogeneousSaddlePointProblem(obje Line 1608  class HomogeneousSaddlePointProblem(obje
1608           while not converged:           while not converged:
1609                # calculate velocity for current pressure:                # calculate velocity for current pressure:
1610                v=self.getV(p,v)                v=self.getV(p,v)
               #  
1611                norm_v=self.norm_v(v)                norm_v=self.norm_v(v)
1612                norm_Bv=self.norm_Bv(v)                norm_Bv=self.norm_Bv(v)
1613                ATOL=norm_v*rtol+atol                ATOL=norm_v*rtol+atol
1614                if self.verbose: print "saddle point solver: norm v= %e, norm_Bv= %e, tolerance = %e."%(norm_v, norm_Bv,ATOL)                if self.verbose: print "HomogeneousSaddlePointProblem: norm v= %e, norm_Bv= %e, tolerance = %e."%(norm_v, norm_Bv,ATOL)
1615                if not ATOL>0: raise ValueError,"overall absolute tolerance needs to be positive."                if not ATOL>0: raise ValueError,"overall absolute tolerance needs to be positive."
1616                if norm_Bv <= ATOL:                if norm_Bv <= ATOL:
1617                   converged=True                   converged=True
# Line 1628  class HomogeneousSaddlePointProblem(obje Line 1627  class HomogeneousSaddlePointProblem(obje
1627                   else:                   else:
1628                     norm2=self.norm_p(dp)                     norm2=self.norm_p(dp)
1629                   ATOL_ITER=ATOL/norm_Bv*norm2                   ATOL_ITER=ATOL/norm_Bv*norm2
1630                   if self.verbose: print "saddle point solver: tolerance for solver: %e"%ATOL_ITER                   if self.verbose: print "HomogeneousSaddlePointProblem: tolerance for solver: %e"%ATOL_ITER
1631                   if usePCG:                   if usePCG:
1632                         p,v0,a_norm=PCG(v,self.__Aprod_PCG,p,self.__Msolve_PCG,self.__inner_PCG,atol=ATOL_ITER, rtol=0.,iter_max=max_iter, verbose=self.verbose)                         p,v0,a_norm=PCG(v,self.__Aprod_PCG,p,self.__Msolve_PCG,self.__inner_PCG,atol=ATOL_ITER, rtol=0.,iter_max=max_iter, verbose=self.verbose)
1633                   else:                   else:
1634                         p=GMRES(dp,self.__Aprod_GMRES, p, self.__inner_GMRES,atol=ATOL_ITER, rtol=0.,iter_max=max_iter, iter_restart=iter_restart, verbose=self.verbose)                         p=GMRES(dp,self.__Aprod_GMRES, p, self.__inner_GMRES,atol=ATOL_ITER, rtol=0.,iter_max=max_iter, iter_restart=iter_restart, verbose=self.verbose)
1635           if self.verbose: print "saddle point solver: tolerance reached."           if self.verbose: print "HomogeneousSaddlePointProblem: tolerance reached."
1636       return v,p       return v,p
1637    
1638        #========================================================================        #========================================================================

Legend:
Removed from v.2414  
changed lines
  Added in v.2415

  ViewVC Help
Powered by ViewVC 1.1.26