30 i64 ieos = phdump.read_header_int<
i64>(
"ieos");
32 shamlog_debug_ln(
"PhantomDump",
"read ieos :", ieos);
38 }
else if (ieos == 2) {
42 }
else if (ieos == 3) {
46 }
else if (ieos == 13) {
50 cfg.set_locally_isothermalFA2014_extended(cs0, q, r0,
u32_max);
51 }
else if (ieos == 14) {
54 cfg.set_locally_isothermalFA2014_extended(cs0, q, r0, 2);
56 const std::string msg =
"loading phantom ieos=" + std::to_string(ieos)
57 +
" is not implemented in shamrock";
77 using EOS_LocallyIsothermalFA2014Extended =
80 if (EOS_Isothermal *eos_config = std::get_if<EOS_Isothermal>(&cfg.
config)) {
82 }
else if (EOS_Adiabatic *eos_config = std::get_if<EOS_Adiabatic>(&cfg.
config)) {
85 EOS_LocallyIsothermalLP07 *eos_config
86 = std::get_if<EOS_LocallyIsothermalLP07>(&cfg.
config)) {
89 EOS_LocallyIsothermalFA2014Extended *eos_config
90 = std::get_if<EOS_LocallyIsothermalFA2014Extended>(&cfg.
config)) {
92 if (eos_config->n_sinks ==
u32_max) {
94 }
else if (eos_config->n_sinks == 2) {
98 =
"Phantom only support all or 2 sinks for this EOS configuration";
106 const std::string msg
107 =
"The current shamrock EOS is not implemented in phantom dump conversion";
146 template<
class Tscal>
149 f64 udist = phdump.read_header_float<
f64>(
"udist");
150 f64 umass = phdump.read_header_float<
f64>(
"umass");
151 f64 utime = phdump.read_header_float<
f64>(
"utime");
152 f64 umagfd = phdump.read_header_float<
f64>(
"umagfd");
163 template<
class Tscal>
172 f64 umass = units->template to<shamunits::units::kg>();
173 f64 utime = units->template to<shamunits::units::s>();
174 f64 udist = units->template to<shamunits::units::m>();
178 f64 ucharge = sqrt(umass * udist / (4. * shambase::constants::pi<f64> ));
180 f64 umagfd = umass / (utime * ucharge);
207 if (phdump.has_header_entry(
"xmin")) {
218 void write_shamrock_boundaries_in_phantom_dump(
220 std::tuple<Tvec, Tvec> box_size,
224 auto [bmin, bmax] = box_size;
225 using SolverConfigBC = BCConfig<Tvec>;
226 using SolverBCFree =
typename SolverConfigBC::Free;
227 using SolverBCPeriodic =
typename SolverConfigBC::Periodic;
228 using SolverBCShearingPeriodic =
typename SolverConfigBC::ShearingPeriodic;
231 if (SolverBCFree *c = std::get_if<SolverBCFree>(&cfg.config)) {
233 }
else if (SolverBCPeriodic *c = std::get_if<SolverBCPeriodic>(&cfg.config)) {
234 dump.table_header_fort_real.add(
"xmin", bmin.x());
235 dump.table_header_fort_real.add(
"xmax", bmax.x());
236 dump.table_header_fort_real.add(
"ymin", bmin.y());
237 dump.table_header_fort_real.add(
"ymax", bmax.x());
238 dump.table_header_fort_real.add(
"zmin", bmin.z());
239 dump.table_header_fort_real.add(
"zmax", bmax.x());
241 SolverBCShearingPeriodic *c = std::get_if<SolverBCShearingPeriodic>(&cfg.config)) {
243 =
"Phantom does not support shearing periodic boundaries but your are "
244 "making a phantom dump with them, set bypass_error_check=True to ignore";
247 throw std::runtime_error(err_msg);
260 template void write_shamrock_boundaries_in_phantom_dump<f32_3>(
262 std::tuple<f32_3, f32_3> box_size,
266 template void write_shamrock_boundaries_in_phantom_dump<f64_3>(
268 std::tuple<f64_3, f64_3> box_size,
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.
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
Class holding the value of numerous constants generated from the following source.
void throw_unimplemented(SourceLocation loc=SourceLocation{})
Throw a std::runtime_error saying that the function is unimplemented.
namespace for the sph model
BCConfig< Tvec > get_shamrock_boundary_config(PhantomDump &phdump)
Generate an Shamrock boundary configuration from a PhantomDump object.
AVConfig< Tvec > get_shamrock_avconfig(PhantomDump &phdump)
Generate an Shamrock artificial viscosity configuration from a PhantomDump object.
template EOSConfig< f64_3 > get_shamrock_eosconfig< f64_3 >(PhantomDump &phdump, bool bypass_error)
explicit instanciation for f64_3
EOSConfig< Tvec > get_shamrock_eosconfig(PhantomDump &phdump, bool bypass_error)
Generate a Shamrock EOS configuration from a PhantomDump object.
template void write_shamrock_eos_in_phantom_dump< f64_3 >(EOSConfig< f64_3 > &cfg, PhantomDump &dump, bool bypass_error)
explicit instanciation for f64_3
void write_shamrock_units_in_phantom_dump(std::optional< shamunits::UnitSystem< Tscal > > &units, PhantomDump &dump, bool bypass_error)
Write shamrock units config into the phantom dump.
template EOSConfig< f32_3 > get_shamrock_eosconfig< f32_3 >(PhantomDump &phdump, bool bypass_error)
explicit instanciation for f32_3
shamunits::UnitSystem< Tscal > get_shamrock_units(PhantomDump &phdump)
Get the shamrock units object.
void write_shamrock_eos_in_phantom_dump(EOSConfig< Tvec > &cfg, PhantomDump &dump, bool bypass_error)
Write the eos config to th phantom dump header.
template void write_shamrock_eos_in_phantom_dump< f32_3 >(EOSConfig< f32_3 > &cfg, PhantomDump &dump, bool bypass_error)
explicit instanciation for f32_3
constexpr u32 u32_max
u32 max value
void raw_ln(Types... var2)
Prints a log message with multiple arguments followed by a newline.
void warn_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
Locally isothermal equation of state configuration.
Configuration struct for the equation of state used in the hydrodynamic models.
void set_isothermal(Tscal cs)
Set the EOS configuration to an isothermal equation of state.
Variant config
Current EOS configuration.
shamphys::EOS_Config_Isothermal< Tscal > Isothermal
Isothermal equation of state configuration.
shamphys::EOS_Config_LocallyIsothermalDisc_Farris2014< Tscal > LocallyIsothermalFA2014
Locally isothermal equation of state configuration from Lodato Price 2007.
void set_adiabatic(Tscal gamma)
Set the EOS configuration to an adiabatic equation of state.
shamphys::EOS_Config_LocallyIsothermal_LP07< Tscal > LocallyIsothermalLP07
Locally isothermal equation of state configuration from Lodato Price 2007.
shamphys::EOS_Config_LocallyIsothermalDisc_ExtendedFarris2014< Tscal > LocallyIsothermalFA2014Extended
Locally isothermal equation of state configuration from Farris 2014 extended to q !...
void set_locally_isothermalLP07(Tscal cs0, Tscal q, Tscal r0)
Set the EOS configuration to a locally isothermal equation of state (Lodato Price 2007).
shamphys::EOS_Config_Adiabatic< Tscal > Adiabatic
Adiabatic equation of state configuration.
Configuration for the Artificial Viscosity (AV).
void set_varying_cd10(Tscal alpha_min, Tscal alpha_max, Tscal sigma_decay, Tscal alpha_u, Tscal beta_AV)
Sets the configuration to use a varying Cullen & Dehnen 2010 artificial viscosity.
Boundary conditions configuration.
void set_periodic()
Set the boundary condition to periodic boundaries.
void set_free()
Set the boundary condition to free boundaries.
Class representing a Phantom dump file.
PhantomDumpTableHeader< f64 > table_header_f64
Table header for 64-bit floating-point data.
constexpr T c()
get c in the current unit system units (m.s-1)