Skip to content
Snippets Groups Projects
Commit 4efc01bc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added pressure to entropy and pressure to internal energy functions to the...

Added pressure to entropy and pressure to internal energy functions to the equation of state definition.
parent 73fb4d64
No related branches found
No related tags found
No related merge requests found
......@@ -229,7 +229,7 @@ __attribute__((always_inline)) INLINE static float get_radius_dimension_sphere(
error("The dimension is not defined !");
return 0.f;
#endif
}
......
......@@ -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
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment