3. Size & Shape

3.1. XML Input File

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

microstructpy --demo=intro_3_size_shape.xml

The full text of the file is:

<?xml version="1.0" encoding="UTF-8"?>
<input>
    <material>
        <name> Matrix </name>
        <material_type> matrix </material_type>
        <fraction> 2 </fraction>

        <shape> circle </shape>
        <size>
            <dist_type> uniform </dist_type>
            <loc> 0 </loc>
            <scale> 1.5 </scale>
        </size>
    </material>

    <material>
        <name> Inclusions </name>
        <fraction> 1 </fraction>
        <shape> ellipse </shape>
        <size>
            <dist_type> triang </dist_type>
            <loc> 0 </loc>
            <scale> 2 </scale>
            <c> 1 </c>
        </size>
        <aspect_ratio>
            <dist_type> uniform </dist_type>
            <loc> 1 </loc>
            <scale> 2 </scale>
        </aspect_ratio>
        <angle> random </angle>
    </material>

    <domain>
        <shape> square </shape>
        <side_length> 20 </side_length>
        <corner> (0, 0) </corner>
    </domain>

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

        <directory> intro_3_size_shape </directory>
        <verbose> True </verbose>
    </settings>
</input>

3.1.1. Material 1 - Matrix

<material>
    <name> Matrix </name>
    <material_type> matrix </material_type>
    <fraction> 2 </fraction>

    <shape> circle </shape>
    <size>
        <dist_type> uniform </dist_type>
        <loc> 0 </loc>
        <scale> 1.5 </scale>
    </size>
</material>

There are two materials, in a 2:1 ratio based on volume. The first is a matrix, which is represented with small circles.

3.1.2. Material 2 - Inclusions

<material>
    <name> Inclusions </name>
    <fraction> 1 </fraction>
    <shape> ellipse </shape>
    <size>
        <dist_type> triang </dist_type>
        <loc> 0 </loc>
        <scale> 2 </scale>
        <c> 1 </c>
    </size>
    <aspect_ratio>
        <dist_type> uniform </dist_type>
        <loc> 1 </loc>
        <scale> 2 </scale>
    </aspect_ratio>
    <angle> random </angle>
</material>

The second material consists of elliptical inclusions with size ranging from 0 to 2 and aspect ratio ranging from 1 to 3. Note that the size is defined as the diameter of a circle with equivalent area. The orientation angle of the inclusions are random, specifically they are uniformly distributed from 0 to 360 degrees.

3.1.3. Domain Geometry

        <scale> 2 </scale>
        <c> 1 </c>
    </size>
    <aspect_ratio>
        <dist_type> uniform </dist_type>

These two materials fill a square domain. The bottom-left corner of the rectangle is the origin, which puts the rectangle in the first quadrant. The side length is 20, which is 10x the size of the inclusions.

3.1.4. Settings

        <scale> 2 </scale>
    </aspect_ratio>
    <angle> random </angle>
</material>

<domain>
    <shape> square </shape>
    <side_length> 20 </side_length>
    <corner> (0, 0) </corner>
</domain>

<settings>
    <filetypes>
        <seeds_plot> png </seeds_plot>
        <poly_plot> png </poly_plot>

PNG files of each step in the process will be output, as well as the intermediate text files. They are saved in a folder named intro_3_size_shape, in the current directory (i.e ./intro_3_size_shape).

3.2. Output Files

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

3.2.1. Seeding Plot

Seed particles.

3.2.2. Polygon Mesh Plot

Polygon mesh.

3.2.3. Triangular Mesh Plot

Triangular mesh.