FieldML Example: Tetrahedral Mesh

This FieldML 0.5 model is of a trilinear tetrahedral mesh in a coarse sphere shape. Meshes consisting of just tetrahedral elements are commonly produced by automatic mesh generators, and are typically homogeneous in basis functions as well. The FieldML document in the example can be readily adapted by changing the number of tetrahedral elements, and linking to other connectivity and node field parameters to import a different model, and this example lists the places where such changes must be carefully made to do this.

../../_images/fieldml_tetmesh.png

Tetrahedral mesh of a coarse sphere, read from FieldML.

A feature of this example is that it uses external text data resources for node connectivity (local-to-global node map) and node coordinates. Links to these files are given in DataResourceHref elements in the FieldML document, and the files themselves are listed below the FieldML file.

Following is the tetrahedral mesh model serialised in FieldML. It is similar to the cube example except it has 38 elements (all tetrahedral shape), 102 nodes, and the single element field template uses a trilinear simplex basis with 4 local nodes. To adapt this model to a different linear tetrahedral mesh with different numbers of nodes and elements requires content of the highlighted lines to be modified with the new filenames containing the bulk data, changing the EnsembleType nodes and mesh elements to have the new numbers of nodes and elements, and also changing the ArrayDataSource sizes to match the numbers of nodes or elements as appropriate. That multiple parts need changing to modify the model is one of the main differences compared to a ‘serial’ data format such as the EX format: in the EX format it is simple to add another node or element with the same template as a prior one, however such convenience comes with a loss of random accessibility of data.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?xml version="1.0" encoding="ISO-8859-1"?>
<Fieldml version="0.5.0" xsi:noNamespaceSchemaLocation="http://www.fieldml.org/resources/xml/0.5/FieldML_0.5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
 <Region name="/">
  <Import xlink:href="http://www.fieldml.org/resources/xml/0.5/FieldML_Library_0.5.xml" region="library">
   <ImportType localName="real.1d" remoteName="real.1d"/>
   <ImportEvaluator localName="shape.unit.tetrahedron" remoteName="shape.unit.tetrahedron"/>
   <ImportEvaluator localName="interpolator.3d.unit.trilinearSimplex" remoteName="interpolator.3d.unit.trilinearSimplex"/>
   <ImportType localName="parameters.3d.unit.trilinearSimplex" remoteName="parameters.3d.unit.trilinearSimplex"/>
   <ImportEvaluator localName="parameters.3d.unit.trilinearSimplex.argument" remoteName="parameters.3d.unit.trilinearSimplex.argument"/>
   <ImportType localName="parameters.3d.unit.trilinearSimplex.component" remoteName="parameters.3d.unit.trilinearSimplex.component"/>
   <ImportEvaluator localName="parameters.3d.unit.trilinearSimplex.component.argument" remoteName="parameters.3d.unit.trilinearSimplex.component.argument"/>
   <ImportEvaluator localName="chart.3d.argument" remoteName="chart.3d.argument"/>
   <ImportType localName="coordinates.rc.3d" remoteName="coordinates.rc.3d"/>
   <ImportType localName="coordinates.rc.3d.component" remoteName="coordinates.rc.3d.component"/>
   <ImportEvaluator localName="coordinates.rc.3d.component.argument" remoteName="coordinates.rc.3d.component.argument"/>
  </Import>
  <EnsembleType name="nodes">
   <Members>
    <MemberRange min="1" max="38"/>
   </Members>
  </EnsembleType>
  <EnsembleType name="node_derivatives">
   <Members>
    <MemberRange min="1" max="8"/>
   </Members>
  </EnsembleType>
  <ConstantEvaluator name="node_derivatives.value" value="1" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d_ds1" value="2" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d_ds2" value="3" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d2_ds1ds2" value="4" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d_ds3" value="5" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d2_ds1ds3" value="6" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d2_ds2ds3" value="7" valueType="node_derivatives"/>
  <ConstantEvaluator name="node_derivatives.d3_ds1ds2ds3" value="8" valueType="node_derivatives"/>
  <EnsembleType name="node_versions">
   <Members>
    <MemberRange min="1" max="1"/>
   </Members>
  </EnsembleType>
  <ConstantEvaluator name="node_versions.1" value="1" valueType="node_versions"/>
  <ArgumentEvaluator name="nodes.argument" valueType="nodes"/>
  <ArgumentEvaluator name="node_derivatives.argument" valueType="node_derivatives"/>
  <ArgumentEvaluator name="node_versions.argument" valueType="node_versions"/>
  <ArgumentEvaluator name="nodes.parameters" valueType="real.1d">
   <Arguments>
    <Argument name="nodes.argument"/>
    <Argument name="node_derivatives.argument"/>
    <Argument name="node_versions.argument"/>
   </Arguments>
  </ArgumentEvaluator>
  <MeshType name="mesh3d">
   <Elements name="elements">
    <Members>
     <MemberRange min="1" max="102"/>
    </Members>
   </Elements>
   <Chart name="xi">
    <Components name="mesh3d.xi.components" count="3"/>
   </Chart>
   <Shapes evaluator="shape.unit.tetrahedron"/>
  </MeshType>
  <ArgumentEvaluator name="mesh3d.argument" valueType="mesh3d"/>
  <EnsembleType name="mesh3d.eftIndexes">
   <Members>
    <MemberRange min="1" max="1"/>
   </Members>
  </EnsembleType>
  <ArgumentEvaluator name="mesh3d.eftIndexes.argument" valueType="mesh3d.eftIndexes"/>
  <EnsembleType name="mesh3d.eft1.nodes">
   <Members>
    <MemberRange min="1" max="4"/>
   </Members>
  </EnsembleType>
  <ArgumentEvaluator name="mesh3d.eft1.nodes.argument" valueType="mesh3d.eft1.nodes"/>
  <ArgumentEvaluator name="mesh3d.eft1.nodeparameters.argument" valueType="real.1d">
   <Arguments>
    <Argument name="node_derivatives.argument"/>
    <Argument name="node_versions.argument"/>
    <Argument name="mesh3d.eft1.nodes.argument"/>
   </Arguments>
  </ArgumentEvaluator>
  <ConstantEvaluator name="mesh3d.eft1.nodes.1" value="1" valueType="mesh3d.eft1.nodes"/>
  <ConstantEvaluator name="mesh3d.eft1.nodes.2" value="2" valueType="mesh3d.eft1.nodes"/>
  <ConstantEvaluator name="mesh3d.eft1.nodes.3" value="3" valueType="mesh3d.eft1.nodes"/>
  <ConstantEvaluator name="mesh3d.eft1.nodes.4" value="4" valueType="mesh3d.eft1.nodes"/>
  <ReferenceEvaluator name="mesh3d.eft1.nodeparameters.node1.value.v1" evaluator="mesh3d.eft1.nodeparameters.argument" valueType="real.1d">
   <Bindings>
    <Bind argument="mesh3d.eft1.nodes.argument" source="mesh3d.eft1.nodes.1"/>
    <Bind argument="node_derivatives.argument" source="node_derivatives.value"/>
    <Bind argument="node_versions.argument" source="node_versions.1"/>
   </Bindings>
  </ReferenceEvaluator>
  <ReferenceEvaluator name="mesh3d.eft1.nodeparameters.node2.value.v1" evaluator="mesh3d.eft1.nodeparameters.argument" valueType="real.1d">
   <Bindings>
    <Bind argument="mesh3d.eft1.nodes.argument" source="mesh3d.eft1.nodes.2"/>
    <Bind argument="node_derivatives.argument" source="node_derivatives.value"/>
    <Bind argument="node_versions.argument" source="node_versions.1"/>
   </Bindings>
  </ReferenceEvaluator>
  <ReferenceEvaluator name="mesh3d.eft1.nodeparameters.node3.value.v1" evaluator="mesh3d.eft1.nodeparameters.argument" valueType="real.1d">
   <Bindings>
    <Bind argument="mesh3d.eft1.nodes.argument" source="mesh3d.eft1.nodes.3"/>
    <Bind argument="node_derivatives.argument" source="node_derivatives.value"/>
    <Bind argument="node_versions.argument" source="node_versions.1"/>
   </Bindings>
  </ReferenceEvaluator>
  <ReferenceEvaluator name="mesh3d.eft1.nodeparameters.node4.value.v1" evaluator="mesh3d.eft1.nodeparameters.argument" valueType="real.1d">
   <Bindings>
    <Bind argument="mesh3d.eft1.nodes.argument" source="mesh3d.eft1.nodes.4"/>
    <Bind argument="node_derivatives.argument" source="node_derivatives.value"/>
    <Bind argument="node_versions.argument" source="node_versions.1"/>
   </Bindings>
  </ReferenceEvaluator>
  <AggregateEvaluator name="mesh3d.eft1.parameters" valueType="parameters.3d.unit.trilinearSimplex">
   <Bindings>
    <BindIndex argument="parameters.3d.unit.trilinearSimplex.component.argument" indexNumber="1"/>
   </Bindings>
   <ComponentEvaluators>
    <ComponentEvaluator component="1" evaluator="mesh3d.eft1.nodeparameters.node1.value.v1"/>
    <ComponentEvaluator component="2" evaluator="mesh3d.eft1.nodeparameters.node2.value.v1"/>
    <ComponentEvaluator component="3" evaluator="mesh3d.eft1.nodeparameters.node3.value.v1"/>
    <ComponentEvaluator component="4" evaluator="mesh3d.eft1.nodeparameters.node4.value.v1"/>
   </ComponentEvaluators>
  </AggregateEvaluator>
  <ReferenceEvaluator name="mesh3d.eft1" evaluator="interpolator.3d.unit.trilinearSimplex" valueType="real.1d">
   <Bindings>
    <Bind argument="parameters.3d.unit.trilinearSimplex.argument" source="mesh3d.eft1.parameters"/>
   </Bindings>
  </ReferenceEvaluator>
  <DataResource name="mesh3d.eft1.localtoglobalnodes.data.resource">
   <DataResourceDescription>
    <DataResourceHref xlink:href="tetmesh.mesh3d.eft1.localtoglobalnodes.data.txt" format="PLAIN_TEXT"/>
   </DataResourceDescription>
   <ArrayDataSource name="mesh3d.eft1.localtoglobalnodes.data.source" location="1" rank="2">
    <RawArraySize>102 4</RawArraySize>
    <ArrayDataSize>102 4</ArrayDataSize>
   </ArrayDataSource>
  </DataResource>
  <ParameterEvaluator name="mesh3d.eft1.localtoglobalnodes" valueType="nodes">
   <DenseArrayData data="mesh3d.eft1.localtoglobalnodes.data.source">
    <DenseIndexes>
     <IndexEvaluator evaluator="mesh3d.argument.elements"/>
     <IndexEvaluator evaluator="mesh3d.eft1.nodes.argument"/>
    </DenseIndexes>
   </DenseArrayData>
  </ParameterEvaluator>
  <ReferenceEvaluator name="mesh3d.eft1.evaluator" evaluator="mesh3d.eft1" valueType="real.1d">
   <Bindings>
    <Bind argument="chart.3d.argument" source="mesh3d.argument.xi"/>
    <Bind argument="mesh3d.eft1.nodeparameters.argument" source="nodes.parameters"/>
    <Bind argument="nodes.argument" source="mesh3d.eft1.localtoglobalnodes"/>
   </Bindings>
  </ReferenceEvaluator>
  <PiecewiseEvaluator name="mesh3d.fieldtemplate1" valueType="real.1d">
   <IndexEvaluators>
    <IndexEvaluator evaluator="mesh3d.argument.elements" indexNumber="1"/>
   </IndexEvaluators>
   <EvaluatorMap default="mesh3d.eft1.evaluator"/>
  </PiecewiseEvaluator>
  <DataResource name="nodes.coordinates.data.resource">
   <DataResourceDescription>
    <DataResourceHref xlink:href="tetmesh.nodes.coordinates.data.txt" format="PLAIN_TEXT"/>
   </DataResourceDescription>
   <ArrayDataSource name="nodes.coordinates.data.source" location="0" rank="2">
    <RawArraySize>38 3</RawArraySize>
    <ArrayDataSize>38 3</ArrayDataSize>
   </ArrayDataSource>
  </DataResource>
  <ParameterEvaluator name="nodes.coordinates" valueType="real.1d">
   <DenseArrayData data="nodes.coordinates.data.source">
    <DenseIndexes>
     <IndexEvaluator evaluator="nodes.argument"/>
     <IndexEvaluator evaluator="coordinates.rc.3d.component.argument"/>
    </DenseIndexes>
   </DenseArrayData>
  </ParameterEvaluator>
  <AggregateEvaluator name="coordinates" valueType="coordinates.rc.3d">
   <Bindings>
    <BindIndex argument="coordinates.rc.3d.component.argument" indexNumber="1"/>
    <Bind argument="nodes.parameters" source="nodes.coordinates"/>
   </Bindings>
   <ComponentEvaluators default="mesh3d.fieldtemplate1"/>
  </AggregateEvaluator>
 </Region>
</Fieldml>

The file tetmesh.mesh3d.eft1.localtoglobalnodes.data.txt contains the raw local-to-global node map for 4 local nodes of each element, in order of declaration. Note that the location option in the ArrayDataSource specifies the line number to start reading data from, and the RawArraySize and ArrayDataSize in the above FieldML describe the total and to-be-read array sizes, permitting a range of columns to be parsed out of a larger set. This often allows blocks of data from existing data files to be imported via FieldML. The file contents are:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
 31 4 3 1
 32 34 33 38
 31 36 10 38
 38 19 33 35
 38 7 31 33
 29 27 32 17
 32 24 28 23
 15 32 27 17
 34 11 3 6
 38 7 10 31
 38 7 19 10
 29 35 22 32
 29 35 25 22
 32 38 33 35
 21 33 35 26
 4 31 3 6
 33 23 32 26
 24 34 16 32
 16 33 8 14
 33 23 16 32
 33 23 14 16
 37 38 22 13
 38 19 18 10
 12 15 37 6
 35 19 21 18
 34 36 6 31
 18 10 13 38
 33 23 26 14
 33 9 20 7
 32 37 15 34
 36 12 13 37
 32 37 17 15
 4 12 36 6
 4 12 5 36
 36 38 13 10
 34 15 6 37
 4 31 2 1
 14 33 20 21
 38 19 35 18
 33 9 14 20
 24 34 11 16
 31 4 36 6
 21 35 25 30
 33 34 16 8
 38 36 34 31
 36 13 12 5
 34 15 11 6
 31 2 10 36
 36 10 5 2
 33 34 32 16
 38 7 33 19
 33 31 38 34
 4 36 5 2
 5 13 10 36
 33 9 8 14
 35 19 33 21
 4 31 36 2
 21 33 26 14
 31 7 9 33
 23 32 24 16
 37 32 22 38
 18 38 22 35
 33 7 20 19
 22 29 32 17
 36 37 6 12
 21 33 20 19
 13 38 36 37
 8 31 3 1
 31 34 3 6
 7 31 9 1
 18 38 13 22
 29 27 28 32
 27 24 28 32
 30 32 26 35
 33 31 8 9
 21 26 35 30
 34 36 38 37
 30 32 28 23
 29 35 30 25
 29 35 32 30
 30 32 23 26
 32 35 22 38
 8 11 3 34
 16 8 34 11
 31 2 7 10
 34 31 8 33
 31 8 3 34
 34 36 37 6
 32 30 28 29
 15 24 27 32
 31 7 2 1
 24 34 15 11
 37 32 38 34
 24 34 32 15
 33 35 26 32
 13 12 17 37
 21 35 18 25
 32 37 22 17
 18 35 22 25
 37 22 17 13
 12 15 17 37
 9 31 8 1

The file tetmesh.nodes.coordinates.data.txt lists the x, y, z coordinates of all nodes, in order of declaration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 0.000000000000000e+000 1.666666716337204e-001 4.712086915969849e-001
 2.500000000000000e-001 1.666666716337204e-001 3.990841507911682e-001
 0.000000000000000e+000 3.716512024402618e-001 3.333333432674408e-001
 2.500000000000000e-001 2.746208012104034e-001 3.333333432674408e-001
 4.203929124702377e-001 1.493296010877703e-001 2.197801091934176e-001
 1.139584250632038e-001 4.643906471538776e-001 1.335079616018506e-001
 1.047842693131447e-001 -1.216302332864668e-001 4.699816853774054e-001
 -2.860847058105710e-001 2.107675698110343e-001 3.460974083574382e-001
 -1.962513823038130e-001 -4.501080253267278e-002 4.535003267544548e-001
 3.803384588142564e-001 -1.405760195307595e-001 2.852322285787254e-001
 -1.929083502819747e-001 4.470959268986263e-001 9.885832549949415e-002
 3.519630992810837e-001 3.510716299626377e-001 1.728000075616203e-002
 4.941629558374744e-001 2.161220260419368e-002 -4.776890619355161e-002
 -4.342549494678548e-001 -1.280795837283121e-001 2.028664604919218e-001
 5.975170211622851e-002 4.696202835259190e-001 -1.524235420943749e-001
 -4.436311116752566e-001 2.162750019072896e-001 5.080579237677704e-002
 3.059586921027154e-001 2.198790120072043e-001 -3.232172109319627e-001
 3.357801792341773e-001 -3.664626276811731e-001 -2.429831180536221e-002
 1.467415203902673e-001 -3.800090071319727e-001 2.829384166449897e-001
 -1.318221433378719e-001 -3.072613948308739e-001 3.659946350752681e-001
 -1.154374883138905e-001 -4.827449385891175e-001 2.163220630714846e-002
 3.642554562369713e-001 -1.290545252516323e-001 -3.106827481455944e-001
 -4.538308441113258e-001 8.927009568986568e-003 -2.025594869912190e-001
 -2.979351724064552e-001 3.258026331613518e-001 -2.275975461741350e-001
 1.172652229279828e-001 -3.736231267327574e-001 -3.039945589123630e-001
 -3.880648138632178e-001 -2.870769116279939e-001 -1.130663799702753e-001
 -2.340757437560504e-002 2.747550891633101e-001 -4.139274869231919e-001
 -2.288677189695588e-001 6.371397475175061e-002 -4.365041348992175e-001
 5.906986972463356e-002 -3.745421489449107e-002 -4.918590620166728e-001
 -2.138762823357266e-001 -2.615806908368172e-001 -3.636998197791716e-001
 6.859447354030629e-002 1.118023283842205e-001 2.751065169959183e-001
 -6.189714264220279e-002 5.430868648784158e-002 -1.850313605766330e-001
 -1.351394371444881e-001 -8.313075885524815e-002 1.384394210017095e-001
 -5.678852976095067e-002 2.144570715199013e-001 6.332160380245036e-002
 1.806666493452832e-002 -2.174053915944322e-001 -1.117340562036783e-001
 2.405897473233149e-001 1.409188517333709e-001 1.398100132874502e-001
 1.897585376186373e-001 1.738944322465300e-001 -7.581134088151413e-002
 1.559087589872702e-001 -7.527185888132174e-002 6.150468029133003e-002