1 |
|
2 |
from esys.escript import * |
3 |
from esys.escript.linearPDEs import * |
4 |
from esysi import finley |
5 |
|
6 |
def makeParallelFaultSystem2D(xne=1,yne=1,xl=1.,yfaults=[0.,1.],integrationOrder=0,p1=0,p2=0): |
7 |
""" |
8 |
generates a 2D rectangular domain and a system of parallel faults at yfaults |
9 |
|
10 |
input data : |
11 |
xne - the number of elements over the horizontal edge of the rectangular mesh |
12 |
xl - length of the horizontal edge of the domain |
13 |
yfault[y0,...yi,...y1] where y0 and y1 are the extremity of the block and yi the fault position in the (Oy) direction |
14 |
output data : |
15 |
a mesh with horizontal discontinuities at yi positions |
16 |
""" |
17 |
|
18 |
#yne=xne*1./(xl+1.e-15) |
19 |
|
20 |
mshs=[] |
21 |
for i in range(len(yfaults)-1): |
22 |
yl=yfaults[i+1]-yfaults[i] |
23 |
msh=finley.Rectangle(xne,yne,1,xl,yl,p1,p2,useElementsOnFace=True) |
24 |
msh1=msh |
25 |
#print "mesh done" |
26 |
msh1.setX(msh.getX()+[0.,yfaults[i]]) |
27 |
#print "Xnew" |
28 |
mshs.append(msh1) |
29 |
#print "apres append" |
30 |
#results=finley.joinFaces(mshs) |
31 |
mesh_joint=finley.JoinFaces(mshs) |
32 |
#print "apres faces jointes" |
33 |
return mesh_joint |
34 |
|
35 |
def main(): |
36 |
|
37 |
xne=10 |
38 |
yne=20 |
39 |
xl=10 |
40 |
yl=10 |
41 |
yfaults=[0.,5.,10.] |
42 |
numberfaults=1 |
43 |
|
44 |
mesh=makeParallelFaultSystem2D(xne,yne,xl,yfaults,0,0,0) |
45 |
|
46 |
v=Vector(10.,ContinuousFunction(mesh)) |
47 |
|
48 |
on_elem_v=interpolate(v,Function(mesh)) |
49 |
|
50 |
value_integratedEL_vec=integrate(on_elem_v) |
51 |
|
52 |
print "vector--------" |
53 |
print "value interpolation",value_integratedEL_vec |
54 |
print "--------" |
55 |
|
56 |
main() |