diff --git a/CMakeLists.txt b/CMakeLists.txt index 37d424df99c..cbc19b29fc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,9 @@ cmake_dependent_option( cmake_dependent_option( SINGULARITY_USE_HELMHOLTZ "Include Helmholtz equation of state" OFF "SINGULARITY_USE_SPINER;SINGULARITY_USE_SPINER_WITH_HDF5" OFF) +cmake_dependent_option( + SINGULARITY_USE_STELLAR_COLLAPSE "Include StellarCollapse equation of state" OFF + "SINGULARITY_USE_SPINER;SINGULARITY_USE_SPINER_WITH_HDF5" OFF) # Enables polynomial, carnahan starling, and NobleAbel in variant. # Off by default, as they are not in the default python bindings or used @@ -115,6 +118,12 @@ option(SINGULARITY_BETTER_DEBUG_FLAGS "Better debug flags for singularity" ON) option(SINGULARITY_HIDE_MORE_WARNINGS "hide more warnings" OFF) option(SINGULARITY_STRICT_WARNINGS "Make warnings strict" OFF) +# This enables explicit instantiation of EOS classes, which can +# significantly speed up compilation +option(SINGULARITY_INSTANTIATE_CLASSES + "Instantiate classes and common templates. Speeds up compilation but can reduce runtime performance." + OFF) + # toggle code options option(SINGULARITY_USE_TRUE_LOG_GRIDDING "Use grids that conform to log spacing." OFF) @@ -140,7 +149,7 @@ option(SINGULARITY_FORCE_SUBMODULE_MODE "Submodule mode" OFF) # TODO This should depend on using offloading (`SINGULARITY_USE_CUDA` &t) Also, # patching in the source tree is messy, this should be done in the build dir option(SINGULARITY_PATCH_MPARK_VARIANT - "Apply GPU patch to mpark-variant submodule" ON) + "Apply GPU patch to mpark-variant submodule" ON) # Plugins set(SINGULARITY_PLUGINS "" CACHE STRING "List of paths to plugin directories") @@ -320,6 +329,10 @@ target_compile_definitions(singularity-eos_Interface INTERFACE ) # defines +if (SINGULARITY_INSTANTIATE_CLASSES) + target_compile_definitions(singularity-eos_Interface + INTERFACE SINGULARITY_INSTANTIATE_CLASSES) +endif() if (SINGULARITY_USE_TRUE_LOG_GRIDDING) target_compile_definitions(singularity-eos_Interface INTERFACE SINGULARITY_USE_TRUE_LOG_GRIDDING) diff --git a/cmake/singularity-eos/kokkos.cmake b/cmake/singularity-eos/kokkos.cmake index 22e5e9c7320..36b33aa5606 100644 --- a/cmake/singularity-eos/kokkos.cmake +++ b/cmake/singularity-eos/kokkos.cmake @@ -10,6 +10,11 @@ macro(singularity_import_kokkos) set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "" FORCE) + if (SINGULARITY_INSTANTIATE_CLASSES) + set(Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE + ON + CACHE BOOL "" FORCE) + endif() endif() if(NOT TARGET Kokkos::kokkos) diff --git a/singularity-eos/CMakeLists.txt b/singularity-eos/CMakeLists.txt index 5eefcd6304c..293161cc842 100644 --- a/singularity-eos/CMakeLists.txt +++ b/singularity-eos/CMakeLists.txt @@ -70,6 +70,30 @@ register_headers( eos/eos_electrons.hpp ) +if (SINGULARITY_INSTANTIATE_CLASSES) + register_srcs( + eos/eos.cpp + eos/eos_carnahan_starling.cpp + eos/eos_davis.cpp + eos/eos_electrons.cpp + eos/eos_eospac.cpp + eos/eos_gruneisen.cpp + eos/eos_helmholtz.cpp + eos/eos_ideal.cpp + eos/eos_jwl.cpp + eos/eos_mgusup.cpp + eos/eos_noble_abel.cpp + eos/eos_powermg.cpp + eos/eos_sap_polynomial.cpp + eos/eos_spiner.cpp + eos/eos_stellar_collapse.cpp + eos/eos_stiff.cpp + eos/eos_vinet.cpp + eos/modifiers/shifted_eos.cpp + eos/modifiers/scaled_eos.cpp + ) +endif() + if (SINGULARITY_BUILD_CLOSURE) register_headers( closure/mixed_cell_models.hpp @@ -81,6 +105,7 @@ if (SINGULARITY_BUILD_CLOSURE) # while these are C++ files, they # are only needed for the fortran backend or unit testing register_srcs(eos/singularity_eos.cpp) + register_srcs(eos/get_sg_eos_misc.cpp) register_headers(eos/singularity_eos.hpp) endif() if (SINGULARITY_BUILD_FORTRAN_BACKEND) diff --git a/singularity-eos/base/indexable_types.hpp b/singularity-eos/base/indexable_types.hpp index 25cc4928d95..1ba573937d0 100644 --- a/singularity-eos/base/indexable_types.hpp +++ b/singularity-eos/base/indexable_types.hpp @@ -23,6 +23,15 @@ #include namespace singularity { +// Provide default functionality when lambda isn't passed to vector +// functions +struct NullIndexer { + PORTABLE_FORCEINLINE_FUNCTION + Real *operator[](int i) { return nullptr; } + PORTABLE_FORCEINLINE_FUNCTION + Real *operator[](int i) const { return nullptr; } +}; + namespace IndexerUtils { // Convenience function for accessing an indexer by either type or // natural number index depending on what is available diff --git a/singularity-eos/eos/eos.cpp b/singularity-eos/eos/eos.cpp index d791059870e..52de83d4d6f 100644 --- a/singularity-eos/eos/eos.cpp +++ b/singularity-eos/eos/eos.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// © 2021-2023. Triad National Security, LLC. All rights reserved. This +// © 2021-2025. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract 89233218CNA000001 // for Los Alamos National Laboratory (LANL), which is operated by Triad // National Security, LLC for the U.S. Department of Energy/National @@ -12,34 +12,6 @@ // publicly and display publicly, and to permit others to do so. //------------------------------------------------------------------------------ -// JMM: This is a dummy file to provide a source file for cmake to -// compile when built without fortran. -// -// The main reason to do this is that when we build without fortran -// bindings, the library is completely header only. However WITH -// fortran bindings, it is not. -// -// cmake supports a build mode for header only libraries by marking -// those libraries INTERFACE. Without this flag, a few things will go -// wrong: -// 1. CMake will be unable to infer a proper linker -// so one must be specified by hand. -// 2. no dynamic library file (e.g., "*.a") will be generated, -// but dependencies that link against it, such as another library, -// or in our case, tests, will look for it. This will lead to -// a failure of the downstream library at link time. -// -// On the other hand, a library with implementation files -// CANNOT be marked INTERFACE, as otherwise source files will -// not be compiled. -// -// Unfortunately, switching the INTERFACE tag on and off in cmake -// is very cumbersome, as if a library is marked INTERFACE -// all its dependencies must ALSO be slurped in with an INTERFACE -// flag. This introduces significant branching in the cmake code -// and a lot of builer plate. For now, then, I simply include this -// empty source file. -// -// In the future, we could include centralized code here that we -// always want compiled, such as template instantiations or -// convenience functions. +#include + +template void singularity::impl::ConcretizeType(EOS); diff --git a/singularity-eos/eos/eos.hpp.in b/singularity-eos/eos/eos.hpp.in index 7d7cf9f9398..f32841622fa 100644 --- a/singularity-eos/eos/eos.hpp.in +++ b/singularity-eos/eos/eos.hpp.in @@ -17,4 +17,17 @@ #include <@SINGULARITY_VARIANT@> +#ifdef SINGULARITY_INSTANTIATE_CLASSES +namespace singularity { +namespace impl { +template +void ConcretizeType(T eos) { + eos.CheckParams(); + eos.PrintParams(); +} +extern template void ConcretizeType(EOS); +} // namespace impl +} // namespace singularity +#endif // SINGULARITY_INSTANTIATE_CLASSES + #endif // _SINGULARITY_EOS_EOS_EOS_HPP_ diff --git a/singularity-eos/eos/eos_base.hpp b/singularity-eos/eos/eos_base.hpp index 557d92fdfd4..ba3dee3dfde 100644 --- a/singularity-eos/eos/eos_base.hpp +++ b/singularity-eos/eos/eos_base.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -123,6 +124,70 @@ char *StrCat(char *destination, const char *source) { PORTABLE_INLINE_FUNCTION \ Real MeanAtomicNumber() const { return t_.MeanAtomicNumber(); } +// These are used when SINGULARITY_INSTANTIATE_CLASSES is +// active. Requires relocatable device code. +#define SG_ADD_TEMPLATE_EXTERNS(T, S) \ + extern template class eos_base::EosBase; \ + extern template PORTABLE_FUNCTION Real T::TemperatureFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::InternalEnergyFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::PressureFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::PressureFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::MinInternalEnergyFromDensity(const Real, \ + S &&) const; \ + extern template PORTABLE_FUNCTION Real T::EntropyFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::EntropyFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::SpecificHeatFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::SpecificHeatFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::BulkModulusFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::BulkModulusFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::GruneisenParamFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION Real T::GruneisenParamFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + extern template PORTABLE_FUNCTION void T::ValuesAtReferenceState( \ + Real &, Real &, Real &, Real &, Real &, Real &, Real &, Real &, S &&) const; + +#define SG_ADD_TEMPLATE_INSTANTIATIONS(T, S) \ + template class eos_base::EosBase; \ + template PORTABLE_FUNCTION Real T::TemperatureFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::InternalEnergyFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::PressureFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::PressureFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::MinInternalEnergyFromDensity(const Real, S &&) \ + const; \ + template PORTABLE_FUNCTION Real T::EntropyFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::EntropyFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::SpecificHeatFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::SpecificHeatFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::BulkModulusFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::BulkModulusFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::GruneisenParamFromDensityTemperature( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION Real T::GruneisenParamFromDensityInternalEnergy( \ + const Real, const Real, S &&) const; \ + template PORTABLE_FUNCTION void T::ValuesAtReferenceState( \ + Real &, Real &, Real &, Real &, Real &, Real &, Real &, Real &, S &&) const; + class Factor { Real value_ = 1.0; bool is_set_ = false; diff --git a/singularity-eos/eos/eos_carnahan_starling.cpp b/singularity-eos/eos/eos_carnahan_starling.cpp new file mode 100644 index 00000000000..0d976a27b76 --- /dev/null +++ b/singularity-eos/eos/eos_carnahan_starling.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(CarnahanStarling, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_carnahan_starling.hpp b/singularity-eos/eos/eos_carnahan_starling.hpp index ba073564415..4f40c41a588 100644 --- a/singularity-eos/eos/eos_carnahan_starling.hpp +++ b/singularity-eos/eos/eos_carnahan_starling.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// © 2021-2024. Triad National Security, LLC. All rights reserved. This +// © 2021-2025. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract 89233218CNA000001 // for Los Alamos National Laboratory (LANL), which is operated by Triad // National Security, LLC for the U.S. Department of Energy/National @@ -295,6 +295,10 @@ PORTABLE_INLINE_FUNCTION void CarnahanStarling::FillEos(Real &rho, Real &temp, R cv = SpecificHeatFromDensityInternalEnergy(rho, sie); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(CarnahanStarling, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_EOS_CARNAHAN_STARLING_HPP_ diff --git a/singularity-eos/eos/eos_davis.cpp b/singularity-eos/eos/eos_davis.cpp new file mode 100644 index 00000000000..612223e9a54 --- /dev/null +++ b/singularity-eos/eos/eos_davis.cpp @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(DavisReactants, Real *) +SG_ADD_TEMPLATE_INSTANTIATIONS(DavisProducts, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_davis.hpp b/singularity-eos/eos/eos_davis.hpp index 775555883ae..d781a72ebd5 100644 --- a/singularity-eos/eos/eos_davis.hpp +++ b/singularity-eos/eos/eos_davis.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// © 2021-2024. Triad National Security, LLC. All rights reserved. This +// © 2021-2025. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract 89233218CNA000001 // for Los Alamos National Laboratory (LANL), which is operated by Triad // National Security, LLC for the U.S. Department of Energy/National @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -49,7 +51,7 @@ class DavisReactants : public EosBase { _AZbar.CheckParams(); } template - PORTABLE_INLINE_FUNCTION Real TemperatureFromDensityInternalEnergy( + PORTABLE_FUNCTION Real TemperatureFromDensityInternalEnergy( const Real rho, const Real sie, Indexer_t &&lambda = static_cast(nullptr)) const { const Real power_base = DimlessEdiff(rho, sie); @@ -62,7 +64,7 @@ class DavisReactants : public EosBase { return Ts(rho) * tmp; } template - PORTABLE_INLINE_FUNCTION Real InternalEnergyFromDensityTemperature( + PORTABLE_FUNCTION Real InternalEnergyFromDensityTemperature( const Real rho, const Real temp, Indexer_t &&lambda = static_cast(nullptr)) const { const Real t_s = Ts(rho); @@ -71,21 +73,21 @@ class DavisReactants : public EosBase { _Cv0 * t_s / (1.0 + _alpha) * (std::pow(temp / t_s, 1.0 + _alpha) - 1.0); } template - PORTABLE_INLINE_FUNCTION Real PressureFromDensityTemperature( + PORTABLE_FUNCTION Real PressureFromDensityTemperature( const Real rho, const Real temp, Indexer_t &&lambda = static_cast(nullptr)) const { return PressureFromDensityInternalEnergy( rho, InternalEnergyFromDensityTemperature(rho, temp)); } template - PORTABLE_INLINE_FUNCTION Real PressureFromDensityInternalEnergy( + PORTABLE_FUNCTION Real PressureFromDensityInternalEnergy( const Real rho, const Real sie, Indexer_t &&lambda = static_cast(nullptr)) const { return Ps(rho) + Gamma(rho) * rho * (sie - Es(rho)); } template - PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity( + PORTABLE_FUNCTION Real MinInternalEnergyFromDensity( const Real rho, Indexer_t &&lambda = static_cast(nullptr)) const { // Minimum enegy is when the returned temperature is zero. This only happens // when the base to the exponent is zero (see T(rho, e) equation) @@ -94,28 +96,28 @@ class DavisReactants : public EosBase { return es - (_Cv0 * ts) / (1 + _alpha); } template - PORTABLE_INLINE_FUNCTION Real + PORTABLE_FUNCTION Real EntropyFromDensityTemperature(const Real rho, const Real temperature, Indexer_t &&lambda = static_cast(nullptr)) const { EntropyIsNotEnabled("DavisReactants"); return 1.0; } template - PORTABLE_INLINE_FUNCTION Real EntropyFromDensityInternalEnergy( + PORTABLE_FUNCTION Real EntropyFromDensityInternalEnergy( const Real rho, const Real sie, Indexer_t &&lambda = static_cast(nullptr)) const { EntropyIsNotEnabled("DavisReactants"); return 1.0; } template - PORTABLE_INLINE_FUNCTION Real SpecificHeatFromDensityTemperature( + PORTABLE_FUNCTION Real SpecificHeatFromDensityTemperature( const Real rho, const Real temp, Indexer_t &&lambda = static_cast(nullptr)) const { return SpecificHeatFromDensityInternalEnergy( rho, InternalEnergyFromDensityTemperature(rho, temp)); } template - PORTABLE_INLINE_FUNCTION Real SpecificHeatFromDensityInternalEnergy( + PORTABLE_FUNCTION Real SpecificHeatFromDensityInternalEnergy( const Real rho, const Real sie, Indexer_t &&lambda = static_cast(nullptr)) const { const Real power_base = DimlessEdiff(rho, sie); @@ -126,24 +128,24 @@ class DavisReactants : public EosBase { return _Cv0 / std::pow(power_base, -_alpha / (1 + _alpha)); } template - PORTABLE_INLINE_FUNCTION Real BulkModulusFromDensityTemperature( + PORTABLE_FUNCTION Real BulkModulusFromDensityTemperature( const Real rho, const Real temp, Indexer_t &&lambda = static_cast(nullptr)) const { return BulkModulusFromDensityInternalEnergy( rho, InternalEnergyFromDensityTemperature(rho, temp)); } template - PORTABLE_INLINE_FUNCTION Real BulkModulusFromDensityInternalEnergy( + PORTABLE_FUNCTION Real BulkModulusFromDensityInternalEnergy( const Real rho, const Real sie, Indexer_t &&lambda = static_cast(nullptr)) const; template - PORTABLE_INLINE_FUNCTION Real GruneisenParamFromDensityTemperature( + PORTABLE_FUNCTION Real GruneisenParamFromDensityTemperature( const Real rho, const Real temperature, Indexer_t &&lambda = static_cast(nullptr)) const { return Gamma(rho); } template - PORTABLE_INLINE_FUNCTION Real GruneisenParamFromDensityInternalEnergy( + PORTABLE_FUNCTION Real GruneisenParamFromDensityInternalEnergy( const Real rho, const Real sie, Indexer_t &&lambda = static_cast(nullptr)) const { return Gamma(rho); @@ -577,6 +579,12 @@ DavisProducts::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &pr Real gm1 = GruneisenParamFromDensityTemperature(rho, temp) * rho; dvdt = gm1 * cv / bmod; } + +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(DavisReactants, Real *) +SG_ADD_TEMPLATE_EXTERNS(DavisProducts, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_EOS_DAVIS_HPP_ diff --git a/singularity-eos/eos/eos_electrons.cpp b/singularity-eos/eos/eos_electrons.cpp new file mode 100644 index 00000000000..7942ee74d02 --- /dev/null +++ b/singularity-eos/eos/eos_electrons.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2024-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(IdealElectrons, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_electrons.hpp b/singularity-eos/eos/eos_electrons.hpp index 27f78464fda..48ec1020c74 100644 --- a/singularity-eos/eos/eos_electrons.hpp +++ b/singularity-eos/eos/eos_electrons.hpp @@ -23,6 +23,7 @@ // Base stuff #include +#include #include #include #include @@ -266,6 +267,10 @@ PORTABLE_INLINE_FUNCTION void IdealElectrons::FillEos(Real &rho, Real &temp, Rea cv = SpecificHeatFromDensityInternalEnergy(rho, sie, lambda); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(IdealElectrons, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_ELECTRONS diff --git a/singularity-eos/eos/eos_eospac.cpp b/singularity-eos/eos/eos_eospac.cpp new file mode 100644 index 00000000000..1206927ab0d --- /dev/null +++ b/singularity-eos/eos/eos_eospac.cpp @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +#ifdef SINGULARITY_USE_EOSPAC +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(EOSPAC, Real *) +} // namespace singularity +#endif // SINGULARITY_USE_EOSPAC diff --git a/singularity-eos/eos/eos_eospac.hpp b/singularity-eos/eos/eos_eospac.hpp index 82c579d5bdc..61b0dfe050d 100644 --- a/singularity-eos/eos/eos_eospac.hpp +++ b/singularity-eos/eos/eos_eospac.hpp @@ -30,6 +30,8 @@ #include #include +#include +#include #include #include @@ -1651,6 +1653,10 @@ EOSPAC::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, Re #endif // ON DEVICE } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(EOSPAC, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // SINGULARITY_USE_EOSPAC diff --git a/singularity-eos/eos/eos_gruneisen.cpp b/singularity-eos/eos/eos_gruneisen.cpp new file mode 100644 index 00000000000..d5609c4f429 --- /dev/null +++ b/singularity-eos/eos/eos_gruneisen.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2024. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(Gruneisen, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_gruneisen.hpp b/singularity-eos/eos/eos_gruneisen.hpp index fdf0c17492b..eff6634d866 100644 --- a/singularity-eos/eos/eos_gruneisen.hpp +++ b/singularity-eos/eos/eos_gruneisen.hpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -570,6 +572,11 @@ Gruneisen::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, Real gm1 = GruneisenParamFromDensityInternalEnergy(rho, sie, lambda) * rho; dvdt = gm1 * cv / bmod; } + +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(Gruneisen, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_GRUNEISEN_HPP_ diff --git a/singularity-eos/eos/eos_helmholtz.cpp b/singularity-eos/eos/eos_helmholtz.cpp new file mode 100644 index 00000000000..23490861f2e --- /dev/null +++ b/singularity-eos/eos/eos_helmholtz.cpp @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// © 2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +#ifdef SINGULARITY_USE_SPINER_WITH_HDF5 +#ifdef SINGULARITY_USE_HELMHOLTZ + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(Helmholtz, Real *) +} // namespace singularity + +#endif // SINGULARITY_USE_HELMHOLTZ +#endif // SINGULARITY_USE_SPINER_WITH_HDF5 diff --git a/singularity-eos/eos/eos_helmholtz.hpp b/singularity-eos/eos/eos_helmholtz.hpp index 3455de8117c..9374fa8b8f6 100644 --- a/singularity-eos/eos/eos_helmholtz.hpp +++ b/singularity-eos/eos/eos_helmholtz.hpp @@ -42,6 +42,7 @@ // singularity-eos #include +#include #include #include #include @@ -1565,6 +1566,10 @@ void Helmholtz::GetFromDensityLogTemperature_( } } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(Helmholtz, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + }; // namespace singularity #undef ROOT_FINDER diff --git a/singularity-eos/eos/eos_ideal.cpp b/singularity-eos/eos/eos_ideal.cpp new file mode 100644 index 00000000000..59c6bf8b049 --- /dev/null +++ b/singularity-eos/eos/eos_ideal.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(IdealGas, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_ideal.hpp b/singularity-eos/eos/eos_ideal.hpp index 02a0514674c..0f8e4a8aab2 100644 --- a/singularity-eos/eos/eos_ideal.hpp +++ b/singularity-eos/eos/eos_ideal.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// © 2021-2024. Triad National Security, LLC. All rights reserved. This +// © 2021-2025. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract 89233218CNA000001 // for Los Alamos National Laboratory (LANL), which is operated by Triad // National Security, LLC for the U.S. Department of Energy/National @@ -26,6 +26,7 @@ // Base stuff #include #include +#include #include #include @@ -238,6 +239,10 @@ IdealGas::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real cv = SpecificHeatFromDensityInternalEnergy(rho, sie); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(IdealGas, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #undef MYMAX diff --git a/singularity-eos/eos/eos_jwl.cpp b/singularity-eos/eos/eos_jwl.cpp new file mode 100644 index 00000000000..1de8141c52a --- /dev/null +++ b/singularity-eos/eos/eos_jwl.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(JWL, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_jwl.hpp b/singularity-eos/eos/eos_jwl.hpp index 6e5a18d3074..f7c4222747e 100644 --- a/singularity-eos/eos/eos_jwl.hpp +++ b/singularity-eos/eos/eos_jwl.hpp @@ -280,6 +280,10 @@ JWL::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, Real dvdt = robust::ratio(gm1 * cv, bmod); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(JWL, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_EOS_JWL_HPP_ diff --git a/singularity-eos/eos/eos_mgusup.cpp b/singularity-eos/eos/eos_mgusup.cpp new file mode 100644 index 00000000000..9050adbd351 --- /dev/null +++ b/singularity-eos/eos/eos_mgusup.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(MGUsup, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_mgusup.hpp b/singularity-eos/eos/eos_mgusup.hpp index 059b14a8b11..d84af14c2f2 100644 --- a/singularity-eos/eos/eos_mgusup.hpp +++ b/singularity-eos/eos/eos_mgusup.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -411,6 +412,11 @@ MGUsup::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, Re dpde = _G0 * _rho0; dvdt = robust::ratio(-1.0, _T0 * _G0 * _rho0); } + +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(MGUsup, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_MGUSUP_HPP_ diff --git a/singularity-eos/eos/eos_noble_abel.cpp b/singularity-eos/eos/eos_noble_abel.cpp new file mode 100644 index 00000000000..30aeccc8ac4 --- /dev/null +++ b/singularity-eos/eos/eos_noble_abel.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(NobleAbel, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_noble_abel.hpp b/singularity-eos/eos/eos_noble_abel.hpp index 1ebc3dac03f..faaa4d918fb 100644 --- a/singularity-eos/eos/eos_noble_abel.hpp +++ b/singularity-eos/eos/eos_noble_abel.hpp @@ -246,6 +246,10 @@ NobleAbel::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real cv = SpecificHeatFromDensityInternalEnergy(rho, sie); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(NobleAbel, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_EOS_NOBLE_ABEL_HPP_ diff --git a/singularity-eos/eos/eos_powermg.cpp b/singularity-eos/eos/eos_powermg.cpp new file mode 100644 index 00000000000..37db1c7c0a1 --- /dev/null +++ b/singularity-eos/eos/eos_powermg.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(PowerMG, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_powermg.hpp b/singularity-eos/eos/eos_powermg.hpp index 47d6c8339e6..ce8ecf303b8 100644 --- a/singularity-eos/eos/eos_powermg.hpp +++ b/singularity-eos/eos/eos_powermg.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -489,6 +490,11 @@ PowerMG::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, R dpde = _G0 * _rho0; dvdt = robust::ratio(-1.0, _T0 * _G0 * _rho0); } + +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(PowerMG, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_POWERMG_HPP_ diff --git a/singularity-eos/eos/eos_sap_polynomial.cpp b/singularity-eos/eos/eos_sap_polynomial.cpp new file mode 100644 index 00000000000..a8d6476898c --- /dev/null +++ b/singularity-eos/eos/eos_sap_polynomial.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(SAP_Polynomial, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_sap_polynomial.hpp b/singularity-eos/eos/eos_sap_polynomial.hpp index 07ce564888e..12855c53b57 100644 --- a/singularity-eos/eos/eos_sap_polynomial.hpp +++ b/singularity-eos/eos/eos_sap_polynomial.hpp @@ -250,6 +250,10 @@ PORTABLE_INLINE_FUNCTION void SAP_Polynomial::FillEos(Real &rho, Real &temp, Rea cv = SpecificHeatFromDensityInternalEnergy(rho, sie); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(SAP_Polynomial, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_EOS_SAP_POLYNOMIAL_HPP_ diff --git a/singularity-eos/eos/eos_spiner.cpp b/singularity-eos/eos/eos_spiner.cpp new file mode 100644 index 00000000000..9b9816305e4 --- /dev/null +++ b/singularity-eos/eos/eos_spiner.cpp @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +#ifdef SINGULARITY_USE_SPINER_WITH_HDF5 +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(SpinerEOSDependsRhoT, Real *) +SG_ADD_TEMPLATE_INSTANTIATIONS(SpinerEOSDependsRhoSie, Real *) +} // namespace singularity +#endif // SINGULARITY_USE_SPINER_WITH_HDF5 diff --git a/singularity-eos/eos/eos_spiner.hpp b/singularity-eos/eos/eos_spiner.hpp index 072fd2808e6..23dc110aebd 100644 --- a/singularity-eos/eos/eos_spiner.hpp +++ b/singularity-eos/eos/eos_spiner.hpp @@ -35,6 +35,7 @@ // base #include +#include #include #include #include @@ -2014,6 +2015,11 @@ PORTABLE_INLINE_FUNCTION Real SpinerEOSDependsRhoSie::lRhoFromPlT_( return lRho; } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(SpinerEOSDependsRhoT, Real *) +SG_ADD_TEMPLATE_EXTERNS(SpinerEOSDependsRhoSie, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // SINGULARITY_USE_SPINER_WITH_HDF5 diff --git a/singularity-eos/eos/eos_stellar_collapse.cpp b/singularity-eos/eos/eos_stellar_collapse.cpp new file mode 100644 index 00000000000..32464873c6a --- /dev/null +++ b/singularity-eos/eos/eos_stellar_collapse.cpp @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +#ifdef SINGULARITY_USE_SPINER_WITH_HDF5 +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(StellarCollapse, Real *) +} // namespace singularity +#endif // SINGULARITY_USE_SPINER_WITH_HDF5 diff --git a/singularity-eos/eos/eos_stellar_collapse.hpp b/singularity-eos/eos/eos_stellar_collapse.hpp index be3a3c794c8..0f65d01e04e 100644 --- a/singularity-eos/eos/eos_stellar_collapse.hpp +++ b/singularity-eos/eos/eos_stellar_collapse.hpp @@ -34,6 +34,7 @@ // singularity-eos #include +#include #include #include #include @@ -1227,6 +1228,11 @@ PORTABLE_INLINE_FUNCTION Real StellarCollapse::lTFromlRhoSie_( IndexerUtils::Get(lambda, Lambda::lT) = lT; return lT; } + +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(StellarCollapse, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // SINGULARITY_USE_SPINER_WITH_HDF5 diff --git a/singularity-eos/eos/eos_stiff.cpp b/singularity-eos/eos/eos_stiff.cpp new file mode 100644 index 00000000000..17380dbc3f7 --- /dev/null +++ b/singularity-eos/eos/eos_stiff.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(StiffGas, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_stiff.hpp b/singularity-eos/eos/eos_stiff.hpp index 4660fe44664..0e3b6c6ec35 100644 --- a/singularity-eos/eos/eos_stiff.hpp +++ b/singularity-eos/eos/eos_stiff.hpp @@ -233,6 +233,10 @@ StiffGas::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real cv = SpecificHeatFromDensityInternalEnergy(rho, sie); } +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(StiffGas, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_EOS_STIFF_HPP_ diff --git a/singularity-eos/eos/eos_variant.hpp b/singularity-eos/eos/eos_variant.hpp index 3eafdd2c775..211937f700b 100644 --- a/singularity-eos/eos/eos_variant.hpp +++ b/singularity-eos/eos/eos_variant.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -29,14 +30,6 @@ namespace singularity { template using eos_variant = mpark::variant; -// Provide default functionality when lambda isn't passed to vector functions -struct NullIndexer { - PORTABLE_FORCEINLINE_FUNCTION - Real *operator[](int i) { return nullptr; } - PORTABLE_FORCEINLINE_FUNCTION - Real *operator[](int i) const { return nullptr; } -}; - template class Variant { private: diff --git a/singularity-eos/eos/eos_vinet.cpp b/singularity-eos/eos/eos_vinet.cpp new file mode 100644 index 00000000000..d161c819de7 --- /dev/null +++ b/singularity-eos/eos/eos_vinet.cpp @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include + +namespace singularity { +SG_ADD_TEMPLATE_INSTANTIATIONS(Vinet, Real *) +} // namespace singularity diff --git a/singularity-eos/eos/eos_vinet.hpp b/singularity-eos/eos/eos_vinet.hpp index e1093610588..60b328e3e2a 100644 --- a/singularity-eos/eos/eos_vinet.hpp +++ b/singularity-eos/eos/eos_vinet.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -423,6 +424,11 @@ Vinet::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, Rea dpde = robust::ratio(_A0 * tbmod, _Cv0); dvdt = robust::ratio(_A0, _rho0); } + +#ifdef SINGULARITY_INSTANTIATE_CLASSES +SG_ADD_TEMPLATE_EXTERNS(Vinet, Real *) +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_VINET_HPP_ diff --git a/singularity-eos/eos/get_sg_eos_misc.cpp b/singularity-eos/eos/get_sg_eos_misc.cpp new file mode 100644 index 00000000000..b04a09514b1 --- /dev/null +++ b/singularity-eos/eos/get_sg_eos_misc.cpp @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include +#include +#include +#include +#include +#include + +using namespace singularity; + +int get_sg_PressureFromDensityInternalEnergy(int matindex, EOS *eos, const double *rhos, + const double *sies, double *pressures, + const int len) { + eos[matindex].PressureFromDensityInternalEnergy(rhos, sies, pressures, len); + return 0; +} +int get_sg_MinInternalEnergyFromDensity(int matindex, EOS *eos, const double *rhos, + double *sies, const int len) { + eos[matindex].MinInternalEnergyFromDensity(rhos, sies, len); + return 0; +} +int get_sg_BulkModulusFromDensityInternalEnergy(int matindex, EOS *eos, + const double *rhos, const double *sies, + double *bmods, const int len) { + eos[matindex].BulkModulusFromDensityInternalEnergy(rhos, sies, bmods, len); + return 0; +} diff --git a/singularity-eos/eos/modifiers/scaled_eos.cpp b/singularity-eos/eos/modifiers/scaled_eos.cpp new file mode 100644 index 00000000000..dd349537f27 --- /dev/null +++ b/singularity-eos/eos/modifiers/scaled_eos.cpp @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace singularity { + +template class ScaledEOS; +template class ScaledEOS; +template class ScaledEOS; +template class ScaledEOS; +template class ScaledEOS; +template class ScaledEOS; +template class ScaledEOS; +template class ScaledEOS; + +} // namespace singularity diff --git a/singularity-eos/eos/modifiers/scaled_eos.hpp b/singularity-eos/eos/modifiers/scaled_eos.hpp index 4fdb9e9a89a..2fa807d3b7b 100644 --- a/singularity-eos/eos/modifiers/scaled_eos.hpp +++ b/singularity-eos/eos/modifiers/scaled_eos.hpp @@ -382,6 +382,25 @@ class ScaledEOS : public EosBase> { double inv_scale_; }; +#ifdef SINGULARITY_INSTANTIATE_CLASSES +class IdealGas; +class Gruneisen; +class Vinet; +class MGUsup; +class PowerMG; +class JWL; +class DavisReactants; +class DavisProducts; +extern template class ScaledEOS; +extern template class ScaledEOS; +extern template class ScaledEOS; +extern template class ScaledEOS; +extern template class ScaledEOS; +extern template class ScaledEOS; +extern template class ScaledEOS; +extern template class ScaledEOS; +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_SCALED_EOS_ diff --git a/singularity-eos/eos/modifiers/shifted_eos.cpp b/singularity-eos/eos/modifiers/shifted_eos.cpp new file mode 100644 index 00000000000..cebbf769d56 --- /dev/null +++ b/singularity-eos/eos/modifiers/shifted_eos.cpp @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// © 2021-2025. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract 89233218CNA000001 +// for Los Alamos National Laboratory (LANL), which is operated by Triad +// National Security, LLC for the U.S. Department of Energy/National +// Nuclear Security Administration. All rights in the program are +// reserved by Triad National Security, LLC, and the U.S. Department of +// Energy/National Nuclear Security Administration. The Government is +// granted for itself and others acting on its behalf a nonexclusive, +// paid-up, irrevocable worldwide license in this material to reproduce, +// prepare derivative works, distribute copies to the public, perform +// publicly and display publicly, and to permit others to do so. +//------------------------------------------------------------------------------ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace singularity { + +template class ShiftedEOS; +template class ShiftedEOS; +template class ShiftedEOS; +template class ShiftedEOS; +template class ShiftedEOS; +template class ShiftedEOS; +template class ShiftedEOS; +template class ShiftedEOS; + +} // namespace singularity diff --git a/singularity-eos/eos/modifiers/shifted_eos.hpp b/singularity-eos/eos/modifiers/shifted_eos.hpp index 1e3d43b56ac..4f77a646410 100644 --- a/singularity-eos/eos/modifiers/shifted_eos.hpp +++ b/singularity-eos/eos/modifiers/shifted_eos.hpp @@ -386,6 +386,25 @@ class ShiftedEOS : public EosBase> { double shift_; }; +#ifdef SINGULARITY_INSTANTIATE_CLASSES +class IdealGas; +class Gruneisen; +class Vinet; +class MGUsup; +class PowerMG; +class JWL; +class DavisReactants; +class DavisProducts; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +extern template class ShiftedEOS; +#endif // SINGULARITY_INSTANTIATE_CLASSES + } // namespace singularity #endif // _SINGULARITY_EOS_EOS_SHIFTED_EOS_ diff --git a/singularity-eos/eos/singularity_eos.cpp b/singularity-eos/eos/singularity_eos.cpp index a620166f581..af944ed89c9 100644 --- a/singularity-eos/eos/singularity_eos.cpp +++ b/singularity-eos/eos/singularity_eos.cpp @@ -181,7 +181,7 @@ int init_sg_StiffGas(const int matindex, EOS *eos, const double gm1, const doubl eos[matindex] = eos_.GetOnDevice(); return 0; #else - PORTABLE_THROW_OR_ABORT("Stiff Gas not currently supported. Please build with " + PORTABLE_THROW_OR_ABORT("StiffGas not currently supported. Please build with " "-DSINGULARITY_USE_V_AND_V_EOS"); return 1; #endif // SINGULARITY_USE_V_AND_V_EOS