A handful of "toy" miniapps of less serious nature demonstrate the flexibility of MFEM (and provide a bit of fun):
automata miniapp implements a one dimensional elementary cellular
automata as described in:
This miniapp shows a completely unnecessary use of the finite element method to simply display binary data (but it's fun to play with).
automata miniapp has only three options;
enable or disable visualization,
-ns which defines the number of
steps to evolve the cellular automata, and
-r to select the rule
which is applied at each step. Rules for this type of cellular
automata consist of a sequence of 8 bits which are normally passed as
an integer 0-255. The rule defines how to update each cell based on
the current values of that cell and its two nearest neighbors.
life miniapp implements Conway's Game of Life. A few simple
starting positions are available as well as a random initial
state. The game will terminate only if two successive iterations are
Users can control the size of the domain and the initial placement of
simple objects like blinkers and gliders. Arbitrary patterns can
be supplied through the
-sp option. The sketch
pad was used to produce the above image with the command line:
life -nx 30 -sp '11 11 1 1 1 1 1 1 1 1 2
1 0 1 1 1 1 0 1 2
1 1 1 1 1 1 1 1'
The values following
-sp are the starting coordinates of the pattern
followed by zeros or ones to indicate pixels that should be off or on,
any twos indicate new lines in the pattern.
lissajous miniapp generates two different Lissajous curves in 3D
which appear to spin vertically and/or horizontally, even though the
net motion is the same.
|Vertical Rotation||Horizontal Rotation|
Based on the 2019 Illusion of the year "Dual Axis Illusion" by Frank Force, see Dual Axis Illusion.
mandel miniapp is a specialized version of the
shaper miniapp which
adapts a mesh to the Mandelbrot set.
Both planar and surface meshes are supported.
mondrian miniapp is a specialized version of the
miniapp that converts an input image to an AMR mesh. It allows the
fast approximate meshing of any domain for which there is an image.
The input image should be in 8-bit grayscale PGM format. You can use a number of image manipulation tools, such as GIMP (gimp.org) and ImageMagick's convert utility (imagemagick.org/script/convert.php) to convert your image to this format as a pre-processing step, e.g.:
/usr/bin/convert australia.svg -compress none -depth 8 australia.pgm
rubik miniapp implements an interactive model of a Rubik's Cube™ puzzle.
The basic interactive command is of the form
rotates, about the x, y, or z axis, a single tier, indicated by the
first integer, by a number of increments, indicated by the final
integer. Any manipulation of the cube can be accomplished with a
sequence of these simple three character commands.
||Resets or re-paints the cube|
||Solve the cube starting from the top and working down|
||Specific number of random moves|
||Print the current state of the cube to the screen|
||Solve the top tier only|
||Solve the middle tier assuming the top has already been solved|
||Solve the bottom tier assuming the top and middle are done|
||Swap bottom tier corners in positions 0 and 1|
||Twist, in place, three of the bottom tier corners|
||Permute three of the bottom tier edges|
||Flip, in place, 2 or 4 of the bottom tier edges|
snake miniapp provides a light-hearted example of mesh manipulation and
The Rubik's Snake™ a.k.a. Twist is a simple tool for experimenting with geometric shapes in 3D. It consists of 24 triangular prisms attached in a row so that neighboring wedges can rotate against each other but cannot be separated. An astonishing variety of different configurations can be reached.
Thirteen pre-programmed configurations are available via the
[0-12] command line option. Other configurations can be reached with
-u option. Each configuration must be 23 integers long
corresponding to the 23 joints making up the Snake™ puzzle. The
values can be 0-3 indicating how far to rotate the joint in the
clockwise direction when looking along the snake from the starting
(lower) end. The values 0, 1, 2, and 3 correspond to angles of 0, 90,
180, and 270 degrees respectively.