Skip to content

Commit

Permalink
Fix Kastaun for 1D EOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jyoo1042 committed Sep 26, 2023
1 parent fb1f216 commit 4720aa3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Evolution/Systems/GrMhd/ValenciaDivClean/KastaunEtAl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Primitives FunctionOfMu<ThermodynamicDim>::primitives(const double mu) const {
q_ - 0.5 * b_squared_ -
0.5 * square(mu * x) * (r_squared_ * b_squared_ - r_dot_b_squared_);
// Equation (42) with bounds from Equation (6)
const double epsilon_hat = std::clamp(
double epsilon_hat = std::clamp(
w_hat * (q_bar - mu * r_bar_squared) +
v_hat_squared * square(w_hat) / (1.0 + w_hat),
equation_of_state_.specific_internal_energy_lower_bound(rho_hat),
Expand All @@ -259,6 +259,8 @@ Primitives FunctionOfMu<ThermodynamicDim>::primitives(const double mu) const {
if constexpr (ThermodynamicDim == 1) {
p_hat =
get(equation_of_state_.pressure_from_density(Scalar<double>(rho_hat)));
epsilon_hat = get(equation_of_state_.specific_internal_energy_from_density(
Scalar<double>(rho_hat)));
} else if constexpr (ThermodynamicDim == 2) {
p_hat = get(equation_of_state_.pressure_from_density_and_energy(
Scalar<double>(rho_hat), Scalar<double>(epsilon_hat)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Primitives FunctionOfZ<ThermodynamicDim, EnforcePhysicality>::primitives(
equation_of_state_.rest_mass_density_upper_bound());

// Equation (C14) and (C16)
const double epsilon_hat = std::clamp(
double epsilon_hat = std::clamp(
w_hat * q_ - z * (r_ - z / (1. + w_hat)),
equation_of_state_.specific_internal_energy_lower_bound(rho_hat),
equation_of_state_.specific_internal_energy_upper_bound(rho_hat));
Expand All @@ -129,6 +129,8 @@ Primitives FunctionOfZ<ThermodynamicDim, EnforcePhysicality>::primitives(
if constexpr (ThermodynamicDim == 1) {
p_hat =
get(equation_of_state_.pressure_from_density(Scalar<double>(rho_hat)));
epsilon_hat = get(equation_of_state_.specific_internal_energy_from_density(
Scalar<double>(rho_hat)));
} else if constexpr (ThermodynamicDim == 2) {
p_hat = get(equation_of_state_.pressure_from_density_and_energy(
Scalar<double>(rho_hat), Scalar<double>(epsilon_hat)));
Expand Down

0 comments on commit 4720aa3

Please sign in to comment.