diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 23ee3f49fc30b9db54ebfa1babeefd4cb12e50bb..4bbe69914c7f7a256b06bc41ccd7c26f5fd64ba3 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -261,6 +261,8 @@ EoS: planetary_SESAME_water_table_file: ./EoSTables/SESAME_water_7154.txt planetary_SS08_water_table_file: ./EoSTables/SS08_water.txt planetary_ANEOS_forsterite_table_file: ./EoSTables/ANEOS_forsterite_S19.txt + planetary_ANEOS_iron_table_file: ./EoSTables/ANEOS_iron_S20.txt + planetary_ANEOS_Fe85Si15_table_file: ./EoSTables/ANEOS_Fe85Si15_S20.txt # Parameters related to external potentials -------------------------------------------- diff --git a/src/equation_of_state/planetary/equation_of_state.h b/src/equation_of_state/planetary/equation_of_state.h index d6ba4278a199c321eccf6fc18fbc511463c28c43..7e6260758e323ff6805a3c1b06a8aa1808820544 100644 --- a/src/equation_of_state/planetary/equation_of_state.h +++ b/src/equation_of_state/planetary/equation_of_state.h @@ -125,6 +125,14 @@ enum eos_planetary_material_id { /*! ANEOS forsterite (Stewart et al. 2019) -- in SESAME-style tables */ eos_planetary_id_ANEOS_forsterite = eos_planetary_type_ANEOS * eos_planetary_type_factor, + + /*! ANEOS iron (Stewart 2020) -- in SESAME-style tables */ + eos_planetary_id_ANEOS_iron = + eos_planetary_type_ANEOS * eos_planetary_type_factor + 1, + + /*! ANEOS Fe85Si15 (Stewart 2020) -- in SESAME-style tables */ + eos_planetary_id_ANEOS_Fe85Si15 = + eos_planetary_type_ANEOS * eos_planetary_type_factor + 2, }; /* Individual EOS function headers. */ @@ -138,7 +146,8 @@ enum eos_planetary_material_id { struct eos_parameters { struct Til_params Til_iron, Til_granite, Til_water, Til_basalt; struct HM80_params HM80_HHe, HM80_ice, HM80_rock; - struct SESAME_params SESAME_iron, SESAME_basalt, SESAME_water, SS08_water, ANEOS_forsterite; + struct SESAME_params SESAME_iron, SESAME_basalt, SESAME_water, SS08_water; + struct SESAME_params ANEOS_forsterite, ANEOS_iron, ANEOS_Fe85Si15; }; /** @@ -254,6 +263,16 @@ 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); + break; default: error("Unknown material ID! mat_id = %d", mat_id); @@ -372,6 +391,16 @@ __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); + break; default: error("Unknown material ID! mat_id = %d", mat_id); @@ -487,6 +516,14 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure( return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_forsterite); break; + case eos_planetary_id_ANEOS_iron: + return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_iron); + break; + + case eos_planetary_id_ANEOS_Fe85Si15: + return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_Fe85Si15); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -606,6 +643,16 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy( &eos.ANEOS_forsterite); break; + case eos_planetary_id_ANEOS_iron: + return SESAME_soundspeed_from_entropy(density, entropy, + &eos.ANEOS_iron); + break; + + case eos_planetary_id_ANEOS_Fe85Si15: + return SESAME_soundspeed_from_entropy(density, entropy, + &eos.ANEOS_Fe85Si15); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -724,6 +771,16 @@ gas_entropy_from_internal_energy(float density, float u, &eos.ANEOS_forsterite); break; + case eos_planetary_id_ANEOS_iron: + return SESAME_entropy_from_internal_energy(density, u, + &eos.ANEOS_iron); + break; + + case eos_planetary_id_ANEOS_Fe85Si15: + return SESAME_entropy_from_internal_energy(density, u, + &eos.ANEOS_Fe85Si15); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -844,6 +901,16 @@ gas_pressure_from_internal_energy(float density, float u, &eos.ANEOS_forsterite); break; + case eos_planetary_id_ANEOS_iron: + return SESAME_pressure_from_internal_energy(density, u, + &eos.ANEOS_iron); + break; + + case eos_planetary_id_ANEOS_Fe85Si15: + return SESAME_pressure_from_internal_energy(density, u, + &eos.ANEOS_Fe85Si15); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -967,6 +1034,16 @@ gas_internal_energy_from_pressure(float density, float P, &eos.ANEOS_forsterite); break; + case eos_planetary_id_ANEOS_iron: + return SESAME_internal_energy_from_pressure(density, P, + &eos.ANEOS_iron); + break; + + case eos_planetary_id_ANEOS_Fe85Si15: + return SESAME_internal_energy_from_pressure(density, P, + &eos.ANEOS_Fe85Si15); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -1092,6 +1169,16 @@ gas_soundspeed_from_internal_energy(float density, float u, &eos.ANEOS_forsterite); break; + case eos_planetary_id_ANEOS_iron: + return SESAME_soundspeed_from_internal_energy(density, u, + &eos.ANEOS_iron); + break; + + case eos_planetary_id_ANEOS_Fe85Si15: + return SESAME_soundspeed_from_internal_energy(density, u, + &eos.ANEOS_Fe85Si15); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -1206,6 +1293,15 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure( 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); + break; + default: error("Unknown material ID! mat_id = %d", mat_id); return 0.f; @@ -1237,6 +1333,8 @@ __attribute__((always_inline)) INLINE static void eos_init( char SESAME_water_table_file[PARSER_MAX_LINE_SIZE]; char SS08_water_table_file[PARSER_MAX_LINE_SIZE]; char ANEOS_forsterite_table_file[PARSER_MAX_LINE_SIZE]; + char ANEOS_iron_table_file[PARSER_MAX_LINE_SIZE]; + char ANEOS_Fe85Si15_table_file[PARSER_MAX_LINE_SIZE]; // Set the parameters and material IDs, load tables, etc. for each material // and convert to internal units @@ -1314,15 +1412,27 @@ __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_iron(&e->ANEOS_iron, eos_planetary_id_ANEOS_iron); + set_ANEOS_Fe85Si15(&e->ANEOS_Fe85Si15, eos_planetary_id_ANEOS_Fe85Si15); parser_get_param_string(params, "EoS:planetary_ANEOS_forsterite_table_file", ANEOS_forsterite_table_file); + parser_get_param_string(params, "EoS:planetary_ANEOS_iron_table_file", + ANEOS_iron_table_file); + parser_get_param_string(params, "EoS:planetary_ANEOS_Fe85Si15_table_file", + ANEOS_Fe85Si15_table_file); load_table_SESAME(&e->ANEOS_forsterite, ANEOS_forsterite_table_file); + load_table_SESAME(&e->ANEOS_iron, ANEOS_iron_table_file); + load_table_SESAME(&e->ANEOS_Fe85Si15, ANEOS_Fe85Si15_table_file); prepare_table_SESAME(&e->ANEOS_forsterite); + prepare_table_SESAME(&e->ANEOS_iron); + prepare_table_SESAME(&e->ANEOS_Fe85Si15); convert_units_SESAME(&e->ANEOS_forsterite, us); + convert_units_SESAME(&e->ANEOS_iron, us); + convert_units_SESAME(&e->ANEOS_Fe85Si15, us); } } diff --git a/src/equation_of_state/planetary/sesame.h b/src/equation_of_state/planetary/sesame.h index d49ca15828ea459647c2d8339ed1d80936f93c34..cb62342c055ce9d1d3c14bf066799214123464aa 100644 --- a/src/equation_of_state/planetary/sesame.h +++ b/src/equation_of_state/planetary/sesame.h @@ -23,11 +23,9 @@ /** * @file equation_of_state/planetary/sesame.h * - * Contains the SESAME EOS functions for + * Contains the SESAME and ANEOS-in-SESAME-style EOS functions for * equation_of_state/planetary/equation_of_state.h * - * WORK IN PROGRESS! - * */ /* Some standard headers. */ @@ -81,6 +79,16 @@ INLINE static void set_ANEOS_forsterite(struct SESAME_params *mat, // Stewart et al. (2019) mat->mat_id = mat_id; } +INLINE static void set_ANEOS_iron(struct SESAME_params *mat, + enum eos_planetary_material_id mat_id) { + // Stewart (2020) + mat->mat_id = mat_id; +} +INLINE static void set_ANEOS_Fe85Si15(struct SESAME_params *mat, + enum eos_planetary_material_id mat_id) { + // Stewart (2020) + mat->mat_id = mat_id; +} // Read the tables from file INLINE static void load_table_SESAME(struct SESAME_params *mat,