1 |
######################################################## |
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-2008 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 |
|
21 |
# import tools |
22 |
from esys.escript import * |
23 |
from esys.escript.linearPDEs import LinearPDE |
24 |
from esys.finley import Rectangle |
25 |
# set dimensions |
26 |
L0=1.;L1=1. |
27 |
# bottom temperature: |
28 |
T_bot=100 |
29 |
# location, size and value of heat source |
30 |
xc=[0.3,0.4]; r=0.1; Qc=3000 |
31 |
# create domain |
32 |
mydomain=Rectangle(l0=L0,l1=L1,n0=20,n1=20) |
33 |
x=mydomain.getX() |
34 |
k=1 |
35 |
# temperature for boundary condition |
36 |
T_D=T_bot/L1*(L1-x[1]) |
37 |
# heat source |
38 |
Q=Qc*whereNegative(length(x-xc)-r) |
39 |
# create PDE: |
40 |
mypde=LinearPDE(mydomain) |
41 |
mypde.setSymmetryOn() |
42 |
# set coefficients: |
43 |
mypde.setValue(A=k*kronecker(mydomain),Y=Q, r=T_D, \ |
44 |
q=whereZero(x[1])+whereZero(x[1]-L1)) |
45 |
# get temperature: |
46 |
T=mypde.getSolution() |
47 |
# write to file: |
48 |
saveVTK("u.vtu",T=T) |
49 |
|