# OOF: Finite Element Analysis of Microstructures

Here are some hints for using some of ppm2oof's less intuitive features. It was written as a stop-gap before the ppm2oof manual was finished. This list will grow as users ask questions, and we discover what features are less intuitive.

The adaptive_mesh menu lets elements have different sizes at different parts of the system, giving more resolution where it's needed (at grain boundaries, for example). In general, you should have assigned material and group properties to pixels before creating and refining an adaptive mesh, although it's not %100 necessary to do so.

adaptive_mesh create creates a uniform mesh which can then be refined in a number of ways. The subtlety comes in how the properties assigned to the pixels (i.e. materials and groups) get transferred to the mesh triangles.

There are trivial ways of refining the mesh. refine all and refine selection should be clear. refine depthrefines all triangles with a depth between two given values (triangles created by createhave depth 0, and the depth of a child triangle is one more than the depth of its parent).

[Obsolete as of 1.1beta2] The non-trivial way to refine a mesh is via refine homogeneity, which is a measure of how homogeneous the pixels underlying the triangle are. Homogeneity is determined by dividing the pixels up into political factions and holding an election. The fraction of the population in the winning fraction is the homogeneity. If the homogeneity of a triangle is less than the amount specified in the "refine homogeneity" command, then the triangle is divided. The exact way in which the election is conducted is determined by the homog._type argument to the refine homogeneity command, which will be explained below. Note that if a triangle is so small that it only contains one pixel (or so that it is smaller than a pixel), then its homogeneity will always be 1.

#### Transferring pixel properties to mesh triangles

Once a mesh is generated, the properties of the pixels have to be somehow transferred to the triangles. There are two kinds of properties, materials and groups, and the way in which they are transferred is controlled by the adaptive_mesh materials and adaptive_mesh groups menus. Both menus have basically the same structure.

For both materials and groups, a representative pixel is chosen, and the material or group properties of this pixel are transferred to the mesh triangle. The representative pixel can be chosen in three ways:

• transfer_method = center: the pixel in the center of the triangle is the representative pixel.
• transfer_method = election: the pixels vote to choose a representative.
• transfer_method = all: (groups only) all pixels are representatives --- the triangle is a member of all groups containing a pixel within it.

#### Conduct of Elections

If the transfer_method is election, then all the pixels in the triangle segregate themselves into voting blocs. The criteria used to segregate the pixels are determined by the election_rules submenus of the groups and materials menus. If a criterion is true, then pixels with different values of that criterion will be in separate blocs. After the votes are tallied, the representative pixel is chosen from the pixels in the largest bloc.

[Obsolete as of 1.1beta2] Two sets of election rules are stored: one governs the transfer of materials to triangles and one governs the transfer of groups to triangles. When subdividing the mesh by homogeneity, either one of these sets of rules can be used to compute the homogeneity, via the homog._type argument of the refine homogeneity command.

#### Adaptive meshes in PPM2OOF version 1.1b2 and later

In version 1.1, the mesh can be made to adapt itself more closely to the internal boundaries in the image. The interface for the relevant commands is still in flux. This section describes the interface as of version 1.1 beta 2 and later, but you should expect it to change. Hopefully, this page will change as well.

The new commands improve the mesh by moving nodes and changing their connectivity in order to reduce the value of an effective "energy" function, E. E is a minimum for homogeneous, equilateral triangles, and E for the mesh is the sum of E for the individual triangles. E has two parts:
E = alpha*Ehom + (1-alpha)*Eangle
Where Ehom measures homogeneity and Eangle measures shape. Both range from 0 (best) to 1 (worst). alpha is a real number between 0 and 1. It can be set with the adaptive_mesh alpha_E variable. A value of 1/3 seems to work well.

The definition of "homogeneity" is different than in previous versions, because the previous definition was not a continuous function of the nodal positions. (The command adaptive_mesh refine homogeneity still uses the old definition.) Ehom is computed by first counting the number, N, of distinct pixel types in the system. Pixels belong to different types if they have different material properties assigned to them, or if they belong to different groups. Then the fractional area, a_i, of each type i is determined for each triangle. Ehom is the product of (1-a_i) for i=1 to N, normalized so that its maximum value is 1. A completely homogeneous triangle has a_i=1 for some one value of i, and a_i=0 for all others, so Ehom=0.

Eangle is 1-kA/L2, where L is the perimeter of a triangle and A is its area. k is a normalization factor which makes Eangle=0 for an equilateral triangle.

The command adaptive_mesh refine E refines those triangles with a value of E above a specified threshold. It does not move nodes.

The variable adaptive_mesh refine division determines how triangles are divided during the refinement. division=longest_edge always divides triangles through their longest edge. division=newest_node divides triangles through the most recently created node (a good procedure for meshes whose nodes don't move). division=smallest_E chooses an edge to minimize the total E of the divided triangle. (Beware of infinite loops if alpha_E=1 and divison=smallest_E. Make sure that max_divisions is set!)

Often, dividing a triangle requires the division of one of its neighbors to avoid hanging nodes. Usually, the neighbor is divided by the method set in the division variable, and the process is repeated recursively until all triangles are divided compatibly. This can sometimes lead to infinite recursion, so as of version 1.1 beta 27, there are two variables that limit division. If the area of a triangle is smaller than min_area or if, on the current refinement iteration, it has been divided more than max_divisions times, the specified division method is ignored and the triangle is divided just once, compatibly with whichever neighbor forced its division. If max_divisions=0, then it is ignored, and infinite subdivision is possible.

The command adaptive_mesh refine interface refines triangles that have at least one neighbor of a different material, ie, the triangles on the interfaces between materials. This function doesn't use E at all. [New in ppm2oof 1.1 beta 9.]

The command adaptive_mesh anneal moves nodes through a Monte Carlo procedure. The parameter T is the Monte Carlo temperature: moves that lower E are always accepted, but moves that raise E are accepted with a thermal probability distribution with temperature T. With T=0, E always decreases. A "move" is a randomly generated displacement of a single node. The displacement of each node is randomly selected from a Gaussian distribution of width delta (in units of the pixel size). In one iteration of the procedure, each node gets one chance to move. The nodes are addressed in a random order.

The command adaptive_mesh relax attempts to be a more efficient way of achieving the same result, but in practice doesn't work very well (yet). The gradient of E with respect to the nodal positions is computed numerically, and all nodes are moved at once in the direction that decreases E the fastest. The parameter delta (in units of the pixel size) sets the longest distance moved by any node.

The command adaptive_mesh swap_two flips the common edge between two selected triangles. Exactly two triangles must currently be selected. If one triangle has nodes ABC and the other has nodes CBD, this command attempts to create triangles ABD and ADC. It fails if the orginal pair of triangles don't form a convex quadrilateral. The change in E is reported.

The command adaptive_mesh swap_worst attempts to flip edges on all pairs of triangles, starting with the ones with the highest E. Each triangle will be involved in at most one flip.

A good strategy seems to be to create an initial coarse mesh, refine it a few times, anneal it a bit, swap the worst triangles, anneal it a bit more, refine it again, etc. If the acceptance rate for the annealing procedure gets too small, it's time to refine again, or to decrease delta. Be careful not to let the triangle size get smaller than the pixel size --- Ehom can always be made small by making all triangles smaller than a pixel, with the triangle boundaries following the pixel edges. In this case, the adaptive mesh isn't any smoother than the simple mesh created by bisecting each pixel.

### Saving goof files

To save a .goof file, use one of the following three commands.

• simple_mesh entire This divides each pixel in the image into two triangular elements, and saves them all.
• simple_mesh subregion This is just like simple_mesh entire, but it doesn't save the whole image. You specify the corners of a rectangular subregion.
• adaptive_mesh save This saves an adaptive mesh, as constructed by the various adaptive mesh commands discussed above.

### Firewalls

Firewalls are pixels that can't be selected by the burning algorithms. Select some pixels and use the command firewalls set to make them inflammable. This lets you manually restrict the range of a burn.

### Active Areas [introduced in PPM2OOF 1.1 beta 8]

The active_area menu lets you restrict (almost) all operations to a set of pixels.

Pixels outside the current active area are drawn in a paler color. The variable active_area fade determines how pale they are -- fade=1 makes them white, and fade=0 makes them their normal, unfaded color.

To set the active area, use the active_area set menu. You can set the active area to the currently selected pixels, or to an existing pixel group. The active_area reduce menu replaces the current active area with its intersection with the current selection or with an existing pixel group, thereby reducing its size. The active_area expand menu increases the size of the current active area by replacing it with its union with the current selection or an existing pixel group.

The current active area can be saved with the active_area store command, and previously saved active areas can be recalled with the active_area recall menu.

The active_area select command selects all pixels in the current active area. The active_area unselect command unselects all pixels not in the current active area.

All pixel selection methods are restricted to the current active area, except for select group and its variants.

All mesh operations (adaptive_mesh refine, adaptive_mesh anneal, etc) are restricted to nodes and triangles within the active area, except for adaptive_mesh save, which operates on the entire mesh. Operations which work on nodes (eg adaptive_mesh anneal) are restricted to nodes which lie within the active region at the beginning of the operation. Operations which work on triangles (eg adaptive_mesh refine) are restricted to triangles with at least one node within the active region.

The variable active_area override can be used to temporarily make the whole image active. This is useful if, for example, you want to select more pixels to expand the current active area.