Skip to content
Snippets Groups Projects
Commit 1a46a2f8 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'eos_selection' into 'master'

Eos selection

Closes #743

See merge request !1290
parents 2f8eca80 85460c78
Branches
Tags
1 merge request!1290Eos selection
......@@ -909,15 +909,10 @@ The ``EoS`` section contains options for the equations of state.
Multiple EoS can be used for :ref:`planetary`,
see :ref:`planetary_eos` for more information.
To enable one or multiple of these EoS, the corresponding ``planetary_use_*:``
To enable one or multiple EoS, the corresponding ``planetary_use_*:``
flag(s) must be set to ``1`` in the parameter file for a simulation,
along with the path to any table files, which are provided with the
along with the path to any table files, which are set by the
``planetary_*_table_file:`` parameters.
This currently means that all EoS within each base type are prepared at once,
which we intend to simplify in the future.
The data files for the tabulated EoS can be downloaded using
the ``examples/EoSTables/get_eos_tables.sh`` script.
For the (non-planetary) isothermal EoS, the ``isothermal_internal_energy:``
parameter sets the thermal energy per unit mass.
......
......@@ -5,7 +5,7 @@
Planetary Equations of State
============================
Configuring SWIFT with the ``--with-equation-of-state=planetary`` and
``--with-hydro=planetary`` options enables the use of multiple
equations of state (EoS).
......@@ -29,6 +29,7 @@ The material's ID is set by a somewhat arbitrary base type ID
+ Iron: ``100``
+ Granite: ``101``
+ Water: ``102``
+ Basalt: ``103``
+ Hubbard \& MacFarlane (1980): ``2``
+ Hydrogen-helium atmosphere: ``200``
+ Ice H20-CH4-NH3 mix: ``201``
......@@ -48,18 +49,19 @@ the ``examples/Planetary/EoSTables/get_eos_tables.sh`` script.
To enable one or multiple EoS, the corresponding ``planetary_use_*:``
flag(s) must be set to ``1`` in the parameter file for a simulation,
along with the path to any table files, which are provided with the
along with the path to any table files, which are set by the
``planetary_*_table_file:`` parameters,
as detailed in :ref:`Parameters_eos` and ``examples/parameter_example.yml``.
This currently means that all EoS within each base type are prepared at once,
which we intend to simplify in the future.
The data files for the tabulated EoS can be downloaded using
the ``examples/EoSTables/get_eos_tables.sh`` script.
Unlike the EoS for an ideal or isothermal gas, these more complicated materials
do not always include transformations between the internal energy,
temperature, and entropy. At the moment, we have implemented
\\(P(\\rho, u)\\) and \\(c_s(\\rho, u)\\),
which is sufficient for the :ref:`planetary_sph` hydro scheme,
but makes most materials currently incompatible with entropy-based schemes.
but makes most materials currently incompatible with e.g. entropy-based schemes.
The Tillotson sound speed was derived using
\\(c_s^2 = \\left. ( \\partial P / \\partial \\rho ) \\right|_S \\)
......
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 5.9724e27 # Grams
UnitLength_in_cgs: 6.371e8 # Centimeters
UnitVelocity_in_cgs: 6.371e8 # Centimeters per second
UnitMass_in_cgs: 1e27 # Sets Earth mass = 5.972
UnitLength_in_cgs: 1e8 # Sets Earth radius = 6.371
UnitVelocity_in_cgs: 1e8 # Sets time in seconds
UnitCurrent_in_cgs: 1 # Amperes
UnitTemp_in_cgs: 1 # Kelvin
......@@ -38,17 +38,16 @@ SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
CFL_condition: 0.2 # Courant-Friedrich-Levy condition for time integration.
h_max: 0.2 # Maximal allowed smoothing length (in internal units).
h_max: 1.2 # Maximal allowed smoothing length (in internal units).
viscosity_alpha: 1.5 # Override for the initial value of the artificial viscosity.
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
MAC: adaptive
theta_cr: 0.7
epsilon_fmm: 0.001
use_tree_below_softening: 1
max_physical_baryon_softening: 0.003 # Physical softening length (in internal units).
eta: 0.025 # Constant dimensionless multiplier for time integration.
MAC: adaptive # Choice of mulitpole acceptance criterion: 'adaptive' OR 'geometric'.
epsilon_fmm: 0.001 # Tolerance parameter for the adaptive multipole acceptance criterion.
theta_cr: 0.7 # Opening angle for the purely gemoetric criterion.
max_physical_baryon_softening: 0.02 # Physical softening length (in internal units).
# Parameters for the task scheduling
Scheduler:
......@@ -56,11 +55,6 @@ Scheduler:
# Parameters related to the equation of state
EoS:
planetary_use_Til: 1 # Whether to initialise the Tillotson EOS
# Parameters governing the logger snapshot system
Logger:
delta_step: 10 # Update the particle log every this many updates
basename: index # Common part of the filenames
initial_buffer_size: 0.01 # (Optional) Buffer size in GB
buffer_scale: 10 # (Optional) When buffer size is too small, update it with required memory times buffer_scale
# Select which planetary EoS material(s) to enable for use.
planetary_use_Til_iron: 1 # Tillotson iron, material ID 100
planetary_use_Til_granite: 1 # Tillotson granite, material ID 101
......@@ -2,6 +2,6 @@
# Make a simple animation of the snapshots
out="earth_impact.mp4"
ffmpeg -framerate 5 -i earth_impact_%?%?%?%?%?%?.png $out -y
ffmpeg -framerate 5 -i earth_impact_%?%?%?%?.png $out -y
echo Saved $out
\ No newline at end of file
echo Saved $out
......@@ -57,10 +57,10 @@ Di_mat_colour = {
Di_id_colour = {Di_mat_id[mat]: colour for mat, colour in Di_mat_colour.items()}
def load_snapshot(snapshot_time, ax_lim):
def load_snapshot(snapshot_id, ax_lim):
""" Select and load the particles to plot. """
# Snapshot to load
snapshot = "earth_impact_%06d.hdf5" % snapshot_time
snapshot = "earth_impact_%04d.hdf5" % snapshot_id
# Only load data with the axis limits and below z=0
ax_lim = 0.1
......@@ -131,15 +131,15 @@ if __name__ == "__main__":
ax_lim = 3.4
# Plot each snapshot
for snapshot_time in range(0, 36000 + 1, 1000):
for snapshot_id in range(37):
# Load the data
pos, mat_id = load_snapshot(snapshot_time, ax_lim)
pos, mat_id = load_snapshot(snapshot_id, ax_lim)
# Plot the data
plot_snapshot(pos, mat_id, ax_lim)
# Save the figure
save = "earth_impact_%06d.png" % snapshot_time
save = "earth_impact_%04d.png" % snapshot_id
plt.savefig(save, dpi=100)
print("\rSaved %s" % save)
......
......@@ -266,20 +266,31 @@ LineOfSight:
# Parameters related to the equation of state ------------------------------------------
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_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/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
isothermal_internal_energy: 20.26784 # Thermal energy per unit mass for the case of isothermal equation of state (in internal units).
# Select which planetary EoS material(s) to enable for use.
planetary_use_idg_def: 0 # Default ideal gas, material ID 0
planetary_use_Til_iron: 1 # Tillotson iron, material ID 100
planetary_use_Til_granite: 1 # Tillotson granite, material ID 101
planetary_use_Til_water: 0 # Tillotson water, material ID 102
planetary_use_Til_basalt: 0 # Tillotson basalt, material ID 103
planetary_use_HM80_HHe: 0 # Hubbard & MacFarlane (1980) hydrogen-helium atmosphere, material ID 200
planetary_use_HM80_ice: 0 # Hubbard & MacFarlane (1980) H20-CH4-NH3 ice mix, material ID 201
planetary_use_HM80_rock: 0 # Hubbard & MacFarlane (1980) SiO2-MgO-FeS-FeO rock mix, material ID 202
planetary_use_SESAME_iron: 0 # SESAME iron 2140, material ID 300
planetary_use_SESAME_basalt: 0 # SESAME basalt 7530, material ID 301
planetary_use_SESAME_water: 0 # SESAME water 7154, material ID 302
planetary_use_SS08_water: 0 # Senft & Stewart (2008) SESAME-like water, material ID 303
planetary_use_ANEOS_forsterite: 0 # ANEOS forsterite (Stewart et al. 2019), material ID 400
planetary_use_ANEOS_iron: 0 # ANEOS iron (Stewart 2020), material ID 401
planetary_use_ANEOS_Fe85Si15: 0 # ANEOS Fe85Si15 (Stewart 2020), material ID 402
# Tablulated EoS file paths.
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
planetary_ANEOS_iron_table_file: ./EoSTables/ANEOS_iron_S20.txt
planetary_ANEOS_Fe85Si15_table_file: ./EoSTables/ANEOS_Fe85Si15_S20.txt
......
......@@ -182,136 +182,221 @@ gas_internal_energy_from_entropy(float density, float entropy,
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_internal_energy_from_entropy(density, entropy,
&eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_internal_energy_from_entropy(density, entropy,
&eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_internal_energy_from_entropy(density, entropy,
&eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_internal_energy_from_entropy(density, entropy,
&eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_internal_energy_from_entropy(density, entropy,
&eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_internal_energy_from_entropy(density, entropy,
&eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_internal_energy_from_entropy(density, entropy,
&eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_internal_energy_from_entropy(density, entropy,
&eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_internal_energy_from_entropy(density, entropy,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -333,128 +418,213 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_pressure_from_entropy(density, entropy, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_pressure_from_entropy(density, entropy, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_pressure_from_entropy(density, entropy, &eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_pressure_from_entropy(density, entropy, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_pressure_from_entropy(density, entropy, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_pressure_from_entropy(density, entropy, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_pressure_from_entropy(density, entropy, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_pressure_from_entropy(density, entropy, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.SESAME_water);
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.SS08_water);
break;
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_pressure_from_entropy(density, entropy,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -477,122 +647,207 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_entropy_from_pressure(density, P, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_entropy_from_pressure(density, P, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_entropy_from_pressure(density, P, &eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_entropy_from_pressure(density, P, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_entropy_from_pressure(density, P, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_entropy_from_pressure(density, P, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_entropy_from_pressure(density, P, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_entropy_from_pressure(density, P, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_entropy_from_pressure(density, P, &eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_entropy_from_pressure(density, P, &eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_entropy_from_pressure(density, P, &eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_entropy_from_pressure(density, P, &eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_entropy_from_pressure(density, P,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -614,129 +869,214 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_soundspeed_from_entropy(density, entropy, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_soundspeed_from_entropy(density, entropy, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_soundspeed_from_entropy(density, entropy,
&eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_soundspeed_from_entropy(density, entropy, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_soundspeed_from_entropy(density, entropy, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_soundspeed_from_entropy(density, entropy, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_soundspeed_from_entropy(density, entropy, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_soundspeed_from_entropy(density, entropy, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_soundspeed_from_entropy(density, entropy,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -758,128 +1098,213 @@ gas_entropy_from_internal_energy(float density, float u,
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_entropy_from_internal_energy(density, u, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_entropy_from_internal_energy(density, u, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_entropy_from_internal_energy(density, u, &eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_entropy_from_internal_energy(density, u, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_entropy_from_internal_energy(density, u, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_entropy_from_internal_energy(density, u, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_entropy_from_internal_energy(density, u, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_entropy_from_internal_energy(density, u, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_entropy_from_internal_energy(density, u,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -902,129 +1327,214 @@ gas_pressure_from_internal_energy(float density, float u,
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_pressure_from_internal_energy(density, u, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_pressure_from_internal_energy(density, u, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_pressure_from_internal_energy(density, u,
&eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_pressure_from_internal_energy(density, u, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_pressure_from_internal_energy(density, u, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_pressure_from_internal_energy(density, u, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_pressure_from_internal_energy(density, u, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_pressure_from_internal_energy(density, u, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_pressure_from_internal_energy(density, u,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -1050,129 +1560,214 @@ gas_internal_energy_from_pressure(float density, float P,
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_internal_energy_from_pressure(density, P, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_internal_energy_from_pressure(density, P, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_internal_energy_from_pressure(density, P,
&eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_internal_energy_from_pressure(density, P, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_internal_energy_from_pressure(density, P, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_internal_energy_from_pressure(density, P, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_internal_energy_from_pressure(density, P, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_internal_energy_from_pressure(density, P, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_internal_energy_from_pressure(density, P,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -1195,134 +1790,219 @@ gas_soundspeed_from_internal_energy(float density, float u,
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_soundspeed_from_internal_energy(density, u, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_soundspeed_from_internal_energy(density, u, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_soundspeed_from_internal_energy(density, u,
&eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_soundspeed_from_internal_energy(density, u,
&eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_soundspeed_from_internal_energy(density, u,
&eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_soundspeed_from_internal_energy(density, u,
&eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_soundspeed_from_internal_energy(density, u,
&eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_soundspeed_from_internal_energy(density, u,
&eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_soundspeed_from_internal_energy(density, u,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -1344,124 +2024,209 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
/* Ideal gas EoS */
case eos_planetary_type_idg:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_idg_def:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.idg_def.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
#endif
return idg_soundspeed_from_pressure(density, P, &eos.idg_def);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Tillotson EoS */
case eos_planetary_type_Til:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_Til_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_iron.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
#endif
return Til_soundspeed_from_pressure(density, P, &eos.Til_iron);
break;
case eos_planetary_id_Til_granite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_granite.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
#endif
return Til_soundspeed_from_pressure(density, P, &eos.Til_granite);
break;
case eos_planetary_id_Til_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_water.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
#endif
return Til_soundspeed_from_pressure(density, P, &eos.Til_water);
break;
case eos_planetary_id_Til_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.Til_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
#endif
return Til_soundspeed_from_pressure(density, P, &eos.Til_basalt);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* Hubbard & MacFarlane (1980) EoS */
case eos_planetary_type_HM80:
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_HM80_HHe:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_HHe.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
#endif
return HM80_soundspeed_from_pressure(density, P, &eos.HM80_HHe);
break;
case eos_planetary_id_HM80_ice:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_ice.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
#endif
return HM80_soundspeed_from_pressure(density, P, &eos.HM80_ice);
break;
case eos_planetary_id_HM80_rock:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.HM80_rock.mat_id != mat_id)
error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
#endif
return HM80_soundspeed_from_pressure(density, P, &eos.HM80_rock);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* SESAME EoS */
case eos_planetary_type_SESAME:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_SESAME_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
#endif
return SESAME_soundspeed_from_pressure(density, P, &eos.SESAME_iron);
break;
case eos_planetary_id_SESAME_basalt:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_basalt.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
"1");
#endif
return SESAME_soundspeed_from_pressure(density, P,
&eos.SESAME_basalt);
break;
case eos_planetary_id_SESAME_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SESAME_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
"1");
#endif
return SESAME_soundspeed_from_pressure(density, P, &eos.SESAME_water);
break;
case eos_planetary_id_SS08_water:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.SS08_water.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
#endif
return SESAME_soundspeed_from_pressure(density, P, &eos.SS08_water);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
/* ANEOS -- using SESAME-style tables */
case eos_planetary_type_ANEOS:;
/* Select the material */
/* Select the material and check it has been enabled */
switch (mat_id) {
case eos_planetary_id_ANEOS_forsterite:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_forsterite.mat_id != mat_id)
error(
"EoS not enabled. Please set "
"EoS:planetary_use_ANEOS_forsterite: 1");
#endif
return SESAME_soundspeed_from_pressure(density, P,
&eos.ANEOS_forsterite);
break;
case eos_planetary_id_ANEOS_iron:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_iron.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
#endif
return SESAME_soundspeed_from_pressure(density, P, &eos.ANEOS_iron);
break;
case eos_planetary_id_ANEOS_Fe85Si15:
#ifdef SWIFT_DEBUG_CHECKS
if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
error(
"EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
"1");
#endif
return SESAME_soundspeed_from_pressure(density, P,
&eos.ANEOS_Fe85Si15);
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material ID! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
};
break;
default:
#ifdef SWIFT_DEBUG_CHECKS
error("Unknown material type! mat_id = %d", mat_id);
return 0.f;
#endif
return -1.f;
}
}
......@@ -1475,121 +2240,127 @@ __attribute__((always_inline)) INLINE static void eos_init(
struct eos_parameters *e, const struct phys_const *phys_const,
const struct unit_system *us, struct swift_params *params) {
// Table file names
char HM80_HHe_table_file[PARSER_MAX_LINE_SIZE];
char HM80_ice_table_file[PARSER_MAX_LINE_SIZE];
char HM80_rock_table_file[PARSER_MAX_LINE_SIZE];
char SESAME_iron_table_file[PARSER_MAX_LINE_SIZE];
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];
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
// Prepare any/all requested EoS: Set the parameters and material IDs, load
// tables etc., and convert to internal units
// Ideal gas
if (parser_get_opt_param_int(params, "EoS:planetary_use_idg", 0)) {
if (parser_get_opt_param_int(params, "EoS:planetary_use_idg_def", 0)) {
set_idg_def(&e->idg_def, eos_planetary_id_idg_def);
}
// Tillotson
if (parser_get_opt_param_int(params, "EoS:planetary_use_Til", 0)) {
if (parser_get_opt_param_int(params, "EoS:planetary_use_Til_iron", 0)) {
set_Til_iron(&e->Til_iron, eos_planetary_id_Til_iron);
set_Til_granite(&e->Til_granite, eos_planetary_id_Til_granite);
set_Til_water(&e->Til_water, eos_planetary_id_Til_water);
set_Til_basalt(&e->Til_basalt, eos_planetary_id_Til_basalt);
convert_units_Til(&e->Til_iron, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_Til_granite", 0)) {
set_Til_granite(&e->Til_granite, eos_planetary_id_Til_granite);
convert_units_Til(&e->Til_granite, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_Til_water", 0)) {
set_Til_water(&e->Til_water, eos_planetary_id_Til_water);
convert_units_Til(&e->Til_water, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_Til_basalt", 0)) {
set_Til_basalt(&e->Til_basalt, eos_planetary_id_Til_basalt);
convert_units_Til(&e->Til_basalt, us);
}
// Hubbard & MacFarlane (1980)
if (parser_get_opt_param_int(params, "EoS:planetary_use_HM80", 0)) {
if (parser_get_opt_param_int(params, "EoS:planetary_use_HM80_HHe", 0)) {
char HM80_HHe_table_file[PARSER_MAX_LINE_SIZE];
set_HM80_HHe(&e->HM80_HHe, eos_planetary_id_HM80_HHe);
set_HM80_ice(&e->HM80_ice, eos_planetary_id_HM80_ice);
set_HM80_rock(&e->HM80_rock, eos_planetary_id_HM80_rock);
parser_get_param_string(params, "EoS:planetary_HM80_HHe_table_file",
HM80_HHe_table_file);
load_table_HM80(&e->HM80_HHe, HM80_HHe_table_file);
prepare_table_HM80(&e->HM80_HHe);
convert_units_HM80(&e->HM80_HHe, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_HM80_ice", 0)) {
char HM80_ice_table_file[PARSER_MAX_LINE_SIZE];
set_HM80_ice(&e->HM80_ice, eos_planetary_id_HM80_ice);
parser_get_param_string(params, "EoS:planetary_HM80_ice_table_file",
HM80_ice_table_file);
load_table_HM80(&e->HM80_ice, HM80_ice_table_file);
prepare_table_HM80(&e->HM80_ice);
convert_units_HM80(&e->HM80_ice, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_HM80_rock", 0)) {
char HM80_rock_table_file[PARSER_MAX_LINE_SIZE];
set_HM80_rock(&e->HM80_rock, eos_planetary_id_HM80_rock);
parser_get_param_string(params, "EoS:planetary_HM80_rock_table_file",
HM80_rock_table_file);
load_table_HM80(&e->HM80_HHe, HM80_HHe_table_file);
load_table_HM80(&e->HM80_ice, HM80_ice_table_file);
load_table_HM80(&e->HM80_rock, HM80_rock_table_file);
prepare_table_HM80(&e->HM80_HHe);
prepare_table_HM80(&e->HM80_ice);
prepare_table_HM80(&e->HM80_rock);
convert_units_HM80(&e->HM80_HHe, us);
convert_units_HM80(&e->HM80_ice, us);
convert_units_HM80(&e->HM80_rock, us);
}
// SESAME
if (parser_get_opt_param_int(params, "EoS:planetary_use_SESAME", 0)) {
if (parser_get_opt_param_int(params, "EoS:planetary_use_SESAME_iron", 0)) {
char SESAME_iron_table_file[PARSER_MAX_LINE_SIZE];
set_SESAME_iron(&e->SESAME_iron, eos_planetary_id_SESAME_iron);
set_SESAME_basalt(&e->SESAME_basalt, eos_planetary_id_SESAME_basalt);
set_SESAME_water(&e->SESAME_water, eos_planetary_id_SESAME_water);
set_SS08_water(&e->SESAME_water, eos_planetary_id_SS08_water);
parser_get_param_string(params, "EoS:planetary_SESAME_iron_table_file",
SESAME_iron_table_file);
load_table_SESAME(&e->SESAME_iron, SESAME_iron_table_file);
prepare_table_SESAME(&e->SESAME_iron);
convert_units_SESAME(&e->SESAME_iron, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_SESAME_basalt", 0)) {
char SESAME_basalt_table_file[PARSER_MAX_LINE_SIZE];
set_SESAME_basalt(&e->SESAME_basalt, eos_planetary_id_SESAME_basalt);
parser_get_param_string(params, "EoS:planetary_SESAME_basalt_table_file",
SESAME_basalt_table_file);
load_table_SESAME(&e->SESAME_basalt, SESAME_basalt_table_file);
prepare_table_SESAME(&e->SESAME_basalt);
convert_units_SESAME(&e->SESAME_basalt, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_SESAME_water", 0)) {
char SESAME_water_table_file[PARSER_MAX_LINE_SIZE];
set_SESAME_water(&e->SESAME_water, eos_planetary_id_SESAME_water);
parser_get_param_string(params, "EoS:planetary_SESAME_water_table_file",
SESAME_water_table_file);
load_table_SESAME(&e->SESAME_water, SESAME_water_table_file);
prepare_table_SESAME(&e->SESAME_water);
convert_units_SESAME(&e->SESAME_water, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_SS08_water", 0)) {
char SS08_water_table_file[PARSER_MAX_LINE_SIZE];
set_SS08_water(&e->SESAME_water, eos_planetary_id_SS08_water);
parser_get_param_string(params, "EoS:planetary_SS08_water_table_file",
SS08_water_table_file);
load_table_SESAME(&e->SESAME_iron, SESAME_iron_table_file);
load_table_SESAME(&e->SESAME_basalt, SESAME_basalt_table_file);
load_table_SESAME(&e->SESAME_water, SESAME_water_table_file);
load_table_SESAME(&e->SS08_water, SS08_water_table_file);
prepare_table_SESAME(&e->SESAME_iron);
prepare_table_SESAME(&e->SESAME_basalt);
prepare_table_SESAME(&e->SESAME_water);
prepare_table_SESAME(&e->SS08_water);
convert_units_SESAME(&e->SESAME_iron, us);
convert_units_SESAME(&e->SESAME_basalt, us);
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)) {
if (parser_get_opt_param_int(params, "EoS:planetary_use_ANEOS_forsterite",
0)) {
char ANEOS_forsterite_table_file[PARSER_MAX_LINE_SIZE];
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);
load_table_SESAME(&e->ANEOS_forsterite, ANEOS_forsterite_table_file);
prepare_table_SESAME(&e->ANEOS_forsterite);
convert_units_SESAME(&e->ANEOS_forsterite, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_ANEOS_iron", 0)) {
char ANEOS_iron_table_file[PARSER_MAX_LINE_SIZE];
set_ANEOS_iron(&e->ANEOS_iron, eos_planetary_id_ANEOS_iron);
parser_get_param_string(params, "EoS:planetary_ANEOS_iron_table_file",
ANEOS_iron_table_file);
load_table_SESAME(&e->ANEOS_iron, ANEOS_iron_table_file);
prepare_table_SESAME(&e->ANEOS_iron);
convert_units_SESAME(&e->ANEOS_iron, us);
}
if (parser_get_opt_param_int(params, "EoS:planetary_use_ANEOS_Fe85Si15", 0)) {
char ANEOS_Fe85Si15_table_file[PARSER_MAX_LINE_SIZE];
set_ANEOS_Fe85Si15(&e->ANEOS_Fe85Si15, eos_planetary_id_ANEOS_Fe85Si15);
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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment