2 |
# |
# |
3 |
# $Id$ |
# $Id$ |
4 |
|
|
5 |
import sys |
from esys.escript import * |
6 |
import os |
from esys.linearPDEs import * |
7 |
import unittest |
import esys.finley as finley |
|
|
|
|
esys_root=os.getenv('ESYS_ROOT') |
|
|
sys.path.append(esys_root+'/finley/lib') |
|
|
sys.path.append(esys_root+'/escript/lib') |
|
|
sys.path.append(esys_root+'/escript/py_src') |
|
|
|
|
|
from escript import * |
|
|
from util import * |
|
|
from linearPDE import * |
|
|
|
|
|
import finley |
|
8 |
from math import * |
from math import * |
9 |
|
|
10 |
global seed |
global seed |
11 |
num_elem=2 # number of elements in each spatial direction |
num_elem=2 # number of elements in each spatial direction |
12 |
num_equations=3 # number of equations |
num_equations=3 # number of equations |
192 |
c_A2=c_A |
c_A2=c_A |
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(domain=mydomain,A=c_A2,X=eval(x,elem)) |
mypde1=LinearPDE(mydomain) |
196 |
|
mypde1.setValue(A=c_A2,X=eval(x,elem)) |
197 |
mypde1.setReducedOrderForSolutionsTo(reduce) |
mypde1.setReducedOrderForSolutionsTo(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(domain=mydomain,Y=eval(y,elem),y=matmult(eval(x,face_elem),nrml)) |
mypde2=LinearPDE(mydomain) |
202 |
|
mypde2.setValue(Y=eval(y,elem),y=matmult(eval(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 |
|
|
213 |
c_B2=c_B |
c_B2=c_B |
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(domain=mydomain,B=c_B2,X=eval(x,elem)) |
mypde1=LinearPDE(mydomain) |
217 |
|
mypde1.setValue(B=c_B2,X=eval(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(domain=mydomain,Y=eval(y,elem),y=matmult(eval(x,face_elem),nrml)) |
mypde2=LinearPDE(mydomain) |
223 |
|
mypde2.setValue(Y=eval(y,elem),y=matmult(eval(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 |
|
|
234 |
c_C2=c_C |
c_C2=c_C |
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(domain=mydomain,C=c_C2,Y=eval(y,elem)) |
mypde1=LinearPDE(mydomain) |
238 |
|
mypde1.setValue(C=c_C2,Y=eval(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 |
|
|
250 |
c_D2=c_D |
c_D2=c_D |
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(domain=mydomain,D=c_D2,Y=eval(y,elem)) |
mypde1=LinearPDE(mydomain) |
254 |
|
mypde1.setValue(D=c_D2,Y=eval(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 |
|
|