/[escript]/trunk/finley/test/python/AssembleTest.py
ViewVC logotype

Diff of /trunk/finley/test/python/AssembleTest.py

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

revision 104 by jgs, Fri Dec 17 07:43:12 2004 UTC revision 147 by jgs, Fri Aug 12 01:45:47 2005 UTC
# Line 2  Line 2 
2  #  #
3  # $Id$  # $Id$
4    
5  from esys.escript import *  from escript.escript import *
6  from esys.linearPDEs import *  from escript.linearPDEs import *
7  import esys.finley as finley  import finley.finley as finley
8  from math import *  from math import *
9    
10  global seed  global seed
# Line 116  def mult2(A,u): Line 116  def mult2(A,u):
116        return out        return out
117    
118    
119  def eval(u,this):  def evaluate(u,this):
120      x=this.getX()      x=this.getX()
121      if u.rank==2:      if u.rank==2:
122         out=Data(value=0,shape=(u.shape[0],),what=this,expand=True)         out=Data(value=0,shape=(u.shape[0],),what=this,expand=True)
# Line 172  def TestSystem(numEqu,numComp,mydomain,r Line 172  def TestSystem(numEqu,numComp,mydomain,r
172     # u=numarray.zeros([numComp,len_Basis])     # u=numarray.zeros([numComp,len_Basis])
173     # u[0,0]=1     # u[0,0]=1
174     # u[0,1]=1     # u[0,1]=1
175     U=eval(u,nodes)     U=evaluate(u,nodes)
176     gradu=algebraicGrad(u)     gradu=algebraicGrad(u)
177     #     #
178     #   test A:     #   test A:
# Line 193  def TestSystem(numEqu,numComp,mydomain,r Line 193  def TestSystem(numEqu,numComp,mydomain,r
193                    text="A[%d,%d,%d,%d]"%(p,i,q,j)                    text="A[%d,%d,%d,%d]"%(p,i,q,j)
194                 x=mult4(c_A,gradu)                 x=mult4(c_A,gradu)
195                 mypde1=LinearPDE(mydomain)                 mypde1=LinearPDE(mydomain)
196                 mypde1.setValue(A=c_A2,X=eval(x,elem))                 mypde1.setValue(A=c_A2,X=evaluate(x,elem))
197                 mypde1.setReducedOrderForSolutionsTo(reduce)                 mypde1.setReducedOrderForSolutionTo(reduce)
198                 checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())                 checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())
199                 # check div( A grad(u) ) = Y                 # check div( A grad(u) ) = Y
200                 y=-algebraicDiv(x)                 y=-algebraicDiv(x)
201                 mypde2=LinearPDE(mydomain)                 mypde2=LinearPDE(mydomain)
202                 mypde2.setValue(Y=eval(y,elem),y=matmult(eval(x,face_elem),nrml))                 mypde2.setValue(Y=evaluate(y,elem),y=matrixmult(evaluate(x,face_elem),nrml))
203                 mypde2.setReducedOrderForSolutionsTo(reduce)                 mypde2.setReducedOrderForSolutionsTo(reduce)
204                 checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())                 checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())
205    
# Line 214  def TestSystem(numEqu,numComp,mydomain,r Line 214  def TestSystem(numEqu,numComp,mydomain,r
214                 text="B[%d,%d,%d]"%(p,i,q)                 text="B[%d,%d,%d]"%(p,i,q)
215              x=mult3_2(c_B,u)              x=mult3_2(c_B,u)
216              mypde1=LinearPDE(mydomain)              mypde1=LinearPDE(mydomain)
217              mypde1.setValue(B=c_B2,X=eval(x,elem))              mypde1.setValue(B=c_B2,X=evaluate(x,elem))
218              mypde1.setReducedOrderForSolutionsTo(reduce)              mypde1.setReducedOrderForSolutionsTo(reduce)
219              checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())              checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())
220              # check div( B u ) = Y              # check div( B u ) = Y
221              y=-algebraicDiv(x)              y=-algebraicDiv(x)
222              mypde2=LinearPDE(mydomain)              mypde2=LinearPDE(mydomain)
223              mypde2.setValue(Y=eval(y,elem),y=matmult(eval(x,face_elem),nrml))              mypde2.setValue(Y=evaluate(y,elem),y=matrixmult(evaluate(x,face_elem),nrml))
224              mypde2.setReducedOrderForSolutionsTo(reduce)              mypde2.setReducedOrderForSolutionsTo(reduce)
225              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())
226    
# Line 235  def TestSystem(numEqu,numComp,mydomain,r Line 235  def TestSystem(numEqu,numComp,mydomain,r
235                 text="C[%d,%d,%d]"%(p,q,i)                 text="C[%d,%d,%d]"%(p,q,i)
236              y=mult3_1(c_C,gradu)              y=mult3_1(c_C,gradu)
237              mypde1=LinearPDE(mydomain)              mypde1=LinearPDE(mydomain)
238              mypde1.setValue(C=c_C2,Y=eval(y,elem))              mypde1.setValue(C=c_C2,Y=evaluate(y,elem))
239              mypde1.setReducedOrderForSolutionsTo(reduce)              mypde1.setReducedOrderForSolutionsTo(reduce)
240              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())
241    
# Line 251  def TestSystem(numEqu,numComp,mydomain,r Line 251  def TestSystem(numEqu,numComp,mydomain,r
251              text="D[%d,%d]"%(p,q)              text="D[%d,%d]"%(p,q)
252           y=mult2(c_D,u)           y=mult2(c_D,u)
253           mypde1=LinearPDE(mydomain)           mypde1=LinearPDE(mydomain)
254           mypde1.setValue(D=c_D2,Y=eval(y,elem))           mypde1.setValue(D=c_D2,Y=evaluate(y,elem))
255           mypde1.setReducedOrderForSolutionsTo(reduce)           mypde1.setReducedOrderForSolutionsTo(reduce)
256           checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())           checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())
257    

Legend:
Removed from v.104  
changed lines
  Added in v.147

  ViewVC Help
Powered by ViewVC 1.1.26