OOF2: The Manual
Name
Anneal (Anneal) — Move nodes randomly and accept the ones that meet the acceptance criterion.
Synopsis
Anneal
(targets
,criterion
,T
,delta
,iteration
)
Details
-
Base class:
SkeletonModifier
-
Parameters:
targets
- Which nodes to move. Type: An object of the
FiddleNodesTargets
class. criterion
- Acceptance criterion Type: An object of the
SkelModCriterion
class. T
- Failed moves will be accepted if T>0 and exp(-diffE/T) > r, where diffE is the energy gained and r is a random number between 0 and 1. Type: A real number.
delta
- Width of the distribution of attempted node motions, in units of the pixel size. Type: A real number.
iteration
- Iteration method. Type: An object of the
IterationManager
class.
Description
Anneal
is a Skeleton
modifier that
moves Nodes
to random positions, accepting or rejecting moves
according to the given criterion
. It is
similar to a simulated annealing simulation in statistical
mechanics, from which it gets its name. Instead of minimizing the
free energy of a system of particles, it minimizes the effective energy
of a Skeleton
.
The general procedure for a single iteration of
Anneal
is as follows:
-
Collect target nodes according to the given
targets
parameter. The collectedNodes
are re-ordered randomly to remove any potential artifacts from the original ordering ofNodes
. This re-ordering is repeated at every iteration. -
Give each
Node
a single chance to move to a randomly assigned new position. OOF2 computes the new position fromand
are random numbers chosen from a Gaussian distribution of width
delta
and mean 0.0.delta
is in units of theMicrostructure
pixel size.Figure 6.59(a) shows a node (the big red dot) that is about to move to a new position. Before making the move, OOF2 computes the total effective energy of all of the neighboring elements of the node.
-
After moving each
Node
, the given acceptancecriterion
decides whether or not the move is acceptable. -
If the move is unacceptable according to the acceptance
criterion
, OOF2 may still accept the move if the annealing is being done at a non-zero temperature. The parameterT
sets the effective temperature of the annealing process. Unacceptable moves are accepted with a probabilitywhere
is the difference between the effective energies of the new and old
Element
configurations.
Figure 6.59. Annealing

(a) A node moves by
and
.
The node move affects
four neighboring elements, E0,
E1, E2, and
E3. (b) The node has moved to a
new position. If the move doesn't satisfy the given acceptance
criterion
(computed based on its four
affected elements), it'll be rejected and the node will
move back to its original position.
Successful annealing usually requires a number of iterations. On
each iteration, OOF2 makes one attempt to move each node. The
number of iterations is controlled by the
iteration
parameter, which can be set to
perform a fixed number of iterations or to stop after some
condition is satisfied. See IterationManager for the details.
Statistics for each step of the annealing process are printed in the OOF2 Message window. For example,
Iteration 1: E = 1.1916e+01, deltaE=-1.2495e-01 ( 1.049%), Acceptance Rate = 19.1% Iteration 2: E = 1.1391e+01, deltaE=-1.7564e-01 ( 1.542%), Acceptance Rate = 25.5% Iteration 3: E = 1.0638e+01, deltaE=-1.1883e-01 ( 1.117%), Acceptance Rate = 22.3% Iteration 4: E = 1.0095e+01, deltaE=-1.4345e-01 ( 1.421%), Acceptance Rate = 21.0% Iteration 5: E = 9.5440e+00, deltaE=-8.3725e-02 ( 0.877%), Acceptance Rate = 21.0%
The listing shows the iteration number, the total energy
(E
) of the Skeleton
, the absolute
change in energy (deltaE
) during
the iteration, the percentage change in energy, and the move acceptance rate.
If the change in energy or the acceptance rate gets too small, the
annealing process is not being effective at improving the Skeleton
.
Using ConditionalIteration as
the iteration
parameter can stop the process
when it becomes ineffective.
Figure 6.60 shows a Skeleton
that has been
refined once. Figure 6.61 shows the same skeleton after snapping nodes to the
material boundaries. Snapping was done with a large α (0.9)
so there are some badly misshapen elements. Notice that the
border of the arrow shape does not coincide well with the element
edges in many spots. Further iterations of SnapNodes does not improve matters.
However, the Skeleton
can be improved by Annealing. Annealing with
targets
=AllNodes,
criterion
=AverageEnergy(alpha
=0.9),
and delta
=1.0 for 20 iterations produced the
Skeleton
shown in Figure 6.62. The Skeleton
edges match the boundary of the arrow shape much more
exactly. Further annealing would improve it even more, although
SplitQuads and Rationalize should probably be used
first.
Figure 6.60. A Slightly Refined Skeleton

A Skeleton
for a Microstructure
containing three materials. The
material boundaries do not align well with the Element
edges.
Figure 6.62. An Annealed Skeleton

The Skeleton
from Figure 6.61 after being
annealed. The resolution of the sharp corners has been much
improved.
![]() |
Tip |
---|---|
Even though the example shown above concentrates on resolving
tricky material boundaries (meaning it puts more emphasis on
homogeneity
than shape), |
![]() |
Tip |
---|---|
A good way to anneal efficiently is to apply it only to |