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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6756 - (hide annotations)
Thu Nov 29 07:23:43 2018 UTC (2 months, 3 weeks ago) by aellery
File MIME type: text/x-python
File size: 2524 byte(s)
Temporarily undoing last commit.
1 sshaw 5294 from __future__ import division, print_function
2 jfenwick 3981 ##############################################################################
3 gross 2563 #
4 jfenwick 6651 # Copyright (c) 2003-2018 by The University of Queensland
5 jfenwick 3981 # http://www.uq.edu.au
6 gross 2563 #
7     # Primary Business: Queensland, Australia
8 jfenwick 6112 # Licensed under the Apache License, version 2.0
9     # http://www.apache.org/licenses/LICENSE-2.0
10 gross 2563 #
11 jfenwick 3981 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 jfenwick 4657 # Development 2012-2013 by School of Earth Sciences
13     # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 jfenwick 3981 #
15     ##############################################################################
16 gross 2563
17 jfenwick 6651 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
18 jfenwick 3981 http://www.uq.edu.au
19 gross 2563 Primary Business: Queensland, Australia"""
20 jfenwick 6112 __license__="""Licensed under the Apache License, version 2.0
21     http://www.apache.org/licenses/LICENSE-2.0"""
22 gross 2563 __url__="https://launchpad.net/escript-finley"
23 artak 2211 from esys.escript import *
24     from esys.escript.models import Mountains
25 caltinay 3346 from esys.weipa import saveVTK
26 artak 2211 from math import pi, ceil
27    
28 sshaw 5294 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 gross 2563
35 sshaw 5294 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 artak 2211
50 sshaw 5294 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 artak 2211
70    
71 sshaw 5294 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/4.0fordebian/doc/examples/usersguide/mount.py:5567-5588 /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 /branches/trilinos_from_5897/doc/examples/usersguide/mount.py:5898-6118 /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