/[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 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (20 months, 1 week ago) by jfenwick
File MIME type: text/x-python
File size: 1842 byte(s)
Make everyone sad by touching all the files

Copyright dates update

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2018 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Apache License, version 2.0
23 http://www.apache.org/licenses/LICENSE-2.0"""
24 __url__="https://launchpad.net/escript-finley"
25
26
27 from esys.escript import *
28 from esys.escript.linearPDEs import TransportPDE, SolverOptions
29 from esys.finley import Rectangle, Brick
30 #from esys.ripley import Rectangle, Brick
31 from esys.weipa import saveVTK
32 from math import pi, ceil
33
34 NE=50
35 dom=Rectangle(NE,1,l1=1./NE)
36 dom=Rectangle(NE,NE)
37 fc=TransportPDE(dom,numEquations=1)
38 fc.getSolverOptions().setVerbosityOn()
39 fc.getSolverOptions().setODESolver(SolverOptions.LINEAR_CRANK_NICOLSON)
40 fc.getSolverOptions().setODESolver(SolverOptions.BACKWARD_EULER)
41 fc.getSolverOptions().setODESolver(SolverOptions.CRANK_NICOLSON)
42 fc.setValue(M=1,C=[-1,0])
43 x=dom.getX()
44 u0=whereNegative(x[0]-1./NE)
45
46 c=0
47 t=0
48
49 saveVTK("u.%s.vtu"%c,u=u0)
50 fc.setInitialSolution(u0)
51 dt=fc.getSafeTimeStepSize()
52
53 print("u0 =",u0)
54 T_END=dt
55 print("dt = ",dt)
56 while t<T_END:
57 print("time step t=",t+dt)
58 u=fc.getSolution(dt)
59 saveVTK("u.%s.vtu"%(c+1,),u=u)
60 print("u =",u)
61 c+=1
62 t+=dt

  ViewVC Help
Powered by ViewVC 1.1.26