.. _ex_basalt:

===============
Picritic Basalt
===============

XML Input File
==============

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

    microstructpy --demo=basalt_circle.xml

The full text of the file is:

.. literalinclude:: ../../../../src/microstructpy/examples/basalt_circle.xml
    :language: xml


Material 1 - Plagioclase
========================

Plagioclase composes approximately 45% of this picritic basalt sample.
It is an *aphanitic* component, meaning fine-grained, and follows a custom
size distribution.

Material 2 - Olivine
====================

Olivine composes approximately 19% of this picritic basalt sample.
There are large *phenocrysts* of olivine in picritic basalt, so the crystals
are generally larger than the other components and have a non-circular shape.
The orientation of the phenocrysts is uniform random, with the aspect ratio
varying from 1 to 3 uniformly.

Materials 3-8
=============

Diopside, hypersthene, magnetite, chromite, ilmenite, and apatie compose
approximately 36% of this picritic basalt sample.
They are *aphanitic* components, meaning fine-grained, and follow a custom
size distribution.

Domain Geometry
===============

These materials fill a circular domain with a diameter of 30 mm.


Settings
========

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

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

Mesh controls are introducted to increase grid resolution, particularly at the
grain boundaries.


Output Files
============

The three plots that this file generates are the seeding, the polygon mesh,
and the triangular mesh.
These three plots are shown in
:numref:`f_ex_basalt_seeds` - :numref:`f_ex_basalt_tri`.

.. _f_ex_basalt_seeds:
.. figure:: ../../../../src/microstructpy/examples/basalt_circle/seeds.png
    :alt: Seed geometries.

    Picritic basalt example - seed geometries
    
.. _f_ex_basalt_poly:
.. figure:: ../../../../src/microstructpy/examples/basalt_circle/polymesh.png
    :alt: Polygonal mesh.

    Picritic basalt example - polygonal mesh
    
.. _f_ex_basalt_tri:
.. figure:: ../../../../src/microstructpy/examples/basalt_circle/trimesh.png
    :alt: Triangular mesh.

    Picritic basalt example - triangular mesh

With the ``<verification>`` flag set to ``True``, verification plots are
generated by MicroStructPy.
The grain size distribution comparison is given in :numref:`f_ex_basalt_verif`.

.. _f_ex_basalt_verif:
.. figure:: ../../../../src/microstructpy/examples/basalt_circle/verification/size_cdf.png
    :alt: Comparing input and output CSDs.

    Picritic basalt example - input and output crystal size
    distributions (CSDs).

Comparing the input and output distributions for olivine, it is clear that this
microstructure is not statistically representative.
A larger diameter for the domain would contain more grains of olivine, which
would add more fidelity to the size CDF curve.

