/[escript]/trunk/doc/examples/usersguide/mount.py
ViewVC logotype

Contents of /trunk/doc/examples/usersguide/mount.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5407 - (show annotations)
Thu Dec 18 02:48:24 2014 UTC (4 years, 5 months ago) by jfenwick
File MIME type: text/x-python
File size: 2536 byte(s)
release changes
1 from __future__ import division, print_function
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
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 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23 from esys.escript import *
24 from esys.escript.models import Mountains
25 from esys.weipa import saveVTK
26 from math import pi, ceil
27
28 try:
29 from esys.finley import Rectangle, Brick
30 HAVE_FINLEY = True
31 except ImportError:
32 print("Finley module required but not available")
33 HAVE_FINLEY = False
34
35 if HAVE_FINLEY:
36 NE=16
37 DIM=3
38 H=1.
39 L=2*H
40 OMEGA=10
41 EPS=0.01
42 t=0
43 T_END=0.05 # set T_END=(2*pi)/OMEGA to run a full simulation
44 n=0
45 if DIM==2:
46 mydomain=Rectangle(int(ceil(L*NE/H)),NE,l0=L,l1=H,order=1, useFullElementOrder=True,optimize=True)
47 else:
48 mydomain=Brick(int(ceil(L*NE/H)),int(ceil(L*NE/H)),NE,l0=L,l1=L,l2=H,order=1, useFullElementOrder=True,optimize=True)
49
50 x=mydomain.getX()
51 v = Vector(0.0, Solution(mydomain))
52 if DIM==2:
53 a0=1
54 n0=1
55 n1=0.5
56 a1=-(a0*n0)/n1
57 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])
58 v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])
59 else:
60 a0=1
61 a1=1
62 n0=2
63 n1=2
64 n2=0.5
65 a2=-(a0*n0+a1*n1)/n2
66 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])* cos(pi*n2*x[2])
67 v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])* cos(pi*n2*x[2])
68 v[2]=a2*cos(pi*n0*x[0])* cos(pi*n1*x[1])* sin(pi*n2*x[2])
69
70
71 mts=Mountains(mydomain,eps=EPS)
72 while t<T_END:
73 print("STEP ", t)
74 mts.setVelocity(v*cos(OMEGA*t))
75 Z=mts.update()
76
77 saveVTK("state.%d.vtu"%n,sol=Z, v=mts.getVelocity())
78 print("Integral(Z)=",integrate(Z),Lsup(mts.getVelocity()[DIM-1]))
79 n+=1
80 t+=mts.getSafeTimeStepSize()
81

Properties

Name Value
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/mount.py:2682-2741 /branches/pasowrap/doc/examples/usersguide/mount.py:3661-3674 /branches/py3_attempt2/doc/examples/usersguide/mount.py:3871-3891 /branches/restext/doc/examples/usersguide/mount.py:2610-2624 /branches/ripleygmg_from_3668/doc/examples/usersguide/mount.py:3669-3791 /branches/symbolic_from_3470/doc/examples/usersguide/mount.py:3471-3974 /branches/symbolic_from_3470/ripley/test/python/doc/examples/usersguide/mount.py:3517-3974 /release/4.0/doc/examples/usersguide/mount.py:5380-5406 /trunk/ripley/test/python/doc/examples/usersguide/mount.py:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26