/[escript]/branches/stage3.1/doc/examples/usersguide/mount.py
ViewVC logotype

Contents of /branches/stage3.1/doc/examples/usersguide/mount.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2945 - (show annotations)
Wed Feb 24 00:17:46 2010 UTC (8 years, 11 months ago) by jfenwick
File MIME type: text/x-python
File size: 2009 byte(s)
Bringing release stage up to trunk version 2944

1 ########################################################
2 #
3 # Copyright (c) 2003-2010 by University of Queensland
4 # Earth Systems Science Computational Center (ESSCC)
5 # http://www.uq.edu.au/esscc
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 ########################################################
12
13 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
14 Earth Systems Science Computational Center (ESSCC)
15 http://www.uq.edu.au/esscc
16 Primary Business: Queensland, Australia"""
17 __license__="""Licensed under the Open Software License version 3.0
18 http://www.opensource.org/licenses/osl-3.0.php"""
19 __url__="https://launchpad.net/escript-finley"
20 from esys.escript import *
21 from esys.escript.models import Mountains
22 from esys.finley import Brick,Rectangle
23 from math import pi, ceil
24
25 NE=16
26 DIM=3
27 H=1.
28 L=2*H
29 OMEGA=10
30 EPS=0.01
31 t=0
32 T_END=0.05 # set T_END=(2*pi)/OMEGA to run a full simulation
33 n=0
34 if DIM==2:
35 mydomain=Rectangle(int(ceil(L*NE/H)),NE,l0=L,l1=H,order=1, useFullElementOrder=True,optimize=True)
36 else:
37 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)
38
39 x=mydomain.getX()
40 v = Vector(0.0, Solution(mydomain))
41 if DIM==2:
42 a0=1
43 n0=1
44 n1=0.5
45 a1=-(a0*n0)/n1
46 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])
47 v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])
48 else:
49 a0=1
50 a1=1
51 n0=2
52 n1=2
53 n2=0.5
54 a2=-(a0*n0+a1*n1)/n2
55 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])* cos(pi*n2*x[2])
56 v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])* cos(pi*n2*x[2])
57 v[2]=a2*cos(pi*n0*x[0])* cos(pi*n1*x[1])* sin(pi*n2*x[2])
58
59
60 mts=Mountains(mydomain,eps=EPS)
61 while t<T_END:
62 print "STEP ", t
63 mts.setVelocity(v*cos(OMEGA*t))
64 Z=mts.update()
65
66 saveVTK("state.%d.vtu"%n,sol=Z, v=mts.getVelocity())
67 print "Integral(Z)=",integrate(Z),Lsup(mts.getVelocity()[DIM-1])
68 n+=1
69 t+=mts.getSafeTimeStepSize()
70

Properties

Name Value
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/mount.py:2682-2741 /branches/restext/doc/examples/usersguide/mount.py:2610-2624 /trunk/doc/examples/usersguide/mount.py:2872-2919,2924-2944

  ViewVC Help
Powered by ViewVC 1.1.26