Reading in compositional initial composition files generated with geomIO#

This section was contributed by Juliane Dannberg

Many geophysical setups require initial conditions with several different materials and complex geometries. Hence, sometimes it would be easier to generate the initial geometries of the materials as a drawing instead of by writing code. The MATLAB-based library geomIO (, (Bauville and Baumann 2019)) provides a convenient tool to convert a drawing generated with the vector graphics editor Inkscape ( to a data file that can be read into . Here, we will demonstrate how this can be done for a 2D setup for a model with one compositional field, but geomIO also has the capability to create 3D volumes based on a series of 2D vector drawings using any number of different materials. Similarly, initial conditions defined in this way can also be used with particles instead of compositional fields.

To obtain the developer version of geomIO, you can clone the bitbucket repository by executing the command

 git clone

or you can download geomIO here. You will then need to add the geomIO source folders to your MATLAB path by running the file located in /path/to/geomio/installation/InstallGeomIO.m. An extensive documentation for how to use geomIO can be found here. Among other things, it explains how to generate drawings in Inkscape that can be read in by geomIO, which involves assigning new attributes to paths in Inkscape’s XML editor. In particular, a new property ‘phase’ has to be added to each path, and set to a value corresponding to the index of the material that should be present in this region in the initial condition of the geodynamic model.

We will here use a drawing of a jellyfish located in cookbooks/geomio/doc/jellyfish.svg, where different phases have already been assigned to each path (Figure 1).


Fig. 52 Vector drawing of a jellyfish.#

After geomIO is initialized in MATLAB, we run geomIO as described in the documentation, loading the default options and then specifying all the option we want to change, such as the path to the input file, or the resolution:

You can view all of the options available by typing opt in MATLAB.

In the next step we create the grid that is used for the coordinates in the ascii data initial conditions file and assign a phase to each grid point:

You can plot the Phase variable in MATLAB to see if the drawing was read in and all phases are assigned correctly (Figure 2).


Fig. 53 Plot of the Phase variable in MATLAB.#

Finally, we want to write output in a format that can be read in by ASPECT’s ascii data compositional initial conditions plugin. We write the data into the file jelly.txt:

To read in the file we just created (a copy is located in ASPECT’s data directory), we set up a model with a box geometry with the same extents we specified for the drawing in px and one compositional field. We choose the ascii data compositional initial conditions and specify that we want to read in our jellyfish. The relevant parts of the input file are listed below:

If we look at the output in ParaView, we can see our jellyfish, with the mesh refined at the boundaries between the different phases (Figure 3).

For a geophysical setup, the MATLAB code could be extended to write out the phases into several different columns of the ASCII data file (corresponding to different compositional fields). This initial conditions file could then be used in with a material model such as the multicomponent model, assigning each phase different material properties.

An animation of a model using the jellyfish as initial condition and assigning it a higher viscosity can be found here:

Bauville, A, and TS Baumann. 2019. “geomIO: An Open-Source MATLAB Toolbox to Create the Initial Configuration of 2d/3d Thermo-Mechanical Simulations from 2d Vector Drawings.” Geochemistry, Geophysics, Geosystems.