External potential (EXTPOT_GAL) cleaned up

This commit is contained in:
Yohai Meiron 2020-03-24 20:37:23 -04:00
parent d7332be188
commit 562ea9618a
4 changed files with 230 additions and 487 deletions

View file

@ -110,6 +110,8 @@ void Config::error_checking()
throw std::runtime_error("The number of live black holes (live_smbh_count) can be 0, 1, or 2");
if (binary_smbh_pn && (live_smbh_count!=2))
throw std::runtime_error("Post-Newtonian gravity (binary_smbh_pn=true) requires live_smbh_count=2");
if (binary_smbh_pn && (pn_c <= 0))
throw std::runtime_error("Post-Newtonian gravity (binary_smbh_pn=true) requires pn_c > 0");
if (live_smbh_custom_eps == eps) live_smbh_custom_eps = -1;
if (live_smbh_output && (live_smbh_count == 0))
throw std::runtime_error("Black hole output (live_smbh_output=true) requires at least one live black hole (live_smbh_count)");
@ -122,6 +124,14 @@ void Config::error_checking()
for (int i; i<7; i++)
if (!((pn_usage[i] == 0) || (pn_usage[i] == 1)))
throw std::runtime_error("PN usage array (pn_usage) must have ones and zeros only");
if (ext_units_physical && ((norm_mass == 0) || (norm_length == 0)))
throw std::runtime_error("Physical units for external gravity (ext_units_physical) requires ext_norm_mass and ext_norm_length to be positive numbers");
if ((ext_m_bulge > 0) && (ext_b_bulge < 0))
throw std::runtime_error("To use external bulge gravity, please specify positive ext_m_bulge and ext_b_bulge");
if ((ext_m_halo_plummer > 0) && (ext_b_halo_plummer < 0))
throw std::runtime_error("To use external Plummer halo gravity, please specify positive ext_m_halo_plummer and ext_b_halo_plummer");
if ((ext_m_disk > 0) && ((ext_a_disk < 0) || (ext_b_disk < 0)))
throw std::runtime_error("To use external disk gravity, please specify positive ext_m_disk, ext_a_disk and ext_b_disk");
}
Config::Config(std::string file_name)
@ -137,16 +147,30 @@ Config::Config(std::string file_name)
eta = get_parameter<double>(dictionary, "eta");
input_file_name = get_parameter<std::string>(dictionary, "input_file_name", "data.con");
dt_min_warning = get_parameter<bool>(dictionary, "dt_min_warning", false);
live_smbh_count = get_parameter<int>(dictionary, "live_smbh_count", 0);
live_smbh_custom_eps = get_parameter<double>(dictionary, "live_smbh_custom_eps", -1);
live_smbh_output = get_parameter<bool>(dictionary, "live_smbh_output", false);
live_smbh_neighbor_output = get_parameter<bool>(dictionary, "live_smbh_neighbor_output", false);
live_smbh_neighbor_number = get_parameter<int>(dictionary, "live_smbh_neighbor_number", 10);
binary_smbh_pn = get_parameter<bool>(dictionary, "binary_smbh_pn", false);
binary_smbh_influence_sphere_output = get_parameter<bool>(dictionary, "binary_smbh_influence_sphere_output", false);
binary_smbh_influence_radius_factor = get_parameter<double>(dictionary, "binary_smbh_influence_radius_factor", 10.);
binary_smbh_pn = get_parameter<bool>(dictionary, "binary_smbh_pn", false);
pn_usage = get_parameter<std::vector<int>>(dictionary, "pn_usage", std::vector<int>({1,1,1,1,1,1,1}));
pn_c = get_parameter<double>(dictionary, "pn_c", 500);
pn_c = get_parameter<double>(dictionary, "pn_c", 0);
ext_units_physical = get_parameter<bool>(dictionary, "ext_units_physical", false);
norm_mass = get_parameter<double>(dictionary, "norm_mass", !ext_units_physical);
norm_length = get_parameter<double>(dictionary, "norm_length", !ext_units_physical);
ext_m_bulge = get_parameter<double>(dictionary, "ext_m_bulge", 0);
ext_b_bulge = get_parameter<double>(dictionary, "ext_b_bulge", -1);
ext_m_disk = get_parameter<double>(dictionary, "ext_m_disk", 0);
ext_a_disk = get_parameter<double>(dictionary, "ext_a_disk", -1);
ext_b_disk = get_parameter<double>(dictionary, "ext_b_disk", -1);
ext_m_halo_plummer = get_parameter<double>(dictionary, "ext_m_halo_plummer", 0);
ext_b_halo_plummer = get_parameter<double>(dictionary, "ext_b_halo_plummer", -1);
error_checking();
}