/[escript]/trunk/escriptcore/py_src/flows.py
ViewVC logotype

Diff of /trunk/escriptcore/py_src/flows.py

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

revision 2415 by gross, Wed May 13 02:48:39 2009 UTC revision 2445 by gross, Fri May 29 03:23:25 2009 UTC
# Line 403  class StokesProblemCartesian(Homogeneous Line 403  class StokesProblemCartesian(Homogeneous
403          self.__surface_stress=surface_stress          self.__surface_stress=surface_stress
404          self.__stress=stress          self.__stress=stress
405    
406       def inner_pBv(self,p,v):       def Bv(self,v):
407           """           """
408           returns inner product of element p and div(v)           returns inner product of element p and div(v)
409    
# Line 412  class StokesProblemCartesian(Homogeneous Line 412  class StokesProblemCartesian(Homogeneous
412           @return: inner product of element p and div(v)           @return: inner product of element p and div(v)
413           @rtype: C{float}           @rtype: C{float}
414           """           """
415           return util.integrate(-p*util.div(v))           self.__pde_proj.setValue(Y=-util.div(v))
416             self.__pde_prec.setTolerance(self.getSubProblemTolerance())
417             return self.__pde_proj.getSolution()
418    
419         def inner_pBv(self,p,Bv):
420             """
421             returns inner product of element p and Bv=-div(v)
422    
423             @param p: a pressure increment
424             @param v: a residual
425             @return: inner product of element p and Bv=-div(v)
426             @rtype: C{float}
427             """
428             return util.integrate(util.interpolate(p,Function(self.domain))*util.interpolate(Bv,Function(self.domain)))
429    
430       def inner_p(self,p0,p1):       def inner_p(self,p0,p1):
431           """           """
# Line 454  class StokesProblemCartesian(Homogeneous Line 467  class StokesProblemCartesian(Homogeneous
467           out=self.__pde_u.getSolution(verbose=self.show_details)           out=self.__pde_u.getSolution(verbose=self.show_details)
468           return  out           return  out
469    
470         def norm_Bv(self,Bv):
          raise NotImplementedError,"no v calculation implemented."  
   
   
      def norm_Bv(self,v):  
471          """          """
472          Returns Bv (overwrite).          Returns Bv (overwrite).
473    
474          @rtype: equal to the type of p          @rtype: equal to the type of p
475          @note: boundary conditions on p should be zero!          @note: boundary conditions on p should be zero!
476          """          """
477          self.__pde_proj.setValue(Y=util.div(v))          return util.sqrt(util.integrate(util.interpolate(Bv,Function(self.domain))**2))
         self.__pde_prec.setTolerance(self.getSubProblemTolerance())  
         return util.sqrt(util.integrate(util.interpolate(self.__pde_proj.getSolution(),Function(self.domain))**2))  
478    
479       def solve_AinvBt(self,p):       def solve_AinvBt(self,p):
480           """           """
# Line 482  class StokesProblemCartesian(Homogeneous Line 489  class StokesProblemCartesian(Homogeneous
489           out=self.__pde_u.getSolution(verbose=self.show_details)           out=self.__pde_u.getSolution(verbose=self.show_details)
490           return  out           return  out
491    
492       def solve_precB(self,v):       def solve_prec(self,Bv):
493           """           """
494           applies preconditioner for for M{BA^{-1}B^*} to M{Bv}           applies preconditioner for for M{BA^{-1}B^*} to M{Bv}
495           with accuracy L{self.getSubProblemTolerance()} (overwrite).           with accuracy L{self.getSubProblemTolerance()}
496    
497           @param v: velocity increment           @param v: velocity increment
498           @return: M{p=P(Bv)} where M{P^{-1}} is an approximation of M{BA^{-1}B^*}           @return: M{p=P(Bv)} where M{P^{-1}} is an approximation of M{BA^{-1}B^*}
499           @note: boundary conditions on p are zero.           @note: boundary conditions on p are zero.
500           """           """
501           self.__pde_prec.setValue(Y=-util.div(v))           self.__pde_prec.setValue(Y=Bv)
502           self.__pde_prec.setTolerance(self.getSubProblemTolerance())           self.__pde_prec.setTolerance(self.getSubProblemTolerance())
503           return self.__pde_prec.getSolution(verbose=self.show_details)           return self.__pde_prec.getSolution(verbose=self.show_details)
504    
505    # rename solve_prec and change argument v to Bv
506    # chnage the argument of inner_pBv to v->Bv
507    # add Bv
508    # inner p still needed?
509    # change norm_Bv argument to Bv

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

  ViewVC Help
Powered by ViewVC 1.1.26