Project

General

Profile

Variables » History » Version 6

Ted Sume, 11/18/2019 10:12 AM

1 1 Ted Sume
# Variables
2
3
# Variables and their metadata
4
5
Variables are represented by datasets with attributes. The attribute vsMesh gives the mesh that the data lives on. Other attributes can denote whether the data lives at the nodes or centers of cells. Of course, the data shape must match up to the mesh shape. 
6
Each variable can optionally show the time group it belongs too (using optional attribute vsTimeGroup). If there is no such attribute, we assume that there is only one global time group to which a variable is tied too. Otherwise (multiple time groups with variables not referencing a particular one) the data is VizSchema compliant. Another problem may occur if a variable uses the vsTimeGroup attribute and its mesh is actually temporal. Such data is also considered not compliant. 
7
8
Jump to
9
10 6 Ted Sume
* [Variables and their metadata](https://ice.txcorp.com/projects/vizschema/wiki/Variables) 
11
* [Variables that are combined with their meshes](https://ice.txcorp.com/projects/vizschema/wiki/VariablesWithMesh)
12
* [Data ordering](https://ice.txcorp.com/projects/vizschema/wiki/DataOrdering)
13
* [Variables defined in terms of other variables](https://ice.txcorp.com/projects/vizschema/wiki/DerivedVariables) 
14
* [Multidomain metadata](https://ice.txcorp.com/projects/vizschema/wiki/MultiDomainMetaData)
15
* [Other metadata](https://ice.txcorp.com/projects/vizschema/wiki/OtherMetaData)
16 1 Ted Sume
17
Nodal structured scalar data
18
```
19
GROUP "/" {
20
  Group "A" {
21
    Dataset "phi" {
22
      Att vsType = "variable"                     // Required string
23
      Att vsMesh = "mycartgrid"                   // Required string
24
      DATASPACE [201, 301, 105]
25
      Att vsCentering = "nodal"                   // Optional string, defaults to "nodal", other allowed values 
26
                                                  // are "zonal", "edge" or "face"
27
      Att vsIndexOrder = "compMinorC"             // Optional string with default value is "compMinorC"
28
                                                  // ("compMajorC" and "compMajorF" have the same result as the minor variants). 
29
      Att vsTimeGroup = "/mytime"                 // Optional string
30
    }
31
    Group mycartgrid {
32
      Att vsType = "mesh"                         // Required string
33
      Att vsKind = "uniform"                      // Required string
34
      Att vsStartCell = [0, 0, 0]                 // Required integer array
35
      Att vsNumCells = [200, 300, 104]            // Required integer array
36
      Att vsLowerBounds = [-2.5, -2.5, -1.3]      // Required float array
37
      Att vsUpperBounds = [2.5, 2.5, 1.3]         // Required float array
38
    }
39
  }
40
}
41
```
42
* vsType identifies phi as a variable. 
43 6 Ted Sume
* vsMesh gives the mesh that this variable lives on. See [Naming Conventions](https://ice.txcorp.com/projects/vizschema/wiki/Naming) for details 
44 1 Ted Sume
* vsCentering set to "nodal" denotes that the variable lives at the mesh nodes. Accordingly, the array is one larger in each dimension than vsNumCells of the mesh. If it is "zonal", then the data is centered at the cell (zone) centers, and the number of points equals the number of cells. In the future, we hope to support face and edge, but for now, any data that is not labeled specifically "zonal" is assumed to be nodal. Other labels are ignored. 
45 6 Ted Sume
* vsIndexOrder indicates the interpretation of the indices for the data set. See [Data Ordering](https://ice.txcorp.com/projects/vizschema/wiki/DataOrdering). E.g., for "compMinorC", the first index is the x index, the second index is the y index, and the last index is the z index. 
46
* vsTimeGroup denotes a time group for this data as described [here](https://ice.txcorp.com/projects/vizschema/wiki/OtherMetaData). 
47 1 Ted Sume
* The data is assumed to have the same index ordering as the spatial part of its corresponding mesh. 
48
49 6 Ted Sume
See [meshes](https://ice.txcorp.com/projects/vizschema/wiki/Meshes) for the definition of the mesh description. 
50 1 Ted Sume
51
**Nodal structured vector data**
52
```
53
GROUP "/" {
54
  Group "A" {
55
    Dataset "phi" {
56
      Att vsType = "variable"                     // Required string
57
      Att vsMesh = "mycartgrid"                   // Required string
58
      DATASPACE [201, 301, 105, 4]
59
      Att vsIndexOrder = "compMinorC"             // Required string, defaults to "compMinorC", denoting that the component
60
                                                  // index is the last, most rapidly varying. 
61
      Att vsCentering = "nodal"                   // Optional string, defaults to "nodal", other allowed values 
62
                                                  // are "zonal", "edge" or "face"
63
      Att vsTimeGroup = "mytime"                  // Optional string
64
      Att vsLabels = "x, y, z"                    // Optional string
65
    }
66
    Group mycartgrid {
67
      Att vsType = "mesh"                         // Required string
68
      Att vsKind = "uniform"                      // Required string
69
      Att vsStartCell = [0, 0, 0]                 // Required integer array
70
      Att vsNumCells = [200, 300, 104]            // Required integer array
71
      Att vsLowerBounds = [-2.5, -2.5, -1.3]      // Required float array
72
      Att vsUpperBounds = [2.5, 2.5, 1.3]         // Required float array
73
    }
74
  }
75
}
76
```
77
* vsType identifies phi as a variable. 
78 6 Ted Sume
* vsMesh gives the mesh that this variable lives on. See [Naming Conventions](https://ice.txcorp.com/projects/vizschema/wiki/Naming) for details 
79 1 Ted Sume
* vsCentering set to "nodal" denotes that the variable lives at the mesh nodes. Accordingly, the array is one larger in each dimension than vsNumCells of the mesh. If it is "zonal", then the data is centered at the cell (zone) centers, and the number of points equals the number of cells. In the future, we hope to support face and edge, but for now, any data that is not labeled specifically "zonal" is assumed to be nodal. Other labels are ignored. 
80
* vsTimeGroup denotes a time group for this data. 
81
* vsIndexOrder can be either "compMinor", the default, or compMajor, with the latter denoting that the most slowly varying index is the component index. This attribute is not needed for data on irregular structured or unstructured meshes, where it is assumed that the data index order matches that of the mesh. 
82
* vsLabels gives names to the components of the variable. In this case, the first three components of variable 'phi' will be named 'x', 'y', and 'z' instead of 'phi_0', 'phi_1', and 'phi_2'. Since there are 3 names given, but 4 components, the last component will retain its default name, 'phi_3'. 
83
84
**Zonal structured data**
85
```
86
GROUP "/" {
87
  Group "A" {
88
    Dataset "phi" {
89
      Att vsType = "variable"                     // Required string
90
      Att vsMesh = "mycartgrid"                   // Required string
91
      DATASPACE [200, 300, 104] 
92
      Att vsCentering = "zonal"                   // Optional string, defaults to "nodal", other allowed values 
93
                                                  // are "zonal", "edge" or "face"
94
      Att vsTimeGroup = "mytime"                  // Optional string
95
    }
96
    Group mycartgrid {
97
      Att vsType = "mesh"                         // Required string
98
      Att vsKind = "uniform"                      // Required string
99
      Att vsStartCell = [0, 0, 0]                 // Required integer array
100
      Att vsNumCells = [200, 300, 104]            // Required integer array
101
      Att vsLowerBounds = [-2.5, -2.5, -1.3]      // Required float array
102
      Att vsUpperBounds = [2.5, 2.5, 1.3]         // Required float array
103
    }
104
  }
105
}
106
```
107
This array now is zonal, so that the data is associated with the centers of the zones. Accordingly, the number of data points per direction should match up to vsNumCells. 
108
109
**Structured data with arbitrary offsets**
110
111
For structured data that are neither nodal nor zonal, one must specify the location of the data within the cell using the vsNodeOffset attribute, a float vector, to be used in place of the vsCentering attribute defined above. The values of vsNodeOffset are in the range 0...1, where 0 refers to the lower, let, bottom node, and 1 to the upper, right, top position within the cell. The number of elements in vsNodeOffset should match the number of topological dimensions. The presence of vsNodeOffset overrides any vsCentering setting. The size of data must match vsNumCells (even in the case where vsNodeOffset is [0., 0., 0.]). Use masking to turn off some cells (see next section). Following are examples of offsets: 
112
```
113
vsNodeOffset = [0., 0., 0.]     // same as nodal 
114
vsNodeOffset = [0.5, 0.5, 0.5]  // same as zonal
115
vsNodeOffset = [0.5, 0., 0.]    // x-edge
116
vsNodeOffset = [0.5, 0.5, 0.]   // z-face
117
```
118
More details are provided at  https://ice.txcorp.com/staggeredviz/wiki/VizSchemaEdgeFace. 
119
120
**Vector edge and face fields**
121
122
In addition to "nodal" or "zonal", the vsCentering attribute can take the values of "edge" or "face" to denote vector fields which are centred on the faces or the edges of the cell. Edge/face fields are common occurrences in electromagnetic simulations with the electric field (E) located on edges and the magnetic field (B) on faces. In finite volume schemes, the flux is typically face-centered. 
123
A field cannot have vsCentering="face" or vsCentering="edge" and vsNodeOffset defined, as an "edge" ("face") centering has a different meaning from a vsNodeOffset. An edge (face) field value represents an average value over the edge (face) whereas a vsNodeOffset denotes the point location of the field with respect to the base node of the cell. 
124
Contrary to "zonal" and "nodal" data, "face" and "edge" data must correspond to vector fields. The number of components of the vector field is expected to match the number of space dimensions. An exception is in 2D where a face/edge vector field will be allowed to have a third component (Bz) which is assumed to be zonal for a face field, and nodal for an edge field (Ez). 
125
For structured grids, the sizes of all components must match the number of nodes in this case. Each component will be implicitly assumed to be attached to the low end face/edge of each cell. For instance, given the nodes (i, j), (i+1, j), (i+1, j+1),and (i, j+1), the edge Ex component will be attached to the segment (i, j) -> (i+1, j) and the Ey component to (i, j) -> (i, j+1). Note that if the number of nodes is (nx + 1) * (ny + 1) then all components are expected to have dimensions (nx + 1, ny + 1). In other words, there is an additional row/column of cells on the upper side of the domain to accommodate the last face/edge values. In the example below, the grid is 2 by 3 cells and has been padded to become 3 by 4 in order to attach face/edge values along i = 2 and j = 3. Face/edge values falling outside the domain, e.g. edge Ey or face Bx at i = 0 and j = 3, are assumed to be invalid. However, edge Ex and face By are valid at i = 0 and j = 3. 
126
```
127
^
128
|
129
j 
130
  +...+...+...+
131
  :   :   :   :
132
3 +---+---+...+
133
  |   |   |   :
134
2 +---+---+...+
135
  |   |   |   :
136
1 +---+---+...+
137
  |   |   |   :
138
0 +---+---+...+
139
  0   1   2   --> I
140
```
141
142
**Edge vector structured data**
143
```
144
GROUP "/" {
145
  Group "A" {
146
    Dataset "phi" {
147
      Att vsType = "variable"                     // Required string
148
      Att vsMesh = "mycartgrid"                   // Required string
149
      DATASPACE [202, 302, 106, 4]
150
      Att vsCentering = "edge"                    // Optional string, defaults to "nodal", other allowed value 
151
                                                  // are "zonal", "edge" and "face"
152
      Att vsIndexOrder = "compMinorC"             // Optional string with default value is "compMinorC"
153
                                                  // ("compMajorC" and "compMajorF" have the same result as the minor variants). 
154
      Att vsTimeGroup = "/mytime"                 // Optional string
155
    }
156
    Group mycartgrid {
157
      Att vsType = "mesh"                         // Required string
158
      Att vsKind = "uniform"                      // Required string
159
      Att vsStartCell = [0, 0, 0]                 // Required integer array
160
      Att vsNumCells = [200, 300, 104]            // Required integer array
161
      Att vsLowerBounds = [-2.5, -2.5, -1.3]      // Required float array
162
      Att vsUpperBounds = [2.5, 2.5, 1.3]         // Required float array
163
    }
164
  }
165
}
166
```
167
**Face vector structured data**
168
```
169
GROUP "/" {
170
  Group "A" {
171
    Dataset "phi" {
172
      Att vsType = "variable"                     // Required string
173
      Att vsMesh = "mycartgrid"                   // Required string
174
      DATASPACE [202, 302, 106, 4]
175
      Att vsCentering = "face"                    // Optional string, defaults to "nodal", other allowed value 
176
                                                  // are "zonal", "edge" and "face"
177
      Att vsIndexOrder = "compMinorC"             // Optional string with default value is "compMinorC"
178
                                                  // ("compMajorC" and "compMajorF" have the same result as the minor variants). 
179
      Att vsTimeGroup = "/mytime"                 // Optional string
180
    }
181
    Group mycartgrid {
182
      Att vsType = "mesh"                         // Required string
183
      Att vsKind = "uniform"                      // Required string
184
      Att vsStartCell = [0, 0, 0]                 // Required integer array
185
      Att vsNumCells = [200, 300, 104]            // Required integer array
186
      Att vsLowerBounds = [-2.5, -2.5, -1.3]      // Required float array
187
      Att vsUpperBounds = [2.5, 2.5, 1.3]         // Required float array
188
    }
189
  }
190
}
191
```
192
For unstructured grids, the attributes "face" and "edge" can also be used. In this case, the user is expected to attach a scalar value to each oriented face/edge element, the list of edges and faces must be provided as a list of node indexes. Note that edges are defined by two nodes (i, j) and that edge (j, i) = - edge(i, j). Similarly, faces are defined by 3 nodes (i, j, k) and face(i, k, j) = - face(i, j, k). In other words, the permutation of two indexes introduces a negative sign. 
193 3 Ted Sume
194 1 Ted Sume
Below are vector basis functions for edge (silver) and face (gold) vector fields in the case of a tetrahedral cell (left and middle) and a cuboid cell. Theses basis functions, known as Whitney forms, determine the interpolation weights inside a cell. They have the important property that the line (area) integral of the vector field over the edge (face) is zero on all edges (faces) except one. Note that the direction of the edge (face) vector field is not necessarily along the edge (perpendicular to the face). 
195 5 Ted Sume
                           
196
<img style="width:15%" src="https://ice.txcorp.com/attachments/download/100/simplexEdge.png"> <img style="width:15%" src="https://ice.txcorp.com/attachments/download/101/simplexFace.png"> <img style="width:15%" src="https://ice.txcorp.com/attachments/download/99/cuboid.png">
197 1 Ted Sume
   
198
**Missing data values**
199
200
There are cases where the data are corrupted or otherwise not known. Since data values are expected to be provided over the entire mesh, special values must be chosen to indicate that the data are invalid at these locations. This is known as a missing value. Missing values should be chosen outside the range of data validity, if possible. Thus, variables that are positive definite (density, temperature in Kelvin, etc.) may choose a negative value. When this is not possible then an extremely unlikely value can also serve the purpose of a missing value, e.g. close to the minimum or maximum range of the floating point number representation (-3.402823466E+38, 3.402823466E+38). 
201
202
The optional variable attribute for a missing value is vsMissingValue. This attribute cannot apply to a variable that has vsType == "mask". 
203
```
204
GROUP "/" {
205
  Group "A" {
206
    Dataset "myarray" {
207
      Att vsMissingValue =  -3.402823466E+38      // float attribute
208
      Att vsMesh = "mycartgrid"                   // Required string
209
      DATASPACE [201, 301, 105]
210
      Att vsCentering = "nodal"                   // Optional string, defaults to "nodal", other allowed values 
211
                                                  // are "zonal", "edge" or "face"
212
      Att vsIndexOrder = "compMinorC"             // Optional string with default value is "compMinorC"
213
                                                  // ("compMajorC" and "compMajorF" have the same result as the minor variants). 
214
      Att vsTimeGroup = "/mytime"                 // Optional string
215
    }
216
    Group mycartgrid {
217
      Att vsType = "mesh"                         // Required string
218
      Att vsKind = "uniform"                      // Required string
219
      Att vsStartCell = [0, 0, 0]                 // Required integer array
220
      Att vsNumCells = [200, 300, 104]            // Required integer array
221
      Att vsLowerBounds = [-2.5, -2.5, -1.3]      // Required float array
222
      Att vsUpperBounds = [2.5, 2.5, 1.3]         // Required float array
223
    }
224
  }
225
```
226
**Labeling Variable Components**
227
228
The default names given to components of a multi-component variable are generally of the form "datasetName_componentNumber". Users desiring more human-readable labels for components may use the vsLabels attribute to specify different names. This attribute must contain a comma-separated string of names to be used for each component of a variable. In the event of an error such as an incorrectly formatted string, the default component names will be used. 
229
Note that if labels are assigned to components, those components will no longer be available with the default name. This limitation includes any expressions defined with vsVars or in a VisIt session. Any expression that refers to an old component name will fail to find the component under the new name. In order to function properly, these expressions will need to refer to the label as supplied by the vsLabel attribute. 
230
This example shows a variable with 7 components, labeled 'x', 'y', 'z', 'dx', 'dy', 'dz', 'particle_id':
231
```
232
Dataset "myVar" {
233
  Att vsType = "variable"
234
  Att vsMesh = "myMesh"
235
  DATASPACE [200, 7] 
236
  vsLabels = "x, y, z, dx, dy, dz, particle_id" 
237
}
238
```
239
**Associating Variables with Times**
240
241
Any Variable or VariableWithMesh may be assigned time information using the vsTimeGroup attribute. This optional attribute should contain the name of a "time" group (see [Other metadata](https://ice.txcorp.com/vizschema/wiki/OtherMetaData) for more information). 
242
Note that since Vizschema does not allow multiple timesteps in a single file, conflicting time information will result in undefined behavior. 
243
In this example, the variable "myVar" has been declared to belong to time "0.005" and step "2": 
244
```
245
Dataset "myVar" {
246
  Att vsType = "variable"
247
  Att vsMesh = "myMesh"
248
  DATASPACE [200, 7]
249
  Att vsTimeGroup = "timeGroup"
250
}
251
252
Group "timeGroup" {
253
  Att vsKind = "time"
254
  Att vsTime = "0.005"
255
  Att vsStep = "2"
256
}
257
```
258
For unstructured grids there are attributes for various shapes. Lines, Triangles, Quadrilaterals, Polygons and Polyherda. Datasets of these types must include the connectivity. The attributes are vsLines, vsTriangles, vsPolygons, vsPolyhedra, vsPoints, vsLines, vsTriangles, vsQuadrilaterals, vsTetrahedrals, vsPyramids, vsPrisms and vsHexahedrals. 
259
```
260
Dataset "myVar" {
261
  Att vsType = "variable"         // 
262
  Att vsMesh = "myMesh"           //
263
  DATASPACE [5, 6, 7]
264
  Att vsLines = "/connectivity"
265
}
266
Dataset "connectivity" {
267
  DATA [210, 2]
268
}
269
Group myMesh {
270
      Att vsType = "mesh"                         // Required string
271
      Att vsKind = "uniform"                      // Required string
272
      Att vsStartCell = [0, 0, 0]                 // Required integer array
273
      Att vsNumCells = [5, 6, 7]                  // Required integer array
274
```
275
**High order fields**
276
277
High order fields can be attached to meshes of type vsKind = "unstructured", "structured", or "uniform". These fields are similar to unstructured, structured, or uniform fields except that they carry an additional index, of dimension n_subCell, which denotes the location of the field inside the coarse cells. 
278
```
279
Dataset myScalarVar {
280
   Att vsType = "variable"
281
   Att vsMesh = "myMesh"
282
   DATASPACE [n_coarseCells, n_subCell]
283
}
284
```
285
Higher order vector fields have the component as last index: 
286
```
287
Dataset myVectorVar {
288
   Att vsType = "variable"
289
   Att vsMesh = "myMesh"
290
   DATASPACE [n_coarseCells, n_subCell, n_comps]
291
}
292
```
293
High order fields cannot have the vsCentering attribute.