/[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 3892 - (hide annotations)
Tue Apr 10 08:57:23 2012 UTC (6 years, 10 months ago) by jfenwick
File MIME type: text/x-python
File size: 2081 byte(s)
Merged changes across from the attempt2 branch.
This version builds and passes python2 tests.
It also passes most python3 tests.



1 jfenwick 3892
2     from __future__ import print_function
3 gross 2563 ########################################################
4     #
5 jfenwick 2881 # Copyright (c) 2003-2010 by University of Queensland
6 gross 2563 # 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 jfenwick 2881 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
16 gross 2563 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 artak 2211 from esys.escript import *
23     from esys.escript.models import Mountains
24     from esys.finley import Brick,Rectangle
25 caltinay 3346 from esys.weipa import saveVTK
26 artak 2211 from math import pi, ceil
27    
28     NE=16
29     DIM=3
30     H=1.
31 artak 2306 L=2*H
32 artak 2211 OMEGA=10
33     EPS=0.01
34     t=0
35 gross 2502 T_END=0.05 # set T_END=(2*pi)/OMEGA to run a full simulation
36 artak 2211 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 gross 2563
42 artak 2211 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 gross 2563 mts=Mountains(mydomain,eps=EPS)
64 artak 2211 while t<T_END:
65 jfenwick 3892 print("STEP ", t)
66 gross 2563 mts.setVelocity(v*cos(OMEGA*t))
67     Z=mts.update()
68 artak 2211
69 gross 2563 saveVTK("state.%d.vtu"%n,sol=Z, v=mts.getVelocity())
70 jfenwick 3892 print("Integral(Z)=",integrate(Z),Lsup(mts.getVelocity()[DIM-1]))
71 artak 2211 n+=1
72 gross 2563 t+=mts.getSafeTimeStepSize()
73 artak 2211

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

  ViewVC Help
Powered by ViewVC 1.1.26