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

Contents of /branches/symbolic_from_3470/doc/examples/usersguide/mount.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3868 - (show annotations)
Thu Mar 15 06:07:08 2012 UTC (7 years, 1 month ago) by caltinay
File MIME type: text/x-python
File size: 2040 byte(s)
Update to latest trunk

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 esys.weipa import saveVTK
24 from math import pi, ceil
25
26 NE=16
27 DIM=3
28 H=1.
29 L=2*H
30 OMEGA=10
31 EPS=0.01
32 t=0
33 T_END=0.05 # set T_END=(2*pi)/OMEGA to run a full simulation
34 n=0
35 if DIM==2:
36 mydomain=Rectangle(int(ceil(L*NE/H)),NE,l0=L,l1=H,order=1, useFullElementOrder=True,optimize=True)
37 else:
38 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)
39
40 x=mydomain.getX()
41 v = Vector(0.0, Solution(mydomain))
42 if DIM==2:
43 a0=1
44 n0=1
45 n1=0.5
46 a1=-(a0*n0)/n1
47 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])
48 v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])
49 else:
50 a0=1
51 a1=1
52 n0=2
53 n1=2
54 n2=0.5
55 a2=-(a0*n0+a1*n1)/n2
56 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])* cos(pi*n2*x[2])
57 v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])* cos(pi*n2*x[2])
58 v[2]=a2*cos(pi*n0*x[0])* cos(pi*n1*x[1])* sin(pi*n2*x[2])
59
60
61 mts=Mountains(mydomain,eps=EPS)
62 while t<T_END:
63 print "STEP ", t
64 mts.setVelocity(v*cos(OMEGA*t))
65 Z=mts.update()
66
67 saveVTK("state.%d.vtu"%n,sol=Z, v=mts.getVelocity())
68 print "Integral(Z)=",integrate(Z),Lsup(mts.getVelocity()[DIM-1])
69 n+=1
70 t+=mts.getSafeTimeStepSize()
71

Properties

Name Value
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/mount.py:2682-2741 /branches/pasowrap/doc/examples/usersguide/mount.py:3661-3674 /branches/restext/doc/examples/usersguide/mount.py:2610-2624 /branches/ripleygmg_from_3668/doc/examples/usersguide/mount.py:3669-3791 /trunk/doc/examples/usersguide/mount.py:3471-3867

  ViewVC Help
Powered by ViewVC 1.1.26