# 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 %}
