# A3 - Eval Metric

## Eval Metric

evalMetric computes

1. The energy tensor
2. The Eulerian energy tensor
3. The null, weak, strong, and dominant energy conditions
4. The expansion, shear, and vorticity scalars,

All in 1 line of code.

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

```matlab
%% Make Metric
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);

%% Run evalMetric
[Evaluation] = evalMetric(Metric);
```

{% endcode %}

Get field names

{% code lineNumbers="true" %}

```matlab
fieldnames(Evaluation)
```

{% endcode %}

### Metric

{% code lineNumbers="true" %}

```matlab
plotTensor(Evaluation.metric, 0)
```

{% endcode %}

### Energy Tensor

{% code lineNumbers="true" %}

```matlab
plotTensor(Evaluation.energyTensor, 0)
```

{% endcode %}

### Eulerian Energy Tensor

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

```matlab
plotTensor(Evaluation.energyTensorEulerian, 0)
```

{% endcode %}

### Null Energy Condition

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

```matlab
surfq(Evaluation.null(1,3:end-2,3:end-2,round(worldCenter(4))))
title("Null")
view(2)
xlim([1 gridSize(2)-4])
ylim([1 gridSize(3)-4])
```

{% endcode %}

### Weak Energy Condition

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

```matlab
surfq(Evaluation.weak(1,3:end-2,3:end-2,round(worldCenter(4))))
title("Weak")
view(2)
xlim([1 gridSize(2)-4])
ylim([1 gridSize(3)-4])
```

{% endcode %}

### Strong Energy Condition

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

```matlab
surfq(Evaluation.strong(1,3:end-2,3:end-2,round(worldCenter(4))))
title("Strong")
view(2)
xlim([1 gridSize(2)-4])
ylim([1 gridSize(3)-4])ab
```

{% endcode %}

### Dominant Energy Condition

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

```matlab
surfq(Evaluation.dominant(1,3:end-2,3:end-2,round(worldCenter(4))))
title("Dominant")
view(2)
xlim([1 gridSize(2)-4])
ylim([1 gridSize(3)-4])
```

{% endcode %}

### Expansion Scalar

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

```matlab
surfq(Evaluation.expansion(1,:,:,round(worldCenter(4))))
title("Expansion Scalar")
view(2)
xlim([1 gridSize(2)])
ylim([1 gridSize(3)])
```

{% endcode %}

### Shear Scalar

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

```matlab
surfq(Evaluation.shear(1,:,:,round(worldCenter(4))))
title("Shear Scalar")
view(2)
xlim([1 gridSize(2)])
ylim([1 gridSize(3)])
```

{% endcode %}

### Vorticity Scalar

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

```matlab
surfq(Evaluation.vorticity(1,:,:,round(worldCenter(4))))
title("Vorticity Scalar")
view(2)
xlim([1 gridSize(2)])
ylim([1 gridSize(3)])
```

{% endcode %}

Vorticity should always be 0.
