## HydroBase

April 29, 2010

Abstract

HydroBase extends the CactusEinstein framework to include an interface for magnetohydrodynamics to work within. HydroBase’s main function is to store the primitive variables, common among hydrodynamic simulations, commonly needed parameters, and schedule groups for the main functions of a hydrodynamics code. This has been done with an eye on Whisky, but can be used to implement any hydrodynamics formulation.

### 1 Introduction

The idea behind this thorn is to create a slim, common set of variables, parameters and scheduling groups which can then be used by diﬀerent hydrodynamics codes. It should contain the common concepts of diﬀerent hydrodynamics codes, but at the same time it should be as slim as possible to remain as general as possible. HydroBase should not contain the actual source code of typical routines of hydrodynamics codes, it should merely provide a common setup in which hydrodynamics codes can put their routines.

Because there exist diﬀerent formulations of the hydrodynamics equations and not all of them involve concepts like conserved variabled or treat them diﬀerently, which is the reason why these variables are not deﬁned in HydroBase but this is left to the hydrodynamics codes.

One of the advantages of such a common base is that modules of hydrodynamics codes only working with entities deﬁned in HydroBase could be used interchangeably. Prime examples for this are initial data solvers or importers and analysis modules. Another advantage is that the format of output generated by diﬀerent hydrodynamics codes in Cactus would be the same, including variable names and unit conventions, which would improve the ability to compare results of diﬀerent codes directly a lot.

### 2 Using this Thorn

HydroBase is to be used as a central part of hydrodynamics ﬁelds just as ADMBase is used as a central part of spacetime evolution and analysis codes. HydroBase only stores variables which are common to most if not all hydrodynamics codes solving the Euler equations, the so called primitive variables. These are also the variables which are needed to couple to a spacetime solver and which are usually needed by analysis thorns. The usage of a common set of variables by diﬀerent hydrodynamics codes creates the possibility to share parts of the code, e.g. initial data solvers or analysis routines.

Currently the deﬁned primitive variables are (see [1] for details):

• rho: rest mass density $\varrho$
• press: pressure $p$
• eps: speciﬁc internal energy $𝜖$
• vel[3]: contravariant ﬂuid three velocity ${v}^{i}$ with respect to the Eulerian observer deﬁned as  ${v}^{i}=\frac{{u}^{i}}{\alpha {u}^{0}}+\frac{{\beta }^{i}}{\alpha }$ (1)

in terms of the four-velocity ${u}^{\mu }$, lapse $\alpha$, and shift vector ${\beta }^{i}$.

• Y_e: electron fraction ${Y}_{e}$
• temperature: temperature $T$
• entropy: speciﬁc entropy per particle $s$
• Bvec[3]: contravariant magnetic ﬁeld vector deﬁned as  ${B}^{i}=\frac{1}{\sqrt{4\pi }}{n}_{\nu }{F}^{\ast \nu i}$ (2)

in terms of the dual ${F}^{\ast \mu \nu }=\frac{1}{2}{𝜀}^{\mu \nu \alpha \beta }{F}_{\alpha \beta }$ to the Faraday tensor and the unit normal of the foliation of spacetime ${n}^{\mu }$.

HydroBase also sets up scheduling blocks that organize the main functions which modules of a hydrodynamics code may need. All of those scheduling blocks are optional, however if used, they might simplify existing codes and make them more interoperable. HydroBase itself does not schedule something inside most of the groups which it provides.

Currently the scheduling blocks are:

• Initializing the primitive variables
• Converting primitive variables to conservative variables
• Calculating the right hand side (RHS) in the method of lines (MoL)
• Setting and updating an excision mask
• Applying boundary conditions

In this way the initiation of the primitive variables, methods to recover the conservative variables, and basic atmosphere handling can be implemented in diﬀerent thorns while allowing a central access point for analysis thorns.

### 3 Units

HydroBase does not require a speciﬁc set of units itself. However so that there are no misunderstandings between thorns a speciﬁc set of units is suggested. These units are derived from the conventions

$\begin{array}{rcll}{M}_{sun}=1& ;& c=G=1& \text{(3)}\text{}\text{}\end{array}$

which are commonly used in astrophysics and in relativity. The former sets the mass scale to the solar one and the latter adopts the same units for time, length and mass.

We assume the following deﬁnitions and constants of nature:

$\begin{array}{rcll}c& =& 299792458\phantom{\rule{0.3em}{0ex}}m∕s& \text{(4)}\text{}\text{}\\ G& =& 6.67428\cdot 1{0}^{-11}\phantom{\rule{0.3em}{0ex}}{m}^{3}∕kg∕{s}^{2}& \text{(5)}\text{}\text{}\\ {\mu }_{0}& =& 4\pi 1{0}^{-7}\phantom{\rule{0.3em}{0ex}}N∕{A}^{2}& \text{(6)}\text{}\text{}\\ {𝜖}_{0}& =& \frac{1}{{\mu }_{0}{c}^{2}}& \text{(7)}\text{}\text{}\\ {M}_{sun}& =& 1.98892\cdot 1{0}^{30}\phantom{\rule{0.3em}{0ex}}kg& \text{(8)}\text{}\text{}\end{array}$

This corresponds to the following units for mass, length, time, and magnetic ﬁeld:

$\begin{array}{rcll}\left[M\right]& =& {M}_{sun}& \text{(9)}\text{}\text{}\\ \left[L\right]& =& \left[M\right]\phantom{\rule{2.77695pt}{0ex}}G∕{c}^{2}& \text{(10)}\text{}\text{}\\ \left[T\right]& =& \left[L\right]\phantom{\rule{2.77695pt}{0ex}}∕c& \text{(11)}\text{}\text{}\\ \left[B\right]& =& 1∕\left[L\right]\phantom{\rule{2.77695pt}{0ex}}∕\sqrt{{𝜖}_{0}G∕{c}^{2}}\phantom{\rule{2em}{0ex}}\left(SI\right)& \text{(12)}\text{}\text{}\\ \left[B\right]& =& {c}^{2}∕\left[L\right]\phantom{\rule{2.77695pt}{0ex}}∕\sqrt{G}\phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}\left(Gaussian\right)& \text{(13)}\text{}\text{}\end{array}$

Inserting the SI units into the above unit correspondences, we ﬁnd the following conversion factors:

$\begin{array}{rcll}\left[L\right]& =& 1\phantom{\rule{0.3em}{0ex}}{M}_{sun}\equiv 1.477\phantom{\rule{0.3em}{0ex}}km& \text{(14)}\text{}\text{}\\ \left[T\right]& =& 1\phantom{\rule{0.3em}{0ex}}{M}_{sun}\equiv 4.92673\phantom{\rule{0.3em}{0ex}}\mu s& \text{(15)}\text{}\text{}\\ \left[B\right]& =& 1\phantom{\rule{0.3em}{0ex}}\sqrt{{\mu }_{0}∕4\pi }∕{M}_{sun}\equiv 2.35537\cdot 1{0}^{15}\phantom{\rule{0.3em}{0ex}}T,\phantom{\rule{2em}{0ex}}\left(SI\right)& \text{(16)}\text{}\text{}\\ \left[B\right]& =& 1\phantom{\rule{0.3em}{0ex}}{M}_{sun}^{-1}\equiv 2.35537\cdot 1{0}^{19}\phantom{\rule{0.3em}{0ex}}G,\phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}\left(Gaussian\right)& \text{(17)}\text{}\text{}\end{array}$

where T (Tesla) is the magnetic ﬁeld unit in SI, $1\phantom{\rule{0.3em}{0ex}}T=1\phantom{\rule{0.3em}{0ex}}N∕\left(A\cdot m\right)$, and G (Gauss) is its cgs equivalent, $1\phantom{\rule{0.3em}{0ex}}Tesla=1{0}^{4}\phantom{\rule{0.3em}{0ex}}Gauss$.

### 4 Acknowledgments

This thorn was produced by Tanja Bode, Roland Haas, Frank Löﬄer, and Erik Schnetter.

### References

[1]   J. A. Font. Numerical hydrodynamics in General Relativity. Living Rev. Relativity, 3, 2000. [Article in on-line journal], cited on 31/07/01, http://www.livingreviews.org/ Articles/Volume3/2000-2font/index.html.