/[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

trunk/esys2/finley/test/python/AssembleTest.py revision 104 by jgs, Fri Dec 17 07:43:12 2004 UTC trunk/finley/test/python/AssembleTest.py revision 617 by elspeth, Wed Mar 22 02:58:17 2006 UTC
# Line 2  Line 2 
2  #  #
3  # $Id$  # $Id$
4    
5    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
6                        http://www.access.edu.au
7                    Primary Business: Queensland, Australia"""
8    __license__="""Licensed under the Open Software License version 3.0
9                 http://www.opensource.org/licenses/osl-3.0.php"""
10  from esys.escript import *  from esys.escript import *
11  from esys.linearPDEs import *  from esys.escript.linearPDEs import *
12  import esys.finley as finley  from esys import finley
13  from math import *  from math import *
14    
15  global seed  global seed
# Line 116  def mult2(A,u): Line 121  def mult2(A,u):
121        return out        return out
122    
123    
124  def eval(u,this):  def evaluate(u,this):
125      x=this.getX()      x=this.getX()
126      if u.rank==2:      if u.rank==2:
127         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 177  def TestSystem(numEqu,numComp,mydomain,r
177     # u=numarray.zeros([numComp,len_Basis])     # u=numarray.zeros([numComp,len_Basis])
178     # u[0,0]=1     # u[0,0]=1
179     # u[0,1]=1     # u[0,1]=1
180     U=eval(u,nodes)     U=evaluate(u,nodes)
181     gradu=algebraicGrad(u)     gradu=algebraicGrad(u)
182     #     #
183     #   test A:     #   test A:
# Line 193  def TestSystem(numEqu,numComp,mydomain,r Line 198  def TestSystem(numEqu,numComp,mydomain,r
198                    text="A[%d,%d,%d,%d]"%(p,i,q,j)                    text="A[%d,%d,%d,%d]"%(p,i,q,j)
199                 x=mult4(c_A,gradu)                 x=mult4(c_A,gradu)
200                 mypde1=LinearPDE(mydomain)                 mypde1=LinearPDE(mydomain)
201                 mypde1.setValue(A=c_A2,X=eval(x,elem))                 mypde1.setValue(A=c_A2,X=evaluate(x,elem))
202                 mypde1.setReducedOrderForSolutionsTo(reduce)                 mypde1.setReducedOrderForSolutionTo(reduce)
203                 checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())                 checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())
204                 # check div( A grad(u) ) = Y                 # check div( A grad(u) ) = Y
205                 y=-algebraicDiv(x)                 y=-algebraicDiv(x)
206                 mypde2=LinearPDE(mydomain)                 mypde2=LinearPDE(mydomain)
207                 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))
208                 mypde2.setReducedOrderForSolutionsTo(reduce)                 mypde2.setReducedOrderForSolutionsTo(reduce)
209                 checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())                 checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())
210    
# Line 214  def TestSystem(numEqu,numComp,mydomain,r Line 219  def TestSystem(numEqu,numComp,mydomain,r
219                 text="B[%d,%d,%d]"%(p,i,q)                 text="B[%d,%d,%d]"%(p,i,q)
220              x=mult3_2(c_B,u)              x=mult3_2(c_B,u)
221              mypde1=LinearPDE(mydomain)              mypde1=LinearPDE(mydomain)
222              mypde1.setValue(B=c_B2,X=eval(x,elem))              mypde1.setValue(B=c_B2,X=evaluate(x,elem))
223              mypde1.setReducedOrderForSolutionsTo(reduce)              mypde1.setReducedOrderForSolutionsTo(reduce)
224              checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())              checkSystem(text+" const with X",mypde1.getOperator(),U,mypde1.getRightHandSide())
225              # check div( B u ) = Y              # check div( B u ) = Y
226              y=-algebraicDiv(x)              y=-algebraicDiv(x)
227              mypde2=LinearPDE(mydomain)              mypde2=LinearPDE(mydomain)
228              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))
229              mypde2.setReducedOrderForSolutionsTo(reduce)              mypde2.setReducedOrderForSolutionsTo(reduce)
230              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde2.getRightHandSide())
231    
# Line 235  def TestSystem(numEqu,numComp,mydomain,r Line 240  def TestSystem(numEqu,numComp,mydomain,r
240                 text="C[%d,%d,%d]"%(p,q,i)                 text="C[%d,%d,%d]"%(p,q,i)
241              y=mult3_1(c_C,gradu)              y=mult3_1(c_C,gradu)
242              mypde1=LinearPDE(mydomain)              mypde1=LinearPDE(mydomain)
243              mypde1.setValue(C=c_C2,Y=eval(y,elem))              mypde1.setValue(C=c_C2,Y=evaluate(y,elem))
244              mypde1.setReducedOrderForSolutionsTo(reduce)              mypde1.setReducedOrderForSolutionsTo(reduce)
245              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())              checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())
246    
# Line 251  def TestSystem(numEqu,numComp,mydomain,r Line 256  def TestSystem(numEqu,numComp,mydomain,r
256              text="D[%d,%d]"%(p,q)              text="D[%d,%d]"%(p,q)
257           y=mult2(c_D,u)           y=mult2(c_D,u)
258           mypde1=LinearPDE(mydomain)           mypde1=LinearPDE(mydomain)
259           mypde1.setValue(D=c_D2,Y=eval(y,elem))           mypde1.setValue(D=c_D2,Y=evaluate(y,elem))
260           mypde1.setReducedOrderForSolutionsTo(reduce)           mypde1.setReducedOrderForSolutionsTo(reduce)
261           checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())           checkSystem(text+" const with Y",mypde1.getOperator(),U,mypde1.getRightHandSide())
262    

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

  ViewVC Help
Powered by ViewVC 1.1.26