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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2484 - (hide annotations)
Mon Jun 22 04:22:19 2009 UTC (9 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 1558 byte(s)
numarray removed from docu; Locator revised.
1 ksteube 1811
2     ########################################################
3     #
4     # Copyright (c) 2003-2008 by University of Queensland
5     # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
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     ########################################################
13    
14     __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15     Earth Systems Science Computational Center (ESSCC)
16     http://www.uq.edu.au/esscc
17     Primary Business: Queensland, Australia"""
18     __license__="""Licensed under the Open Software License version 3.0
19     http://www.opensource.org/licenses/osl-3.0.php"""
20 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
21 ksteube 1811
22 gross 569 from esys.escript import *
23     from esys.escript.linearPDEs import LinearPDE
24 jgs 108 from esys.finley import Rectangle
25 jgs 102 #... set some parameters ...
26 jgs 108 xc=[0.02,0.002]
27 jgs 102 r=0.001
28 jgs 108 qc=50.e6
29 jgs 102 Tref=0.
30     rhocp=2.6e6
31     eta=75.
32     kappa=240.
33 jgs 108 tend=5.
34     # ... time, time step size and counter ...
35     t=0
36 jgs 102 h=0.1
37     i=0
38     #... generate domain ...
39 jgs 108 mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
40 jgs 102 #... open PDE ...
41 gross 569 mypde=LinearPDE(mydomain)
42     mypde.setSymmetryOn()
43     mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
44 jgs 102 # ... set heat source: ....
45     x=mydomain.getX()
46 lkettle 575 qH=qc*whereNegative(length(x-xc)-r)
47 jgs 102 # ... set initial temperature ....
48     T=Tref
49     # ... start iteration:
50 jgs 108 while t<tend:
51 jgs 102 i+=1
52     t+=h
53     print "time step :",t
54 lkettle 575 mypde.setValue(Y=qH+rhocp/h*T)
55 jgs 102 T=mypde.getSolution()
56 gross 569 saveVTK("T.%d.xml"%i,temp=T)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.26