SpECTRE  v2024.04.12
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  CutoffYe
 Cutoff below which \(Y_e\) is set to MinimumValueOfYe. More...
 
struct  Enable
 Whether or not the limiting is enabled. More...
 
struct  MagneticField
 How to treat the magnetic field. More...
 
struct  MinimumValueOfD
 Minimum value of rest-mass density times lorentz factor. More...
 
struct  MinimumValueOfYe
 Minimum value of electron fraction \(Y_e\). More...
 
struct  SafetyFactorForB
 Safety factor \(\epsilon_B\). More...
 
struct  SafetyFactorForS
 Safety factor \(\epsilon_S\). More...
 
struct  SafetyFactorForSCutoffD
 Cutoff in \(\rho_0 W\) below which we use a stricter safety factor for the magnitude of S. More...
 
struct  SafetyFactorForSSlope
 Below SafetyFactorForSCutoffD, reduce \(\epsilon_S\) by SafetyFactorForSSlope times \(\log_{10}(\rho_0 W / SafetyFactorForSCutoffD)\). More...
 

Public Types

using options = tmpl::list< MinimumValueOfD, CutoffD, MinimumValueOfYe, CutoffYe, SafetyFactorForB, SafetyFactorForS, SafetyFactorForSCutoffD, SafetyFactorForSSlope, Enable, MagneticField >
 
using return_tags = tmpl::list< grmhd::ValenciaDivClean::Tags::TildeD, grmhd::ValenciaDivClean::Tags::TildeYe, grmhd::ValenciaDivClean::Tags::TildeTau, grmhd::ValenciaDivClean::Tags::TildeS<> >
 
using argument_tags = tmpl::list< grmhd::ValenciaDivClean::Tags::TildeB<>, gr::Tags::SpatialMetric< DataVector, 3 >, gr::Tags::InverseSpatialMetric< DataVector, 3 >, gr::Tags::SqrtDetSpatialMetric< DataVector > >
 

Public Member Functions

 FixConservatives (double minimum_rest_mass_density_times_lorentz_factor, double rest_mass_density_times_lorentz_factor_cutoff, double minimum_electron_fraction, double electron_fraction_cutoff, double safety_factor_for_magnetic_field, double safety_factor_for_momentum_density, double safety_factor_for_momentum_density_cutoff_d, double safety_factor_for_momentum_density_slope, bool enable, hydro::MagneticFieldTreatment magnetic_field_treatment, const Options::Context &context={})
 
 FixConservatives (const FixConservatives &)=default
 
FixConservativesoperator= (const FixConservatives &)=default
 
 FixConservatives (FixConservatives &&)=default
 
FixConservativesoperator= (FixConservatives &&)=default
 
void pup (PUP::er &p)
 
bool operator() (gsl::not_null< Scalar< DataVector > * > tilde_d, gsl::not_null< Scalar< DataVector > * > tilde_ye, 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
 Returns true if any variables were fixed.
 

Static Public Attributes

static constexpr Options::String help
 

Friends

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

Detailed Description

Fix conservative variables using method developed by Foucart.

Adjusts the conservative variables as follows:

  • If the electron fraction \(Y_e\) is below the value of the option CutoffYe, change \(\tilde{Y}_e\) to \(\tilde{D}\) times the value of the option MinimumValueOfYe.
  • 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"}

The documentation for this class was generated from the following file: