> For the complete documentation index, see [llms.txt](https://applied-physics.gitbook.io/warp-factory/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://applied-physics.gitbook.io/warp-factory/modules/analyzer-module/getscalars.md).

# getScalars

## Description

The properties of the metric can be explored by comparing geometric properties such as the expansion, shear, and vorticity scalars. Each of these scalars is built from the metric tensor and evaluated at each point in spacetime using projections of the metric on a timelike vector field.&#x20;

<details>

<summary>Expansion Scalar</summary>

The expansion scalar is a quantity that describes the change in the volume of a region. We define this scalar $$\theta$$ as:

$$\theta = g^{\mu\nu}\theta\_{\mu\nu}$$

where $$\theta\_{\mu\nu}$$ is the stress tensor found from the projection tensor $$P^\alpha\_\mu$$ acting on the observer vector field $$U^\mu$$ as&#x20;

$$\theta\_{\mu\nu} = P^\alpha\_\mu P^\beta\_\nu \nabla\_{(\alpha} U\_{\beta)}$$

and the projection tensor is given by:&#x20;

$$P\_{\mu\nu} = g\_{\mu\nu} + U\_\mu U\_\nu$$

</details>

<details>

<summary>Shear Scalar</summary>

The shear scalar is a quantity that describes the relative stretching while preserving the volume of an object. The shear scalar $$\sigma^2$$ is defined as:

$$\sigma^2 = \frac{1}{2} \sigma\_{\mu\nu} \sigma^{\mu\nu}$$

where $$\sigma\_{\mu\nu}$$ is the shear tensor found from the stress tensor and projection tensor$$P\_{\mu\nu}$$, shear tensor $$\theta\_{\mu\nu}$$ and shear scalar $$\theta$$ as:&#x20;

$$\sigma\_{\mu\nu} = \theta\_{\mu\nu} - \frac{\theta}{3} P\_{\mu\nu}$$

</details>

<details>

<summary>Vorticity Scalar</summary>

The vorticity scalar is the magnitude of the twist in spacetime, given by:

$$\omega^2 = \frac{1}{2}\omega\_{\mu\nu}\omega^{\mu\nu}$$

Where $$\omega\_{\mu\nu}$$ is the vorticity tensor found from the projection tensor as

$$\omega\_{\mu\nu} = P^\alpha\_\mu P^\beta\_\nu \nabla\_{\[\alpha} U\_{\beta]}.$$

</details>

## Method

The finite difference methods are used to compute the covariant derivatives for the metric scalars. The 3+1 function is also used to define the observer vector field.

{% hint style="info" %}
Currently, only the Eulerian observer vector field is used in Warp Factory.
{% endhint %}

{% hint style="info" %}
The Eulerian observer vector field results in a Vorticity Scalar that is always zero (within the numerical noise threshold).
{% endhint %}

## Syntax

`[`<mark style="color:green;">`expansionScalar`</mark>`,`` `<mark style="color:green;">`shearScalar`</mark>`,`` `<mark style="color:green;">`vorticityScalar`</mark>`] = getScalars(`<mark style="color:blue;">`metric`</mark>`)`

### Input Arguments

{% hint style="info" %} <mark style="color:blue;">blue</mark> are required inputs
{% endhint %}

<table><thead><tr><th width="232">Inputs</th><th width="94">Format</th><th width="106">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>Metric</code></mark></td><td>struct</td><td>object</td><td>Input metric tensor.</td></tr></tbody></table>

### Output Arguments

<table><thead><tr><th width="221">Outputs</th><th width="120.33333333333331">Format</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:green;"><code>expansionScalar</code></mark></td><td>4x4 array</td><td>double</td><td>Returned expansion scalar at all spacetime points.</td></tr><tr><td><mark style="color:green;"><code>shearScalar</code></mark></td><td>4x4 array</td><td>double</td><td>Returned shear scalar at all spacetime points.</td></tr><tr><td><mark style="color:green;"><code>vorticityScalar</code></mark></td><td>4x4 array</td><td>double</td><td>Returned vorticity scalar at all spacetime points.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://applied-physics.gitbook.io/warp-factory/modules/analyzer-module/getscalars.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
