### 6.2 Sources of matter

#### 6.2.1 Cosmological constant

A cosmological constant is implemented in the 3 + 1 framework simply by introducing the quantity as an effective isotropic pressure in the stress-energy tensor

The matter source terms can then be written as
with .

#### 6.2.2 Scalar field

The dynamics of scalar fields is governed by the Lagrangian density

where is the scalar Riemann curvature, is the interaction potential, is typically assumed to be , and is the field-curvature coupling constant ( for minimally coupled fields and for conformally coupled fields). Varying the action yields the Klein–Gordon equation
for the scalar field and
for the stress-energy tensor, where .

For a massive, minimally coupled scalar field [46],

and
where
, and is a general potential which, for example, can be set to in the chaotic inflation model. The covariant form of the scalar field equation (25) can be expanded as in [107] to yield
which, when coupled to Equation (31), determines the evolution of the scalar field.

#### 6.2.3 Collisionless dust

The stress-energy tensor for a fluid composed of collisionless particles (or dark matter) can be written simply as the sum of the stress-energy tensors for each particle [161],

where is the rest mass of the particles, is the number density in the comoving frame, and is the 4-velocity of each particle. The matter source terms are
There are two conservation laws: the conservation of particles , and the conservation of energy-momentum , where is the covariant derivative in the full 4-dimensional spacetime. Together these conservation laws lead to , the geodesic equations of motion for the particles, which can be written out more explicitly in the computationally convenient form
where is the coordinate position of each particle, is determined by the normalization ,
is the Lagrangian derivative, and is the “transport” velocity of the particles as measured by observers at rest with respect to the coordinate grid.

#### 6.2.4 Ideal gas

The stress-energy tensor for a perfect fluid is

where is the 4-metric, is the relativistic enthalpy, and , , and are the specific internal energy (per unit mass), pressure, rest mass density and four-velocity of the fluid. Defining and
as the generalization of the special relativistic boost factor, the matter source terms become
The hydrodynamics equations are derived from the normalization of the 4-velocity, , the conservation of baryon number, , and the conservation of energy-momentum, . The resulting equations can be written in flux conservative form as [162]
where , , , , and is the determinant of the 4-metric satisfying . A prescription for specifying an equation of state (e.g., for an ideal gas) completes the above equations.

When solving Equations (45, 46, 47), an artificial viscosity (AV) method is needed to handle the formation and propagation of shock fronts [1628485]. These methods are computationally cheap, easy to implement, and easily adaptable to multi-physics applications. However, it has been demonstrated that problems involving very high Lorentz factors are somewhat sensitive to different implementations of the viscosity terms, and can result in substantial numerical errors if solved using time explicit methods [126].

On the other hand, a number of different formulations [75] of these equations have been developed to take advantage of the hyperbolic and conservative nature of the equations in using high resolution and non-oscillatory shock capturing schemes (although strict conservation is only possible in flat spacetimes – curved spacetimes exhibit source terms due to geometry). These techniques potentially provide more accurate and stable treatments in highly relativistic regimes. A particular formulation used together with high resolution Godunov techniques and approximate Riemann solvers is the following [13926]:

where
and , , , , , , and .

Although Godunov-type schemes are accepted as more accurate alternatives to AV methods, especially in the limit of high Lorentz factors, they are not immune to problems and should generally be used with caution. They may produce unexpected results in certain cases that can be overcome only with problem-specific fixes or by adding additional dissipation. A few known examples include the admittance of expansion shocks, negative internal energies in kinematically dominated flows, the ‘carbuncle’ effect in high Mach number bow shocks, kinked Mach stems, and odd/even decoupling in mesh-aligned shocks [135]. Godunov methods, whether they solve the Riemann problem exactly or approximately, are also computationally much more expensive than their simpler AV counterparts, and it is more difficult to incorporate additional physics.

A third class of computational fluid dynamics methods reviewed here is also based on a conservative hyperbolic formulation of the hydrodynamics equations. However, in this case the equations are derived directly from the conservation of stress-energy,

to give
with curvature source terms . The variables and are the same as those defined in the internal energy formulation, but now
are different expressions for energy and momenta. An alternative approach of using high resolution, non-oscillatory, central difference (NOCD) methods [99100] has been applied by Anninos and Fragile [12] to solve the relativistic hydrodynamics equations in the above form. These schemes combine the speed, efficiency, and flexibility of AV methods with the advantages of the potentially more accurate conservative formulation approach of Godunov methods, but without the cost and complication of Riemann solvers and flux splitting.

NOCD and artificial viscosity methods have been discussed at length in [12] and compared also with other published Godunov methods on their abilities to model shock tube, wall shock and black hole accretion problems. They find that for shock tube problems at moderate to high boost factors, with velocities up to , internal energy formulations using artificial viscosity methods compare quite favorably with total energy schemes, including NOCD methods and Godunov methods using either approximate or exact Riemann solvers. However, AV methods can be somewhat sensitive to parameters (e.g., viscosity coefficients, Courant factor, etc.) and generally suspect in wall shock problems at high boost factors (). On the other hand, NOCD methods can easily be extended to ultra-relativistic velocities () for the same wall shock tests, and are comparable in accuracy to the more standard but complicated Riemann solver codes. NOCD schemes thus provide a reasonable alternative for relativistic hydrodynamics, though it should be noted that low order versions of these methods can be significantly more diffusive than either the AV or Godunov methods.

#### 6.2.5 Imperfect fluid

The perfect fluid equations discussed in Section 6.2.4 can be generalized to include viscous stress in the stress-energy tensor,

where and are the dynamic shear and bulk viscosity coefficients, respectively. Also, is the expansion of fluid world lines, is the trace-free spatial shear tensor with
and is the projection tensor.

The corresponding energy and momentum conservation equations for the internal energy formulation of Section 6.2.4 become

For the NOCD formulation discussed in Section 6.2.4 it is sufficient to replace the source terms in the energy and momentum equations (53, 53, 54) by