1. Basic Example

1.1. XML Input File

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

microstructpy --demo=intro_1_basic.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> circle </shape>
        <diameter> 2 </diameter>
    </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_1_basic </directory>
        <verbose> True </verbose>
    </settings>
</input>

1.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.

1.1.2. Material 2 - Inclusions

<material>
    <name> Inclusions </name>
    <fraction> 1 </fraction>
    <shape> circle </shape>
    <diameter> 2 </diameter>
</material>

The second material consists of circular inclusions with diameter 2.

1.1.3. Domain Geometry

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

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.

1.1.4. Settings

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

    <directory> intro_1_basic </directory>
    <verbose> True </verbose>
</settings>

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_1_basic, in the current directory (i.e ./intro_1_basic).

1.2. Output Files

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

1.2.1. Seeding Plot

Seed particles.

1.2.2. Polygon Mesh Plot

Polygon mesh.

1.2.3. Triangular Mesh Plot

Triangular mesh.