SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
grmhd::ValenciaDivClean::PrimitiveFromConservative< OrderedListOfPrimitiveRecoverySchemes, ErrorOnFailure > Struct Template Reference

Compute the primitive variables from the conservative variables. More...

#include <PrimitiveFromConservative.hpp>

Public Types

using return_tags
using argument_tags

Static Public Member Functions

template<bool EnforcePhysicality = true>
static bool apply (gsl::not_null< Scalar< DataVector > * > rest_mass_density, gsl::not_null< Scalar< DataVector > * > electron_fraction, gsl::not_null< Scalar< DataVector > * > specific_internal_energy, gsl::not_null< tnsr::I< DataVector, 3, Frame::Inertial > * > spatial_velocity, gsl::not_null< tnsr::I< DataVector, 3, Frame::Inertial > * > magnetic_field, gsl::not_null< Scalar< DataVector > * > divergence_cleaning_field, gsl::not_null< Scalar< DataVector > * > lorentz_factor, gsl::not_null< Scalar< DataVector > * > pressure, gsl::not_null< Scalar< DataVector > * > temperature, const Scalar< DataVector > &tilde_d, const Scalar< DataVector > &tilde_ye, const Scalar< DataVector > &tilde_tau, const tnsr::i< DataVector, 3, Frame::Inertial > &tilde_s, const tnsr::I< DataVector, 3, Frame::Inertial > &tilde_b, const Scalar< DataVector > &tilde_phi, const tnsr::ii< DataVector, 3, Frame::Inertial > &spatial_metric, const tnsr::II< DataVector, 3, Frame::Inertial > &inv_spatial_metric, const Scalar< DataVector > &sqrt_det_spatial_metric, const EquationsOfState::EquationOfState< true, 3 > &equation_of_state, const grmhd::ValenciaDivClean::PrimitiveFromConservativeOptions &primitive_from_conservative_options)

Detailed Description

template<typename OrderedListOfPrimitiveRecoverySchemes, bool ErrorOnFailure = true>
struct grmhd::ValenciaDivClean::PrimitiveFromConservative< OrderedListOfPrimitiveRecoverySchemes, ErrorOnFailure >

Compute the primitive variables from the conservative variables.

For the Valencia formulation of the GRMHD system with divergence cleaning, the conversion of the evolved conserved variables to the primitive variables cannot be expressed in closed analytic form and requires a root find.

[Siegel {et al}, The Astrophysical Journal 859:71(2018)] (http://iopscience.iop.org/article/10.3847/1538-4357/aabcc5/meta) compares several inversion methods.

If ErrorOnFailure is false then the returned bool will be false if recovery failed and true if it succeeded.

If EnforcePhysicality is false then the hydrodynamic inversion will return with an error if the input conservatives are unphysical, i.e., if no solution exits. The exact behavior is governed by ErrorOnFailure.

Note
Here, we outline the algebra for computing the spatial velocity \( v^i \):

We start from definition of the momentum density \( S_i \):

\[\begin{aligned} S_i &= (\rho h)^* W^2 v_i - \alpha b^0 b_i \\ &= \left(\rho h + \frac{B^2}{W^2} + (v \cdot B)^2\right) W^2 v_i - \alpha \left(\frac{W}{\alpha}(v \cdot B)\right) \left(\frac{B_i}{W} + (v \cdot B) W v_i\right) \\ &= \left(\rho h + \frac{B^2}{W^2}\right) W^2 v_i - (v \cdot B) B_i \end{aligned} \]

From the above, we obtain:

\[\begin{aligned} S^i &= \left(\rho h + \frac{B^2}{W^2}\right) W^2 v^i - (v \cdot B) B^i \\ S \cdot B &= \left(\rho h + \frac{B^2}{W^2}\right) W^2 (v \cdot B) - (v \cdot B) B^2 \\ &= \rho h W^2 (v \cdot B) \\ v^i &= \frac{1}{\sqrt{\gamma} (\rho h W^2 + B^2)} \tilde{S}^i + \frac{S \cdot B}{\rho h W^2 (\rho h W^2 + B^2)} B^i \end{aligned} \]

Member Typedef Documentation

◆ argument_tags

template<typename OrderedListOfPrimitiveRecoverySchemes, bool ErrorOnFailure = true>
using grmhd::ValenciaDivClean::PrimitiveFromConservative< OrderedListOfPrimitiveRecoverySchemes, ErrorOnFailure >::argument_tags
Initial value:
tmpl::list<
Inverse of the spatial metric.
Definition Tags.hpp:32
Definition Tags.hpp:25
Definition Tags.hpp:43
The densitized magnetic field .
Definition Tags.hpp:56
The densitized rest-mass density .
Definition Tags.hpp:32
The densitized divergence-cleaning field .
Definition Tags.hpp:62
The densitized momentum density .
Definition Tags.hpp:49
The densitized energy density .
Definition Tags.hpp:43
The densitized electron number density times the baryon mass .
Definition Tags.hpp:38
The equation of state retrieved from the analytic solution / data in the input file.
Definition Tags.hpp:343

◆ return_tags

template<typename OrderedListOfPrimitiveRecoverySchemes, bool ErrorOnFailure = true>
using grmhd::ValenciaDivClean::PrimitiveFromConservative< OrderedListOfPrimitiveRecoverySchemes, ErrorOnFailure >::return_tags
Initial value:
tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
The divergence-cleaning field .
Definition Tags.hpp:99
The electron fraction .
Definition Tags.hpp:105
The Lorentz factor , where is the spatial velocity of the fluid.
Definition Tags.hpp:181
The magnetic field measured by an Eulerian observer, where is the normal to the spatial hypersurfac...
Definition Tags.hpp:197
The fluid pressure .
Definition Tags.hpp:234
The spatial velocity of the fluid, where . Here is the spatial part of the 4-velocity of the fluid,...
Definition Tags.hpp:257
The specific internal energy .
Definition Tags.hpp:286
The temperature of the fluid.
Definition Tags.hpp:292

The documentation for this struct was generated from the following file:
  • src/Evolution/Systems/GrMhd/ValenciaDivClean/PrimitiveFromConservative.hpp