/[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 2563 - (hide annotations)
Tue Jul 28 03:50:45 2009 UTC (9 years, 6 months ago) by gross
File MIME type: text/x-python
File size: 2009 byte(s)
reengineered version of the mountain class so it becomes easier to use for the convection code
1 gross 2563 ########################################################
2     #
3     # Copyright (c) 2003-2009 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-2009 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 artak 2211 from esys.escript import *
21     from esys.escript.models import Mountains
22     from esys.finley import Brick,Rectangle
23     from math import pi, ceil
24    
25     NE=16
26     DIM=3
27     H=1.
28 artak 2306 L=2*H
29 artak 2211 OMEGA=10
30     EPS=0.01
31     t=0
32 gross 2502 T_END=0.05 # set T_END=(2*pi)/OMEGA to run a full simulation
33 artak 2211 n=0
34     if DIM==2:
35     mydomain=Rectangle(int(ceil(L*NE/H)),NE,l0=L,l1=H,order=1, useFullElementOrder=True,optimize=True)
36     else:
37     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)
38 gross 2563
39 artak 2211 x=mydomain.getX()
40     v = Vector(0.0, Solution(mydomain))
41     if DIM==2:
42     a0=1
43     n0=1
44     n1=0.5
45     a1=-(a0*n0)/n1
46     v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])
47     v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])
48     else:
49     a0=1
50     a1=1
51     n0=2
52     n1=2
53     n2=0.5
54     a2=-(a0*n0+a1*n1)/n2
55     v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])* cos(pi*n2*x[2])
56     v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])* cos(pi*n2*x[2])
57     v[2]=a2*cos(pi*n0*x[0])* cos(pi*n1*x[1])* sin(pi*n2*x[2])
58    
59    
60 gross 2563 mts=Mountains(mydomain,eps=EPS)
61 artak 2211 while t<T_END:
62     print "STEP ", t
63 gross 2563 mts.setVelocity(v*cos(OMEGA*t))
64     Z=mts.update()
65 artak 2211
66 gross 2563 saveVTK("state.%d.vtu"%n,sol=Z, v=mts.getVelocity())
67     print "Integral(Z)=",integrate(Z),Lsup(mts.getVelocity()[DIM-1])
68 artak 2211 n+=1
69 gross 2563 t+=mts.getSafeTimeStepSize()
70 artak 2211

Properties

Name Value
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.26