Commit 90a5816d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Applied code formatting tool

parent 45267fb2
......@@ -83,10 +83,10 @@ enum eos_planetary_material_id {
/*! Tillotson water */
eos_planetary_id_Til_water =
eos_planetary_type_Til * eos_planetary_type_factor + 2,
/*! Tillotson basalt */
eos_planetary_id_Til_basalt =
eos_planetary_type_Til * eos_planetary_type_factor + 3,
eos_planetary_type_Til * eos_planetary_type_factor + 3,
/* Hubbard & MacFarlane (1980) Uranus/Neptune */
......@@ -263,12 +263,12 @@ gas_internal_energy_from_entropy(float density, float entropy,
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_Fe85Si15);
......@@ -391,12 +391,12 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_Fe85Si15);
......@@ -513,7 +513,8 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_forsterite);
return SESAME_entropy_from_pressure(density, P,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
......@@ -1290,16 +1291,17 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_soundspeed_from_pressure(density, P, &eos.ANEOS_forsterite);
return SESAME_soundspeed_from_pressure(density, P,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
return SESAME_soundspeed_from_pressure(density, P, &eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
return SESAME_soundspeed_from_pressure(density, P, &eos.ANEOS_Fe85Si15);
return SESAME_soundspeed_from_pressure(density, P,
&eos.ANEOS_Fe85Si15);
break;
default:
......@@ -1411,7 +1413,8 @@ __attribute__((always_inline)) INLINE static void eos_init(
// ANEOS -- using SESAME-style tables
if (parser_get_opt_param_int(params, "EoS:planetary_use_ANEOS", 0)) {
set_ANEOS_forsterite(&e->ANEOS_forsterite, eos_planetary_id_ANEOS_forsterite);
set_ANEOS_forsterite(&e->ANEOS_forsterite,
eos_planetary_id_ANEOS_forsterite);
set_ANEOS_iron(&e->ANEOS_iron, eos_planetary_id_ANEOS_iron);
set_ANEOS_Fe85Si15(&e->ANEOS_Fe85Si15, eos_planetary_id_ANEOS_Fe85Si15);
......
......@@ -29,8 +29,8 @@
*/
/* Some standard headers. */
#include <math.h>
#include <float.h>
#include <math.h>
/* Local headers. */
#include "adiabatic_index.h"
......@@ -385,13 +385,12 @@ INLINE static float SESAME_pressure_from_internal_energy(
P_2 = mat->table_P_rho_T[idx_rho * mat->num_T + idx_u_1 + 1];
P_3 = mat->table_P_rho_T[(idx_rho + 1) * mat->num_T + idx_u_2];
P_4 = mat->table_P_rho_T[(idx_rho + 1) * mat->num_T + idx_u_2 + 1];
// If below the minimum u at this rho then just use the lowest table values
if ((idx_rho > 0.f) && (
(intp_u_1 < 0.f) || (intp_u_2 < 0.f) || (P_1 > P_2) || (P_3 > P_4)
)) {
intp_u_1 = 0;
intp_u_2 = 0;
if ((idx_rho > 0.f) &&
((intp_u_1 < 0.f) || (intp_u_2 < 0.f) || (P_1 > P_2) || (P_3 > P_4))) {
intp_u_1 = 0;
intp_u_2 = 0;
}
// If more than two table values are non-positive then return zero
......@@ -403,7 +402,7 @@ INLINE static float SESAME_pressure_from_internal_energy(
if (num_non_pos > 0) {
// If just one or two are non-positive then replace them with a tiny value
// Unless already trying to extrapolate in which case return zero
if ((num_non_pos > 2) || (mat->P_tiny == 0.f) || (intp_rho < 0.f) ||
if ((num_non_pos > 2) || (mat->P_tiny == 0.f) || (intp_rho < 0.f) ||
(intp_u_1 < 0.f) || (intp_u_2 < 0.f)) {
return 0.f;
}
......
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