diff --git a/src/Makefile.am b/src/Makefile.am index 6877cbe71f45d3efc5b77c72b70d8d0722bf3e13..3c2946dd889fee325820d9c4546abb3b511fb42d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,11 +65,13 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \ kernel_long_gravity.h vector.h cache.h runner_doiact.h runner_doiact_vec.h runner_doiact_grav.h runner_doiact_fft.h \ runner_doiact_nosort.h units.h intrinsics.h minmax.h kick.h timestep.h drift.h adiabatic_index.h io_properties.h \ - dimension.h equation_of_state.h part_type.h periodic.h memswap.h dump.h logger.h \ + dimension.h part_type.h periodic.h memswap.h dump.h logger.h \ gravity.h gravity_io.h gravity_cache.h \ gravity/Default/gravity.h gravity/Default/gravity_iact.h gravity/Default/gravity_io.h \ gravity/Default/gravity_debug.h gravity/Default/gravity_part.h \ sourceterms.h \ + equation_of_state.h \ + equation_of_state/ideal_gas/equation_of_state.h equation_of_state/isothermal/equation_of_state.h hydro.h hydro_io.h \ hydro/Minimal/hydro.h hydro/Minimal/hydro_iact.h hydro/Minimal/hydro_io.h \ hydro/Minimal/hydro_debug.h hydro/Minimal/hydro_part.h \ diff --git a/src/equation_of_state.c b/src/equation_of_state.c index 67557d604ae74d24a19b8049cfdf86bd5cc238ad..0953ee7114314f3baf6e86a14a6ddb0e98442dd9 100644 --- a/src/equation_of_state.c +++ b/src/equation_of_state.c @@ -23,4 +23,3 @@ /* Equation of state for the physics model * (temporary ugly solution as a global variable) */ struct eos_parameters eos; - diff --git a/src/equation_of_state.h b/src/equation_of_state.h index c678a90e3ffa5e29d964b00303cadbb8554778df..195b52514f2acc0c40959e09c088a06f0a411869 100644 --- a/src/equation_of_state.h +++ b/src/equation_of_state.h @@ -19,6 +19,13 @@ #ifndef SWIFT_EQUATION_OF_STATE_H #define SWIFT_EQUATION_OF_STATE_H +/** + * @file equation_of_state.h + * @brief Defines the equation of state of the gas we simulate in the form of + * relations between thermodynamic quantities. These are later used internally + * by all hydro schemes + */ + /* Config parameters. */ #include "../config.h" diff --git a/src/equation_of_state/ideal_gas/equation_of_state.h b/src/equation_of_state/ideal_gas/equation_of_state.h index e668f65580c50191cf53dac567e60019b11b7066..42314e0fd87cb5ee2b81bc8cf29029ab4951c869 100644 --- a/src/equation_of_state/ideal_gas/equation_of_state.h +++ b/src/equation_of_state/ideal_gas/equation_of_state.h @@ -19,16 +19,6 @@ #ifndef SWIFT_IDEAL_GAS_EQUATION_OF_STATE_H #define SWIFT_IDEAL_GAS_EQUATION_OF_STATE_H -/** - * @file equation_of_state.h - * @brief Defines the equation of state of the gas we simulate in the form of - * relations between thermodynamic quantities. These are later used internally - * by all hydro schemes - */ - -/* Config parameters. */ -#include "../config.h" - /* Some standard headers. */ #include <math.h> @@ -110,8 +100,7 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy( * @param u The internal energy \f$u\f$ */ __attribute__((always_inline)) INLINE static float -gas_entropy_from_internal_energy( - float density, float u) { +gas_entropy_from_internal_energy(float density, float u) { return hydro_gamma_minus_one * u * pow_minus_gamma_minus_one(density); } @@ -125,8 +114,7 @@ gas_entropy_from_internal_energy( * @param u The internal energy \f$u\f$ */ __attribute__((always_inline)) INLINE static float -gas_pressure_from_internal_energy( - float density, float u) { +gas_pressure_from_internal_energy(float density, float u) { return hydro_gamma_minus_one * u * density; } @@ -141,8 +129,7 @@ gas_pressure_from_internal_energy( * @return The internal energy \f$u\f$. */ __attribute__((always_inline)) INLINE static float -gas_internal_energy_from_pressure( - float density, float pressure) { +gas_internal_energy_from_pressure(float density, float pressure) { return hydro_one_over_gamma_minus_one * pressure / density; } @@ -155,8 +142,7 @@ gas_internal_energy_from_pressure( * @param u The internal energy \f$u\f$ */ __attribute__((always_inline)) INLINE static float -gas_soundspeed_from_internal_energy( - float density, float u) { +gas_soundspeed_from_internal_energy(float density, float u) { return sqrtf(u * hydro_gamma * hydro_gamma_minus_one); } @@ -198,7 +184,6 @@ __attribute__((always_inline)) INLINE static void eos_print( message("Adiabatic index gamma: %f.", hydro_gamma); } - #if defined(HAVE_HDF5) /** * @brief Write equation of state information to the snapshot @@ -207,7 +192,7 @@ __attribute__((always_inline)) INLINE static void eos_print( * @param e The #eos_parameters */ __attribute__((always_inline)) INLINE static void eos_print_snapshot( - hid_t h_grpsph, const struct eos_parameters *e ) { + hid_t h_grpsph, const struct eos_parameters *e) { io_write_attribute_f(h_grpsph, "Adiabatic index", hydro_gamma); diff --git a/src/equation_of_state/isothermal/equation_of_state.h b/src/equation_of_state/isothermal/equation_of_state.h index ccd1450e3e5b29d53d787762114343f633050753..71890b4df656cb5f44d3cb0fbb3bd6005bd6ab6a 100644 --- a/src/equation_of_state/isothermal/equation_of_state.h +++ b/src/equation_of_state/isothermal/equation_of_state.h @@ -19,16 +19,6 @@ #ifndef SWIFT_ISOTHERMAL_EQUATION_OF_STATE_H #define SWIFT_ISOTHERMAL_EQUATION_OF_STATE_H -/** - * @file equation_of_state.h - * @brief Defines the equation of state of the gas we simulate in the form of - * relations between thermodynamic quantities. These are later used internally - * by all hydro schemes - */ - -/* Config parameters. */ -#include "../config.h" - /* Some standard headers. */ #include <math.h> @@ -92,7 +82,7 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure( float density, float pressure) { return hydro_gamma_minus_one * eos.isothermal_internal_energy * - pow_minus_gamma_minus_one(density); + pow_minus_gamma_minus_one(density); } /** @@ -122,11 +112,10 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy( * @param u The internal energy \f$u\f$ */ __attribute__((always_inline)) INLINE static float -gas_entropy_from_internal_energy( - float density, float u) { +gas_entropy_from_internal_energy(float density, float u) { return hydro_gamma_minus_one * eos.isothermal_internal_energy * - pow_minus_gamma_minus_one(density); + pow_minus_gamma_minus_one(density); } /** @@ -139,8 +128,7 @@ gas_entropy_from_internal_energy( * @param u The internal energy \f$u\f$ */ __attribute__((always_inline)) INLINE static float -gas_pressure_from_internal_energy( - float density, float u) { +gas_pressure_from_internal_energy(float density, float u) { return hydro_gamma_minus_one * eos.isothermal_internal_energy * density; } @@ -155,8 +143,7 @@ gas_pressure_from_internal_energy( * @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) { +gas_internal_energy_from_pressure(float density, float pressure) { return eos.isothermal_internal_energy; } @@ -171,8 +158,7 @@ gas_internal_energy_from_pressure( * @param u The internal energy \f$u\f$ */ __attribute__((always_inline)) INLINE static float -gas_soundspeed_from_internal_energy( - float density, float u) { +gas_soundspeed_from_internal_energy(float density, float u) { return sqrtf(eos.isothermal_internal_energy * hydro_gamma * hydro_gamma_minus_one); @@ -207,7 +193,7 @@ __attribute__((always_inline)) INLINE static void eos_init( struct eos_parameters *e, const struct swift_params *params) { e->isothermal_internal_energy = - parser_get_param_float(params, "EoS:isothermal_internal_energy"); + parser_get_param_float(params, "EoS:isothermal_internal_energy"); } /** @@ -219,9 +205,9 @@ __attribute__((always_inline)) INLINE static void eos_print( const struct eos_parameters *e) { message( - "Equation of state: Isothermal with internal energy " - "per unit mass set to %f.", - e->isothermal_internal_energy); + "Equation of state: Isothermal with internal energy " + "per unit mass set to %f.", + e->isothermal_internal_energy); message("Adiabatic index gamma: %f.", hydro_gamma); }