SpECTRE  2021.08.02
grmhd::ValenciaDivClean::FixConservatives Class Reference

Fix conservative variables using method developed by Foucart. More...

#include <FixConservatives.hpp>

Classes

struct  CutoffD
 Cutoff below which \(D = \rho W\) is set to MinimumValueOfD. More...
 
struct  MinimumValueOfD
 Minimum value of rest-mass density times lorentz factor. More...
 
struct  SafetyFactorForB
 Safety factor \(\epsilon_B\). More...
 
struct  SafetyFactorForS
 Safety factor \(\epsilon_S\). More...
 

Public Types

using options = tmpl::list< MinimumValueOfD, CutoffD, SafetyFactorForB, SafetyFactorForS >
 
using return_tags = tmpl::list< grmhd::ValenciaDivClean::Tags::TildeD, grmhd::ValenciaDivClean::Tags::TildeTau, grmhd::ValenciaDivClean::Tags::TildeS<> >
 
using argument_tags = tmpl::list< grmhd::ValenciaDivClean::Tags::TildeB<>, gr::Tags::SpatialMetric< 3 >, gr::Tags::InverseSpatialMetric< 3 >, gr::Tags::SqrtDetSpatialMetric<> >
 

Public Member Functions

 FixConservatives (double minimum_rest_mass_density_times_lorentz_factor, double rest_mass_density_times_lorentz_factor_cutoff, double safety_factor_for_magnetic_field, double safety_factor_for_momentum_density, const Options::Context &context={})
 
 FixConservatives (const FixConservatives &)=default
 
FixConservatives & operator= (const FixConservatives &)=default
 
 FixConservatives (FixConservatives &&) noexcept=default
 
FixConservatives & operator= (FixConservatives &&) noexcept=default
 
void pup (PUP::er &p) noexcept
 
bool operator() (gsl::not_null< Scalar< DataVector > * > tilde_d, gsl::not_null< Scalar< DataVector > * > tilde_tau, gsl::not_null< tnsr::i< DataVector, 3, Frame::Inertial > * > tilde_s, const tnsr::I< DataVector, 3, Frame::Inertial > &tilde_b, 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 noexcept
 Returns true if any variables were fixed.
 

Static Public Attributes

static constexpr Options::String help
 

Friends

bool operator== (const FixConservatives &lhs, const FixConservatives &rhs) noexcept
 

Detailed Description

Fix conservative variables using method developed by Foucart.

Adjusts the conservative variables as follows:

  • Changes \({\tilde D}\), the generalized mass-energy density, such that \(D\), the product of the rest mass density \(\rho\) and the Lorentz factor \(W\), is set to value of the option MinimumValueOfD, whenever \(D\) is below the value of the option CutoffD.
  • Increases \({\tilde \tau}\), the generalized internal energy density, such that \({\tilde B}^2 \leq 2 \sqrt{\gamma} (1 - \epsilon_B) {\tilde \tau}\), where \({\tilde B}^i\) is the generalized magnetic field, \(\gamma\) is the determinant of the spatial metric, and \(\epsilon_B\) is the option SafetyFactorForB.
  • Decreases \({\tilde S}_i\), the generalized momentum density, such that \({\tilde S}^2 \leq (1 - \epsilon_S) {\tilde S}^2_{max}\), where \(\epsilon_S\) is the option SafetyFactorForS, and \({\tilde S}^2_{max}\) is a complicated function of the conservative variables which can only be found through root finding. There are sufficient conditions for a set of conservative variables to satisfy the inequality, which can be used to avoid root finding at most points.
Note
The routine currently assumes the minimum specific enthalpy is one.

For more details see Appendix B from the thesis of Francois Foucart

You can plot the function whose root we are finding using:

import numpy as np
import matplotlib.pyplot as plt
upper_bound = 1.000119047987896748e+00
lower_bound = 1.000000000000000000e+00
s_tilde_squared = 5.513009056734747750e-30
d_tilde = 1.131468709980503465e-12
sqrt_det_g: 1.131468709980503418e+00
tau_tilde = 1.346990732914080573e-16
b_tilde_squared = 3.048155733848927391e-16
b_squared_over_d = 2.380959757934347320e-04
tau_over_d = 1.190479878968363843e-04
normalized_s_dot_b = -9.999999082462245337e-01
def function_of_w(lorentz_factor):
return ((lorentz_factor + b_squared_over_d - tau_over_d - 1.0) *
(lorentz_factor**2 + b_squared_over_d * normalized_s_dot_b**2 *
(b_squared_over_d + 2.0 * lorentz_factor)) -
0.5 * b_squared_over_d -
0.5 * b_squared_over_d * normalized_s_dot_b**2 *
(lorentz_factor**2 - 1.0 +
2.0 * lorentz_factor * b_squared_over_d + b_squared_over_d**2))
lorentz_factor = np.linspace(lower_bound, upper_bound, num=10000)
plt.plot(lorentz_factor, function_of_w(lorentz_factor))
plt.show()

Member Data Documentation

◆ help

constexpr Options::String grmhd::ValenciaDivClean::FixConservatives::help
staticconstexpr
Initial value:
= {
"Variable fixing used in Foucart's thesis.\n"}