12 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
13 |
|
|
14 |
|
|
15 |
|
|
16 |
\chapter{The Module \pycad} \label{PYCAD CHAP} |
\chapter{The Module \pycad} \label{PYCAD CHAP} |
17 |
|
|
18 |
|
|
19 |
\section{Introduction} |
\section{Introduction} |
20 |
|
|
21 |
\pycad provides a simple way to build a mesh for your finite element |
\pycad provides a simple way to build a mesh for your finite element |
22 |
simulation. You begin by building what we call a {\it Design} using |
simulation. You begin by building what we call a \class{Design} using |
23 |
primitive geometric objects, and then to go on to build a mesh from |
primitive geometric objects, and then to go on to build a mesh from |
24 |
the {\it Design}. The final step of generating the mesh from a {\it |
this. The final step of generating the mesh from a \class{Design} |
25 |
Design} uses freely available mesh generation software, such as \gmshextern. |
uses freely available mesh generation software, such as \gmshextern. |
26 |
|
|
27 |
A {\it Design} is built by defining points, which are used to specify |
A \class{Design} is built by defining points, which are used to specify |
28 |
the corners of geometric objects and the vertices of curves. Using |
the corners of geometric objects and the vertices of curves. Using |
29 |
points you construct more interesting objects such as lines, |
points you construct more interesting objects such as lines, |
30 |
rectangles, and arcs. By adding many of these objects into what we |
rectangles, and arcs. By adding many of these objects into what we |
31 |
call a {\it Design}, you can build meshes for arbitrarily complex 2-D |
call a \class{Design}, you can build meshes for arbitrarily complex 2-D |
32 |
and 3-D structures. |
and 3-D structures. |
33 |
|
|
34 |
The example included below shows how to use {\it pycad} to create a 2-D mesh |
\section{The Unit Square} |
35 |
in the shape of a trapezoid with a cutout area. |
So the simplest geometry is the unit square. First we generate the |
36 |
|
corner points |
37 |
|
\begin{python} |
38 |
|
from esys.pycad import * |
39 |
|
p0=Point(0.,0.,0.) |
40 |
|
p1=Point(1.,0.,0.) |
41 |
|
p2=Point(1.,1.,0.) |
42 |
|
p3=Point(0.,1.,0.) |
43 |
|
\end{python} |
44 |
|
which are then linked to define the edges of the square |
45 |
\begin{python} |
\begin{python} |
46 |
from esys.pycad import * |
l01=Line(p0,p1) |
47 |
from esys.pycad.gmsh import Design |
l12=Line(p1,p2) |
48 |
from esys.finley import MakeDomain |
l23=Line(p2,p3) |
49 |
|
l30=Line(p3,p0) |
|
# A trapezoid |
|
|
p0=Point(0.0, 0.0, 0.0) |
|
|
p1=Point(1.0, 0.0, 0.0) |
|
|
p2=Point(1.0, 0.5, 0.0) |
|
|
p3=Point(0.0, 1.0, 0.0) |
|
|
l01=Line(p0, p1) |
|
|
l12=Line(p1, p2) |
|
|
l23=Line(p2, p3) |
|
|
l30=Line(p3, p0) |
|
|
c=CurveLoop(l01, l12, l23, l30) |
|
|
|
|
|
# A small triangular cutout |
|
|
x0=Point(0.1, 0.1, 0.0) |
|
|
x1=Point(0.5, 0.1, 0.0) |
|
|
x2=Point(0.5, 0.2, 0.0) |
|
|
x01=Line(x0, x1) |
|
|
x12=Line(x1, x2) |
|
|
x20=Line(x2, x0) |
|
|
cutout=CurveLoop(x01, x12, x20) |
|
|
|
|
|
# Create the surface with cutout |
|
|
s=PlaneSurface(c, holes=[cutout]) |
|
|
|
|
|
# Create a Design which can make the mesh |
|
|
d=Design(dim=2, element_size=0.05) |
|
|
|
|
|
# Add the trapezoid with cutout |
|
|
d.addItems(s) |
|
|
|
|
|
# Create the geometry, mesh and Escript domain |
|
|
d.setScriptFileName("trapezoid.geo") |
|
|
d.setMeshFileName("trapezoid.msh") |
|
|
domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, |
|
|
optimizeLabeling=True) |
|
|
|
|
|
# Create a file that can be read back in to python with |
|
|
# mesh=ReadMesh(fileName) |
|
|
domain.write("trapezoid.fly") |
|
50 |
\end{python} |
\end{python} |
51 |
|
The lines are put together to form a loop |
52 |
|
\begin{python} |
53 |
|
c=CurveLoop(l01,l12,l23,l30) |
54 |
|
\end{python} |
55 |
|
The orientation of the line defining the \class{CurveLoop} is important. It is assumed that the surrounded |
56 |
|
area is to the left when moving along the lines from their starting points towards the end points. Moreover, |
57 |
|
the line need to form a closed loop. |
58 |
|
|
59 |
|
We use the \class{CurveLoop} to define a surface |
60 |
|
\begin{python} |
61 |
|
s=PlaneSurface(c) |
62 |
|
\end{python} |
63 |
|
Notice there is difference between the \class{CurveLoop} defining the boundary |
64 |
|
of the surface and the actually surface \class{PlaneSurface}. This difference becomes clearer in the next example with a hole. The direction of the lines is important. |
65 |
|
New we are ready to define the geometry which described by an instance of \class{Design} class: |
66 |
|
\begin{python} |
67 |
|
d=Design(dim=2,element_size=0.05) |
68 |
|
\end{python} |
69 |
|
Here we use the two dimensional domain with a local element size in the finite element mesh of $0.05$. |
70 |
|
We then add the surface \code{s} to the geometry |
71 |
|
\begin{python} |
72 |
|
d.addItems(s) |
73 |
|
\end{python} |
74 |
|
This will automatically import all items used to construct \code{s} into the \class{Design} \code{d}. |
75 |
|
Now we are ready to construct a \finley FEM mesh and then write it to the file \file{quad.fly}: |
76 |
|
\begin{python} |
77 |
|
from esys.finley import MakeDomain |
78 |
|
dom=MakeDomain(d) |
79 |
|
dom.write("quad.fly") |
80 |
|
\end{python} |
81 |
|
In some cases it is useful to access the script used to generate the geometry. You can specify a specific name |
82 |
|
for the script file. In our case we use |
83 |
|
\begin{python} |
84 |
|
d.setScriptFileName("quad.geo") |
85 |
|
\end{python} |
86 |
|
If we put everything together we get the script |
87 |
|
\begin{python} |
88 |
|
from esys.pycad import * |
89 |
|
from esys.pycad.gmsh import Design |
90 |
|
from esys.finley import MakeDomain |
91 |
|
p0=Point(0.,0.,0.) |
92 |
|
p1=Point(1.,0.,0.) |
93 |
|
p2=Point(1.,1.,0.) |
94 |
|
p3=Point(0.,1.,0.) |
95 |
|
l01=Line(p0,p1) |
96 |
|
l12=Line(p1,p2) |
97 |
|
l23=Line(p2,p3) |
98 |
|
l30=Line(p3,p0) |
99 |
|
c=CurveLoop(l01,l12,l23,l30) |
100 |
|
s=PlaneSurface(c) |
101 |
|
d=Design(dim=2,element_size=0.05) |
102 |
|
d.setScriptFileName("quad.geo") |
103 |
|
d.setMeshFileName("quad.msh") |
104 |
|
d.addItems(s) |
105 |
|
pl1=PropertySet("sides",l01,l23) |
106 |
|
pl2=PropertySet("top_and_bottom",l12,l30) |
107 |
|
d.addItems(pl1, pl2) |
108 |
|
dom=MakeDomain(d) |
109 |
|
dom.write("quad.fly") |
110 |
|
\end{python} |
111 |
This example is included with the software in |
This example is included with the software in |
112 |
\code{pycad/examples/trapezoid.py}. If you have gmsh installed you can |
\file{quad.py} in the \ExampleDirectory. |
113 |
run the example and view the geometry and mesh with: |
|
114 |
|
There are three extra statements which we have not discussed yet: By default the mesh used to subdivide |
115 |
|
the boundary are not written into the mesh file mainly to reduce the size of the data file. One need to explicitly add the lines to the \Design which should be present in the mesh data. Here we additionally labeled the |
116 |
|
lines on the top and the bottom with the name ``top_and_bottom`` and the lines on the left and right hand side |
117 |
|
with the name ``sides`` using \class{PropertySet} objects. The labeling is convenient |
118 |
|
when using tagging \index{tagging}, see Chapter~\ref{ESCRIPT CHAP}. |
119 |
|
|
120 |
|
\begin{figure} |
121 |
|
\centerline{\includegraphics[width=\figwidth]{figures/quad.eps}} |
122 |
|
\caption{Trapozid with triangle Hole.} |
123 |
|
\label{fig:PYCAD 0} |
124 |
|
\end{figure} |
125 |
|
|
126 |
|
If you have \gmshextern installed you can run the example and view the geometry and mesh with: |
127 |
|
\begin{python} |
128 |
|
escript quad.py |
129 |
|
gmsh quad.geo |
130 |
|
gmsh quad.msh |
131 |
|
\end{python} |
132 |
|
See Figure~\ref{fig:PYCAD 0} for a result. |
133 |
|
|
134 |
|
In most cases it is best practice to generate the mesh and to solve the mathematical |
135 |
|
model in to different scripts. In our example you can read the \finley mesh into your simulation |
136 |
|
code using |
137 |
\begin{python} |
\begin{python} |
138 |
python trapezoid.py |
from finley import ReadMesh |
139 |
gmsh trapezoid.geo |
mesh=ReadMesh("quad.fly") |
|
gmsh trapezoid.msh |
|
140 |
\end{python} |
\end{python} |
141 |
|
|
142 |
|
Note that the underlying mesh generation software will not accept all |
143 |
|
the geometries you can create with \pycad. For example, \pycad |
144 |
|
will happily allow you to create a 2-D \class{Design} that is a |
145 |
|
closed loop with some additional points or lines lying outside of the |
146 |
|
enclosed area, but \gmshextern will fail to create a mesh for it. |
147 |
|
|
148 |
|
\begin{figure} |
149 |
|
\centerline{\includegraphics[width=\figwidth]{figures/trap.eps}} |
150 |
|
\caption{Trapozid with triangle Hole.} |
151 |
|
\label{fig:PYCAD 1} |
152 |
|
\end{figure} |
153 |
|
|
154 |
|
|
155 |
|
\section{Holes} |
156 |
|
The example included below shows how to use \pycad to create a 2-D mesh |
157 |
|
in the shape of a trapezoid with a cut-out area, see Figure~\ref{fig:PYCAD 1}: |
158 |
|
\begin{python} |
159 |
|
from esys.pycad import * |
160 |
|
from esys.pycad.gmsh import Design |
161 |
|
from esys.finley import MakeDomain |
162 |
|
|
163 |
|
# A trapezoid |
164 |
|
p0=Point(0.0, 0.0, 0.0) |
165 |
|
p1=Point(1.0, 0.0, 0.0) |
166 |
|
p2=Point(1.0, 0.5, 0.0) |
167 |
|
p3=Point(0.0, 1.0, 0.0) |
168 |
|
l01=Line(p0, p1) |
169 |
|
l12=Line(p1, p2) |
170 |
|
l23=Line(p2, p3) |
171 |
|
l30=Line(p3, p0) |
172 |
|
c=CurveLoop(l01, l12, l23, l30) |
173 |
|
|
174 |
|
# A small triangular cutout |
175 |
|
x0=Point(0.1, 0.1, 0.0) |
176 |
|
x1=Point(0.5, 0.1, 0.0) |
177 |
|
x2=Point(0.5, 0.2, 0.0) |
178 |
|
x01=Line(x0, x1) |
179 |
|
x12=Line(x1, x2) |
180 |
|
x20=Line(x2, x0) |
181 |
|
cutout=CurveLoop(x01, x12, x20) |
182 |
|
|
183 |
|
# Create the surface with cutout |
184 |
|
s=PlaneSurface(c, holes=[cutout]) |
185 |
|
|
186 |
|
# Create a Design which can make the mesh |
187 |
|
d=Design(dim=2, element_size=0.05) |
188 |
|
|
189 |
|
# Add the trapezoid with cutout |
190 |
|
d.addItems(s) |
191 |
|
|
192 |
|
# Create the geometry, mesh and Escript domain |
193 |
|
d.setScriptFileName("trapezoid.geo") |
194 |
|
d.setMeshFileName("trapezoid.msh") |
195 |
|
domain=MakeDomain(d) |
196 |
|
# write mesh to a finley file: |
197 |
|
domain.write("trapezoid.fly") |
198 |
|
\end{python} |
199 |
|
This example is included with the software in |
200 |
|
\file{trapezoid.py} in the \ExampleDirectory. |
201 |
|
|
202 |
A \code{CurveLoop} is used to connect several lines into a single curve. |
A \code{CurveLoop} is used to connect several lines into a single curve. |
203 |
It is used in the example above to create the trapezoidal outline for the grid |
It is used in the example above to create the trapezoidal outline for the grid |
204 |
and also for the triangular cutout area. |
and also for the triangular cutout area. |
205 |
You can use any number of lines when creating a \code{CurveLoop}, but |
You can use any number of lines when creating a \class{CurveLoop}, but |
206 |
the end of one line must be identical to the start of the next. |
the end of one line must be identical to the start of the next. |
207 |
|
|
|
Sometimes you might see us write \code{-c} where \code{c} is a |
|
|
\code{CurveLoop}. This is the reverse curve of the curve \code{c}. |
|
|
It is identical to the original except that its points are traversed |
|
|
in the opposite order. This may make it easier to connect two curves |
|
|
in a \code{CurveLoop}. |
|
|
|
|
|
The example python script above calls both |
|
|
\code{d.setScriptFileName()} and \code{d.setMeshFileName()}. You need |
|
|
only call these if you wish to save the gmsh geometry and mesh files. |
|
208 |
|
|
209 |
Note that the underlying mesh generation software will not accept all |
\begin{figure} |
210 |
the geometries you can create with {\it pycad}. For example, {\it |
\centerline{\includegraphics[width=\figwidth]{figures/brick.eps}} |
211 |
pycad} will happily allow you to create a 2-D {\it Design} that is a |
\caption{Three dimensional Block.} |
212 |
closed loop with some additional points or lines lying outside of the |
\label{fig:PYCAD 2} |
213 |
enclosed area, but gmsh will fail to create a mesh for it. |
\end{figure} |
214 |
|
|
215 |
|
\section{A 3D example} |
216 |
|
In this section we discuss the definition of 3D geometries. The example is the unit cube, see Figure~\ref{fig:PYCAD 2}. First we generate the vertices of the cube: |
217 |
|
\begin{python} |
218 |
|
from esys.pycad import * |
219 |
|
p0=Point(0.,0.,0.) |
220 |
|
p1=Point(1.,0.,0.) |
221 |
|
p2=Point(0.,1.,0.) |
222 |
|
p3=Point(1.,1.,0.) |
223 |
|
p4=Point(0.,0.,1.) |
224 |
|
p5=Point(1.,0.,1.) |
225 |
|
p6=Point(0.,1.,1.) |
226 |
|
p7=Point(1.,1.,1.) |
227 |
|
\end{python} |
228 |
|
We connect the points to form the bottom and top surfaces of the cube: |
229 |
|
\begin{python} |
230 |
|
l01=Line(p0,p1) |
231 |
|
l13=Line(p1,p3) |
232 |
|
l32=Line(p3,p2) |
233 |
|
l20=Line(p2,p0) |
234 |
|
bottom=PlaneSurface(CurveLoop(l01,l13,l32,l20)) |
235 |
|
\end{python} |
236 |
|
and |
237 |
|
\begin{python} |
238 |
|
l45=Line(p4,p5) |
239 |
|
l57=Line(p5,p7) |
240 |
|
l76=Line(p7,p6) |
241 |
|
l64=Line(p6,p4) |
242 |
|
top=PlaneSurface(CurveLoop(l45,l57,l76,l64)) |
243 |
|
\end{python} |
244 |
|
To form the front face we introduce the two additional lines connecting the left and right front |
245 |
|
points of the the \code{top} and \code{bottom} face: |
246 |
|
\begin{python} |
247 |
|
l15=Line(p1,p5) |
248 |
|
l40=Line(p4,p0) |
249 |
|
\end{python} |
250 |
|
To form the front face we encounter the problem as the line \code{l45} used to define the |
251 |
|
\code{top} face is pointing the wrong direction. In \pycad you can reversing direction of an |
252 |
|
object by changing its sign. So we write \code{-l45} to indicate that the direction is to be reversed. With this notation we can write |
253 |
|
\begin{python} |
254 |
|
front=PlaneSurface(CurveLoop(l01,l15,-l45,l40)) |
255 |
|
\end{python} |
256 |
|
Keep in mind that if you use \code{Line(p4,p5)} instead \code{-l45} both objects are treated as different although the connecting the same points with a straight line in the same direction. The resulting geometry would include an opening along the \code{p4}--\code{p5} connection. This will lead to an inconsistent mesh and may result in a failure of the volumetric mesh generator. Similarly we can define the other sides of the cube: |
257 |
|
\begin{python} |
258 |
|
l37=Line(p3,p7) |
259 |
|
l62=Line(p6,p2) |
260 |
|
back=PlaneSurface(CurveLoop(l32,-l62,-l76,-l37)) |
261 |
|
left=PlaneSurface(CurveLoop(-l40,-l64,l62,l20)) |
262 |
|
right=PlaneSurface(CurveLoop(-l15,l13,l37,-l57)) |
263 |
|
\end{python} |
264 |
|
We can now put the six surfaces together to form a \class{SurfaceLoop} defining the |
265 |
|
boundary of the volume of the cube: |
266 |
|
\begin{python} |
267 |
|
sl=SurfaceLoop(top,-bottom,front,back,left,right) |
268 |
|
v=Volume(sl) |
269 |
|
\end{python} |
270 |
|
Similar to the definition of a \code{CurvedLoop} the orientation of the surfaces \code{SurfaceLoop} is relevant. In fact the surface normal direction defined by the the right hand rule needs to point outwards as indicated by the surface normals in |
271 |
|
Figure~\ref{fig:PYCAD 2}. As the \code{bottom} face is directed upwards it is inserted with the minus sign |
272 |
|
into the \code{SurfaceLoop} in order to adjust the orientation of the surface. |
273 |
|
|
274 |
|
As in the 2D case, the \class{Design} class is used to define the geometry: |
275 |
|
\begin{python} |
276 |
|
from esys.pycad.gmsh import Design |
277 |
|
from esys.finley import MakeDomain |
278 |
|
|
279 |
|
des=Design(dim=3, element_size = 0.1, keep_files=True) |
280 |
|
des.setScriptFileName("brick.geo") |
281 |
|
des.addItems(v, top, bottom, back, front, left , right) |
282 |
|
|
283 |
|
dom=MakeDomain(des) |
284 |
|
dom.write("brick.fly") |
285 |
|
\end{python} |
286 |
|
Note that the \finley mesh file \file{brick.fly} will contain the |
287 |
|
triangles used to define the surfaces as they are added to the \class{Design}. |
288 |
|
The example script of the cube is included with the software in |
289 |
|
\file{brick.py} in the \ExampleDirectory. |
290 |
|
|
291 |
|
\begin{figure} |
292 |
|
\centerline{\includegraphics[width=\figwidth]{figures/refine1.eps}} |
293 |
|
\caption{Local refinement at the origin by \code{local_scale=0.01} with \code{element_size=0.3} and number of elements on the top set to 10.} |
294 |
|
\label{fig:PYCAD 5} |
295 |
|
\end{figure} |
296 |
|
|
297 |
|
\section{Element Sizes} |
298 |
|
The element size used globally is defined by the |
299 |
|
\code{element_size} argument of the \class{Design}. The mesh generator |
300 |
|
will try to use this mesh size everywhere in the geometry. In some cases it can be |
301 |
|
desirable to use locally a finer mesh. A local refinement can be defined at each |
302 |
|
\class{Point}: |
303 |
|
\begin{python} |
304 |
|
p0=Point(0.,0.,0.,local_scale=0.01) |
305 |
|
\end{python} |
306 |
|
Here the mesh generator will create a mesh with an element size which is by the factor \code{0.01} |
307 |
|
times smaller than the global mesh size \code{element_size=0.3}, see Figure~\ref{fig:PYCAD 5}. The point where a refinement is defined must be a point of curve used to define the geometry. |
308 |
|
|
309 |
|
Alternatively, one can define a mesh size along a curve by defining the number of elements to be used to subdivide the curve. For instance, to use $20$ element on line \code{l23} on uses: |
310 |
|
\begin{python} |
311 |
|
l23=Line(p2, p3) |
312 |
|
l23.setElementDistribution(20) |
313 |
|
\end{python} |
314 |
|
Setting the number of elements on a curve overwrites the global mesh size \code{element_size}. The result is shown in Figure~\ref{fig:PYCAD 5}. |
315 |
|
|
316 |
|
|
317 |
|
|
321 |
|
|
322 |
\subsection{Primitives} |
\subsection{Primitives} |
323 |
|
|
324 |
Some of the most commonly-used objects in {\it pycad} are listed here. For a more complete |
Some of the most commonly-used objects in \pycad are listed here. For a more complete |
325 |
list see the full API documentation. |
list see the full API documentation. |
326 |
|
|
327 |
\begin{classdesc}{Point}{x=0.,y=0.,z=0.\optional{,local_scale=1.}} |
\begin{classdesc}{Point}{x=0.,y=0.,z=0.\optional{,local_scale=1.}} |
332 |
Create a line with between starting and ending points. |
Create a line with between starting and ending points. |
333 |
\end{classdesc} |
\end{classdesc} |
334 |
\begin{methoddesc}[Line]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
\begin{methoddesc}[Line]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
335 |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between naighboured elements. If \var{createBump} is set |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between neighboured elements. If \var{createBump} is set |
336 |
progression is applied towards the center of the line. |
progression is applied towards the centre of the line. |
337 |
\end{methoddesc} |
\end{methoddesc} |
338 |
\begin{methoddesc}[Line]{resetElementDistribution}{} |
\begin{methoddesc}[Line]{resetElementDistribution}{} |
339 |
removes a previously set element distribution from the line. |
removes a previously set element distribution from the line. |
349 |
A spline curve defined by a list of points \var{point0}, \var{point1},.... |
A spline curve defined by a list of points \var{point0}, \var{point1},.... |
350 |
\end{classdesc} |
\end{classdesc} |
351 |
\begin{methoddesc}[Spline]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
\begin{methoddesc}[Spline]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
352 |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between naighboured elements. If \var{createBump} is set |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between neighboured elements. If \var{createBump} is set |
353 |
progression is applied towards the center of the line. |
progression is applied towards the centre of the line. |
354 |
\end{methoddesc} |
\end{methoddesc} |
355 |
\begin{methoddesc}[Spline]{resetElementDistribution}{} |
\begin{methoddesc}[Spline]{resetElementDistribution}{} |
356 |
removes a previously set element distribution from the line. |
removes a previously set element distribution from the line. |
365 |
A B-spline curve defined by a list of points \var{point0}, \var{point1},.... |
A B-spline curve defined by a list of points \var{point0}, \var{point1},.... |
366 |
\end{classdesc} |
\end{classdesc} |
367 |
\begin{methoddesc}[BSpline]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
\begin{methoddesc}[BSpline]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
368 |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between naighboured elements. If \var{createBump} is set |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between neighboured elements. If \var{createBump} is set |
369 |
progression is applied towards the center of the line. |
progression is applied towards the centre of the line. |
370 |
\end{methoddesc} |
\end{methoddesc} |
371 |
\begin{methoddesc}[BSpline]{resetElementDistribution}{} |
\begin{methoddesc}[BSpline]{resetElementDistribution}{} |
372 |
removes a previously set element distribution from the line. |
removes a previously set element distribution from the line. |
381 |
A Brezier spline curve defined by a list of points \var{point0}, \var{point1},.... |
A Brezier spline curve defined by a list of points \var{point0}, \var{point1},.... |
382 |
\end{classdesc} |
\end{classdesc} |
383 |
\begin{methoddesc}[BezierCurve]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
\begin{methoddesc}[BezierCurve]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
384 |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between naighboured elements. If \var{createBump} is set |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between neighboured elements. If \var{createBump} is set |
385 |
progression is applied towards the center of the line. |
progression is applied towards the centre of the line. |
386 |
\end{methoddesc} |
\end{methoddesc} |
387 |
\begin{methoddesc}[BezierCurve]{resetElementDistribution}{} |
\begin{methoddesc}[BezierCurve]{resetElementDistribution}{} |
388 |
removes a previously set element distribution from the line. |
removes a previously set element distribution from the line. |
393 |
no element distribution is set None is returned. |
no element distribution is set None is returned. |
394 |
\end{methoddesc} |
\end{methoddesc} |
395 |
|
|
396 |
\begin{classdesc}{Arc}{center_point, start_point, end_point} |
\begin{classdesc}{Arc}{centre_point, start_point, end_point} |
397 |
Create an arc by specifying a center for a circle and start and end points. An arc may subtend an angle of at most $\pi$ radians. |
Create an arc by specifying a centre for a circle and start and end points. An arc may subtend an angle of at most $\pi$ radians. |
398 |
\end{classdesc} |
\end{classdesc} |
399 |
\begin{methoddesc}[Arc]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
\begin{methoddesc}[Arc]{setElementDistribution}{n\optional{,progression=1\optional{,createBump=\False}}} |
400 |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between naighboured elements. If \var{createBump} is set |
Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor \var{progression} defines the change of element size between neighboured elements. If \var{createBump} is set |
401 |
progression is applied towards the center of the line. |
progression is applied towards the centre of the line. |
402 |
\end{methoddesc} |
\end{methoddesc} |
403 |
\begin{methoddesc}[Arc]{resetElementDistribution}{} |
\begin{methoddesc}[Arc]{resetElementDistribution}{} |
404 |
removes a previously set element distribution from the line. |
removes a previously set element distribution from the line. |
429 |
applies 2D transfinite meshing to the surface. |
applies 2D transfinite meshing to the surface. |
430 |
\var{orientation} defines the orientation of triangles. Allowed values |
\var{orientation} defines the orientation of triangles. Allowed values |
431 |
are \var{``Left''}, \var{``Right''} or \var{``Alternate''}. The |
are \var{``Left''}, \var{``Right''} or \var{``Alternate''}. The |
432 |
boundary of the surface muist be defined by three or four lines where an |
boundary of the surface must be defined by three or four lines where an |
433 |
element distribution must be defined on all faces where opposite |
element distribution must be defined on all faces where opposite |
434 |
faces uses the same element distribution. No holes must be present. |
faces uses the same element distribution. No holes must be present. |
435 |
\end{methoddesc} |
\end{methoddesc} |
451 |
applies 2D transfinite meshing to the surface. |
applies 2D transfinite meshing to the surface. |
452 |
\var{orientation} defines the orientation of triangles. Allowed values |
\var{orientation} defines the orientation of triangles. Allowed values |
453 |
are \var{``Left''}, \var{``Right''} or \var{``Alternate''}. The |
are \var{``Left''}, \var{``Right''} or \var{``Alternate''}. The |
454 |
boundary of the surface muist be defined by three or four lines where an |
boundary of the surface must be defined by three or four lines where an |
455 |
element distribution must be defined on all faces where opposite |
element distribution must be defined on all faces where opposite |
456 |
faces uses the same element distribution. No holes must be present. |
faces uses the same element distribution. No holes must be present. |
457 |
\end{methoddesc} |
\end{methoddesc} |
487 |
defines a rotation by \var{angle} around axis through point \var{point} and direction \var{axis}. |
defines a rotation by \var{angle} around axis through point \var{point} and direction \var{axis}. |
488 |
\var{axis} and \var{point} can be any object that can be converted |
\var{axis} and \var{point} can be any object that can be converted |
489 |
into a \numpy object of shape $(3,)$. |
into a \numpy object of shape $(3,)$. |
490 |
\var{axis} does not have to be normalized but must have positive length. The right hand rule~\cite{RIGHTHANDRULE} |
\var{axis} does not have to be normalised but must have positive length. The right hand rule~\cite{RIGHTHANDRULE} |
491 |
applies. |
applies. |
492 |
\end{classdesc} |
\end{classdesc} |
493 |
|
|
494 |
|
|
495 |
\begin{classdesc}{Dilation}{\optional{factor=1., \optional{center=[0,0,0]}}} |
\begin{classdesc}{Dilation}{\optional{factor=1., \optional{centre=[0,0,0]}}} |
496 |
defines a dilation by the expansion/contraction \var{factor} with |
defines a dilation by the expansion/contraction \var{factor} with |
497 |
\var{center} as the dilation center. |
\var{centre} as the dilation centre. |
498 |
\var{center} can be any object that can be converted |
\var{centre} can be any object that can be converted |
499 |
into a \numpy object of shape $(3,)$. |
into a \numpy object of shape $(3,)$. |
500 |
\end{classdesc} |
\end{classdesc} |
501 |
|
|
504 |
where $n$ is the surface normal \var{normal} and $d$ is the plane \var{offset}. |
where $n$ is the surface normal \var{normal} and $d$ is the plane \var{offset}. |
505 |
\var{normal} can be any object that can be converted |
\var{normal} can be any object that can be converted |
506 |
into a \numpy object of shape $(3,)$. |
into a \numpy object of shape $(3,)$. |
507 |
\var{normal} does not have to be normalized but must have positive length. |
\var{normal} does not have to be normalised but must have positive length. |
508 |
\end{classdesc} |
\end{classdesc} |
509 |
|
|
510 |
\begin{datadesc}{DEG} |
\begin{datadesc}{DEG} |
574 |
\modulesynopsis{Python geometry description and meshing interface} |
\modulesynopsis{Python geometry description and meshing interface} |
575 |
|
|
576 |
The class and methods described here provide an interface to the mesh |
The class and methods described here provide an interface to the mesh |
577 |
generation software, which is currently gmsh. This interface could be |
generation software, which is currently \gmshextern. This interface could be |
578 |
adopted to triangle or another mesh generation package if this is |
adopted to triangle or another mesh generation package if this is |
579 |
deemed to be desirable in the future. |
deemed to be desirable in the future. |
580 |
|
|
640 |
\end{methoddesc} |
\end{methoddesc} |
641 |
|
|
642 |
\begin{methoddesc}[Design]{setScriptFileName}{\optional{name=None}} |
\begin{methoddesc}[Design]{setScriptFileName}{\optional{name=None}} |
643 |
set the filename for the gmsh input script. if no name is given a name with extension "geo" is generated. |
set the file name for the gmsh input script. if no name is given a name with extension "geo" is generated. |
644 |
\end{methoddesc} |
\end{methoddesc} |
645 |
|
|
646 |
\begin{methoddesc}[Design]{getScriptFileName}{} |
\begin{methoddesc}[Design]{getScriptFileName}{} |