/[escript]/trunk/doc/examples/usersguide/heatedblock.py
ViewVC logotype

Annotation of /trunk/doc/examples/usersguide/heatedblock.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3792 - (hide annotations)
Wed Feb 1 06:16:25 2012 UTC (7 years, 1 month ago) by caltinay
File MIME type: text/x-python
File size: 2050 byte(s)
Merged ripley rectangular domain into trunk.

1 ksteube 1811
2     ########################################################
3     #
4 jfenwick 2881 # Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 # 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 jfenwick 2881 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 ksteube 1811 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 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
21 ksteube 1811
22 gross 578 from esys.escript import *
23     from esys.escript.linearPDEs import LinearPDE
24 gross 579 from esys.finley import Brick
25 caltinay 3346 from esys.weipa import saveVTK
26 gross 578 #... set some parameters ...
27 gross 579 lam=1.
28     mu=0.1
29     alpha=1.e-6
30     xc=[0.3,0.3,1.]
31     beta=8.
32     T_ref=0.
33     T_0=1.
34 gross 578 #... generate domain ...
35 gross 579 mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10)
36     x=mydomain.getX()
37     #... set temperature ...
38     T=T_0*exp(-beta*length(x-xc))
39     #... open symmetric PDE ...
40 gross 578 mypde=LinearPDE(mydomain)
41     mypde.setSymmetryOn()
42 gross 579 #... set coefficients ...
43     C=Tensor4(0.,Function(mydomain))
44     for i in range(mydomain.getDim()):
45     for j in range(mydomain.getDim()):
46     C[i,i,j,j]+=lam
47 gross 3667 C[i,j,i,j]+=mu
48     C[i,j,j,i]+=mu
49 gross 579 msk=whereZero(x[0])*[1.,0.,0.] \
50     +whereZero(x[1])*[0.,1.,0.] \
51     +whereZero(x[2])*[0.,0.,1.]
52     sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)
53     mypde.setValue(A=C,X=sigma0,q=msk)
54 gross 2502 mypde.getSolverOptions().setVerbosityOn()
55 gross 579 #... solve pde ...
56 gross 2502 u=mypde.getSolution()
57 gross 579 #... calculate von-Misses
58     g=grad(u)
59     sigma=mu*(g+transpose(g))+lam*trace(g)*kronecker(mydomain)-sigma0
60     sigma_mises=sqrt(((sigma[0,0]-sigma[1,1])**2+(sigma[1,1]-sigma[2,2])**2+ \
61 gross 2513 (sigma[2,2]-sigma[0,0])**2)/2. \
62     +3*(sigma[0,1]**2 + sigma[1,2]**2 + sigma[2,0]**2))
63 gross 579 #... output ...
64 caltinay 2534 saveVTK("deform.vtu",disp=u,stress=sigma_mises)
65 gross 578

Properties

Name Value
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/heatedblock.py:2682-2741 /branches/pasowrap/doc/examples/usersguide/heatedblock.py:3661-3674 /branches/restext/doc/examples/usersguide/heatedblock.py:2610-2624 /branches/ripleygmg_from_3668/doc/examples/usersguide/heatedblock.py:3669-3791 /trunk/doc/examples/usersguide/heatedblock.py:1388-2483

  ViewVC Help
Powered by ViewVC 1.1.26