From de1d873a19af86b62eb71d6574ff9567b526df6c Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Tue, 10 Dec 2024 10:18:41 -0700 Subject: [PATCH 1/7] latest parth develop --- external/parthenon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/parthenon b/external/parthenon index b559452..75ec2e2 160000 --- a/external/parthenon +++ b/external/parthenon @@ -1 +1 @@ -Subproject commit b5594528e31cbcb3bd5d2aaa0f944d36d10b2c8f +Subproject commit 75ec2e2e1951b1d35022f33105eaa7dedf112c69 From 49426d64c5bd164b2b1b855a854713027d5ab4c1 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 12 Dec 2024 09:10:57 -0700 Subject: [PATCH 2/7] Update to support units changes in singularity-opac --- env/bash | 1 - external/singularity-opac | 2 +- src/mcblock/mcblock.cpp | 30 ++++++++++++++++++++++++++---- src/mcblock/mcblock.hpp | 2 +- src/mcblock/opacity.hpp | 10 ++++++---- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/env/bash b/env/bash index f9a97b7..6731622 100644 --- a/env/bash +++ b/env/bash @@ -295,6 +295,5 @@ function build_jaybenne { make -j make_status=$? - echo "${ABS_BUILD_DIR}" return $make_status } diff --git a/external/singularity-opac b/external/singularity-opac index de8c652..2679682 160000 --- a/external/singularity-opac +++ b/external/singularity-opac @@ -1 +1 @@ -Subproject commit de8c6523d04a5ab923550d7b5d374e699729e0b1 +Subproject commit 26796828d774496f9202ccc89833c94ffbea26f3 diff --git a/src/mcblock/mcblock.cpp b/src/mcblock/mcblock.cpp index 3a41752..5798fce 100644 --- a/src/mcblock/mcblock.cpp +++ b/src/mcblock/mcblock.cpp @@ -81,17 +81,32 @@ std::shared_ptr Initialize(ParameterInput *pin) { pkg->AddParam<>("eos_h", eos_h); pkg->AddParam<>("eos_d", eos_h.GetOnDevice()); + // Units (conversion factors from code to CGS) + const Real time_scale = pin->GetOrAddReal("mcblock", "time_scale", 1.); + const Real mass_scale = pin->GetOrAddReal("mcblock", "mass_scale", 1.); + const Real length_scale = pin->GetOrAddReal("mcblock", "length_scale", 1.); + pkg->AddParam<>("time_scale", time_scale); + pkg->AddParam<>("mass_scale", mass_scale); + pkg->AddParam<>("length_scale", length_scale); + // Absorption opacity model OpacityModel opacity_model; Opacity opacity; std::string opacity_model_name = pin->GetString("mcblock", "opacity_model"); if (opacity_model_name == "none") { opacity_model = OpacityModel::none; - opacity = singularity::photons::Gray(0.0); + opacity = singularity::photons::NonCGSUnits( + singularity::photons::Gray(0.0), time_scale, mass_scale, length_scale, 1.); } else if (opacity_model_name == "constant") { opacity_model = OpacityModel::constant; Real kappa = pin->GetReal("mcblock", "opacity_constant_value"); - opacity = singularity::photons::Gray(kappa); + // opacity = singularity::photons::Gray(kappa); + opacity = singularity::photons::NonCGSUnits( + singularity::photons::Gray(kappa), time_scale, mass_scale, length_scale, 1.); + } else if (opacity_model_name == "ep_bremss") { + opacity_model = OpacityModel::epbremss; + opacity = singularity::photons::NonCGSUnits( + singularity::photons::EPBremss(), time_scale, mass_scale, length_scale, 1.); } else { // nothing else supported for now PARTHENON_FAIL("Only none or constant opacity models supported!"); @@ -100,18 +115,25 @@ std::shared_ptr Initialize(ParameterInput *pin) { pkg->AddParam<>("opacity_h", opacity); // Scattering opacity model + // TODO(BRR) Remove apm with switch in singularity-opac to cm^2/g opacities? + const Real apm = + pin->GetOrAddReal("mcblock", "apm", 1.); // Average particle mass (code units) + pkg->AddParam<>("apm", apm); ScatteringModel scattering_model; Scattering scattering; std::string scattering_model_name = pin->GetOrAddString("mcblock", "scattering_model", "none"); if (scattering_model_name == "none") { scattering_model = ScatteringModel::none; - scattering = singularity::photons::GrayS(0.0, 1.0); + scattering = singularity::photons::NonCGSUnits( + singularity::photons::GrayS(0.0, apm), time_scale, mass_scale, length_scale, 1.); } else if (scattering_model_name == "constant") { // TODO(BRR): parse 2nd argument: average particle mass? scattering_model = ScatteringModel::constant; Real kappa_s = pin->GetReal("mcblock", "scattering_constant_value"); - scattering = singularity::photons::GrayS(kappa_s, 1.0); + scattering = singularity::photons::NonCGSUnits( + singularity::photons::GrayS(kappa_s, apm), time_scale, mass_scale, length_scale, + 1.); } else { PARTHENON_FAIL("Only none or constant scattering models supported!"); } diff --git a/src/mcblock/mcblock.hpp b/src/mcblock/mcblock.hpp index 6bf168b..a186a92 100644 --- a/src/mcblock/mcblock.hpp +++ b/src/mcblock/mcblock.hpp @@ -29,7 +29,7 @@ namespace mcblock { // Model enums enum class InitialRadiation { none, thermal }; -enum class OpacityModel { none, constant }; +enum class OpacityModel { none, constant, epbremss }; enum class ScatteringModel { none, constant }; std::shared_ptr Initialize(ParameterInput *pin); diff --git a/src/mcblock/opacity.hpp b/src/mcblock/opacity.hpp index 7cf5602..580d992 100644 --- a/src/mcblock/opacity.hpp +++ b/src/mcblock/opacity.hpp @@ -20,12 +20,14 @@ namespace mcblock { // Reduced absorption variant just for jaybenne -using Opacity = singularity::photons::impl::Variant; +using Opacity = singularity::photons::impl::Variant< + singularity::photons::NonCGSUnits, + singularity::photons::NonCGSUnits>; // Reduced scattering variant just for jaybenne -using Scattering = singularity::photons::impl::S_Variant; +using Scattering = singularity::photons::impl::S_Variant< + singularity::photons::NonCGSUnitsS, + singularity::photons::NonCGSUnitsS>; } // namespace mcblock From 09824c59b870ce8bae4bfbeffde7458e446bdb36 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 12 Dec 2024 12:19:44 -0700 Subject: [PATCH 3/7] latest singularity-opac --- external/singularity-opac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/singularity-opac b/external/singularity-opac index 2679682..b4542ed 160000 --- a/external/singularity-opac +++ b/external/singularity-opac @@ -1 +1 @@ -Subproject commit 26796828d774496f9202ccc89833c94ffbea26f3 +Subproject commit b4542ed7cd618e6ad0d9331205f7ed3d0c2e3a0d From e47cb2064cd0982d5652009a4c927e35db173671 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 12 Dec 2024 12:25:25 -0700 Subject: [PATCH 4/7] dont update parthenon --- external/parthenon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/parthenon b/external/parthenon index 75ec2e2..b559452 160000 --- a/external/parthenon +++ b/external/parthenon @@ -1 +1 @@ -Subproject commit 75ec2e2e1951b1d35022f33105eaa7dedf112c69 +Subproject commit b5594528e31cbcb3bd5d2aaa0f944d36d10b2c8f From 730399eccad948c5ceec9430fdc741fc5a915712 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 12 Dec 2024 12:30:50 -0700 Subject: [PATCH 5/7] add temperature scale, remove old comments --- src/mcblock/mcblock.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mcblock/mcblock.cpp b/src/mcblock/mcblock.cpp index 5798fce..3077cf2 100644 --- a/src/mcblock/mcblock.cpp +++ b/src/mcblock/mcblock.cpp @@ -85,9 +85,11 @@ std::shared_ptr Initialize(ParameterInput *pin) { const Real time_scale = pin->GetOrAddReal("mcblock", "time_scale", 1.); const Real mass_scale = pin->GetOrAddReal("mcblock", "mass_scale", 1.); const Real length_scale = pin->GetOrAddReal("mcblock", "length_scale", 1.); + const Real temperature_scale = pin->GetOrAddReal("mcblock", "temperature_scale", 1.); pkg->AddParam<>("time_scale", time_scale); pkg->AddParam<>("mass_scale", mass_scale); pkg->AddParam<>("length_scale", length_scale); + pkg->AddParam<>("temperature_scale", temperature_scale); // Absorption opacity model OpacityModel opacity_model; @@ -96,17 +98,19 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (opacity_model_name == "none") { opacity_model = OpacityModel::none; opacity = singularity::photons::NonCGSUnits( - singularity::photons::Gray(0.0), time_scale, mass_scale, length_scale, 1.); + singularity::photons::Gray(0.0), time_scale, mass_scale, length_scale, + temperature_scale); } else if (opacity_model_name == "constant") { opacity_model = OpacityModel::constant; Real kappa = pin->GetReal("mcblock", "opacity_constant_value"); - // opacity = singularity::photons::Gray(kappa); opacity = singularity::photons::NonCGSUnits( - singularity::photons::Gray(kappa), time_scale, mass_scale, length_scale, 1.); + singularity::photons::Gray(kappa), time_scale, mass_scale, length_scale, + temperature_scale); } else if (opacity_model_name == "ep_bremss") { opacity_model = OpacityModel::epbremss; opacity = singularity::photons::NonCGSUnits( - singularity::photons::EPBremss(), time_scale, mass_scale, length_scale, 1.); + singularity::photons::EPBremss(), time_scale, mass_scale, length_scale, + temperature_scale); } else { // nothing else supported for now PARTHENON_FAIL("Only none or constant opacity models supported!"); @@ -126,14 +130,14 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (scattering_model_name == "none") { scattering_model = ScatteringModel::none; scattering = singularity::photons::NonCGSUnits( - singularity::photons::GrayS(0.0, apm), time_scale, mass_scale, length_scale, 1.); + singularity::photons::GrayS(0.0, apm), time_scale, mass_scale, length_scale, + temperature_scale); } else if (scattering_model_name == "constant") { - // TODO(BRR): parse 2nd argument: average particle mass? scattering_model = ScatteringModel::constant; Real kappa_s = pin->GetReal("mcblock", "scattering_constant_value"); scattering = singularity::photons::NonCGSUnits( singularity::photons::GrayS(kappa_s, apm), time_scale, mass_scale, length_scale, - 1.); + temperature_scale); } else { PARTHENON_FAIL("Only none or constant scattering models supported!"); } From d9fce77547b726bc3c18f2770a0661c0d48a6786 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 12 Dec 2024 12:58:45 -0700 Subject: [PATCH 6/7] oops NonCGSUnits vs NonCGSUnitsS --- src/mcblock/mcblock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mcblock/mcblock.cpp b/src/mcblock/mcblock.cpp index 3077cf2..d5496bd 100644 --- a/src/mcblock/mcblock.cpp +++ b/src/mcblock/mcblock.cpp @@ -129,13 +129,13 @@ std::shared_ptr Initialize(ParameterInput *pin) { pin->GetOrAddString("mcblock", "scattering_model", "none"); if (scattering_model_name == "none") { scattering_model = ScatteringModel::none; - scattering = singularity::photons::NonCGSUnits( + scattering = singularity::photons::NonCGSUnitsS( singularity::photons::GrayS(0.0, apm), time_scale, mass_scale, length_scale, temperature_scale); } else if (scattering_model_name == "constant") { scattering_model = ScatteringModel::constant; Real kappa_s = pin->GetReal("mcblock", "scattering_constant_value"); - scattering = singularity::photons::NonCGSUnits( + scattering = singularity::photons::NonCGSUnitsS( singularity::photons::GrayS(kappa_s, apm), time_scale, mass_scale, length_scale, temperature_scale); } else { From 3e3f6cd345e3f3f0fdc60260feb680e2a69cf244 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 12 Dec 2024 15:50:28 -0700 Subject: [PATCH 7/7] Latest parthenon --- external/parthenon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/parthenon b/external/parthenon index b559452..89099e3 160000 --- a/external/parthenon +++ b/external/parthenon @@ -1 +1 @@ -Subproject commit b5594528e31cbcb3bd5d2aaa0f944d36d10b2c8f +Subproject commit 89099e3aa7b642fbf60fc43cf93c9ce3d78bcec9