DerivedVariables » History » Version 1
Ted Sume, 11/13/2019 03:26 PM
1 | 1 | Ted Sume | # DerivedVariables |
---|---|---|---|
2 | |||
3 | # Derived Variables |
||
4 | |||
5 | Derived variables are those defined in terms of [variables](https://ice.txcorp.com/vizschema/wiki/Variables) read in from the file. Use of derived variables allows one to rename variables or set groups as vectors. One can also do variable transformations. |
||
6 | |||
7 | **Jump to** |
||
8 | |||
9 | * [Variables and their metadata](https://ice.txcorp.com/vizschema/wiki/Variables) |
||
10 | * [Variables that are combined with their meshes](https://ice.txcorp.com/vizschema/wiki/VariablesWithMesh) |
||
11 | * [Data ordering](https://ice.txcorp.com/vizschema/wiki/DataOrdering) |
||
12 | * [Variables defined in terms of other variables](https://ice.txcorp.com/vizschema/wiki/DerivedVariables) |
||
13 | * [Multidomain metadata](https://ice.txcorp.com/vizschema/wiki/MultiDomainMetaData) |
||
14 | * [Other metadata](https://ice.txcorp.com/vizschema/wiki/OtherMetaData) |
||
15 | |||
16 | |||
17 | **Accessing a variable by a different name** |
||
18 | ``` |
||
19 | Group anygroupname0 { |
||
20 | ATT vsType = "vsVars" // Required string |
||
21 | ATT vsMesh = "resultCartGrid" // [Optional string] The new variable can be associated with a different, |
||
22 | // though necessarily compatible, mesh. |
||
23 | ATT E = "YeeElecField" // Declares a new variable "E" that is equivalent to "YeeElecField" |
||
24 | } |
||
25 | ``` |
||
26 | This shows how one can use a different name for a variable. This can be useful, as some visualization tools label plots using the variable name. By default the variable is associated with the same mesh as the original variable. However, use of vsMesh allows one to associate this variable with a new mesh. This can be useful, e.g., when one wants to view the original variable on some mesh but the new variable on the transformed mesh. One use case is where one defines a uniform mesh in (r, phi, z) and by transformation gets an irregular structured mesh in (x, y, z) as shown in an example on the [page on meshes](https://ice.txcorp.com/vizschema/wiki/Meshes). |
||
27 | |||
28 | **Defining a scalar as one component of an array** |
||
29 | ``` |
||
30 | Group anygroupname1 { |
||
31 | ATT vsType = "vsVars" |
||
32 | ATT weight = "electrons_6" |
||
33 | } |
||
34 | ``` |
||
35 | **Defining a vector from three scalar variables** |
||
36 | |||
37 | Below are two examples, one for fields and one for particles. |
||
38 | ``` |
||
39 | Group anygroupname2 { |
||
40 | ATT vsType = "vsVars" // Required string |
||
41 | ATT Evec = "{YeeElecField_0, YeeElecField_1, YeeElecField_2}" // Required string showing actual |
||
42 | // construction |
||
43 | } |
||
44 | ``` |
||
45 | ``` |
||
46 | Group anygroupname3 { |
||
47 | ATT vsType = "vsVars" // Required string |
||
48 | ATT velocity = "{electrons_3, electrons_4, electrons_5}" // Definition for particle variables |
||
49 | } |
||
50 | ``` |
||
51 | All components must live on the same mesh. The braces must contain 2 or 3 components for a 2D mesh and it must contain 3 components for a 3D mesh. |
||
52 | |||
53 | **Defining an array from more than three scalar variables** |
||
54 | |||
55 | For now we see no reason to have collections of variables that are not vectors. |
||
56 | |||
57 | **Defining a scalar from a mathematical expression** |
||
58 | ``` |
||
59 | Group anygroupname5 { |
||
60 | ATT vsType = "vsVars" // Required string |
||
61 | ATT elecEnergyDensity = "0.5*8.854e-12*(E_0*E_0 + E_1*E_1 + E_2*E_2)" // Required string definition |
||
62 | } |
||
63 | ``` |
||
64 | Definitions in terms of simple math as understood by the final visualization tool are supported. |