diff --git a/src/dimension.h b/src/dimension.h index 9169a0796efc77c4f7842af873dcdfed4af05d0f..7c58b5b846490e8f5227a232eaaeb3df5995f795 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -229,7 +229,7 @@ __attribute__((always_inline)) INLINE static float get_radius_dimension_sphere( error("The dimension is not defined !"); return 0.f; - + #endif } diff --git a/src/equation_of_state.h b/src/equation_of_state.h index 5e570fc6343f11eb2c71720cfd51afe52161ff02..28c97c7b96b778c7bbb7bcbfb6ffe682ce54ba22 100644 --- a/src/equation_of_state.h +++ b/src/equation_of_state.h @@ -69,6 +69,21 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy( return entropy * pow_gamma(density); } +/** + * @brief Returns the entropy given density and pressure. + * + * Computes \f$A = \frac{P}{\rho^\gamma}\f$. + * + * @param density The density \f$\rho\f$. + * @param pressure The pressure \f$P\f$. + * @return The entropy \f$A\f$. + */ +__attribute__((always_inline)) INLINE static float gas_entropy_from_pressure( + float density, float pressure) { + + return pressure * pow_minus_gamma(density); +} + /** * @brief Returns the sound speed given density and entropy * @@ -111,6 +126,20 @@ gas_pressure_from_internal_energy(float density, float u) { return hydro_gamma_minus_one * u * density; } +/** + * @brief Returns the internal energy given density and pressure. + * + * Computes \f$u = \frac{1}{\gamma - 1}\frac{P}{\rho}\f$. + * + * @param density The density \f$\rho\f$. + * @param pressure The pressure \f$P\f$. + * @return The internal energy \f$u\f$. + */ +__attribute__((always_inline)) INLINE static float +gas_internal_energy_from_pressure(float density, float pressure) { + return hydro_one_over_gamma_minus_one * pressure / density; +} + /** * @brief Returns the sound speed given density and internal energy * @@ -172,6 +201,22 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy( return hydro_gamma_minus_one * const_isothermal_internal_energy * density; } +/** + * @brief Returns the entropy given density and pressure. + * + * Computes \f$A = \frac{P}{\rho^\gamma}\f$. + * + * @param density The density \f$\rho\f$. + * @param pressure The pressure \f$P\f$ (ignored). + * @return The entropy \f$A\f$. + */ +__attribute__((always_inline)) INLINE static float gas_entropy_from_pressure( + float density, float pressure) { + + return hydro_gamma_minus_one * const_isothermal_internal_energy * + pow_minus_gamma_minus_one(density); +} + /** * @brief Returns the sound speed given density and entropy * @@ -219,6 +264,20 @@ gas_pressure_from_internal_energy(float density, float u) { return hydro_gamma_minus_one * const_isothermal_internal_energy * density; } +/** + * @brief Returns the internal energy given density and pressure. + * + * Just returns the constant internal energy. + * + * @param density The density \f$\rho\f$ (ignored). + * @param pressure The pressure \f$P\f$ (ignored). + * @return The internal energy \f$u\f$ (which is constant). + */ +__attribute__((always_inline)) INLINE static float +gas_internal_energy_from_pressure(float density, float pressure) { + return const_isothermal_energy; +} + /** * @brief Returns the sound speed given density and internal energy *