From 916f45045a9a0d9a0c5975e9ac2b98ff1b43b265 Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Tue, 30 Jul 2024 10:57:04 -0600 Subject: [PATCH 01/11] Initial commit for StiffGas python interface --- python/module.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/module.cpp b/python/module.cpp index 2b89795552..725d2f400c 100644 --- a/python/module.cpp +++ b/python/module.cpp @@ -32,6 +32,11 @@ PYBIND11_MODULE(singularity_eos, m) { py::arg("gm1"), py::arg("Cv") ); + eos_class(m, "StiffGas") + .def(py::init()) + .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("q"), py:;arg("Pinf")); + + eos_class(m, "Gruneisen") .def(py::init()) .def( From 342837ead88ebc7548e9d48e26272c5db12172e6 Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Tue, 30 Jul 2024 18:51:44 -0600 Subject: [PATCH 02/11] Add NobleAble to module.cpp for python interfacing. --- python/module.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/module.cpp b/python/module.cpp index 725d2f400c..b0105e99e5 100644 --- a/python/module.cpp +++ b/python/module.cpp @@ -36,6 +36,9 @@ PYBIND11_MODULE(singularity_eos, m) { .def(py::init()) .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("q"), py:;arg("Pinf")); + eos_class(m, "NobleAble") + .def(py::init()) + .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("b"), py::arg("q")) eos_class(m, "Gruneisen") .def(py::init()) From 7f39e3fe4e3b5b21febca709ba4cb081299e8216 Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Mon, 5 Aug 2024 09:52:19 -0600 Subject: [PATCH 03/11] Changing branch --- python/module.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/module.cpp b/python/module.cpp index b0105e99e5..9c23c19d2b 100644 --- a/python/module.cpp +++ b/python/module.cpp @@ -34,11 +34,11 @@ PYBIND11_MODULE(singularity_eos, m) { eos_class(m, "StiffGas") .def(py::init()) - .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("q"), py:;arg("Pinf")); + .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("Pinf"), py:arg("q")); - eos_class(m, "NobleAble") - .def(py::init()) - .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("b"), py::arg("q")) + //eos_class(m, "NobleAble") + //.def(py::init()) + //.def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("b"), py::arg("q")) eos_class(m, "Gruneisen") .def(py::init()) From d15d8b0439b5671bd54b50f6efbbe0fc36413d9b Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Thu, 8 Aug 2024 15:06:36 -0600 Subject: [PATCH 04/11] debugged stiff gas in python module --- python/module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/module.cpp b/python/module.cpp index 9c23c19d2b..15e5df8408 100644 --- a/python/module.cpp +++ b/python/module.cpp @@ -34,7 +34,7 @@ PYBIND11_MODULE(singularity_eos, m) { eos_class(m, "StiffGas") .def(py::init()) - .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("Pinf"), py:arg("q")); + .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("Pinf"), py::arg("q")); //eos_class(m, "NobleAble") //.def(py::init()) From 7587914d4070f008f3161620e5542a4cc915b559 Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Thu, 8 Aug 2024 16:54:30 -0600 Subject: [PATCH 05/11] Removed NobleAble comments from module.cpp and added initialization testing for StiffGas in test/python_bindings.py --- python/module.cpp | 4 ---- singularity-eos/eos/eos_variant.hpp | 30 +++++++++++++++++++++++++++++ test/python_bindings.py | 3 +++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/python/module.cpp b/python/module.cpp index 15e5df8408..f9c70f32a2 100644 --- a/python/module.cpp +++ b/python/module.cpp @@ -36,10 +36,6 @@ PYBIND11_MODULE(singularity_eos, m) { .def(py::init()) .def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("Pinf"), py::arg("q")); - //eos_class(m, "NobleAble") - //.def(py::init()) - //.def(py::init(), py::arg("gm1"), py::arg("Cv"), py::arg("b"), py::arg("q")) - eos_class(m, "Gruneisen") .def(py::init()) .def( diff --git a/singularity-eos/eos/eos_variant.hpp b/singularity-eos/eos/eos_variant.hpp index 1a98dfdcc8..0cc441ef0c 100644 --- a/singularity-eos/eos/eos_variant.hpp +++ b/singularity-eos/eos/eos_variant.hpp @@ -120,6 +120,36 @@ class Variant { eos_); } + ///////////////////////////// + /// NEW SGERBERDING STUFF /// + ///////////////////////////// + + template + PORTABLE_INLINE_FUNCTION Real InternalEnergyFromDensityPressure( + const Real rho, const Real pressure, + Indexer_t &&lambda = static_cast(nullptr)) const { + return mpark::visit( + [&rho, &pressure, &lambda](const auto &eos) { + return eos.InternalEnergyFromDensityPressure(rho, pressure, lambda); + }, + eos_); + } + + template + PORTABLE_INLINE_FUNCTION Real TemperatureFromDensityPressure( + const Real rho, const Real pressure, + Indexer_t &&lambda = static_cast(nullptr)) const { + return mpark::visit( + [&rho, &pressure, &lambda](const auto &eos) { + return eos.TemperatureFromDensityPressure(rho, pressure, lambda); + }, + eos_); + } + +////////////////////////////////////// +////////////////////////////////////// +////////////////////////////////////// + template PORTABLE_INLINE_FUNCTION Real PressureFromDensityTemperature( const Real rho, const Real temperature, diff --git a/test/python_bindings.py b/test/python_bindings.py index 951e90523e..2e79ddd91e 100644 --- a/test/python_bindings.py +++ b/test/python_bindings.py @@ -67,6 +67,9 @@ def testConstants(self): def testIdealGas(self): eos = singularity_eos.IdealGas(1,1) + def testStiffGase(self): + eos = singularity_eos.StiffGas(1,1,1) + def testShiftedIdealGas(self): eos = singularity_eos.Shifted(singularity_eos.IdealGas(1,1),1) From 4af5134ada6bd93139feec70756b43d04181184c Mon Sep 17 00:00:00 2001 From: Gerbeset <110115947+Gerbeset@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:05:38 -0600 Subject: [PATCH 06/11] Update test/python_bindings.py Co-authored-by: Jeff Peterson <83598606+jhp-lanl@users.noreply.github.com> --- test/python_bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python_bindings.py b/test/python_bindings.py index 2e79ddd91e..714d6bd06d 100644 --- a/test/python_bindings.py +++ b/test/python_bindings.py @@ -67,7 +67,7 @@ def testConstants(self): def testIdealGas(self): eos = singularity_eos.IdealGas(1,1) - def testStiffGase(self): + def testStiffGas(self): eos = singularity_eos.StiffGas(1,1,1) def testShiftedIdealGas(self): From 16e4bc4664e5c38a27cc3d60068b6d6d0ba6497f Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Thu, 8 Aug 2024 17:07:25 -0600 Subject: [PATCH 07/11] Removed wrong changes to eos_variant.hpp --- singularity-eos/eos/eos_variant.hpp | 30 ----------------------------- 1 file changed, 30 deletions(-) diff --git a/singularity-eos/eos/eos_variant.hpp b/singularity-eos/eos/eos_variant.hpp index 0cc441ef0c..1a98dfdcc8 100644 --- a/singularity-eos/eos/eos_variant.hpp +++ b/singularity-eos/eos/eos_variant.hpp @@ -120,36 +120,6 @@ class Variant { eos_); } - ///////////////////////////// - /// NEW SGERBERDING STUFF /// - ///////////////////////////// - - template - PORTABLE_INLINE_FUNCTION Real InternalEnergyFromDensityPressure( - const Real rho, const Real pressure, - Indexer_t &&lambda = static_cast(nullptr)) const { - return mpark::visit( - [&rho, &pressure, &lambda](const auto &eos) { - return eos.InternalEnergyFromDensityPressure(rho, pressure, lambda); - }, - eos_); - } - - template - PORTABLE_INLINE_FUNCTION Real TemperatureFromDensityPressure( - const Real rho, const Real pressure, - Indexer_t &&lambda = static_cast(nullptr)) const { - return mpark::visit( - [&rho, &pressure, &lambda](const auto &eos) { - return eos.TemperatureFromDensityPressure(rho, pressure, lambda); - }, - eos_); - } - -////////////////////////////////////// -////////////////////////////////////// -////////////////////////////////////// - template PORTABLE_INLINE_FUNCTION Real PressureFromDensityTemperature( const Real rho, const Real temperature, From 64eb62831c533566c840d19d341eab3cf182ef83 Mon Sep 17 00:00:00 2001 From: Seth James Gerberding Date: Thu, 8 Aug 2024 17:09:50 -0600 Subject: [PATCH 08/11] Fixed spelling mistake in StiffGas for python_bindings.py in test/ --- test/python_bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python_bindings.py b/test/python_bindings.py index 2e79ddd91e..714d6bd06d 100644 --- a/test/python_bindings.py +++ b/test/python_bindings.py @@ -67,7 +67,7 @@ def testConstants(self): def testIdealGas(self): eos = singularity_eos.IdealGas(1,1) - def testStiffGase(self): + def testStiffGas(self): eos = singularity_eos.StiffGas(1,1,1) def testShiftedIdealGas(self): From f67ff35b0df7fd0525483907fcbdca946d64d36f Mon Sep 17 00:00:00 2001 From: Gerbeset <110115947+Gerbeset@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:17:30 -0600 Subject: [PATCH 09/11] Update test/python_bindings.py Co-authored-by: Jeff Peterson <83598606+jhp-lanl@users.noreply.github.com> --- test/python_bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python_bindings.py b/test/python_bindings.py index 714d6bd06d..4d5f0f55b6 100644 --- a/test/python_bindings.py +++ b/test/python_bindings.py @@ -68,7 +68,7 @@ def testIdealGas(self): eos = singularity_eos.IdealGas(1,1) def testStiffGas(self): - eos = singularity_eos.StiffGas(1,1,1) + eos = singularity_eos.StiffGas(1,1,1,1) def testShiftedIdealGas(self): eos = singularity_eos.Shifted(singularity_eos.IdealGas(1,1),1) From 49b6436fa173997919614caa45733f655a5df6b2 Mon Sep 17 00:00:00 2001 From: Jeff Peterson <83598606+jhp-lanl@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:23:16 -0600 Subject: [PATCH 10/11] Update CHANGELOG for stiff gas addition --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c4142d09c..3b8436346d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Changed (changing behavior/API/variables/...) ### Infrastructure (changes irrelevant to downstream codes) +- [[PR402]](https://github.com/lanl/singularity-eos/pull/402) Added stiff gas to python interface ### Removed (removing behavior/API/varaibles/...) From b4caf67bc4deb60696fbd4879fd8959543c0b731 Mon Sep 17 00:00:00 2001 From: Jeff Peterson <83598606+jhp-lanl@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:25:04 -0600 Subject: [PATCH 11/11] Update python_bindings.py Update copyright --- test/python_bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python_bindings.py b/test/python_bindings.py index 4d5f0f55b6..8f4be98716 100644 --- a/test/python_bindings.py +++ b/test/python_bindings.py @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# © 2021-2023. Triad National Security, LLC. All rights reserved. This +# © 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