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

Contents of /trunk/doc/examples/usersguide/diffusion.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5288 - (show annotations)
Tue Dec 2 23:18:40 2014 UTC (4 years, 9 months ago) by sshaw
File MIME type: text/x-python
File size: 2035 byte(s)
fixing tests for cases where required domains not built
1 from __future__ import division, print_function
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
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 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2003-2014 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
24 from esys.escript import *
25 from esys.escript.linearPDEs import LinearPDE
26 try:
27 from esys.finley import Rectangle
28 HAVE_FINLEY = True
29 except ImportError:
30 HAVE_FINLEY = False
31 from esys.weipa import saveVTK
32 #... set some parameters ...
33 if not HAVE_FINLEY:
34 print("Finley module not available")
35 else:
36 xc=[0.02,0.002]
37 r=0.001
38 qc=50.e6
39 Tref=0.
40 rhocp=2.6e6
41 eta=75.
42 kappa=240.
43 tend=5.
44 # ... time, time step size and counter ...
45 t=0
46 h=0.1
47 i=0
48 #... generate domain ...
49 mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
50 #... open PDE ...
51 mypde=LinearPDE(mydomain)
52 mypde.setSymmetryOn()
53 mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
54 # ... set heat source: ....
55 x=mydomain.getX()
56 qH=qc*whereNegative(length(x-xc)-r)
57 # ... set initial temperature ....
58 T=Tref
59 # ... start iteration:
60 while t<tend:
61 i+=1
62 t+=h
63 print("time step :",t)
64 mypde.setValue(Y=qH+rhocp/h*T)
65 T=mypde.getSolution()
66 saveVTK("T.%d.vtu"%i,temp=T)
67

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/diffusion.py:2682-2741 /branches/pasowrap/doc/examples/usersguide/diffusion.py:3661-3674 /branches/py3_attempt2/doc/examples/usersguide/diffusion.py:3871-3891 /branches/restext/doc/examples/usersguide/diffusion.py:2610-2624 /branches/ripleygmg_from_3668/doc/examples/usersguide/diffusion.py:3669-3791 /branches/symbolic_from_3470/doc/examples/usersguide/diffusion.py:3471-3974 /branches/symbolic_from_3470/ripley/test/python/doc/examples/usersguide/diffusion.py:3517-3974 /trunk/doc/examples/usersguide/diffusion.py:1388-2483 /trunk/ripley/test/python/doc/examples/usersguide/diffusion.py:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26