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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

  ViewVC Help
Powered by ViewVC 1.1.26