# metricGet\_Schwarzschild

## Description

Create the Schwarzschild spacetime in Cartesian coordinates.

<details>

<summary>Schwarzschild Metric</summary>

The classic Schwarzschild metric given in pseudo-Cartesian coordinates is:

$$\begin{aligned} d s^2= & -\left(1-\frac{r\_s}{r}\right)^2 d t^2+\left(\frac{x^2}{1-r\_s / r}+y^2+z^2\right) \frac{d x^2}{r^2}+\left(x^2+\frac{y^2}{1-r\_s / r}+z^2\right) \frac{d y^2}{r^2} \ & +\left(x^2+y^2+\frac{z^2}{1-r\_s / r}\right) \frac{d z^2}{r^2}+\frac{2 r\_s}{r^2\left(r-r\_s\right)}(x y d x d y+x z d x d z+y z d y d z), \end{aligned}$$

where $$r\_s$$ is the Schwarzschild radius.

</details>

For more details on the Schwarzschild metric please read the following reference (section 2.2.2) or any standard general relativity textbook:

{% embed url="<https://arxiv.org/abs/0904.4184>" %}

## Method

The metric is constructed using the Schwarzschild radius as a unitless pass-in value in Cartesian coordinates.&#x20;

## Syntax

`[`<mark style="color:green;">`metric`</mark>`] = metricGet_Schwarzschild(`<mark style="color:blue;">`gridSize`</mark>`,`<mark style="color:blue;">`worldCenter`</mark>`,`<mark style="color:blue;">`rs`</mark>`,`` `<mark style="color:orange;">`gridScale`</mark>`)`

### Input Arguments

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

<mark style="color:orange;">orange</mark> are optional inputs with native default values.
{% endhint %}

<mark style="color:blue;">blue</mark> are required inputs

<table><thead><tr><th width="213">Inputs</th><th width="133">Format</th><th width="89">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>gridSize</code></mark></td><td>1x4 array</td><td>integer</td><td><p>The size of the world specified as:</p><p></p><p><span class="math">[t, x, y, z]</span> </p></td></tr><tr><td><mark style="color:blue;"><code>worldCenter</code></mark></td><td>1x4 array</td><td>double</td><td><p>The center of the world, which defines the center of <span class="math">r_s</span> as a 4-vector, specified as:</p><p></p><p><span class="math">[t,x,y,z]</span></p></td></tr><tr><td><mark style="color:blue;"><code>rs</code></mark></td><td>1x1 array</td><td>double</td><td>Schwarzschild radius, in unitless form.</td></tr><tr><td><mark style="color:orange;"><code>gridScale</code></mark></td><td>1x4 array</td><td>double</td><td><p>Unit scaling factor of the grid dimensions defined relative to <mark style="color:blue;"><code>gridSize</code></mark>.  This determines the resolution of the grid along each dimension. Specified as:</p><p></p><p><span class="math">[t_{scale}, x_{scale}, y_{scale}, z_{scale}]</span></p><p></p><p> <strong>The default value is [1, 1, 1, 1].</strong></p></td></tr></tbody></table>

### Output Arguments

<table><thead><tr><th width="151">Outputs</th><th width="113.33333333333331">Format</th><th width="94">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:green;"><code>metric</code></mark></td><td>struct</td><td>object</td><td>Schwarzschild solution returned as the metric tensor object.</td></tr></tbody></table>
