1 |
|
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 |
__url__="http://www.uq.edu.au/esscc/escript-finley" |
21 |
|
22 |
from esys.escript import * |
23 |
from esys.escript.linearPDEs import LinearPDE |
24 |
from esys.finley import Rectangle |
25 |
#... set some parameters ... |
26 |
xc=[0.02,0.002] |
27 |
r=0.001 |
28 |
qc=50.e6 |
29 |
Tref=0. |
30 |
rhocp=2.6e6 |
31 |
eta=75. |
32 |
kappa=240. |
33 |
tend=5. |
34 |
# ... time, time step size and counter ... |
35 |
t=0 |
36 |
h=0.1 |
37 |
i=0 |
38 |
#... generate domain ... |
39 |
mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50) |
40 |
#... open PDE ... |
41 |
mypde=LinearPDE(mydomain) |
42 |
mypde.setSymmetryOn() |
43 |
mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref) |
44 |
# ... set heat source: .... |
45 |
x=mydomain.getX() |
46 |
qH=qc*whereNegative(length(x-xc)-r) |
47 |
# ... set initial temperature .... |
48 |
T=Tref |
49 |
# ... start iteration: |
50 |
while t<tend: |
51 |
i+=1 |
52 |
t+=h |
53 |
print "time step :",t |
54 |
mypde.setValue(Y=qH+rhocp/h*T) |
55 |
T=mypde.getSolution() |
56 |
saveVTK("T.%d.xml"%i,temp=T) |