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

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

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

revision 614 by elspeth, Wed Mar 22 01:37:07 2006 UTC revision 791 by bcumming, Thu Jul 27 00:37:57 2006 UTC
# Line 7  the PDE solver library defined through t Line 7  the PDE solver library defined through t
7  The general interface is provided through the L{LinearPDE} class. The  The general interface is provided through the L{LinearPDE} class. The
8  L{AdvectivePDE} which is derived from the L{LinearPDE} class  L{AdvectivePDE} which is derived from the L{LinearPDE} class
9  provides an interface to PDE dominated by its advective terms. The L{Poisson},  provides an interface to PDE dominated by its advective terms. The L{Poisson},
10  L{Helmholtz}, L{LameEquation}, L{AdvectionDiffusion}  L{Helmholtz}, L{LameEquation}, L{AdvectivePDE}
11  classs which are also derived form the L{LinearPDE} class should be used  classs which are also derived form the L{LinearPDE} class should be used
12  to define of solve these sepecial PDEs.  to define of solve these sepecial PDEs.
13    
14  @var __author__: name of author  @var __author__: name of author
15    @var __copyright__: copyrights
16  @var __license__: licence agreement  @var __license__: licence agreement
17  @var __url__: url entry point on documentation  @var __url__: url entry point on documentation
18  @var __version__: version  @var __version__: version
# Line 28  __copyright__="""  Copyright (c) 2006 by Line 29  __copyright__="""  Copyright (c) 2006 by
29                  Primary Business: Queensland, Australia"""                  Primary Business: Queensland, Australia"""
30  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
31               http://www.opensource.org/licenses/osl-3.0.php"""               http://www.opensource.org/licenses/osl-3.0.php"""
32  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys"
33  __version__="$Revision$"  __version__="$Revision$"
34  __date__="$Date$"  __date__="$Date$"
35    
# Line 114  class PDECoefficient(object): Line 115  class PDECoefficient(object):
115         @param domain: domain on which the PDE uses the coefficient         @param domain: domain on which the PDE uses the coefficient
116         @type domain: L{Domain<escript.Domain>}         @type domain: L{Domain<escript.Domain>}
117         @param reducedEquationOrder: True to indicate that reduced order is used to represent the equation         @param reducedEquationOrder: True to indicate that reduced order is used to represent the equation
118         @type domain: C{bool}         @type reducedEquationOrder: C{bool}
119         @param reducedSolutionOrder: True to indicate that reduced order is used to represent the solution         @param reducedSolutionOrder: True to indicate that reduced order is used to represent the solution
120         @type domain: C{bool}         @type reducedSolutionOrder: C{bool}
121         @return:  L{FunctionSpace<escript.FunctionSpace>} of the coefficient         @return:  L{FunctionSpace<escript.FunctionSpace>} of the coefficient
122         @rtype:  L{FunctionSpace<escript.FunctionSpace>}         @rtype:  L{FunctionSpace<escript.FunctionSpace>}
123         """         """
# Line 154  class PDECoefficient(object): Line 155  class PDECoefficient(object):
155         @param numSolutions: number of components of the PDE solution         @param numSolutions: number of components of the PDE solution
156         @type numSolutions: C{int}         @type numSolutions: C{int}
157         @param reducedEquationOrder: True to indicate that reduced order is used to represent the equation         @param reducedEquationOrder: True to indicate that reduced order is used to represent the equation
158         @type domain: C{bool}         @type reducedEquationOrder: C{bool}
159         @param reducedSolutionOrder: True to indicate that reduced order is used to represent the solution         @param reducedSolutionOrder: True to indicate that reduced order is used to represent the solution
160         @type domain: C{bool}         @type reducedSolutionOrder: C{bool}
161         @param newValue: number of components of the PDE solution         @param newValue: number of components of the PDE solution
162         @type newValue: any object that can be converted into a L{Data<escript.Data>} object with the appropriate shape and L{FunctionSpace<escript.FunctionSpace>}         @type newValue: any object that can be converted into a L{Data<escript.Data>} object with the appropriate shape and L{FunctionSpace<escript.FunctionSpace>}
163         @raise IllegalCoefficientValue: if the shape of the assigned value does not match the shape of the coefficient         @raise IllegalCoefficientValue: if the shape of the assigned value does not match the shape of the coefficient
# Line 663  class LinearPDE(object): Line 664  class LinearPDE(object):
664       @rtype: L{Data<escript.Data>}       @rtype: L{Data<escript.Data>}
665       """       """
666       if u==None:       if u==None:
667            return self.getOperator()*self.getSolution()          return self.getOperator()*self.getSolution()
668       else:       else:
669          self.getOperator()*escript.Data(u,self.getFunctionSpaceForSolution())          return self.getOperator()*escript.Data(u,self.getFunctionSpaceForSolution())
670    
671     def getResidual(self,u=None):     def getResidual(self,u=None):
672       """       """
# Line 884  class LinearPDE(object): Line 885  class LinearPDE(object):
885         """         """
886         sets a new solver package         sets a new solver package
887    
888         @param solver: sets a new solver method.         @param package: sets a new solver method.
889         @type solver: one of L{DEFAULT}, L{PASO} L{SCSL}, L{MKL}, L{UMLPACK}         @type package: one of L{DEFAULT}, L{PASO} L{SCSL}, L{MKL}, L{UMFPACK}
890         """         """
891         if package==None: package=self.DEFAULT         if package==None: package=self.DEFAULT
892         if not package==self.getSolverPackage():         if not package==self.getSolverPackage():
893             self.__solver_method=solver             self.__solver_package=package
894             self.__checkMatrixType()             self.__checkMatrixType()
895             self.trace("New solver is %s"%self.getSolverMethodName())             self.trace("New solver is %s"%self.getSolverMethodName())
896    
# Line 1512  class LinearPDE(object): Line 1513  class LinearPDE(object):
1513           r=self.getCoefficientOfGeneralPDE("r")           r=self.getCoefficientOfGeneralPDE("r")
1514           homogeneous_constraint=True           homogeneous_constraint=True
1515           if not q.isEmpty() and not r.isEmpty():           if not q.isEmpty() and not r.isEmpty():
1516               if util.Lsup(q*r)>=1.e-13*util.Lsup(r):               if util.Lsup(q*r)>0.:
1517                 self.trace("Inhomogeneous constraint detected.")                 self.trace("Inhomogeneous constraint detected.")
1518                 self.__invalidateSystem()                 self.__invalidateSystem()
1519    
# Line 1537  class LinearPDE(object): Line 1538  class LinearPDE(object):
1538                   D=self.getCoefficientOfGeneralPDE("D")                   D=self.getCoefficientOfGeneralPDE("D")
1539                   if not D.isEmpty():                   if not D.isEmpty():
1540                       if self.getNumSolutions()>1:                       if self.getNumSolutions()>1:
1541                          D_times_e=util.matrixmult(D,numarray.ones((self.getNumSolutions(),)))                          #D_times_e=util.matrixmult(D,numarray.ones((self.getNumSolutions(),)))
1542                            D_times_e=util.matrix_mult(D,numarray.ones((self.getNumSolutions(),)))
1543                       else:                       else:
1544                          D_times_e=D                          D_times_e=D
1545                   else:                   else:
# Line 1545  class LinearPDE(object): Line 1547  class LinearPDE(object):
1547                   d=self.getCoefficientOfGeneralPDE("d")                   d=self.getCoefficientOfGeneralPDE("d")
1548                   if not d.isEmpty():                   if not d.isEmpty():
1549                       if self.getNumSolutions()>1:                       if self.getNumSolutions()>1:
1550                          d_times_e=util.matrixmult(d,numarray.ones((self.getNumSolutions(),)))                          #d_times_e=util.matrixmult(d,numarray.ones((self.getNumSolutions(),)))
1551                            d_times_e=util.matrix_mult(d,numarray.ones((self.getNumSolutions(),)))
1552                       else:                       else:
1553                          d_times_e=d                          d_times_e=d
1554                   else:                   else:
# Line 1806  class LameEquation(LinearPDE): Line 1809  class LameEquation(LinearPDE):
1809     """     """
1810     Class to define a Lame equation problem:     Class to define a Lame equation problem:
1811    
1812     M{-grad(S{mu}*(grad(u[i])[j]+grad(u[j])[i]))[j] - grad(S{lambda}*grad(u[j])[i])[j] = F_i -grad(S{sigma}[i,j])[j] }     M{-grad(S{mu}*(grad(u[i])[j]+grad(u[j])[i]))[j] - grad(S{lambda}*grad(u[k])[k])[j] = F_i -grad(S{sigma}[ij])[j] }
1813    
1814     with natural boundary conditons:     with natural boundary conditons:
1815    
1816     M{n[j]*(S{mu}*(grad(u[i])[j]+grad(u[j])[i]) - S{lambda}*grad(u[j])[i]) = f_i -n[j]*S{sigma}[i,j] }     M{n[j]*(S{mu}*(grad(u[i])[j]+grad(u[j])[i]) + S{lambda}*grad(u[k])[k]) = f_i +n[j]*S{sigma}[ij] }
1817    
1818     and constraints:     and constraints:
1819    

Legend:
Removed from v.614  
changed lines
  Added in v.791

  ViewVC Help
Powered by ViewVC 1.1.26