Commit f476bfc9 authored by Jacob Kegerreis 's avatar Jacob Kegerreis
Browse files

Add ANEOS forsterite with SESAME-style table

parent f53803f5
......@@ -248,25 +248,26 @@ LineOfSight:
EoS:
isothermal_internal_energy: 20.26784 # Thermal energy per unit mass for the case of isothermal equation of state (in internal units).
planetary_use_Til: 1 # (Optional) Whether to prepare the Tillotson EOS
planetary_use_HM80: 0 # (Optional) Whether to prepare the Hubbard & MacFarlane (1980) EOS
planetary_use_ANEOS: 0 # (Optional) Whether to prepare the ANEOS EOS
planetary_use_SESAME: 0 # (Optional) Whether to prepare the SESAME EOS
planetary_use_Til: 1 # (Optional) Whether to prepare the Tillotson EoS
planetary_use_HM80: 0 # (Optional) Whether to prepare the Hubbard & MacFarlane (1980) EoS
planetary_use_SESAME: 0 # (Optional) Whether to prepare the SESAME EoS
planetary_use_ANEOS: 0 # (Optional) Whether to prepare the ANEOS EoS
# (Optional) Table file paths
planetary_HM80_HHe_table_file: ./EoSTables/planetary_HM80_HHe.txt
planetary_HM80_ice_table_file: ./EoSTables/planetary_HM80_ice.txt
planetary_HM80_rock_table_file: ./EoSTables/planetary_HM80_rock.txt
planetary_SESAME_iron_table_file: ./EoSTables/planetary_SESAME_iron_2140.txt
planetary_SESAME_basalt_table_file: ./EoSTables/planetary_SESAME_basalt_7530.txt
planetary_SESAME_water_table_file: ./EoSTables/planetary_SESAME_water_7154.txt
planetary_SS08_water_table_file: ./EoSTables/planetary_SS08_water.txt
planetary_HM80_HHe_table_file: ./EoSTables/HM80_HHe.txt
planetary_HM80_ice_table_file: ./EoSTables/HM80_ice.txt
planetary_HM80_rock_table_file: ./EoSTables/HM80_rock.txt
planetary_SESAME_iron_table_file: ./EoSTables/SESAME_iron_2140.txt
planetary_SESAME_basalt_table_file: ./EoSTables/SESAME_basalt_7530.txt
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
# Parameters related to external potentials --------------------------------------------
# Point mass external potentials
PointMassPotential:
useabspos: 0 # 0 -> positions based on centre, 1 -> absolute positions
position: [50.,50.0,50.] # location of external point mass (internal units)
position: [50.,50.,50.] # location of external point mass (internal units)
mass: 1e10 # mass of external point mass (internal units)
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
softening: 0.05 # For point-mass-softened option
......@@ -421,9 +422,9 @@ GEARChemistry:
# EAGLE star formation model (Schaye and Dalla Vecchia 2008)
EAGLEStarFormation:
EOS_density_norm_H_p_cm3: 0.1 # Physical density used for the normalisation of the EOS assumed for the star-forming gas in Hydrogen atoms per cm^3.
EOS_temperature_norm_K: 8000 # Temperature om the polytropic EOS assumed for star-forming gas at the density normalisation in Kelvin.
EOS_gamma_effective: 1.3333333 # Slope the of the polytropic EOS assumed for the star-forming gas.
EOS_density_norm_H_p_cm3: 0.1 # Physical density used for the normalisation of the EoS assumed for the star-forming gas in Hydrogen atoms per cm^3.
EOS_temperature_norm_K: 8000 # Temperature om the polytropic EoS assumed for star-forming gas at the density normalisation in Kelvin.
EOS_gamma_effective: 1.3333333 # Slope the of the polytropic EoS assumed for the star-forming gas.
gas_fraction: 0.25 # (Optional) The gas fraction used internally by the model (Defaults to 1).
KS_normalisation: 1.515e-4 # Normalization of the Kennicutt-Schmidt law in Msun / kpc^2 / yr.
KS_exponent: 1.4 # Exponent of the Kennicutt-Schmidt law.
......@@ -431,7 +432,7 @@ EAGLEStarFormation:
KS_high_density_threshold_H_p_cm3: 1e3 # Hydrogen number density above which the Kennicut-Schmidt law changes slope in Hydrogen atoms per cm^3.
KS_high_density_exponent: 2.0 # Slope of the Kennicut-Schmidt law above the high-density threshold.
KS_max_density_threshold_H_p_cm3: 1e5 # (Optional) Density above which a gas particle gets automatically turned into a star in Hydrogen atoms per cm^3 (Defaults to FLT_MAX).
EOS_entropy_margin_dex: 0.5 # (Optional) Logarithm base 10 of the maximal entropy above the EOS at which stars can form.
EOS_entropy_margin_dex: 0.5 # (Optional) Logarithm base 10 of the maximal entropy above the EoS at which stars can form.
threshold_norm_H_p_cm3: 0.1 # Normalisation of the metal-dependant density threshold for star formation in Hydrogen atoms per cm^3.
threshold_Z0: 0.002 # Reference metallicity (metal mass fraction) for the metal-dependant threshold for star formation.
threshold_slope: -0.64 # Slope of the metal-dependant star formation threshold
......
......@@ -60,6 +60,9 @@ enum eos_planetary_type_id {
/*! SESAME */
eos_planetary_type_SESAME = 3,
/*! ANEOS */
eos_planetary_type_ANEOS = 4,
};
/**
......@@ -116,6 +119,12 @@ enum eos_planetary_material_id {
/*! Senft & Stewart (2008) SESAME-like water */
eos_planetary_id_SS08_water =
eos_planetary_type_SESAME * eos_planetary_type_factor + 3,
/* ANEOS */
/*! ANEOS forsterite (Stewart et al. 2019) -- in SESAME-style tables */
eos_planetary_id_ANEOS_forsterite =
eos_planetary_type_ANEOS * eos_planetary_type_factor,
};
/* Individual EOS function headers. */
......@@ -129,7 +138,7 @@ 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;
struct SESAME_params SESAME_iron, SESAME_basalt, SESAME_water, SS08_water, ANEOS_forsterite;
};
/**
......@@ -236,6 +245,22 @@ gas_internal_energy_from_entropy(float density, float entropy,
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -338,6 +363,22 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -437,6 +478,21 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -540,6 +596,22 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -642,6 +714,22 @@ gas_entropy_from_internal_energy(float density, float u,
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_entropy_from_internal_energy(density, u,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -746,6 +834,22 @@ gas_pressure_from_internal_energy(float density, float u,
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_pressure_from_internal_energy(density, u,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -853,6 +957,22 @@ gas_internal_energy_from_pressure(float density, float P,
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_internal_energy_from_pressure(density, P,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -962,6 +1082,22 @@ gas_soundspeed_from_internal_energy(float density, float u,
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -1061,6 +1197,21 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
return SESAME_soundspeed_from_pressure(density, P, &eos.ANEOS_forsterite);
break;
default:
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
};
break;
default:
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
......@@ -1085,6 +1236,7 @@ __attribute__((always_inline)) INLINE static void eos_init(
char SESAME_basalt_table_file[PARSER_MAX_LINE_SIZE];
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];
// Set the parameters and material IDs, load tables, etc. for each material
// and convert to internal units
......@@ -1158,6 +1310,20 @@ __attribute__((always_inline)) INLINE static void eos_init(
convert_units_SESAME(&e->SESAME_water, us);
convert_units_SESAME(&e->SS08_water, us);
}
// 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);
parser_get_param_string(params, "EoS:planetary_ANEOS_forsterite_table_file",
ANEOS_forsterite_table_file);
load_table_SESAME(&e->ANEOS_forsterite, ANEOS_forsterite_table_file);
prepare_table_SESAME(&e->ANEOS_forsterite);
convert_units_SESAME(&e->ANEOS_forsterite, us);
}
}
/**
......
......@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_SESAME_EQUATION_OF_STATE_H
#ifndef SWIFT_SESAME_EQUATION_OF_STATE_H //### or aneos?
#define SWIFT_SESAME_EQUATION_OF_STATE_H
/**
......@@ -75,6 +75,11 @@ INLINE static void set_SS08_water(struct SESAME_params *mat,
// Senft & Stewart (2008)
mat->mat_id = mat_id;
}
INLINE static void set_ANEOS_forsterite(struct SESAME_params *mat,
enum eos_planetary_material_id mat_id) {
// Stewart et al. (2019)
mat->mat_id = mat_id;
}
// Read the tables from file
INLINE static void load_table_SESAME(struct SESAME_params *mat,
......
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