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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1061 - (show annotations)
Mon Mar 26 05:32:22 2007 UTC (13 years, 7 months ago) by ksteube
File MIME type: text/x-python
File size: 1579 byte(s)
Commented the example

1 """
2 a trapezoid with a cutout
3
4 @var __author__: Ken Steube
5 @var __url__: http://www.iservo.edu.au/esys/escript
6 @var __date__: 26 March 2007
7 """
8
9
10 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
11 http://www.access.edu.au
12 Primary Business: Queensland, Australia"""
13 __license__="""Licensed under the Open Software License version 3.0
14 http://www.opensource.org/licenses/osl-3.0.php"""
15 __author__="Ken Steube, k.steube@uq.edu.au"
16 __url__="http://www.iservo.edu.au/esys/escript"
17 __version__="$Revision$"
18 __date__="$Date$"
19
20 from esys.pycad import *
21 from esys.pycad.gmsh import Design
22 from esys.finley import MakeDomain
23
24 # A trapezoid
25 p0=Point(0.0, 0.0, 0.0)
26 p1=Point(1.0, 0.0, 0.0)
27 p2=Point(1.0, 0.5, 0.0)
28 p3=Point(0.0, 1.0, 0.0)
29 l01=Line(p0, p1)
30 l12=Line(p1, p2)
31 l23=Line(p2, p3)
32 l30=Line(p3, p0)
33 c=CurveLoop(l01, l12, l23, l30)
34
35 # A small triangular cutout
36 x0=Point(0.1, 0.1, 0.0)
37 x1=Point(0.5, 0.1, 0.0)
38 x2=Point(0.5, 0.2, 0.0)
39 x01=Line(x0, x1)
40 x12=Line(x1, x2)
41 x20=Line(x2, x0)
42 cutout=CurveLoop(x01, x12, x20)
43
44 # Create the surface with cutout
45 s=PlaneSurface(c, holes=[cutout])
46
47 # Create a Design which can make the mesh
48 d=Design(dim=2, element_size=0.05)
49
50 # Add the trapezoid with cutout
51 d.addItems(s)
52
53 # Create the geometry, mesh and Escript domain
54 d.setScriptFileName("trapezoid.geo")
55 d.setMeshFileName("trapezoid.msh")
56 domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True)
57
58 # Create a file that can be read back in to python with mesh=ReadMesh(fileName)
59 domain.write("trapezoid.fly")
60

  ViewVC Help
Powered by ViewVC 1.1.26