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

Contents of /trunk/finley/test/python/FCT_test0.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3825 - (show annotations)
Tue Feb 14 06:11:58 2012 UTC (7 years, 11 months ago) by gross
File MIME type: text/x-python
File size: 1681 byte(s)
don't call MPI withing parallel regions
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2010 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 from esys.escript import *
23 from esys.escript.linearPDEs import TransportPDE
24 from esys.finley import Rectangle, Brick
25 #from esys.ripley import Rectangle, Brick
26 from esys.weipa import saveVTK
27 from math import pi, ceil
28
29 NE=50
30 dom=Rectangle(NE,1,l1=1./NE)
31 dom=Rectangle(NE,NE)
32 fc=TransportPDE(dom,numEquations=1)
33 fc.getSolverOptions().setVerbosityOn()
34 fc.getSolverOptions().setODESolver(fc.getSolverOptions().LINEAR_CRANK_NICOLSON)
35 fc.getSolverOptions().setODESolver(fc.getSolverOptions().BACKWARD_EULER)
36 fc.getSolverOptions().setODESolver(fc.getSolverOptions().CRANK_NICOLSON)
37 fc.setValue(M=1,C=[-1,0])
38 x=dom.getX()
39 u0=whereNegative(x[0]-1./NE)
40
41 c=0
42 t=0
43
44 saveVTK("u.%s.vtu"%c,u=u0)
45 fc.setInitialSolution(u0)
46 dt=fc.getSafeTimeStepSize()
47
48 print "u0 =",u0
49 T_END=dt
50 print "dt = ",dt
51 while t<T_END:
52 print("time step t=",t+dt)
53 u=fc.getSolution(dt)
54 saveVTK("u.%s.vtu"%(c+1,),u=u)
55 print "u =",u
56 c+=1
57 t+=dt

  ViewVC Help
Powered by ViewVC 1.1.26