/[escript]/branches/diaplayground/poisson.py
ViewVC logotype

Contents of /branches/diaplayground/poisson.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4946 - (show annotations)
Fri May 16 05:13:21 2014 UTC (5 years ago) by caltinay
File MIME type: text/x-python
File size: 1112 byte(s)
few fixes.

1 from esys.escript import *
2 from esys.escript.linearPDEs import LinearPDE,SolverOptions
3 from esys.ripley import Rectangle, Brick
4 from time import time
5
6 BLOCKSIZE=2
7
8 dom = Rectangle(l0=1.,l1=1.,n0=99, n1=99)
9 x = dom.getX()
10 gammaD = whereZero(x[0])+whereZero(x[1])
11
12 pde = LinearPDE(dom, numEquations=BLOCKSIZE, numSolutions=BLOCKSIZE)
13 A = pde.createCoefficient("A")
14 q = pde.createCoefficient("q")
15 Y_reduced = pde.createCoefficient("Y_reduced")
16
17 if BLOCKSIZE == 1:
18 A = kronecker(dom)
19 q = gammaD
20 Y_reduced = 1.
21 else:
22 for i in range(BLOCKSIZE):
23 A[i,:,i,:] = kronecker(dom)
24 q[i] = gammaD
25 Y_reduced[i] = 1.
26
27 pde.setValue(A=A, Y_reduced=Y_reduced, q=q)
28 pde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
29 pde.getSolverOptions().setPreconditioner(SolverOptions.NO_PRECONDITIONER)
30 pde.getSolverOptions().setVerbosityOn()
31 #pde.setDebugOn()
32 #rhs=pde.getRightHandSide()
33 #saveDataCSV('/tmp/rhs.csv',rhs=rhs)
34 pde.getSystem()[0].saveMM('/tmp/poissonripley.mtx')
35 t0=time()
36 x = pde.getSolution()
37 t1=time()
38 print "Solver Time: ", t1-t0
39 print "Solution: %s..%s"%(inf(x),sup(x))
40 print x
41

  ViewVC Help
Powered by ViewVC 1.1.26