# Object Types

## Description

Core to the analysis in Warp Factory is the metric and stress-energy tensors. Both of these tensors are stored as a `.struct` which has several fields that contain the data. These structs have certian required fields which are used by the various functions in Warp Factory to ensure that operations are conducted properly when manipulating data. These fields are also helpful references to the user.

{% hint style="info" %}
The term "**Internal use**" means that the value is used to determine logic within the analysis functions in Warp Factory. These fields should be overwritten and only modified by appropriate function calls.
{% endhint %}

{% hint style="info" %}
The term "**Reserved field**" means that this struct field has certian values that Warp Factory will understand and use. It also means that changing these values outside of the appropriate functions that also change the tensor data will result in data type mismatches.
{% endhint %}

## Metric Tensor Structure

The metric tensor is a unitless object which defines the curvature of spacetime. In Warp Factory the metric tensor is a special object stored as a `.struct` type, which includes several important fields that are used by several functions across the toolkit.

{% hint style="info" %} <mark style="color:blue;">blue</mark> are required fields. These fields interact with different functions inside Warp Factory.

<mark style="color:orange;">orange</mark> are optional fields. These fields act as a helpful reference for the user and are sometimes used by Warp Factory, but are not required for proper data handling.
{% endhint %}

<table data-full-width="true"><thead><tr><th width="156">Field</th><th width="115.33333333333331">Values</th><th width="112">Format</th><th width="92">Type</th><th>Comment</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>.type</code></mark></td><td>Object type</td><td>1x1 array</td><td>string</td><td><strong>The string is a reserved field for internal use, only to be "metric".</strong></td></tr><tr><td><mark style="color:blue;"><code>.tensor</code></mark></td><td>Value of the metric components at each spacetime point</td><td>4x4 cells containing 4x4 arrays</td><td>double</td><td><p>Tensor is in the standard form stored as a cell:</p><p><br><span class="math">g_{\mu\nu} = \begin{pmatrix} g_{00} &#x26; g_{01} &#x26; g_{02} &#x26; g_{03} \\ g_{01} &#x26; g_{11} &#x26; g_{12} &#x26; g_{13}  \\ g_{02} &#x26; g_{12} &#x26; g_{22} &#x26; g_{23}   \\ g_{03} &#x26; g_{13} &#x26; g_{23} &#x26; g_{33}  \\\end{pmatrix}</span></p><p><br>The index of this tensor can be all types and is specified by the <mark style="color:blue;"><code>.index</code></mark> field.</p></td></tr><tr><td><mark style="color:blue;"><code>.scaling</code></mark></td><td>Scaling factor used for the dimensions</td><td>1x4 array</td><td>double</td><td>Specified in <span class="math">[x_0, x_1, x_2, x_3]</span>. Smaller values mean higher resolution grids, relative to the <mark style="color:blue;"><code>gridSize</code></mark> input. Scaling is used by the solver in the finite element method.</td></tr><tr><td><mark style="color:blue;"><code>.index</code></mark></td><td>Tensor index</td><td>1x1 array</td><td>string</td><td>Can be either "covariant" or "contravariant"<strong>.  This is a reserved field for internal use and should not be manually changed.</strong></td></tr><tr><td><mark style="color:blue;"><code>.coords</code></mark></td><td>Name of the used coordinate system</td><td>1x1 array</td><td>string</td><td><strong>Only the Cartesian coordinate system has been implemented in Warp Factory in the current release.</strong> Other systems can be used but have not been tested or adapted in the solver and analysis functions</td></tr><tr><td><mark style="color:orange;"><code>.name</code></mark></td><td>Name of the metric</td><td>1x1 array</td><td>string</td><td>Standard names are used in the metric library but can be overwritten.</td></tr><tr><td><mark style="color:orange;"><code>.date</code></mark></td><td>Date created</td><td>1x1 array</td><td>string</td><td>In the metric library, the MATLAB internal <code>date</code> function is used. The format is "dd-MMM-yyyy".</td></tr><tr><td><mark style="color:orange;"><code>.params</code></mark></td><td>Contains sub-fields depending on the parameters used by the metric to construct it</td><td><code>.struct</code> fields</td><td>double</td><td>The metric library functions assign the values passed into them as subfields. For example, this would be the radius and sigma factor for the Alcubierre bubble. Users can adapt this field as they see fit for custom metrics. </td></tr></tbody></table>

## Stress-energy Tensor Structure

The stress-energy tensor is the physical content in the spacetime which is associated with the curvature in the metric tensor. In Warp Factory the stress-energy tensor is a special object stored as a `.struct` type, which includes several important fields that are used by several functions across the toolkit.

{% hint style="info" %} <mark style="color:blue;">blue</mark> are required fields. These fields interact with different functions inside Warp Factory.

<mark style="color:orange;">orange</mark> are optional fields. These fields act as a helpful reference for the user.
{% endhint %}

<table data-full-width="true"><thead><tr><th width="155">Field</th><th width="125.33333333333331">Values</th><th width="121">Format</th><th width="94">Type</th><th>Comment</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>.type</code></mark></td><td>Object type</td><td>1x1</td><td>string</td><td><strong>The string is a reserved field for internal use, only to be "stress-energy".</strong></td></tr><tr><td><mark style="color:blue;"><code>.tensor</code></mark></td><td>Value of the stress-energy components at each spacetime point</td><td>4x4 cells containing 4x4 arrays</td><td>double</td><td><p>Tensor is in the standard form stored as a cell:</p><p><br><span class="math">T_{\mu\nu} = \begin{pmatrix} T_{00} &#x26; T_{01} &#x26; T_{02} &#x26; T_{03} \\ T_{01} &#x26; T_{11} &#x26; T_{12} &#x26; T_{13}  \\ T_{02} &#x26; T_{12} &#x26; T_{22} &#x26; T_{23}   \\ T_{03} &#x26; T_{13} &#x26; T_{23} &#x26; T_{33}  \\\end{pmatrix}</span></p><p><br>The index of this tensor can be all types and is specified by the <mark style="color:blue;"><code>.index</code></mark> field.</p></td></tr><tr><td><mark style="color:blue;"><code>.scaling</code></mark></td><td>Scaling factor used for the dimensions</td><td>1x4 array</td><td>double</td><td>Inherents the value from the metric <code>.scaling</code> field, specified in <span class="math">[x_0, x_1, x_2, x_3]</span>. <strong>This is a reference field for internal use in the solver and should not be manually changed.</strong></td></tr><tr><td><mark style="color:blue;"><code>.index</code></mark></td><td>Tensor index</td><td>1x1 array</td><td>string</td><td>Can be either "covariant", "contravariant", "mixedupdown", or "mixeddownup"<strong>.  This is a reserved field for internal use and should not be manually changed.</strong></td></tr><tr><td><mark style="color:blue;"><code>.coords</code></mark></td><td>Name of the used coordinates</td><td>1x1 array</td><td>string</td><td><strong>Only the Cartesian coordinate system has been implemented in Warp Factory in the current release.</strong> Other systems can be used but have not been tested or adapted in the solver and analysis functions</td></tr><tr><td><mark style="color:orange;"><code>.frame</code></mark></td><td>Name of the frame of the tensor</td><td>1x1 array</td><td>string</td><td>The frame is an optional field that is modified by doing frame transformations. Currently, only Eulerian transformations are implemented. <strong>This is a reserved field and should not be manually changed, but is not required unless a transformation is done.</strong></td></tr><tr><td><mark style="color:orange;"><code>.date</code></mark></td><td>Date created</td><td>1x1 array</td><td>string</td><td>The <code>getEnergyTensor</code> assigns this using the MATLAB internal <code>date</code> function when generating the stress-energy tensor. Format is "dd-MMM-yyyy".</td></tr><tr><td><mark style="color:orange;"><code>.name</code></mark></td><td>Name of the tensor</td><td>1x1 array</td><td>string</td><td>Inherents the name from the metric <mark style="color:orange;"><code>.name</code></mark> field.</td></tr><tr><td><mark style="color:orange;"><code>.order</code></mark></td><td>Solver order used</td><td>1x1 array</td><td>string</td><td>This is assigned by the <code>getEnergyTensor</code> function, where the solver order is specified as either "second" or "fourth". <strong>This is a reserved field and should not be manually changed.</strong></td></tr></tbody></table>
