[Top] [Prev] [Next] [Bottom]

## 7.3 Data Setup Functions for Plotting

### Calling Sequence

plane3 (<normal>, <point>)

### Description

This function returns the coefficients of the equation of a plane as a vector of length four. This is the form of a plane argument as expected by the slicing functions. <normal> is a vector of length three giving the direction numbers of the normal to the plane; <point> is a vector of length three giving the coordinates of a point in the plane.

### 7.3.2 Creating a mesh3 argument

The function mesh3 is used to create a mesh3 object from your data. A mesh3 object is required as an input to a number of routines, most importantly, the various slicing functions.

### Calling Sequence (1)

mesh3 (x, y, z)
mesh3 (x, y, z, funcs = [f1, f2, ...], [verts = <spec>])

### Description

mesh3 creates a mesh3 object as expected by the various functions slice3, xyz3, getv3, etc. The form of a mesh3 object will be described below (See "Description of a mesh3 object" on page 63). Note that Python is able to determine which of the above calls is intended because it can check for the presence of optional and keyword arguments and can check the dimensions and types of the arguments.

In the first two forms of the call, x, y, and z are coordinate arrays specifying the mesh. If x, y, and z are three dimensional of the same shape, then they represent the coordinates of the vertices of a regular rectangular mesh. If x, y, and z are one dimensional of the same size, then the keyword argument verts determines how they are interpreted. If verts is not present, then we have a structured reectangular mesh with unequally spaced nodes. If verts is present, then they represent the coordinates of an unstructured mesh, and the keyword argument verts must be used to pass information about the cells to the mesh3 function. <spec> can be either a single two dimensional array of integer subscripts into x, y, and z, or a Python list of up to four such objects, one for each type of cell in the mesh. The format of the two dimensional array for each type of cell shape is as follows:

• hexahedra: the array is no_hex_cells by 8. The first subscript is the hexahedron cell number; for each value of this subscript, the second indexes the vertices in canonical order (the first side in outward normal order, the opposite side's correcponding vertices in inward normal order).
• prisms: the array is no_prism_cells by 6. The first subscript is the prism cell number; for each value of this subscript, the second indexes the vertices in canonical order (the first side in outward normal order, the opposite side's correcponding vertices in inward normal order).
• pyramids: the array is no_pyr_cells by 5. The first subscript is the pyramid cell number; for each value of this subscript, the second indexes first the apex, then the vertices of the base in inward normal order.
• tetrahedra: the array is no_tet_cells by 4. The first subscript is the tetrahedron cell number; for each value of this subscript, the second indexes first some arbitrary cell as the apex, then the vertices of the base in inward normal order.

Each type of cell has a relative cell number running from 0 to no_celltype_cells - 1. The cells are also assumed to have absolute cell numbers, which depend on the order in which the defining arrays appear, but will run consecutively starting from 0 in the first cell of the first type up to the total number of cells - 1 for the last cell of the last type.

The optional keyword funcs defines f1, f2, etc., which are arrays of function values (e.g. density, temperature) defined on the mesh. In the case of a regular (or structured) rectangular mesh, these functions are 3-D arrays. If they represent cell-centered data, they will have one less value along each dimension than the coordinate arrays. If they are vertex-centered data, then they will have the same dimensions. In the case of an unstructured mesh, f1, f2, etc. are one-dimensional arrays. If they represent cell-centered data, then they are indexed by the absolute cell number, and must be the same length as the number of cells. If they represent vertex-centered data, then they are indexed the same as the vertices, and must be the same length as the vertex arrays.

### Calling Sequence (2)

mesh3 (xyz, funcs = [f1, f2, ...])

### Description

In this case xyz is a four dimensional array specifying the mesh; xyz [0] is the three dimensional x coordinate, xyz [1] is the three dimensional y coordinate, and xyz [2] is the three dimensional z coordinate. (mesh3 actually converts the x, y, z arguments of the first two calls into this xyz form in a mesh3 object; see "Description of a mesh3 object" on page 63. The funcs keyword operates as previously described.

### Calling Sequence (3)

mesh3 (nxnynz, dxdydz, x0y0z0, funcs = [f1, f2, ...])

### Description

nxnynz is a vector of 3 integers, specifying the number of cells of a uniform 3D mesh in the x, y, and z directions, respectively. dxdydz is an array of three reals, specifying the size of the entire mesh, not the size of one cell, in each of the three directions, and x0y0z0 is an array of three reals, representing the point of minimum x, y, and z where the mesh begins. The funcs keyword operates as previously described.

### Description of a mesh3 object

The form of a mesh3 object varies according to whether the mesh specified was uniform, structured, or unstructured.

Uniform case, node equally spaced:

[[xyz3_unif, getv3_rect, getc3_rect, iterator3_rect],
[ (nxnynz [0], nxnynz [1], nxnynz [2]),
array ( [dxdydz, x0y0z0])], [f1, f2, ...]]

The four items in the first list are the names of functions. The details of these need not concern us at this time except in their broad outlines. The iterator3 function will split the mesh into chunks for processing by the slicing functions, if necessary, in order to save space. xyz3 returns the vertex coordinates of a chunk. getv3 returns the vertex values of a function on the chunk; getc3 returns cell values. Because these routines necessarily differ depending on the type of mesh, their names are passed along with the mesh specifications to that the apporopriate ones can be called. The remainder of the items in the object specify the mesh and the function(s) defined on the mesh (if any; if there are none, the final list will be []).

Uniform case, nodes unequally spaced:

[[xyz3_unif, getv3_rect, getc3_rect, iterator3_rect],
[ (len (x) - 1, len (y) - 1, len (z) - 1),
array ( [x, y, z])], [f1, f2, ...]]

The functions' purpose is as described above. x, y, and z are one-dimensional arrays, possibly of different lengths, specifying the node coordinates of a uniform rectangular mesh, which might be unequally spaced. The triple consisting of the three array lengths minus one gives the size of the mesh in cells.

Structured case:

[[xyz3_rect, getv3_rect, getc3_rect, iterator3_rect],
[dim_cell, xyz], [f1, f2, ...]]

The functions' purpose is as described above. dim_cell is an integer vector of length three giving the size of the mesh in cells, dim_cell [0] being the x direction size, dim_cell [1] the y, and dim_cell [2] the z. xyz is a four dimensional array of coordinates; xyz [0] is the three dimensional x coordinate array, xyz [1] is the three dimensional y coordinate array, and xyz [2] is the three dimensional z coordinate array.

Unstructured case:

[[xyz3_irreg, getv3_irreg, getc3_irreg, iterator3_irreg],
[dims, array ( [x, y, z]), sizes, totals], [f1, f2, ...]]

The functions' purpose is as described above. dims is the value of the keyword argument verts, i. e., it represents one array, or a list of up to four arrays, specifying the subscripts of the cell vertices into arrays x, y, and z in canonical order. If there is only one type of cell in the unstructured mesh, then sizes and totals will not be present; otherwise, they are used to help recover the absolute cell number from a cell's index in the list of cells of the same type. sizes [i] is the number of cells of type i; totals [i] is the total number of cells up to and including type i.

[Top] [Prev] [Next] [Bottom]

support@icf.llnl.gov