Changeset 3119
- Timestamp:
- Jun 8, 2006, 2:53:26 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/anuga_user_manual.tex
r3114 r3119 310 310 \item a dictionary \code{boundary} that stores the edges on 311 311 the boundary and associates each with one of the symbolic tags \code{`left'}, \code{`right'}, 312 \code{`top'} or \code{`bottom'}. 312 \code{`top'} or \code{`bottom'}. (For more details on symbolic tags, 313 see page \pageref{ref:tagdescription}.) 313 314 314 315 \end{itemize} … … 494 495 \end{itemize} 495 496 496 Before describing how these boundary conditions are assigned, we 497 recall that the definition of a mesh uses a variable \code{boundary} 498 to store the edges of the mesh that lie on the boundary. (In the 499 code we are discussing, \code{boundary} was one of the three 500 variables returned by the function \code{rectangular}.) 501 502 This variable \code{boundary} is a Python dictionary and it serves 503 not only to hold the edges that make up the boundary but also to 504 assign symbolic tags to these edges to distinguish different parts 505 of the boundary. In this example, the tags used are \code{`left', 506 \code{`right'}, \code{`top'} and \code{`bottom'}, corresponding to 507 the left, right, top and bottom of the rectangle bounding the mesh, 508 and the function \code{rectangular} automatically assigns these tags 509 to the boundary edges when it generates the mesh. The tags are used 510 as keys for the dictionary, so that, for example, 511 \code{boundary[`left']} is a list of the mesh edges that lie along 512 the left part of the boundary. 497 \label{ref:tagdescription}Before describing how these boundary 498 conditions are assigned, we recall that a mesh is specified using 499 three variables \code{points}, \code{vertices} and \code{boundary}. 500 In the code we are discussing, these three variables are returned by 501 the function \code{rectangular}; however, the example given in 502 Section \ref{sec:realdataexample} illustrates another way of 503 assigning the values, by means of the function 504 \code{create\_mesh\_from\_regions}. 505 506 These variables store the data determining the mesh as follows. (You 507 may find that the example given in Section \ref{sec:meshexample} 508 helps to clarify the following discussion, even though that example 509 is a \emph{non-rectangular} mesh.) 510 511 \begin{itemize} 512 \item The variable \code{points} stores a list of 2-tuples giving the 513 coordinates of the mesh points. 514 515 \item The variable \code{vertices} stores a list of 3-tuples of 516 numbers, representing vertices of triangles in the mesh. In this 517 list, the triangle whose vertices are \code{points[i]}, 518 \code{points[j]}, \code{points[k]} is represented by the 3-tuple 519 \code{(i, j, k)}. 520 521 \item The variable \code{boundary} is a Python dictionary that 522 not only stores the edges that make up the boundary but also assigns 523 symbolic tags to these edges to distinguish different parts of the 524 boundary. An edge with endpoints \code{points[i]} and 525 \code{points[j]} is represented by the 2-tuple \code{(i, j)}. The 526 keys for the dictionary are the 2-tuples \code{[i, j]} corresponding 527 to boundary edges in the mesh, and the values are the tags are used 528 to label them. In the present example, the value \code{boundary[i, 529 j]} assigned to \code{[i, j]} is one of the four tags \code{`left'}, 530 \code{`right'}, \code{`top'} or \code{`bottom'}, depending on 531 whether the boundary edge represented by \code{(i, j)} occurs at the 532 left, right, top or bottom of the rectangle bounding the mesh. The 533 function \code{rectangular} automatically assigns these tags to the 534 boundary edges when it generates the mesh. 535 \end{itemize} 513 536 514 537 The tags provide the means to assign different boundary conditions 515 538 to an edge depending on which part of the boundary it belongs to. 516 (Later we shall describe an example that uses different boundary 517 tags---we are not limited to using `left', `right', `top' and 518 `bottom'.) 539 (In Section \ref{sec:realdataexample} we describe an example that 540 uses different boundary tags---in general, the possible tags are not 541 limited to `left', `right', `top' and `bottom', but can be selected 542 by the user.) 519 543 520 544 Using the boundary objects described above, we assign a boundary … … 564 588 See Section \ref{sec:file formats} (page \pageref{sec:file formats}) 565 589 for more on NetCDF and other file formats. 590 591 The following is a listing of the screen output seen by the user 592 when this example is run: 593 594 \verbatiminput{examples/runupoutput.txt} 566 595 567 596 … … 2645 2674 2646 2675 \subsubsection{How do I tag interior polygons?} 2647 At the moment create_mesh_from_regions does not allow interior polygons2648 with symbolict tags. If tags are needed, the interior polygons must be 2649 created subsequently. For example, given a filename of polygons representing 2650 solid walls (in Arc Ungenerate format) can be tagged as such using the code 2651 snippet:2652 \begin{verbatim} 2676 At the moment create_mesh_from_regions does not allow interior 2677 polygons with symbolic tags. If tags are needed, the interior 2678 polygons must be created subsequently. For example, given a filename 2679 of polygons representing solid walls (in Arc Ungenerate format) can 2680 be tagged as such using the code snippet: 2681 \begin{verbatim} 2653 2682 # Create mesh outline with tags 2654 2683 mesh = create_mesh_from_regions(bounding_polygon, … … 2659 2688 2660 2689 # Generate and write mesh to file 2661 mesh.generate_mesh(maximum_triangle_area=max_area) 2690 mesh.generate_mesh(maximum_triangle_area=max_area) 2662 2691 mesh.export_mesh_file(mesh_filename) 2663 \end{verbatim} 2692 \end{verbatim} 2664 2693 2665 2694 Note that a mesh object is returned from \code{create_mesh_from_regions}
Note: See TracChangeset
for help on using the changeset viewer.