SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
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
using return_tags
using argument_tags

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 Typedef Documentation

◆ argument_tags

using grmhd::ValenciaDivClean::FixConservatives::argument_tags
Initial value:
tmpl::list<grmhd::ValenciaDivClean::Tags::TildeB<>,
Inverse of the spatial metric.
Definition Tags.hpp:32
Definition Tags.hpp:25
Definition Tags.hpp:43

◆ options

using grmhd::ValenciaDivClean::FixConservatives::options
Initial value:
The x,y,z components of the uniform magnetic field threading the matter.
Definition BlastWave.hpp:114
Cutoff below which is set to MinimumValueOfD.
Definition FixConservatives.hpp:104
Cutoff below which is set to MinimumValueOfYe.
Definition FixConservatives.hpp:118
Whether or not the limiting is enabled.
Definition FixConservatives.hpp:159
Minimum value of rest-mass density times lorentz factor.
Definition FixConservatives.hpp:97
Minimum value of electron fraction .
Definition FixConservatives.hpp:111
Safety factor .
Definition FixConservatives.hpp:125
Cutoff in below which we use a stricter safety factor for the magnitude of S.
Definition FixConservatives.hpp:140
Below SafetyFactorForSCutoffD, reduce by SafetyFactorForSSlope times .
Definition FixConservatives.hpp:151
Safety factor .
Definition FixConservatives.hpp:132

◆ return_tags

using grmhd::ValenciaDivClean::FixConservatives::return_tags
Initial value:
The densitized rest-mass density .
Definition Tags.hpp:32
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

Member Data Documentation

◆ help

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:
  • src/Evolution/Systems/GrMhd/ValenciaDivClean/FixConservatives.hpp