|
| 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 |
|
FixConservatives & | operator= (const FixConservatives &)=default |
|
| FixConservatives (FixConservatives &&)=default |
|
FixConservatives & | operator= (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.
|
|
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()