# A2 - Metric Scalars

## Computing Metric Scalars

### Get Metric

{% code overflow="wrap" lineNumbers="true" %}

```matlab
%% Alcubierre
gridSize = [1 20 20 20];
worldCenter = (gridSize+1)./2;
velocity = 0.5;
R = 5;
sigma = 0.5;
Metric = metricGet_AlcubierreComoving(gridSize,worldCenter,velocity,R,sigma);
```

{% endcode %}

### Get Scalars

{% code lineNumbers="true" %}

```matlab
[expansionScalar, shearScalar, vorticityScalar] = getScalars(Metric);
```

{% endcode %}

### Plot Scalars

{% code overflow="wrap" lineNumbers="true" %}

```matlab
surfq(expansionScalar(1,:,:,10),'EdgeColor','none')
title('Expansion Scalar')

surfq(shearScalar(1,:,:,10),'EdgeColor','none')
title('Shear Scalar')

surfq(vorticityScalar(1,:,:,10),'EdgeColor','none')
title('Vorticity Scalar')
```

{% endcode %}

{% hint style="info" %}
When copying this code to your own script, add `figure()` in between each call to create new figures for each plot.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://applied-physics.gitbook.io/warp-factory/examples/analysis/a2-metric-scalars.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
