Skip to content
Snippets Groups Projects
Commit 47ff6c06 authored by Jacob Kegerreis's avatar Jacob Kegerreis
Browse files

Add parameter file options to select which EOS are being used and for table file names

parent 76347111
No related branches found
No related tags found
1 merge request!547Add generic utility function to find a value in an array
......@@ -42,3 +42,7 @@ Gravity:
InitialConditions:
# The initial conditions file to read
file_name: moon_forming_impact.hdf5
# Parameters related to the equation of state
EoS:
use_Til: 1 # Whether to prepare the Tillotson EOS
......@@ -41,3 +41,11 @@ Gravity:
# Parameters related to the initial conditions
InitialConditions:
file_name: uranus_impact.hdf5 # The initial conditions file to read
# Parameters related to the equation of state
EoS:
use_HM80: 1 # Whether to prepare the Hubbard & MacFarlane (1980) EOS
# Table file paths
HM80_HHe_table_file: /gpfs/data/dc-kege1/gihr_data/P_rho_u_HHe.txt
HM80_ice_table_file: /gpfs/data/dc-kege1/gihr_data/P_rho_u_ice.txt
HM80_rock_table_file: /gpfs/data/dc-kege1/gihr_data/P_rho_u_roc.txt
......@@ -131,7 +131,16 @@ DomainDecomposition:
# 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).
isothermal_internal_energy: 20.26784 # Thermal energy per unit mass for the case of isothermal equation of state (in internal units).
use_Til: 1 # (Optional) Whether to prepare the Tillotson EOS
use_HM80: 0 # (Optional) Whether to prepare the Hubbard & MacFarlane (1980) EOS
use_ANEOS: 0 # (Optional) Whether to prepare the ANEOS EOS
use_SESAME: 0 # (Optional) Whether to prepare the SESAME EOS
# (Optional) Table file paths
HM80_HHe_table_file: HM80_HHe.txt
HM80_ice_table_file: HM80_ice.txt
HM80_rock_table_file: HM80_rock.txt
# Parameters related to external potentials --------------------------------------------
......
......@@ -1077,46 +1077,62 @@ __attribute__((always_inline)) INLINE static void eos_init(
struct eos_parameters *e, const struct phys_const *phys_const,
const struct unit_system *us, const 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];
// Set the parameters and material IDs, load tables, etc. for each material
// and convert to internal units
// Tillotson
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);
if (parser_get_opt_param_int(params, "EoS:use_Til", 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);
convert_units_Til(&e->Til_iron, us);
convert_units_Til(&e->Til_granite, us);
convert_units_Til(&e->Til_water, us);
}
// Hubbard & MacFarlane (1980)
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);
load_HM80_table(&e->HM80_HHe, HM80_HHe_table_file);
load_HM80_table(&e->HM80_ice, HM80_ice_table_file);
load_HM80_table(&e->HM80_rock, HM80_rock_table_file);
if (parser_get_opt_param_int(params, "EoS:use_HM80", 0)) {
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:HM80_HHe_table_file",
HM80_HHe_table_file);
parser_get_param_string(params, "EoS:HM80_ice_table_file",
HM80_ice_table_file);
parser_get_param_string(params, "EoS:HM80_rock_table_file",
HM80_rock_table_file);
load_HM80_table(&e->HM80_HHe, HM80_HHe_table_file);
load_HM80_table(&e->HM80_ice, HM80_ice_table_file);
load_HM80_table(&e->HM80_rock, HM80_rock_table_file);
convert_units_HM80(&e->HM80_HHe, us);
convert_units_HM80(&e->HM80_ice, us);
convert_units_HM80(&e->HM80_rock, us);
}
// ANEOS
set_ANEOS_iron(&e->ANEOS_iron, eos_planetary_id_ANEOS_iron);
set_MANEOS_forsterite(&e->MANEOS_forsterite,
eos_planetary_id_MANEOS_forsterite);
// SESAME
set_SESAME_iron(&e->SESAME_iron, eos_planetary_id_SESAME_iron);
// Convert to internal units
// Tillotson
convert_units_Til(&e->Til_iron, us);
convert_units_Til(&e->Til_granite, us);
convert_units_Til(&e->Til_water, us);
// Hubbard & MacFarlane (1980)
convert_units_HM80(&e->HM80_HHe, us);
convert_units_HM80(&e->HM80_ice, us);
convert_units_HM80(&e->HM80_rock, us);
if (parser_get_opt_param_int(params, "EoS:use_ANEOS", 0)) {
set_ANEOS_iron(&e->ANEOS_iron, eos_planetary_id_ANEOS_iron);
set_MANEOS_forsterite(&e->MANEOS_forsterite,
eos_planetary_id_MANEOS_forsterite);
// ANEOS
convert_units_ANEOS(&e->ANEOS_iron, us);
convert_units_ANEOS(&e->MANEOS_forsterite, us);
convert_units_ANEOS(&e->ANEOS_iron, us);
convert_units_ANEOS(&e->MANEOS_forsterite, us);
}
// SESAME
convert_units_SESAME(&e->SESAME_iron, us);
if (parser_get_opt_param_int(params, "EoS:use_SESAME", 0)) {
set_SESAME_iron(&e->SESAME_iron, eos_planetary_id_SESAME_iron);
convert_units_SESAME(&e->SESAME_iron, us);
}
}
/**
......
......@@ -48,12 +48,6 @@ struct HM80_params {
enum eos_planetary_material_id mat_id;
};
// Table file names
/// to be read in from the parameter file instead once finished testing...
#define HM80_HHe_table_file "/gpfs/data/dc-kege1/gihr_data/P_rho_u_HHe.txt"
#define HM80_ice_table_file "/gpfs/data/dc-kege1/gihr_data/P_rho_u_ice.txt"
#define HM80_rock_table_file "/gpfs/data/dc-kege1/gihr_data/P_rho_u_roc.txt"
// Parameter values for each material (cgs units)
INLINE static void set_HM80_HHe(struct HM80_params *mat,
enum eos_planetary_material_id mat_id) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment