Commit 663491b8 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Pass the physical constants and the internal unit system to the initialisation of the EoS.

parent 62c6eed3
......@@ -611,7 +611,7 @@ int main(int argc, char *argv[]) {
/* Initialise the hydro properties */
if (with_hydro)
hydro_props_init(&hydro_properties, &prog_const, &us, params);
if (with_hydro) eos_init(&eos, params);
if (with_hydro) eos_init(&eos, &prog_const, &us, params);
/* Initialise the gravity properties */
if (with_self_gravity)
......
......@@ -26,10 +26,15 @@
#include "adiabatic_index.h"
#include "common_io.h"
#include "inline.h"
#include "physical_constants.h"
extern struct eos_parameters eos;
/* ------------------------------------------------------------------------- */
/**
* @brief The parameters of the equation of state for the gas.
*
* This equation of state is parameter-free.
*/
struct eos_parameters {};
/**
......@@ -164,12 +169,16 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
/**
* @brief Initialize the eos parameters
*
* @param e The #eos_paramters
* @param params The parsed parameters
* Nothing to do here since this EoS is parameter-free.
*
* @param e The #eos_paramters.
* @param phys_const The physical constants in the internal unit system.
* @param us The internal unit system.
* @param params The parsed parameters.
*/
__attribute__((always_inline)) INLINE static void eos_init(
struct eos_parameters *e, const struct swift_params *params) {}
struct eos_parameters *e, const struct phys_const *phys_const,
const struct unit_system *us, const struct swift_params *params) {}
/**
* @brief Print the equation of state
*
......
......@@ -26,6 +26,7 @@
#include "adiabatic_index.h"
#include "common_io.h"
#include "inline.h"
#include "physical_constants.h"
extern struct eos_parameters eos;
/* ------------------------------------------------------------------------- */
......@@ -180,16 +181,19 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
hydro_gamma_minus_one);
}
/* ------------------------------------------------------------------------- */
/**
* @brief Initialize the eos parameters
*
* @param e The #eos_paramters
* @param params The parsed parameters
* Read the constant internal energy from the parameter file.
*
* @param e The #eos_paramters.
* @param phys_const The physical constants in the internal unit system.
* @param us The internal unit system.
* @param params The parsed parameters.
*/
__attribute__((always_inline)) INLINE static void eos_init(
struct eos_parameters *e, const struct swift_params *params) {
struct eos_parameters *e, const struct phys_const *phys_const,
const struct unit_system *us, const struct swift_params *params) {
e->isothermal_internal_energy =
parser_get_param_float(params, "EoS:isothermal_internal_energy");
......
......@@ -41,6 +41,14 @@
#define hydro_props_default_min_temp 0.f
#define hydro_props_default_H_fraction 0.76
/**
* @brief Initialize the global properties of the hydro scheme.
*
* @param p The #hydro_props.
* @param phys_const The physical constants in the internal unit system.
* @param us The internal unit system.
* @param params The parsed parameters.
*/
void hydro_props_init(struct hydro_props *p,
const struct phys_const *phys_const,
const struct unit_system *us,
......@@ -128,6 +136,11 @@ void hydro_props_init(struct hydro_props *p,
p->minimal_internal_energy = u_min / mean_molecular_weight;
}
/**
* @brief Print the global properties of the hydro scheme.
*
* @param p The #hydro_props.
*/
void hydro_props_print(const struct hydro_props *p) {
/* Print equation of state first */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment