Skip to content

Commit

Permalink
Add equilibrium_electron_fraction_from_density_temperature to 3D EOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrandrsn committed Jun 24, 2024
1 parent fb38ec0 commit 4b596cc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ class Barotropic3D : public EquationOfState<ColdEquilEos::is_relativistic, 3> {
*/
Scalar<double> equilibrium_electron_fraction_from_density_temperature(
const Scalar<double>& rest_mass_density,
const Scalar<double>& temperature) const {
const Scalar<double>& temperature) const override {
return underlying_eos_
.equilibrium_electron_fraction_from_density_temperature(
rest_mass_density, temperature);
}

Scalar<DataVector> equilibrium_electron_fraction_from_density_temperature(
const Scalar<DataVector>& rest_mass_density,
const Scalar<DataVector>& temperature) const {
const Scalar<DataVector>& temperature) const override{
return underlying_eos_
.equilibrium_electron_fraction_from_density_temperature(
rest_mass_density, temperature);
Expand Down
15 changes: 15 additions & 0 deletions src/PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,21 @@ class EquationOfState<IsRelativistic, 3> : public PUP::able {
/// \brief Returns `true` if the EOS is in beta-equilibrium
virtual bool is_equilibrium() const = 0;

/// @{
/*!
* Computes the electron fraction in beta-equilibrium \f$Y_e^{\rm eq}\f$ from
* the rest mass density \f$\rho\f$ and the temperature \f$T\f$.
*/
virtual Scalar<double> equilibrium_electron_fraction_from_density_temperature(
const Scalar<double>& /*rest_mass_density*/,
const Scalar<double>& /*temperature*/) const = 0;

virtual Scalar<DataVector>
equilibrium_electron_fraction_from_density_temperature(
const Scalar<DataVector>& /*rest_mass_density*/,
const Scalar<DataVector>& /*temperature*/) const = 0;
/// @}

/// @{
/*!
* Computes the pressure \f$p\f$ from the rest mass density \f$\rho\f$, the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ class Equilibrium3D : public EquationOfState<EquilEos::is_relativistic, 3> {
*/
Scalar<double> equilibrium_electron_fraction_from_density_temperature(
const Scalar<double>& rest_mass_density,
const Scalar<double>& temperature) const {
const Scalar<double>& temperature) const override{
return underlying_eos_
.equilibrium_electron_fraction_from_density_temperature(
rest_mass_density, temperature);
}

Scalar<DataVector> equilibrium_electron_fraction_from_density_temperature(
const Scalar<DataVector>& rest_mass_density,
const Scalar<DataVector>& temperature) const {
const Scalar<DataVector>& temperature) const override {
return underlying_eos_
.equilibrium_electron_fraction_from_density_temperature(
rest_mass_density, temperature);
Expand Down
9 changes: 9 additions & 0 deletions src/PointwiseFunctions/Hydro/EquationsOfState/Tabulated3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,3 +660,12 @@ Tabulated3D<IsRelativistic>::Tabulated3D(const std::string& filename,

template class EquationsOfState::Tabulated3D<true>;
template class EquationsOfState::Tabulated3D<false>;

//template Scalar<double> EquationsOfState::Tabulated3D<true>::
// equilibrium_electron_fraction_from_density_temperature(
// Tensor<double, brigand::list<>, brigand::list<>> const&,
// Tensor<double, brigand::list<>, brigand::list<>> const&) const;
//template Scalar<DataVector> EquationsOfState::Tabulated3D<true>::
// equilibrium_electron_fraction_from_density_temperature(
// Tensor<DataVector, brigand::list<>, brigand::list<>> const&,
// Tensor<DataVector, brigand::list<>, brigand::list<>> const&) const;
6 changes: 3 additions & 3 deletions src/PointwiseFunctions/Hydro/EquationsOfState/Tabulated3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Tabulated3D : public EquationOfState<IsRelativistic, 3> {
/// \brief Returns `true` if the EOS is barotropic
bool is_barotropic() const override { return false; }

/// \breif Returns `true` if the EOS is in beta-equilibrium
/// \brief Returns `true` if the EOS is in beta-equilibrium
bool is_equilibrium() const override { return false; }

bool operator==(const Tabulated3D<IsRelativistic>& rhs) const;
Expand All @@ -148,14 +148,14 @@ class Tabulated3D : public EquationOfState<IsRelativistic, 3> {
*/
Scalar<double> equilibrium_electron_fraction_from_density_temperature(
const Scalar<double>& rest_mass_density,
const Scalar<double>& temperature) const {
const Scalar<double>& temperature) const override {
return equilibrium_electron_fraction_from_density_temperature_impl<double>(
rest_mass_density, temperature);
}

Scalar<DataVector> equilibrium_electron_fraction_from_density_temperature(
const Scalar<DataVector>& rest_mass_density,
const Scalar<DataVector>& temperature) const {
const Scalar<DataVector>& temperature) const override{
return equilibrium_electron_fraction_from_density_temperature_impl<
DataVector>(rest_mass_density, temperature);
}
Expand Down

0 comments on commit 4b596cc

Please sign in to comment.