71 eos.polyk = 2.0 / 3.0 * RK2;
73 bool use_krome =
false;
74 int maxvxyzu = (eos.gamma != 1.) ? 4 : 3;
79 logger::raw_ln(
"KROME eos: initial gamma = 1.666667");
81 logger::raw_ln(shambase::format(
"adiabatic eos: gamma = {}", eos.gamma));
86 "setting isothermal sound speed^2 (polyk) = {}, gamma = {}",
89 if (eos.polyk <= std::numeric_limits<f64>::epsilon()) {
92 "WARNING! sound speed zero in dump!, polyk = {}", eos.polyk));
102 if (std::abs(eos.gamma - 1.0) > std::numeric_limits<f64>::epsilon() && maxvxyzu < 4) {
105 "WARNING! compiled for isothermal equation of state but gamma /= 1, gamma={}",
109 if (ieos == 3 || ieos == 6 || ieos == 7) {
110 if (eos.qfacdisc <= std::numeric_limits<f64>::epsilon()) {
112 logger::raw_ln(shambase::format(
"ERROR: qfacdisc <= 0"));
115 logger::raw_ln(shambase::format(
"qfacdisc = {}", eos.qfacdisc));
124 if (std::abs(eos.qfacdisc2) <= std::numeric_limits<f64>::epsilon()) {
126 logger::raw_ln(shambase::format(
"ERROR: qfacdisc2 == 0"));
129 logger::raw_ln(shambase::format(
"qfacdisc2 = {}", eos.qfacdisc2));
138namespace shammodels::sph::phdump {
145 if (ieos_dump != ieos) {
147 "You are querying phantom dump eos {} parameters, even though ieos is {}",
166 EOSPhConfig eos = read_headeropts_eos(dump, 1);
168 cs = sycl::sqrt(eos.polyk);
177 write_headeropts_eos(1, dump, eos);
198 EOSPhConfig eos = read_headeropts_eos(dump, 2);
209 write_headeropts_eos(2, dump, eos);
231 EOSPhConfig eos = read_headeropts_eos(dump, 3);
233 cs0 = sycl::sqrt(eos.polyk);
241 eos.polyk = cs0 * cs0 / (r0 * r0);
245 write_headeropts_eos(3, dump, eos);
261 EOSPhConfig eos = read_headeropts_eos(dump, 13);
263 cs0 = sycl::sqrt(eos.polyk);
271 eos.polyk = cs0 * cs0 / (r0 * r0);
275 write_headeropts_eos(13, dump, eos);
289 EOSPhConfig eos = read_headeropts_eos(dump, 14);
291 cs0 = sycl::sqrt(eos.polyk);
299 eos.polyk = cs0 * cs0 / (r0 * r0);
303 write_headeropts_eos(14, dump, eos);
void assert_ieos_val(const PhantomDump &dump, int ieos)
Check that the eos in the dump is the expected one.
void eos2_write(PhantomDump &dump, const f64 &gamma)
Write the EOS2 to the phantom dump.
void eos1_write(PhantomDump &dump, const f64 &cs)
Write the EOS1 to the phantom dump.
void eos2_load(const PhantomDump &dump, f64 &gamma)
Load the EOS2 from the phantom dump.
void eos13_write(PhantomDump &dump, const f64 &cs0, const f64 &q, const f64 &r0)
Write the EOS13 to the phantom dump.
void eos3_load(const PhantomDump &dump, f64 &cs0, f64 &q, f64 &r0)
Load the EOS3 from the phantom dump.
bool is_maxvxyzu_at_least_4(const PhantomDump &dump)
check if alphau is set in the header, which is the case for (maxvxyzu >= 4)
void eos13_load(const PhantomDump &dump, f64 &cs0, f64 &q, f64 &r0)
Load the EOS13 from the phantom dump.
void eos14_write(PhantomDump &dump, const f64 &cs0, const f64 &q, const f64 &r0)
Write the EOS14 to the phantom dump.
void eos14_load(const PhantomDump &dump, f64 &cs0, f64 &q, f64 &r0)
Load the EOS14 from the phantom dump.
void eos3_write(PhantomDump &dump, const f64 &cs0, const f64 &q, const f64 &r0)
Write the EOS3 to the phantom dump.
void eos1_load(const PhantomDump &dump, f64 &cs)
Load the EOS1 from the phantom dump.
double f64
Alias for double.
std::int64_t i64
64 bit integer
std::int32_t i32
32 bit integer
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
Class representing a Phantom dump file.
T read_header_float(std::string s) const
Retrieves a floating-point value from the table headers.
bool has_header_entry(std::string s) const
Checks if a given string is present in any of the table headers.
PhantomDumpTableHeader< i32 > table_header_i32
Table header for signed 32-bit integer data.
T read_header_int(std::string s) const
Retrieves an integer value from the table headers.
PhantomDumpTableHeader< fort_real > table_header_fort_real
Table header for floating-point data.
Functions related to the MPI communicator.