# Contents of /trunk/doc/examples/geotutorial/backward_euler.py

Revision 2549 - (show annotations)
Mon Jul 20 06:43:47 2009 UTC (12 years, 2 months ago) by jfenwick
File MIME type: text/x-python
File size: 1886 byte(s)
```Remainder of copyright date fixes
```
 1 ######################################################## 2 # 3 # Copyright (c) 2003-2009 by University of Queensland 4 # Earth Systems Science Computational Center (ESSCC) 5 6 # 7 # Primary Business: Queensland, Australia 8 # Licensed under the Open Software License version 3.0 9 10 # 11 ######################################################## 12 13 __copyright__="""Copyright (c) 2003-2009 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 19 __url__= 20 21 # import tools 22 from esys.escript import * 23 from esys.escript.linearPDEs import LinearPDE 24 from esys.finley import Rectangle 25 # end of simulation time 26 t_end=0.1 27 # time step size: 28 dt=0.01 29 # dimensions: 30 L0=1.;L1=1. 31 # location, size and value of heat source 32 xc=[0.3,0.4]; r=0.1; Qc=3000 33 # material parameter 34 k=1; rhocp=100; 35 # bottom temperature: 36 T_bot=100 37 # generate domain: 38 mydomain=Rectangle(l0=L0,l1=L1,n0=20,n1=20) 39 x=mydomain.getX() 40 # set boundray temperature: 41 T_D=T_bot/L1*(L1-x[1]) 42 # set heat source: 43 Q=Qc*whereNegative(length(x-xc)-r) 44 # generate domain: 45 mypde=LinearPDE(mydomain) 46 mypde.setSymmetryOn() 47 # set PDE coefficients: 48 mypde.setValue(A=dt*k*kronecker(mydomain), D=dt*rhocp, 49 r=T_D, q=whereZero(x[1])+whereZero(x[1]-L1)) 50 # initial temperature 51 T=T_D 52 # step counter and time marker: 53 N=0; t=0 54 # stop when t_end is reached: 55 while t