# Section <grids>¶

<grids>

In this section one can define computational meshes for use by solvers. It can be done by one of the two ways: either by specifying the mesh directly or, by creating a generator that will automatically construct the required mesh basing on the structure geometry when the calculations in the solver using particular generator are about to begin. Hence the two allowed tags in this section are <mesh> and <generator>. The contents of these tags are determined by the particular mesh or generator type, while their attributes are always the same:

<generator>

Specification of the mesh generator.

Attributes: name (required) – Object name for further reference. type (required) – Type of the mesh to generate. method (required) – Generation method i.e. the type of the generator.
Contents:
The content of this element depends on the values of the type and method tag. It specifies generator configuration (if any). See below for details.
<mesh>

Specification of the mesh.

Attributes: name (required) – Name of the mesh for reference in configuration of the solvers. type (required) – Type of the mesh.
Contents:
The content of this element depends on the value of the type tag. See below for details.

## Possible <mesh> contents for different types¶

<mesh type="ordered">

One-dimensional rectangular mesh.

Contents:
<axis>

Specification of the horizontal axis.

If any of the following attributes are specified, the points along this axis are equally distributed like in regular meshes. In such a case the contents must be empty.

Attributes: start – Position of the first point on the axis. (float [µm]) stop – Position of the last point on the axis. (float [µm]) num – Number of the equally distributed points along the axis. (integer)
Contents:
Comma-separated list of the mesh points along this axis.
<mesh type="regular">

One-dimensional rectangular mesh with regular intervals.

Contents:
<axis>

Specification of the horizontal axis.

Attributes: start (required) – Position of the first point on the axis. (float [µm]) stop (required) – Position of the last point on the axis. (float [µm]) num (required) – Number of the equally distributed points along the axis. (integer)
<mesh type="regular1d">

Deprecated alias to ordered <mesh>.

<mesh type="rectangular2d">

Two-dimensional rectangular mesh.

Contents:
<axis0>

Specification of the horizontal axis.

Attributes: type – Type of axis: ordered or regular. If not given, axis will be regular only if any of the start, stop or num attributes are specified (in other case it will be ordered). start – Position of the first point on the axis. (float [µm]) stop – Position of the last point on the axis. (float [µm]) num – Number of the equally distributed points along the axis. (integer)
Contents:
Comma-separated list of the mesh points along this axis. Allowed and required only for rectangular axis.
<axis1>

Specification of the vertical axis.

Attributes and contents are in the same format as in <axis0>.

<mesh type="regular2d">

Deprecated alias to <mesh>.

<mesh type="triangular2d">

Two-dimensional triangular mesh.

Contents:

Either a sequence of <triangle> tags or a sequence of <node> tags followed by sequence of <element> tags.

The sequence of <node> tags describes a 0-indexed vector of nodes.

<triangle>

Specification of a triangular element of the mesh; a triangle.

Attributes: a0 – horizontal coordinate of the first vertex of the triangle. (float [µm]) a1 – vertical coordinate of the first vertex of the triangle. (float [µm]) b0 – horizontal coordinate of the second vertex of the triangle. (float [µm]) b1 – vertical coordinate of the second vertex of the triangle. (float [µm]) c0 – horizontal coordinate of the third vertex of the triangle. (float [µm]) c1 – vertical coordinate of the third vertex of the triangle. (float [µm])
<node>

Node specification; a 2D point; a vertex of triangular element.

Attributes: tran – horizontal coordinate of the point. (float [µm]) vert – vertical coordinate of the point. (float [µm])
<element>

Specification of a triangular element of the mesh; a triangle.

Attributes: a – index of the first vertex of the triangle in the vector of nodes. (integer) b – index of the second vertex of the triangle in the vector of nodes. (integer) c – index of the third vertex of the triangle in the vector of nodes. (integer)
<mesh type="rectangular3d">

Three-dimensional rectangular mesh.

Contents:
<axis0>

Specification of the longitudinal axis.

Attributes: type – Type of axis: ordered or regular. If not given, axis will be regular only if any of the start, stop or num attributes are specified (in other case it will be ordered). start – Position of the first point on the axis. (float [µm]) stop – Position of the last point on the axis. (float [µm]) num – Number of the equally distributed points along the axis. (integer)
Contents:
Comma-separated list of the mesh points along this axis. Allowed and required only for rectangular axis.
<axis1>

Specification of the transversal axis.

Attributes and contents are in the same format as in <axis0>.

<axis2>

Specification of the vertical axis.

Attributes and contents are in the same format as in <axis0>.

<mesh type="regular3d">

Deprecated alias to <mesh>.

## Possible <generator> contents for different types and methods¶

<generator type="ordered" method="divide">

Generator that divides each geometry object along both axes into a specified number of elements, ensuring that two adjacent do not differ in size more than twice.

Contents:
<options/>
Attributes: gradual – Turn on/off smooth mesh step (i.e. if disabled, the adjacent elements of the generated mesh may differ more than by the factor of two). (bool, yes by default)
<prediv/>

Set number of the initial divisions of each geometry object.

Attributes: by – Number of parts each object is divided into along horizontal axis.
<postdiv/>

Set number of the final divisions of each geometry object.

Attributes: by – Number of parts each object is divided into along horizontal axis.
<refinements>

Specify list of additional refinements of the generated mesh.

Contents:
<axis0/>

Add refinement to the horizontal axis.

Attributes: object (required) – Name of the geometry object to add additional division to. path – Path name, specifying particular instance of the object given in the object attribute. at – If this attribute is present, a single refinement line is placed at the position specified in it (in the local object coordinates). by – If this attribute is present, multiple refinement lines are placed dividing the object into a specified number of equal parts. every – If this attribute is present, multiple refinement lines are places at distance from each other specified in the attribute value.

Exactly one of at, by, or every attribute must be present.

<warnings/>

Control printing of the warnings.

Attributes: missing – Warn if any refinement references to non-existing object. Defaults to ‘yes’. (bool) multiple – Warn if any refinement references to multiple objects. Defaults to ‘yes’. (bool) outside – Warn if refining line lies outside of the specified object. Defaults to ‘yes’. (bool)
<generator type="ordered" method="regular">

Generator creating the mesh with lines at transverse edges of all objects and fine regular division of each object with spacing approximately equal to the specified one.

<spacing/>
Attributes: every – Approximate single element size.
<boundaries/>
Attributes: split – Split mesh lines at object boundaries. This is useful mostly for plotting discontinous material parameters. Defaults to ‘no’. (bool)
<generator type="ordered" method="simple">

Simple generator creating the rectangular mesh consisting of ordered axes with lines at the edges of bounding boxes of each object of the geometry.

<boundaries/>
Attributes: split – Split mesh lines at object boundaries. This is useful mostly for plotting discontinous material parameters. Defaults to ‘no’. (bool)
<generator type="ordered" method="smooth">

Generator that divides each geometry object along both axes with elements of given size near a boundary and increasing geometrically by given factor towards the middle of an object.

Contents:
<steps/>

Parametrs specifying element size.

Attributes: small – Maximum size of the smallest elements near objects edges. factor – Factor by which sizes of elements increase towards objects centers.
<refinements>

Specify list of additional refinements of the generated mesh.

Contents:
<axis0/>

Add refinement to the horizontal axis.

Attributes: object (required) – Name of the geometry object to add additional division to. path – Path name, specifying particular instance of the object given in the object attribute. at – If this attribute is present, a single refinement line is placed at the position specified in it (in the local object coordinates). by – If this attribute is present, multiple refinement lines are placed dividing the object into a specified number of equal parts. every – If this attribute is present, multiple refinement lines are places at distance from each other specified in the attribute value.

Exactly one of at, by, or every attribute must be present.

<warnings/>

Control printing of the warnings.

Attributes: missing – Warn if any refinement references to non-existing object. Defaults to ‘yes’. (bool) multiple – Warn if any refinement references to multiple objects. Defaults to ‘yes’. (bool) outside – Warn if refining line lies outside of the specified object. Defaults to ‘yes’. (bool)
<generator type="rectangular2d" method="divide">

Generator that divides each geometry object along both axes into a specified number of elements, ensuring that two adjacent do not differ in size more than twice.

Contents:
<gradual/>

Turn on/off smooth mesh step (i.e. if disabled, the adjacent elements of the generated mesh may differ more than by the factor of two).

Gradual is enabled by default.

Attributes: all – enable (if yes) or disable (if no) gradual for all axes (bool, yes by default)
<prediv/>

Set number of the initial divisions of each geometry object.

Attributes: by0 – Number of parts each object is divided into along horizontal axis. by1 – Number of parts each object is divided into along vertical axis. by – Set values of by0 and by1 both at once. It this attribute is specified, no other ones are allowed.
<postdiv/>

Set number of the final divisions of each geometry object.

It has same attributes as <prediv/>.

<refinements>

Specify list of additional refinements of the generated mesh.

Contents:
<axis0/>

Add refinement to the horizontal axis.

Attributes: object (required) – Name of the geometry object to add additional division to. path – Path name, specifying particular instance of the object given in the object attribute. at – If this attribute is present, a single refinement line is placed at the position specified in it (in the local object coordinates). by – If this attribute is present, multiple refinement lines are placed dividing the object into a specified number of equal parts. every – If this attribute is present, multiple refinement lines are places at distance from each other specified in the attribute value.

Exactly one of at, by, or every attribute must be present.

<axis1/>

Add refinement to the vertical axis.

It has same attributes as <axis0/>.

<warnings/>

Control printing of the warnings.

Attributes: missing – Warn if any refinement references to non-existing object. Defaults to ‘yes’. (bool) multiple – Warn if any refinement references to multiple objects. Defaults to ‘yes’. (bool) outside – Warn if refining line lies outside of the specified object. Defaults to ‘yes’. (bool)
<generator type="rectangular2d" method="regular">

Generator creating the mesh with lines at transverse edges of all objects and fine regular division of each object with spacing approximately equal to the specified one.

<spacing/>
Attributes: every – Approximate single element size along all axes (this is mutaally exclusive with all other attributes). every0 – Approximate single element size along horizontal axis. every1 – Approximate single element size along vertical axis.
<boundaries/>
Attributes: split – Split mesh lines at object boundaries. This is useful mostly for plotting discontinous material parameters. Defaults to ‘no’. (bool)
<generator type="rectangular2d" method="simple">

Simple generator creating the rectangular mesh consisting of ordered axes with lines at the edges of bounding boxes of each object of the geometry.

<boundaries/>
Attributes: split – Split mesh lines at object boundaries. This is useful mostly for plotting discontinous material parameters. Defaults to ‘no’. (bool)
<generator type="rectangular2d" method="smooth">

Generator that divides each geometry object along both axes with elements of given size near a boundary and increasing geometrically by given factor towards the middle of an object.

Contents:
<options/>
Attributes: aspect – Maximum aspect ratio for the rectangular and cubic elements generated by this generator. If set the mesh elements are additionally divided to ensure their aspect not larger than this value. (float)
<steps/>

Parameters specifying element size.

Attributes: small – Maximum size of the smallest elements near objects edges. factor – Factor by which sizes of elements increase towards objects centers.
<refinements>

Specify list of additional refinements of the generated mesh.

Contents:
<axis0/>

Add refinement to the horizontal axis.

Attributes: object (required) – Name of the geometry object to add additional division to. path – Path name, specifying particular instance of the object given in the object attribute. at – If this attribute is present, a single refinement line is placed at the position specified in it (in the local object coordinates). by – If this attribute is present, multiple refinement lines are placed dividing the object into a specified number of equal parts. every – If this attribute is present, multiple refinement lines are places at distance from each other specified in the attribute value.

Exactly one of at, by, or every attribute must be present.

<warnings/>

Control printing of the warnings.

Attributes: missing – Warn if any refinement references to non-existing object. Defaults to ‘yes’. (bool) multiple – Warn if any refinement references to multiple objects. Defaults to ‘yes’. (bool) outside – Warn if refining line lies outside of the specified object. Defaults to ‘yes’. (bool)
<generator type="triangular2d" method="triangle">

Generator which creates triangular mesh by Triangle library authored by Jonathan Richard Shewchuk.

Citing official Triangle documentation: Triangle generates exact Delaunay triangulations, constrained Delaunay triangulations, conforming Delaunay triangulations, Voronoi diagrams, and high-quality triangular meshes. The latter can be generated with no small or large angles, and are thus suitable for finite element analysis.

Contents:
<options/>
Attributes: maxarea – A maximum triangle area constraint. (float [µm²]) minangle – A minimum angle. (float [°]) full – If yes the mesh fills the whole bounding box of the geometry. (bool)

Citing official Triangle documentation (http://www.cs.cmu.edu/~quake/triangle.q.html): If the minimum angle is 20.7° or smaller, the triangulation algorithm is theoretically guaranteed to terminate (assuming infinite precision arithmetic - Triangle may fail to terminate if you run out of precision). In practice, the algorithm often succeeds for minimum angles up to 33°. It usually does not terminate for angles above 34°. For some meshes, however, it may be necessary to reduce the minimum angle to well below 20° to avoid problems associated with insufficient floating-point precision.

<generator type="rectangular3d" method="divide">

Generator that divides each geometry object along both axes into a specified number of elements, ensuring that two adjacent do not differ in size more than twice.

Contents:
<gradual/>

Turn on/off smooth mesh step (i.e. if disabled, the adjacent elements of the generated mesh may differ more than by the factor of two).

Gradual is enabled by default.

Attributes: all – enable (if yes) or disable (if no) gradual for all axes (bool, yes by default)
<no-gradual/>

Turn off smooth mesh step (i.e. the adjacent elements of the generated mesh may differ more than by the factor of two).

Deprecated alias to <gradual all="false"/>.

<prediv/>

Set number of the initial divisions of each geometry object.

Attributes: by0 – Number of parts each object is divided into along longitudinal axis. by1 – Number of parts each object is divided into along transverse axis. by2 – Number of parts each object is divided into along vertical axis. by – Set values of by0, by1 and by2 at once. It this attribute is specified, no other ones are allowed.
<postdiv/>

Set number of the final divisions of each geometry object.

It has same attributes as <prediv/>.

<refinements>

Specify list of additional refinements of the generated mesh.

Contents:
<axis0/>

Add refinement to the longitudinal axis.

Attributes: object (required) – Name of the geometry object to add additional division to. path – Path name, specifying particular instance of the object given in the object attribute. at – If this attribute is present, a single refinement line is placed at the position specified in it (in the local object coordinates). by – If this attribute is present, multiple refinement lines are placed dividing the object into a specified number of equal parts. every – If this attribute is present, multiple refinement lines are places at distance from each other specified in the attribute value.

Exactly one of at, by, or every attribute must be present.

<axis1/>

Add refinement to the transverse axis.

It has same attributes as <axis0/>.

<axis2/>

Add refinement to the vertical axis.

It has same attributes as <axis0/>.

<warnings/>

Control printing of the warnings.

Attributes: missing – Warn if any refinement references to non-existing object. Defaults to ‘yes’. (bool) multiple – Warn if any refinement references to multiple objects. Defaults to ‘yes’. (bool) outside – Warn if refining line lies outside of the specified object. Defaults to ‘yes’. (bool)
<generator type="rectangular3d" method="regular">

Generator creating the mesh with lines at transverse edges of all objects and fine regular division of each object with spacing approximately equal to the specified one.

<spacing/>
Attributes: every – Approximate single element size along all axes (this is mutaally exclusive with all other attributes). every0 – Approximate single element size along longitudinal axis. every1 – Approximate single element size along transverse axis. every2 – Approximate single element size along vertical axis.
<boundaries/>
Attributes: split – Split mesh lines at object boundaries. This is useful mostly for plotting discontinous material parameters. Defaults to ‘no’. (bool)
<generator type="rectangular3d" method="simple">

Simple generator creating the rectangular mesh consisting of ordered axes with lines at the edges of bounding boxes of each object of the geometry.

<boundaries/>
Attributes: split – Split mesh lines at object boundaries. This is useful mostly for plotting discontinous material parameters. Defaults to ‘no’. (bool)
<generator type="rectangular3d" method="smooth">

Generator that divides each geometry object along both axes with elements of given size near a boundary and increasing geometrically by given factor towards the middle of an object.

Contents:
<options/>
Attributes: aspect – Maximum aspect ratio for the rectangular and cubic elements generated by this generator. If set the mesh elements are additionally divided to ensure their aspect not larger than this value. (float)
<steps/>

Parameters specifying element size.

Attributes: small – Maximum size of the smallest elements near objects edges. factor – Factor by which sizes of elements increase towards objects centers.
<refinements>

Specify list of additional refinements of the generated mesh.

Contents:
<axis0/>

Add refinement to the horizontal axis.

Attributes: object (required) – Name of the geometry object to add additional division to. path – Path name, specifying particular instance of the object given in the object attribute. at – If this attribute is present, a single refinement line is placed at the position specified in it (in the local object coordinates). by – If this attribute is present, multiple refinement lines are placed dividing the object into a specified number of equal parts. every – If this attribute is present, multiple refinement lines are places at distance from each other specified in the attribute value.

Exactly one of at, by, or every attribute must be present.

<axis1/>

Add refinement to the transverse axis.

It has same attributes as <axis0/>.

<axis2/>

Add refinement to the vertical axis.

It has same attributes as <axis0/>.

<warnings/>

Control printing of the warnings.

Attributes: missing – Warn if any refinement references to non-existing object. Defaults to ‘yes’. (bool) multiple – Warn if any refinement references to multiple objects. Defaults to ‘yes’. (bool) outside – Warn if refining line lies outside of the specified object. Defaults to ‘yes’. (bool)