/[escript]/trunk-mpi-branch/doc/examples/diffusion.py
ViewVC logotype

Contents of /trunk-mpi-branch/doc/examples/diffusion.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1306 - (show annotations)
Tue Sep 18 05:51:09 2007 UTC (11 years, 11 months ago) by ksteube
File MIME type: text/x-python
File size: 1226 byte(s)
New Copyright in each .c .h .cpp and .py file

1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 from esys.escript import *
18 from esys.escript.linearPDEs import LinearPDE
19 from esys.finley import Rectangle
20 #... set some parameters ...
21 xc=[0.02,0.002]
22 r=0.001
23 qc=50.e6
24 Tref=0.
25 rhocp=2.6e6
26 eta=75.
27 kappa=240.
28 tend=5.
29 # ... time, time step size and counter ...
30 t=0
31 h=0.1
32 i=0
33 #... generate domain ...
34 mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
35 #... open PDE ...
36 mypde=LinearPDE(mydomain)
37 mypde.setSymmetryOn()
38 mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
39 # ... set heat source: ....
40 x=mydomain.getX()
41 qH=qc*whereNegative(length(x-xc)-r)
42 # ... set initial temperature ....
43 T=Tref
44 # ... start iteration:
45 while t<tend:
46 i+=1
47 t+=h
48 print "time step :",t
49 mypde.setValue(Y=qH+rhocp/h*T)
50 T=mypde.getSolution()
51 saveVTK("T.%d.xml"%i,temp=T)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26