Skip to content

Conserved and primitive variables: Conversion and inversion

Vedant Dhruv edited this page Nov 22, 2021 · 4 revisions

Conserved and primitive variables

Conserved variables are first discussed in this section. For the equations of ideal GRMHD the conserved variables vector is,

equation.

In addition to these, fluid codes define an additional vector of variables called primitives (P). These variables have the following advantages,

  • Facilitate computing the interface states via reconstruction and consequently the fluxes.
  • Facilitate computing the fluid source terms (since it involves computing the components of the stress-energy tensor)
  • Can be physically better understood.

The primitive variables vector is,

equation.

where equation. vi is defined here. This was done to increase numerical stability.

Primitives ---> conserved variables (conversion)

The conserved variables are analytic functions of the primitives and can be computed exactly. This is done in two steps,

  1. The fluid four velocity (uµ) and magnetic induction vector (bµ) are computed from the primitives.

equation,

equation,

equation,

equation,

where Equations (1) and (2) are true because the fluid four velocity is measured w.r.t. a normal observer. Equation (3) is from the definition of bµ, while Equation (4) can be derived from equation, which is true in the ideal MHD limit. The function get_state_vec found in phys.c computes the four vectors.

  1. The components of the stress-energy tensor are calculated from the primitives and the four vectors. The conserved variables are evaluated from these.

Conserved variables ---> primitives (inversion)

The matter conserved variables are nonlinear functions of the corresponding primitives which have no known analytic inverse expressions. A 1DW scheme (Mignone & McKinney (2007) and Noble et al. (2006)) is used to numerically compute the matter primitives. The magnetic field primitives are equal to the corresponding conserved variables up to a factor of equation. iharm inverts the conserved variables twice during a single time step: (i) following the update to U in advance_fluid having computed fluxes and source terms (ii) following the application of fluid floors in fixup_floor.

The inversion scheme is not guaranteed to successfully converge to reasonable values for the primitives in a finite number of iterations. iharm fixes the 'bad' values of the inverted primitives by interpolating from nearby zones (fixup_utoprim).