In this example, a 3D microstructure is generated with grains colored by their seed number, rather than the material.
XML Input File¶
The basename for this input file is
The file can be run using this command:
The full text of the script is:
<?xml version="1.0" encoding="UTF-8"?> <input> <material> <shape> sphere </shape> <size> <dist_type> uniform </dist_type> <loc> 1 </loc> <scale> 2 </scale> </size> </material> <domain> <shape> cube </shape> <side_length> 15 </side_length> </domain> <settings> <directory> colormap </directory> <mesh_min_angle> 15 </mesh_min_angle> <color_by> seed number </color_by> <colormap> RdYlBu </colormap> </settings> </input>
There is a single material with grain sizes ranging from 1 to 3 on a uniform distribution.
The domain of the microstructure is a
The cube’s center is at the origin and its side length is 15.
The output directory is
./colormap, which contains the text files
and PNG plots of the microstructure.
The minimum dihedral angle for the mesh elements is set to 15 degrees to
ensure mesh quality.
<color_by> option indicates how to color seeds in the output plots.
There are three values available for this option: “material”, “seed number”,
and “material number”.
The “material” value will use colors specified in each
The “seed number” value will use the seed numbers as values for a colormap.
Similarly, “material number” will use the material number in a colormap.
<colormap> option indicates which colormap should be used in the output
The default colormap is “viridis”, which is also the default for matplotlib.
A complete listing of available colormaps is available on the matplotlib
Choosing Colormaps in Matplotlib webpage.