Elliptical Grains

XML Input File

The basename for this file is elliptical_grains.xml. The file can be run using this command:

microstructpy --demo=elliptical_grains.xml

The full text of the file is:

<?xml version="1.0" encoding="UTF-8"?>
<input>
    <material>
        <fraction> 1 </fraction>
        <shape> ellipse </shape>
        <a>
            <dist_type> uniform </dist_type>
            <loc> 0.05 </loc>
            <scale> 0.35 </scale>
        </a>
        <b> 0.05 </b>
        <orientation> random </orientation>
        <color> #eaaa00 </color>
    </material>

    <material>
        <fraction> 2 </fraction>
        <shape> circle </shape>
        <diameter>
            <dist_type> lognorm </dist_type>
            <scale> 0.06 </scale>
            <s> 0.6 </s>
        </diameter>
        <color> #00263A </color>
    </material>

    <domain>
        <shape> rectangle </shape>
        <side_lengths> (2, 3) </side_lengths>
    </domain>

    <settings>
        <mesh_min_angle> 20 </mesh_min_angle>

        <filetypes>
            <seeds_plot> png </seeds_plot>
            <poly_plot> png </poly_plot>
            <tri_plot> png </tri_plot>
        </filetypes>

        <directory> elliptical_grains </directory>
        <plot_axes> False </plot_axes>

        <seeds_kwargs>
            <edgecolor> w </edgecolor>
            <linewidth> 0.5 </linewidth>
        </seeds_kwargs>

        <poly_kwargs>
            <edgecolors> w </edgecolors>
            <linewidth> 0.5 </linewidth>
        </poly_kwargs>

        <tri_kwargs>
            <edgecolor> w </edgecolor>
            <linewidth> 0.1 </linewidth>
        </tri_kwargs>
    </settings>
</input>

Material 1 - Ellipses

<material>
    <fraction> 1 </fraction>
    <shape> ellipse </shape>
    <a>
        <dist_type> uniform </dist_type>
        <loc> 0.05 </loc>
        <scale> 0.35 </scale>
    </a>
    <b> 0.05 </b>
    <orientation> random </orientation>
    <color> #eaaa00 </color>
</material>

There are two materials, in a 1:2 ratio based on volume. The first material consists of ellipses and the semi-major axes are uniformly distributed, \(A \sim U(0.05, 0.40)\). The semi-minor axes are fixed at 0.05, meaning the aspect ratio of these seeds are 1-8. The orientation angles of the ellipses are uniform random in distribution.

Material 2 - Circles

<material>
    <fraction> 2 </fraction>
    <shape> circle </shape>
    <diameter>
        <dist_type> lognorm </dist_type>
        <scale> 0.06 </scale>
        <s> 0.6 </s>
    </diameter>
    <color> #00263A </color>
</material>

The second material consists of circles, which have a diameter that is log-normally distributed, \(D \sim 0.06 e^{N(0, 0.5)}\).

Domain Geometry

<domain>
    <shape> rectangle </shape>
    <side_lengths> (2, 3) </side_lengths>
</domain>

These two materials fill a rectangular domain. The bottom-left corner of the rectangle is the origin, which puts the rectangle in the first quadrant. The width of the rectangle is 2 and the height is 3.

Settings

<settings>
    <mesh_min_angle> 20 </mesh_min_angle>

    <filetypes>
        <seeds_plot> png </seeds_plot>
        <poly_plot> png </poly_plot>
        <tri_plot> png </tri_plot>
    </filetypes>

    <directory> elliptical_grains </directory>
    <plot_axes> False </plot_axes>

    <seeds_kwargs>
        <edgecolor> w </edgecolor>
        <linewidth> 0.5 </linewidth>
    </seeds_kwargs>

    <poly_kwargs>
        <edgecolors> w </edgecolors>
        <linewidth> 0.5 </linewidth>
    </poly_kwargs>

    <tri_kwargs>
        <edgecolor> w </edgecolor>
        <linewidth> 0.1 </linewidth>
    </tri_kwargs>
</settings>

The aspect ratio of elements in the triangular mesh is controlled by setting the minimum interior angle for the elements at 20 degrees.

The function will output only plots of the microstructure process (no text files), and those plots are saved as PNGs. They are saved in a folder named elliptical_grains, in the current directory (i.e ./elliptical_grains).

The axes are turned off in these plots, creating PNG files with minimal whitespace.

Output Files

The three plots that this file generates are the seeding, the polygon mesh, and the triangular mesh.

Seeding Plot

Seed particles.

Polygon Mesh Plot

Polygon mesh.

Triangular Mesh Plot

Triangular mesh.