/[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 3268 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 3269 by jfenwick, Wed Oct 13 03:21:50 2010 UTC
# Line 2417  class LinearPDE(LinearProblem): Line 2417  class LinearPDE(LinearProblem):
2417       #       #
2418       #   the coefficients of the PDE:       #   the coefficients of the PDE:
2419       #       #
   
2420       self.introduceCoefficients(       self.introduceCoefficients(
2421         A=PDECoef(PDECoef.INTERIOR,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION,PDECoef.BY_DIM),PDECoef.OPERATOR),         A=PDECoef(PDECoef.INTERIOR,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION,PDECoef.BY_DIM),PDECoef.OPERATOR),
2422         B=PDECoef(PDECoef.INTERIOR,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),         B=PDECoef(PDECoef.INTERIOR,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),
# Line 2427  class LinearPDE(LinearProblem): Line 2426  class LinearPDE(LinearProblem):
2426         Y=PDECoef(PDECoef.INTERIOR,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),         Y=PDECoef(PDECoef.INTERIOR,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),
2427         d=PDECoef(PDECoef.BOUNDARY,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),         d=PDECoef(PDECoef.BOUNDARY,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),
2428         y=PDECoef(PDECoef.BOUNDARY,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),         y=PDECoef(PDECoef.BOUNDARY,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),
2429           d_contact=PDECoef(PDECoef.CONTACT,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),
2430           y_contact=PDECoef(PDECoef.CONTACT,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),
2431         A_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION,PDECoef.BY_DIM),PDECoef.OPERATOR),         A_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION,PDECoef.BY_DIM),PDECoef.OPERATOR),
2432         B_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),         B_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_DIM,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),
2433         C_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION,PDECoef.BY_DIM),PDECoef.OPERATOR),         C_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION,PDECoef.BY_DIM),PDECoef.OPERATOR),
# Line 2435  class LinearPDE(LinearProblem): Line 2436  class LinearPDE(LinearProblem):
2436         Y_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),         Y_reduced=PDECoef(PDECoef.INTERIOR_REDUCED,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),
2437         d_reduced=PDECoef(PDECoef.BOUNDARY_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),         d_reduced=PDECoef(PDECoef.BOUNDARY_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),
2438         y_reduced=PDECoef(PDECoef.BOUNDARY_REDUCED,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),         y_reduced=PDECoef(PDECoef.BOUNDARY_REDUCED,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),
2439           d_contact_reduced=PDECoef(PDECoef.CONTACT_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),
2440           y_contact_reduced=PDECoef(PDECoef.CONTACT_REDUCED,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),
2441         r=PDECoef(PDECoef.SOLUTION,(PDECoef.BY_SOLUTION,),PDECoef.RIGHTHANDSIDE),         r=PDECoef(PDECoef.SOLUTION,(PDECoef.BY_SOLUTION,),PDECoef.RIGHTHANDSIDE),
2442         q=PDECoef(PDECoef.SOLUTION,(PDECoef.BY_SOLUTION,),PDECoef.BOTH) )         q=PDECoef(PDECoef.SOLUTION,(PDECoef.BY_SOLUTION,),PDECoef.BOTH) )
      if domain.supportsContactElements():  
          self.introduceCoefficients(  
         d_contact_reduced=PDECoef(PDECoef.CONTACT_REDUCED,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),  
             y_contact_reduced=PDECoef(PDECoef.CONTACT_REDUCED,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE),  
             d_contact=PDECoef(PDECoef.CONTACT,(PDECoef.BY_EQUATION,PDECoef.BY_SOLUTION),PDECoef.OPERATOR),  
             y_contact=PDECoef(PDECoef.CONTACT,(PDECoef.BY_EQUATION,),PDECoef.RIGHTHANDSIDE)  
        )  
2443    
2444     def __str__(self):     def __str__(self):
2445       """       """
# Line 2482  class LinearPDE(LinearProblem): Line 2478  class LinearPDE(LinearProblem):
2478        out=out and self.checkSymmetricTensor("D_reduced", verbose)        out=out and self.checkSymmetricTensor("D_reduced", verbose)
2479        out=out and self.checkSymmetricTensor("d", verbose)        out=out and self.checkSymmetricTensor("d", verbose)
2480        out=out and self.checkSymmetricTensor("d_reduced", verbose)        out=out and self.checkSymmetricTensor("d_reduced", verbose)
2481        if self.getDomain().supportsContactElements():        out=out and self.checkSymmetricTensor("d_contact", verbose)
2482            out=out and self.checkSymmetricTensor("d_contact", verbose)        out=out and self.checkSymmetricTensor("d_contact_reduced", verbose)
           out=out and self.checkSymmetricTensor("d_contact_reduced", verbose)  
2483        return out        return out
2484    
2485     def createOperator(self):     def createOperator(self):
# Line 2537  class LinearPDE(LinearProblem): Line 2532  class LinearPDE(LinearProblem):
2532                        raise ValueError,"coefficient B in lumped matrix may not be present."                        raise ValueError,"coefficient B in lumped matrix may not be present."
2533                   if not self.getCoefficient("C").isEmpty():                   if not self.getCoefficient("C").isEmpty():
2534                        raise ValueError,"coefficient C in lumped matrix may not be present."                        raise ValueError,"coefficient C in lumped matrix may not be present."
2535                     if not self.getCoefficient("d_contact").isEmpty():
2536                          raise ValueError,"coefficient d_contact in lumped matrix may not be present."
2537                   if not self.getCoefficient("A_reduced").isEmpty():                   if not self.getCoefficient("A_reduced").isEmpty():
2538                        raise ValueError,"coefficient A_reduced in lumped matrix may not be present."                        raise ValueError,"coefficient A_reduced in lumped matrix may not be present."
2539                   if not self.getCoefficient("B_reduced").isEmpty():                   if not self.getCoefficient("B_reduced").isEmpty():
2540                        raise ValueError,"coefficient B_reduced in lumped matrix may not be present."                        raise ValueError,"coefficient B_reduced in lumped matrix may not be present."
2541                   if not self.getCoefficient("C_reduced").isEmpty():                   if not self.getCoefficient("C_reduced").isEmpty():
2542                        raise ValueError,"coefficient C_reduced in lumped matrix may not be present."                        raise ValueError,"coefficient C_reduced in lumped matrix may not be present."
2543           if self.getDomain().supportsContactElements():                   if not self.getCoefficient("d_contact_reduced").isEmpty():
                    if not self.getCoefficient("d_contact").isEmpty():  
                       raise ValueError,"coefficient d_contact in lumped matrix may not be present."                  
            if not self.getCoefficient("d_contact_reduced").isEmpty():  
2544                        raise ValueError,"coefficient d_contact_reduced in lumped matrix may not be present."                        raise ValueError,"coefficient d_contact_reduced in lumped matrix may not be present."
2545                   D=self.getCoefficient("D")                   D=self.getCoefficient("D")
2546                   d=self.getCoefficient("d")                   d=self.getCoefficient("d")
# Line 2602  class LinearPDE(LinearProblem): Line 2596  class LinearPDE(LinearProblem):
2596                if not self.isRightHandSideValid():                if not self.isRightHandSideValid():
2597                   self.resetRightHandSide()                   self.resetRightHandSide()
2598                   righthandside=self.getCurrentRightHandSide()                   righthandside=self.getCurrentRightHandSide()
2599           args=(self.getCoefficient("X"), \                   self.getDomain().addPDEToRHS(righthandside, \
2600                                   self.getCoefficient("X"), \
2601                                 self.getCoefficient("Y"),\                                 self.getCoefficient("Y"),\
2602                                 self.getCoefficient("y"))                                 self.getCoefficient("y"),\
2603           if self.getDomain().supportsContactElements():                                 self.getCoefficient("y_contact"))
2604               args+=(self.getCoefficient("y_contact"),)                   self.getDomain().addPDEToRHS(righthandside, \
2605                   self.getDomain().addPDEToRHS(righthandside, *args)                                 self.getCoefficient("X_reduced"), \
          args=(self.getCoefficient("X_reduced"), \  
2606                                 self.getCoefficient("Y_reduced"),\                                 self.getCoefficient("Y_reduced"),\
2607                                 self.getCoefficient("y_reduced"))                                 self.getCoefficient("y_reduced"),\
2608           if self.getDomain().supportsContactElements():                                 self.getCoefficient("y_contact_reduced"))
              args+=(self.getCoefficient("y_contact_reduced"),)  
                  self.getDomain().addPDEToRHS(righthandside, *args)  
2609                   self.trace("New right hand side has been built.")                   self.trace("New right hand side has been built.")
2610                   self.validRightHandSide()                   self.validRightHandSide()
2611                self.insertConstraint(rhs_only=False)                self.insertConstraint(rhs_only=False)
# Line 2624  class LinearPDE(LinearProblem): Line 2616  class LinearPDE(LinearProblem):
2616                   righthandside=self.getCurrentRightHandSide()                   righthandside=self.getCurrentRightHandSide()
2617                   self.resetOperator()                   self.resetOperator()
2618                   operator=self.getCurrentOperator()                   operator=self.getCurrentOperator()
2619           args=(operator,righthandside, \                   self.getDomain().addPDEToSystem(operator,righthandside, \
2620                                 self.getCoefficient("A"), \                                 self.getCoefficient("A"), \
2621                                 self.getCoefficient("B"), \                                 self.getCoefficient("B"), \
2622                                 self.getCoefficient("C"), \                                 self.getCoefficient("C"), \
# Line 2632  class LinearPDE(LinearProblem): Line 2624  class LinearPDE(LinearProblem):
2624                                 self.getCoefficient("X"), \                                 self.getCoefficient("X"), \
2625                                 self.getCoefficient("Y"), \                                 self.getCoefficient("Y"), \
2626                                 self.getCoefficient("d"), \                                 self.getCoefficient("d"), \
2627                                 self.getCoefficient("y"))                                 self.getCoefficient("y"), \
2628           if self.getDomain().supportsContactElements():                                 self.getCoefficient("d_contact"), \
                    args=args+(self.getCoefficient("d_contact"), \  
2629                                 self.getCoefficient("y_contact"))                                 self.getCoefficient("y_contact"))
2630                   self.getDomain().addPDEToSystem(*args)                   self.getDomain().addPDEToSystem(operator,righthandside, \
          args=(operator,righthandside, \  
2631                                 self.getCoefficient("A_reduced"), \                                 self.getCoefficient("A_reduced"), \
2632                                 self.getCoefficient("B_reduced"), \                                 self.getCoefficient("B_reduced"), \
2633                                 self.getCoefficient("C_reduced"), \                                 self.getCoefficient("C_reduced"), \
# Line 2645  class LinearPDE(LinearProblem): Line 2635  class LinearPDE(LinearProblem):
2635                                 self.getCoefficient("X_reduced"), \                                 self.getCoefficient("X_reduced"), \
2636                                 self.getCoefficient("Y_reduced"), \                                 self.getCoefficient("Y_reduced"), \
2637                                 self.getCoefficient("d_reduced"), \                                 self.getCoefficient("d_reduced"), \
2638                                 self.getCoefficient("y_reduced"))                                 self.getCoefficient("y_reduced"), \
2639           if self.getDomain().supportsContactElements():                                 self.getCoefficient("d_contact_reduced"), \
                    args=args+(self.getCoefficient("d_contact_reduced"), \  
2640                                 self.getCoefficient("y_contact_reduced"))                                 self.getCoefficient("y_contact_reduced"))
                  self.getDomain().addPDEToSystem(*args)  
2641                   self.insertConstraint(rhs_only=False)                   self.insertConstraint(rhs_only=False)
2642                   self.trace("New system has been built.")                   self.trace("New system has been built.")
2643                   self.validOperator()                   self.validOperator()
# Line 2657  class LinearPDE(LinearProblem): Line 2645  class LinearPDE(LinearProblem):
2645               elif not self.isRightHandSideValid():               elif not self.isRightHandSideValid():
2646                   self.resetRightHandSide()                   self.resetRightHandSide()
2647                   righthandside=self.getCurrentRightHandSide()                   righthandside=self.getCurrentRightHandSide()
2648           args=(self.getCoefficient("X"), \                   self.getDomain().addPDEToRHS(righthandside,
2649                                   self.getCoefficient("X"), \
2650                                 self.getCoefficient("Y"),\                                 self.getCoefficient("Y"),\
2651                                 self.getCoefficient("y"))                                 self.getCoefficient("y"),\
2652           if self.getDomain().supportsContactElements():                                 self.getCoefficient("y_contact"))
2653               args+=(self.getCoefficient("y_contact"),)                   self.getDomain().addPDEToRHS(righthandside,
2654                   self.getDomain().addPDEToRHS(righthandside, *args)                                 self.getCoefficient("X_reduced"), \
          args=( self.getCoefficient("X_reduced"), \  
2655                                 self.getCoefficient("Y_reduced"),\                                 self.getCoefficient("Y_reduced"),\
2656                                 self.getCoefficient("y_reduced"))                                 self.getCoefficient("y_reduced"),\
2657           if self.getDomain().supportsContactElements():                                 self.getCoefficient("y_contact_reduced"))
              args+=(self.getCoefficient("y_contact_reduced"),)  
                  self.getDomain().addPDEToRHS(righthandside,*args)  
2658                   self.insertConstraint(rhs_only=True)                   self.insertConstraint(rhs_only=True)
2659                   self.trace("New right hand side has been built.")                   self.trace("New right hand side has been built.")
2660                   self.validRightHandSide()                   self.validRightHandSide()

Legend:
Removed from v.3268  
changed lines
  Added in v.3269

  ViewVC Help
Powered by ViewVC 1.1.26