# Diff of /trunk/doc/examples/pyvisi/heatedblock_with_pyvisi.py

revision 1148 by jongui, Wed May 16 22:45:33 2007 UTC revision 1153 by jongui, Thu May 17 06:33:54 2007 UTC
# Line 19  xc=[0.3,0.3,1.] Line 19  xc=[0.3,0.3,1.]
19  beta=8.  beta=8.
20  T_ref=0.  T_ref=0.
21  T_0=1.  T_0=1.
22
23  #... generate domain ...  #... generate domain ...
24  mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10)  mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10)
25  x=mydomain.getX()  x=mydomain.getX()
# Line 27  T=T_0*exp(-beta*length(x-xc)) Line 28  T=T_0*exp(-beta*length(x-xc))
28  #... open symmetric PDE ...  #... open symmetric PDE ...
29  mypde=LinearPDE(mydomain)  mypde=LinearPDE(mydomain)
30  mypde.setSymmetryOn()  mypde.setSymmetryOn()
31
32  #... set coefficients ...  #... set coefficients ...
33  C=Tensor4(0.,Function(mydomain))  C=Tensor4(0.,Function(mydomain))
34  for i in range(mydomain.getDim()):  for i in range(mydomain.getDim()):
# Line 39  msk=whereZero(x[0])*[1.,0.,0.] \ Line 41  msk=whereZero(x[0])*[1.,0.,0.] \
41     +whereZero(x[2])*[0.,0.,1.]     +whereZero(x[2])*[0.,0.,1.]
42  sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)  sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)
43  mypde.setValue(A=C,X=sigma0,q=msk)  mypde.setValue(A=C,X=sigma0,q=msk)
44
45  #... solve pde ...  #... solve pde ...
46  u=mypde.getSolution()  u=mypde.getSolution()
47  #... calculate von-Misses  #... calculate von-Misses
# Line 65  v.setScaleFactor(scale_factor = 0.3) Line 68  v.setScaleFactor(scale_factor = 0.3)
68  c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)  c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
69  c.isometricView()  c.isometricView()
70

71  # Render the object.  # Render the object.
72  s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH,\  s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH,\
73          "heatedblock.jpg"))          "heatedblock.jpg"))

Legend:
 Removed from v.1148 changed lines Added in v.1153