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