/[escript]/trunk/pycad/examples/trapezoid.py
ViewVC logotype

Annotation of /trunk/pycad/examples/trapezoid.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (hide annotations)
Thu Sep 25 06:43:44 2008 UTC (12 years, 7 months ago) by ksteube
File MIME type: text/x-python
File size: 1919 byte(s)
Copyright updated in all python files

1 ksteube 1809
2     ########################################################
3     #
4     # Copyright (c) 2003-2008 by University of Queensland
5     # 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     __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15     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     __url__="http://www.uq.edu.au/esscc/escript-finley"
21    
22 ksteube 1060 """
23     a trapezoid with a cutout
24    
25     @var __author__: Ken Steube
26     @var __url__: http://www.iservo.edu.au/esys/escript
27     @var __date__: 26 March 2007
28     """
29    
30     from esys.pycad import *
31     from esys.pycad.gmsh import Design
32     from esys.finley import MakeDomain
33    
34     # A trapezoid
35     p0=Point(0.0, 0.0, 0.0)
36     p1=Point(1.0, 0.0, 0.0)
37     p2=Point(1.0, 0.5, 0.0)
38     p3=Point(0.0, 1.0, 0.0)
39     l01=Line(p0, p1)
40     l12=Line(p1, p2)
41     l23=Line(p2, p3)
42     l30=Line(p3, p0)
43     c=CurveLoop(l01, l12, l23, l30)
44    
45     # A small triangular cutout
46     x0=Point(0.1, 0.1, 0.0)
47     x1=Point(0.5, 0.1, 0.0)
48     x2=Point(0.5, 0.2, 0.0)
49     x01=Line(x0, x1)
50     x12=Line(x1, x2)
51     x20=Line(x2, x0)
52     cutout=CurveLoop(x01, x12, x20)
53    
54 ksteube 1061 # Create the surface with cutout
55 ksteube 1060 s=PlaneSurface(c, holes=[cutout])
56    
57 ksteube 1061 # Create a Design which can make the mesh
58 ksteube 1060 d=Design(dim=2, element_size=0.05)
59 ksteube 1061
60     # Add the trapezoid with cutout
61 ksteube 1060 d.addItems(s)
62    
63 ksteube 1061 # Create the geometry, mesh and Escript domain
64 ksteube 1060 d.setScriptFileName("trapezoid.geo")
65     d.setMeshFileName("trapezoid.msh")
66 ksteube 1061 domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True)
67 ksteube 1060
68 ksteube 1061 # Create a file that can be read back in to python with mesh=ReadMesh(fileName)
69     domain.write("trapezoid.fly")
70    

  ViewVC Help
Powered by ViewVC 1.1.26