/[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 3975 - (show annotations)
Thu Sep 20 01:54:06 2012 UTC (7 years, 1 month ago) by caltinay
File MIME type: text/x-python
File size: 2081 byte(s)
Merged symbolic branch into trunk. Curious what daniel and spartacus have to
say...

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

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 /trunk/ripley/test/python/doc/examples/usersguide/mount.py:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26