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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/doc/examples/heatedblock.py revision 1892 by artak, Fri Oct 17 00:55:59 2008 UTC trunk/doc/examples/usersguide/heatedblock.py revision 2881 by jfenwick, Thu Jan 28 02:03:15 2010 UTC
# Line 1  Line 1 
1    
2  ########################################################  ########################################################
3  #  #
4  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2010 by University of Queensland
5  # Earth Systems Science Computational Center (ESSCC)  # Earth Systems Science Computational Center (ESSCC)
6  # http://www.uq.edu.au/esscc  # http://www.uq.edu.au/esscc
7  #  #
# Line 11  Line 11 
11  #  #
12  ########################################################  ########################################################
13    
14  __copyright__="""Copyright (c) 2003-2008 by University of Queensland  __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15  Earth Systems Science Computational Center (ESSCC)  Earth Systems Science Computational Center (ESSCC)
16  http://www.uq.edu.au/esscc  http://www.uq.edu.au/esscc
17  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
18  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
19  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
20  __url__="http://www.uq.edu.au/esscc/escript-finley"  __url__="https://launchpad.net/escript-finley"
21    
22  from esys.escript import *  from esys.escript import *
23  from esys.escript.linearPDEs import LinearPDE  from esys.escript.linearPDEs import LinearPDE
# Line 50  msk=whereZero(x[0])*[1.,0.,0.] \ Line 50  msk=whereZero(x[0])*[1.,0.,0.] \
50     +whereZero(x[2])*[0.,0.,1.]     +whereZero(x[2])*[0.,0.,1.]
51  sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)  sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)
52  mypde.setValue(A=C,X=sigma0,q=msk)  mypde.setValue(A=C,X=sigma0,q=msk)
53  mypde.setSolverMethod(mypde.PCG,mypde.AMG)  mypde.getSolverOptions().setVerbosityOn()
54  #... solve pde ...  #... solve pde ...
55  u=mypde.getSolution(verbose=True)  u=mypde.getSolution()
56  #... calculate von-Misses  #... calculate von-Misses
57  g=grad(u)  g=grad(u)
58  sigma=mu*(g+transpose(g))+lam*trace(g)*kronecker(mydomain)-sigma0  sigma=mu*(g+transpose(g))+lam*trace(g)*kronecker(mydomain)-sigma0
59  sigma_mises=sqrt(((sigma[0,0]-sigma[1,1])**2+(sigma[1,1]-sigma[2,2])**2+ \  sigma_mises=sqrt(((sigma[0,0]-sigma[1,1])**2+(sigma[1,1]-sigma[2,2])**2+ \
60                    (sigma[2,2]-sigma[0,0])**2)/6. \                    (sigma[2,2]-sigma[0,0])**2)/2. \
61                     +sigma[0,1]**2 + sigma[1,2]**2 + sigma[2,0]**2)                     +3*(sigma[0,1]**2 + sigma[1,2]**2 + sigma[2,0]**2))
62  #... output ...  #... output ...
63  saveVTK("deform.xml",disp=u,stress=sigma_mises)  saveVTK("deform.vtu",disp=u,stress=sigma_mises)
64    

Legend:
Removed from v.1892  
changed lines
  Added in v.2881

  ViewVC Help
Powered by ViewVC 1.1.26