From 723067f0c8ae144b7c70c7f664df4affe7ac950f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 09:11:08 -0500 Subject: [PATCH 001/111] introduce FrozenKeyIdxBiMap data structure --- CMakePresets.json | 2 +- src/clib/CMakeLists.txt | 1 + src/clib/utils/FrozenKeyIdxBiMap.hpp | 226 ++++++++++++++++++ tests/unit/CMakeLists.txt | 4 + tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 262 +++++++++++++++++++++ 5 files changed, 494 insertions(+), 1 deletion(-) create mode 100644 src/clib/utils/FrozenKeyIdxBiMap.hpp create mode 100644 tests/unit/test_unit_FrozenKeyIdxBiMap.cpp diff --git a/CMakePresets.json b/CMakePresets.json index b91a0cd74..037914b50 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -51,7 +51,7 @@ "cacheVariables" : { "CMAKE_COMPILE_WARNING_AS_ERROR": "ON", "CMAKE_C_FLAGS": "-Wall -Wpedantic -Wextra -Wno-error=unused-variable -Wno-error=newline-eof -Wno-unused-parameter", - "CMAKE_CXX_FLAGS": "-Wall -Wpedantic -Wno-c++17-attribute-extensions -Wno-unused-parameter" + "CMAKE_CXX_FLAGS": "-Wall -Wpedantic -Wno-c++17-attribute-extensions -Wno-unused-parameter -Wno-error=self-assign" } }, { diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 6e3b757c8..f865f97e7 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -125,6 +125,7 @@ add_library(Grackle_Grackle solve_rate_cool_g-cpp.cpp solve_rate_cool_g-cpp.h step_rate_newton_raphson.hpp time_deriv_0d.hpp + utils/FrozenKeyIdxBiMap.hpp utils-cpp.cpp utils-cpp.hpp utils-field.hpp fortran_func_wrappers.hpp diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp new file mode 100644 index 000000000..7bf0b2772 --- /dev/null +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -0,0 +1,226 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Declares the internal FrozenKeyIdxBiMap type +/// +/// All insertions occur during initialization. This simplifies a lot of +/// bookkeeping. +/// +/// The underlying implementation of this type is *highly* suboptimal (it's +/// simplistic at the cost of speed). PR #270 introduce a drop-in replacement +/// that maintains the exact same API +/// +//===----------------------------------------------------------------------===// +#ifndef UTILS_FROZENKEYIDXBIMAP_HPP +#define UTILS_FROZENKEYIDXBIMAP_HPP + +#include +#include +#include +#include + +#include "grackle.h" +#include "status_reporting.h" + +// the motivation for these constants are provided in PR #270 (they are related +// to some optimizations in the FrozenKeyIdxBiMap implementation) +namespace grackle::impl::bimap { +/// specifies an invalid value of the map (we state that you can't store the +/// maximum u16 value) +inline constexpr std::uint16_t invalid_val = + std::numeric_limits::max(); + +/// specifies maximum allowed length of a key (excluding the null character). +inline constexpr std::uint16_t keylen_max = 29; +} + +// these are just here for to make it easier for us to adopt changes from PR +// #270 (then we can delete these macros) +#define STRU16MAP_INVALID_VAL grackle::impl::bimap::invalid_val +#define STRU16MAP_KEYLEN_MAX grackle::impl::bimap::keylen_max + +namespace grackle::impl { + +enum class BiMapMode { + REFS_KEYDATA = 0, + COPIES_KEYDATA = 1 +}; + +/// @brief This is a bidirectional map (bimap). It is specialized to map `n` +/// unique string keys to unique indexes with values of `0` through `n-1` and +/// vice versa. The ordering of keys is set at initialization and frozen. +/// +/// This is primarily intended to be used in the implementation of Maps of +/// arrays (where the values could be part of a single contiguous array or are +/// individual arrays), but this but may be broadly useful for other +/// applications. +/// +/// This operates in 2 modes: +/// 1. @ref BiMapMode::REFS_KEYDATA This is the default, where we operate +/// under the assumption that the allocations holding the string characters +/// outlive the bimap. In this mode the bimap is intended to hold +/// string-literals. (which are live for the entirety of a program). This +/// minimizes memory usage. +/// 2. @ref BiMapMode::COPIES_KEYDATA Under this mode, the bimap copies the +/// data of all keys. This is useful for testing purposes. In the long-term, +/// if we allow dynamic extension of chemistry networks, it will also be +/// useful. If we are implement the optimizations described down below +/// (where we directly embed the string in the hash-table-rows), this will +/// probably be a quite a bit faster +/// +/// Replacement in PR #270 +/// ====================== +/// The current implementation is extremely oversimplified and inefficient! It +/// doesn't even use a hash table. The purpose is to create a simple abstract +/// data structure for which the implementation will be dramatically improved +/// by PR #270 (but the interface won't be touched at all). +/// +/// The PR with the improved version, also updates this docstring with a +/// detailed explanation of design decisions (like why the contents +/// are "frozen") and highlights a number of potential improvements. +/// +/// > [!note] +/// > The contents of this struct should be considered an implementation +/// > detail! Always prefer the associated functions (they are defined in such +/// > a way that they should be inlined +struct FrozenKeyIdxBiMap{ + // don't forget to update FrozenKeyIdxBiMap_clone when changing members + + /// the number of contained strings + int length; + /// array of keys + const char** keys; + /// indicates whether the map "owns" the memory holding the characters in + /// each key or just references it + BiMapMode mode; +}; + +/// Constructs a new FrozenKeyIdxBiMap +/// +/// @param[out] out Pointer where the allocated type is stored +/// @param[in] keys Sequence of 1 or more unique strings. Each string must +/// include at least 1 non-null character and be null-terminated +/// @param[in] key_count The length of keys +/// @param[in] mode specifies handling of keys. This will be passed on to any +/// clones that are made. +inline int new_FrozenKeyIdxBiMap( + FrozenKeyIdxBiMap** out, const char* keys[], int key_count, + BiMapMode mode +) { + + // check the specified keys + long long max_keys = static_cast(bimap::invalid_val) - 1LL; + if (key_count < 1 || static_cast(key_count) > max_keys) { + return GrPrintAndReturnErr( + "key_count must be positive and cannot exceed %lld", max_keys + ); + } else if (keys == nullptr) { + return GrPrintAndReturnErr("keys must not be a nullptr"); + } + for (int i = 0; i < key_count; i++) { + GR_INTERNAL_REQUIRE(keys[i] != nullptr, "Can't specify a nullptr key"); + std::size_t n_chrs_without_nul = std::strlen(keys[i]); + if (n_chrs_without_nul == 0 || n_chrs_without_nul > bimap::keylen_max) { + return GrPrintAndReturnErr( + "calling strlen on \"%s\", the key @ index %d, yields 0 or a length " + "exceeding %d", + keys[i], i, bimap::keylen_max + ); + } + // check uniqueness + for (int j = 0; j < i; j++) { + if (strcmp(keys[i], keys[j]) == 0) { + return GrPrintAndReturnErr("\"%s\" key repeats", keys[i]); + } + } + } + + // now, actually construct the result + const char** out_keys = nullptr; + switch (mode) { + case BiMapMode::REFS_KEYDATA: { + out_keys = new const char*[key_count]; + for (int i = 0; i < key_count; i++) { + out_keys[i] = keys[i]; + } + break; + } + case BiMapMode::COPIES_KEYDATA: { + char** tmp_keys = new char*[key_count]; + for (int i = 0; i < key_count; i++) { + std::size_t n_chrs_without_nul = std::strlen(keys[i]); + tmp_keys[i] = new char[n_chrs_without_nul + 1]; + std::memcpy(tmp_keys[i], keys[i], n_chrs_without_nul + 1); + } + out_keys = (const char**)tmp_keys; + break; + } + default: return GrPrintAndReturnErr("unknown mode"); + } + + (*out) = new FrozenKeyIdxBiMap; + (*out)->length = key_count; + (*out)->keys = out_keys; + + return GR_SUCCESS; +} + +/// Destroys the specified FrozenKeyIdxBiMap +inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { + if (ptr->mode == BiMapMode::COPIES_KEYDATA) { + for (int i = 0; i < ptr->length; i++) { + delete[] ptr->keys[i]; + } + } + delete[] ptr->keys; + delete ptr; +} + + +/// Makes a clone of the specified FrozenKeyIdxBiMap (the clone inherites the +/// original BiMapMode). +int FrozenKeyIdxBiMap_clone(FrozenKeyIdxBiMap** out, + const FrozenKeyIdxBiMap* ptr) { + return new_FrozenKeyIdxBiMap(out, ptr->keys, ptr->length, ptr->mode); +}; + +/// returns the value associated with the key or (if the key can't be found) +/// @ref grackle::impl::bimap::invalid_val +inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( + const FrozenKeyIdxBiMap* map, const char* key +) +{ + GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); + for (int i = 0; i < map->length; i++) { + if (std::strcmp(map->keys[i], key) == 0) { + return static_cast(i); + } + } + return bimap::invalid_val; +} + +/// checks if the map contains a key +inline int FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, + const char* key) { + return FrozenKeyIdxBiMap_idx_from_key(map, key) != bimap::invalid_val; +} + +inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) +{ return map->length; } + +/// Return the ith key (this is effectively a reverse lookup) +inline const char* FrozenKeyIdxBiMap_key_from_idx( + const FrozenKeyIdxBiMap* map, std::uint16_t i +) { + if (i >= map->length) { return nullptr; } + return map->keys[i]; // this can't be a nullptr +} + +} // namespace grackle::impl + +#endif // UTILS_FROZENKEYIDXBIMAP_HPP diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 9e05050ba..b6c9e0ba1 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -48,6 +48,10 @@ target_compile_definitions(grtest_utils # start declaring targets for tests # --------------------------------- +add_executable(testFrozenKeyIdxBiMap test_unit_FrozenKeyIdxBiMap.cpp) +target_link_libraries(testFrozenKeyIdxBiMap testdeps) +gtest_discover_tests(testFrozenKeyIdxBiMap) + add_executable(runInterpolationTests test_unit_interpolators_g.cpp) target_link_libraries(runInterpolationTests testdeps) diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp new file mode 100644 index 000000000..83aabc0ca --- /dev/null +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -0,0 +1,262 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// tests the @ref grackle::impl::FrozenKeyIdxBiMap +/// +//===----------------------------------------------------------------------===// + +#include +#include + +#include +#include "utils/FrozenKeyIdxBiMap.hpp" +#include "grackle.h" + +class FrozenKeyIdxBiMapConstructorSuite : + public testing::TestWithParam { + // You can implement all the usual fixture class members here. + // To access the test parameter, call GetParam() from class + // TestWithParam. + +}; + +TEST_P(FrozenKeyIdxBiMapConstructorSuite, Simple) { + grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; + const char* keys[] = {"denisty", "internal_energy"}; + + EXPECT_EQ(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); + ASSERT_NE(tmp, nullptr); + grackle::impl::drop_FrozenKeyIdxBiMap(tmp); +} + +TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { + grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; + + const char* first_key = "density"; + std::string long_key(STRU16MAP_KEYLEN_MAX, 'A'); + const char* keys[2] = {first_key, long_key.data()}; + EXPECT_EQ(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); + ASSERT_NE(tmp, nullptr); + grackle::impl::drop_FrozenKeyIdxBiMap(tmp); +} + +TEST_P(FrozenKeyIdxBiMapConstructorSuite, TooLongKey) { + grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; + + const char* first_key = "density"; + std::string long_key(STRU16MAP_KEYLEN_MAX+1, 'A'); + const char* keys[2] = {first_key, long_key.data()}; + EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); + ASSERT_EQ(tmp, nullptr); +} + +TEST_P(FrozenKeyIdxBiMapConstructorSuite, 0LenKey) { + grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; + + const char* keys[2] = {"density",""}; + EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); + ASSERT_EQ(tmp, nullptr); +} + +TEST_P(FrozenKeyIdxBiMapConstructorSuite, NoKeys) { + grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; + + EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, nullptr, 0, GetParam()), GR_SUCCESS); + ASSERT_EQ(tmp, nullptr); // if this fails, we'll leak memory (but not much + // can be done) +} + +INSTANTIATE_TEST_SUITE_P( + , /* <- leaving Instantiation name empty */ + FrozenKeyIdxBiMapConstructorSuite, + testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, grackle::impl::BiMapMode::COPIES_KEYDATA), + [](const testing::TestParamInfo& info){ + if (info.param == grackle::impl::BiMapMode::REFS_KEYDATA) { + return std::string("BIMAP_REFS_KEYDATA"); + } else { + return std::string("BIMAP_COPIES_KEYDATA"); + } + } +); + + +/// helper function to initialize a map from a vector +int new_FrozenKeyIdxBiMap(grackle::impl::FrozenKeyIdxBiMap** out, + const std::vector& vec_, + grackle::impl::BiMapMode mode) +{ + std::size_t key_count = vec_.size(); + + // create a vector of pointers + std::vector key_ptr_l(key_count, nullptr); + for (std::size_t i = 0; i < key_count; i++) { + key_ptr_l[i] = vec_[i].c_str(); + } + + return new_FrozenKeyIdxBiMap(out, key_ptr_l.data(), key_count, mode); +} + +class FrozenKeyIdxBiMapGeneralSuite : + public testing::TestWithParam +{ +protected: + std::vector ordered_keys; + grackle::impl::FrozenKeyIdxBiMap* bimap_p = nullptr; + + // we use SetUp/Teardown instead of constructor and destructor so we can + // perform some sanity checks with ASSERTIONs + void SetUp() override { + ordered_keys = std::vector{ + "internal_energy", "density", "metal_density" + }; + + grackle::impl::BiMapMode mode = this->GetParam(); + ASSERT_EQ( + new_FrozenKeyIdxBiMap(&this->bimap_p, ordered_keys, mode), + GR_SUCCESS + ); + + } + + void TearDown() override { + if (bimap_p != nullptr) { grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); } + } + + bool ReusesOriginalKeyPtrs(const grackle::impl::FrozenKeyIdxBiMap* p) const { + for (int i = 0; i < 3; i++) { + const char* orig_key_ptr = ordered_keys[i].c_str(); + if (grackle::impl::FrozenKeyIdxBiMap_key_from_idx(p, i) != orig_key_ptr) { + return false; + } + } + return true; + } + +}; + +TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_ContainedKey) { + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "density"), + 1 + ); + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "internal_energy"), + 0 + ); + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "metal_density"), + 2 + ); +} + +TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_AbsentKey) { + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), + STRU16MAP_INVALID_VAL + ); +} + +TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_AbsentIrregularKeys) { + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), + STRU16MAP_INVALID_VAL + ); + + std::string key(STRU16MAP_KEYLEN_MAX+1, 'A'); + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, key.data()), + STRU16MAP_INVALID_VAL + ); +} + +TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdx_InvalidIdx) { + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 3), nullptr); + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, + STRU16MAP_INVALID_VAL), + nullptr + ); +} + +TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdx_ValidIdx) { + EXPECT_EQ( + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 2)), + std::string("metal_density") + ); + EXPECT_EQ( + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 1)), + std::string("density") + ); + EXPECT_EQ( + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 0)), + std::string("internal_energy") + ); + + // check whether the bimap is using pointers to the keys used during init + if (GetParam() == grackle::impl::BiMapMode::REFS_KEYDATA) { + EXPECT_TRUE(ReusesOriginalKeyPtrs(bimap_p)); + } else { + EXPECT_FALSE(ReusesOriginalKeyPtrs(bimap_p)); + } +} + +TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { + grackle::impl::FrozenKeyIdxBiMap* clone_p = nullptr; + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_clone(&clone_p, bimap_p), + GR_SUCCESS + ); + ASSERT_NE(clone_p, nullptr); + + // for the sake of robustly checking everything, we delete bimap_p + grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); + bimap_p = nullptr; + + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "internal_energy"), + 0 + ); + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "notAKey"), + STRU16MAP_INVALID_VAL + ); + + EXPECT_EQ( + grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 3), + nullptr + ); + EXPECT_EQ( + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 1)), + std::string("density") + ); + + // check whether the clone is using pointers to the keys used during init + if (GetParam() == grackle::impl::BiMapMode::REFS_KEYDATA) { + EXPECT_TRUE(ReusesOriginalKeyPtrs(clone_p)); + } else { + EXPECT_FALSE(ReusesOriginalKeyPtrs(clone_p)); + } + + // finally, cleanup the clone + grackle::impl::drop_FrozenKeyIdxBiMap(clone_p); +} + + +INSTANTIATE_TEST_SUITE_P( + , /* <- leaving Instantiation name empty */ + FrozenKeyIdxBiMapGeneralSuite, + testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, + grackle::impl::BiMapMode::COPIES_KEYDATA), + [](const testing::TestParamInfo& info){ + if (info.param == grackle::impl::BiMapMode::REFS_KEYDATA) { + return std::string("BIMAP_REFS_KEYDATA"); + } else { + return std::string("BIMAP_COPIES_KEYDATA"); + } + } +); From cdecbb5222583ef7cf0b6f18d2ea8b1cf59f2a8d Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 09:18:30 -0500 Subject: [PATCH 002/111] address clang-tidy issues --- .clang-tidy | 1 - tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 34b430c8a..fc03db36d 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -84,7 +84,6 @@ Checks: > readability-reference-to-constructed-temporary, readability-simplify-boolean-expr, readability-simplify-subscript-expr, - readability-static-accessed-through-instance, readability-string-compare, readability-uniqueptr-delete-release, diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 83aabc0ca..b645b3e50 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -139,7 +139,7 @@ class FrozenKeyIdxBiMapGeneralSuite : }; -TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_ContainedKey) { +TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "density"), 1 @@ -154,14 +154,14 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_ContainedKey) { ); } -TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_AbsentKey) { +TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), STRU16MAP_INVALID_VAL ); } -TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_AbsentIrregularKeys) { +TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), STRU16MAP_INVALID_VAL @@ -174,7 +174,7 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKey_AbsentIrregularKeys) { ); } -TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdx_InvalidIdx) { +TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 3), nullptr); EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, @@ -183,7 +183,7 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdx_InvalidIdx) { ); } -TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdx_ValidIdx) { +TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { EXPECT_EQ( std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 2)), std::string("metal_density") From ce3c40471e71f14f58bed610ab552f20ea3a9ab5 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 09:25:08 -0500 Subject: [PATCH 003/111] a few minor tweaks --- src/clib/utils/FrozenKeyIdxBiMap.hpp | 3 +++ tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp index 7bf0b2772..093be15e5 100644 --- a/src/clib/utils/FrozenKeyIdxBiMap.hpp +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -15,6 +15,9 @@ /// simplistic at the cost of speed). PR #270 introduce a drop-in replacement /// that maintains the exact same API /// +/// If we decide to more fully embrace C++, it would make a lot of sense to +/// convert this to a full-blown class. +/// //===----------------------------------------------------------------------===// #ifndef UTILS_FROZENKEYIDXBIMAP_HPP #define UTILS_FROZENKEYIDXBIMAP_HPP diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index b645b3e50..94a977e9d 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -38,7 +38,7 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; const char* first_key = "density"; - std::string long_key(STRU16MAP_KEYLEN_MAX, 'A'); + std::string long_key(grackle::impl::bimap::keylen_max, 'A'); const char* keys[2] = {first_key, long_key.data()}; EXPECT_EQ(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); ASSERT_NE(tmp, nullptr); @@ -49,7 +49,7 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, TooLongKey) { grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; const char* first_key = "density"; - std::string long_key(STRU16MAP_KEYLEN_MAX+1, 'A'); + std::string long_key(grackle::impl::bimap::keylen_max+1, 'A'); const char* keys[2] = {first_key, long_key.data()}; EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); ASSERT_EQ(tmp, nullptr); @@ -157,28 +157,28 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), - STRU16MAP_INVALID_VAL + grackle::impl::bimap::invalid_val ); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), - STRU16MAP_INVALID_VAL + grackle::impl::bimap::invalid_val ); - std::string key(STRU16MAP_KEYLEN_MAX+1, 'A'); + std::string key(grackle::impl::bimap::keylen_max+1, 'A'); EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, key.data()), - STRU16MAP_INVALID_VAL + grackle::impl::bimap::invalid_val ); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 3), nullptr); EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, - STRU16MAP_INVALID_VAL), + grackle::impl::FrozenKeyIdxBiMap_key_from_idx( + bimap_p, grackle::impl::bimap::invalid_val), nullptr ); } @@ -223,7 +223,7 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { ); EXPECT_EQ( grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "notAKey"), - STRU16MAP_INVALID_VAL + grackle::impl::bimap::invalid_val ); EXPECT_EQ( From 660431f6aeecedf733365ae790b3d50a252f7cdd Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 10:46:05 -0500 Subject: [PATCH 004/111] Refactor for consistency with other internal types There is some unforunate consequences, but if we don't do this you end up with some pretty confusing looking code... (the confusion primarily arises if new_FrozenKeyIdxBiMap or drop_FrozenKeyIdxBiMap has different behavior from other functions with similar names). I really think it would be better to make this into a simple C++ class with a constructor and destructor, but thats a topic for another time --- src/clib/utils/FrozenKeyIdxBiMap.hpp | 73 +++++++++++++++------- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 73 +++++++++++----------- 2 files changed, 88 insertions(+), 58 deletions(-) diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp index 093be15e5..a7eb21a37 100644 --- a/src/clib/utils/FrozenKeyIdxBiMap.hpp +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -12,11 +12,14 @@ /// bookkeeping. /// /// The underlying implementation of this type is *highly* suboptimal (it's -/// simplistic at the cost of speed). PR #270 introduce a drop-in replacement -/// that maintains the exact same API +/// simplistic at the cost of speed). PR #270 introduce a replacement that +/// maintains almost the exact same API (the new_FrozenKeyIdxBiMap, +/// FrozenKeyIdxBiMap_clone, and drop_FrozenKeyIdxBiMap functions will need to +/// be tweaked) /// -/// If we decide to more fully embrace C++, it would make a lot of sense to -/// convert this to a full-blown class. +/// If we decide to more fully embrace C++, it would make a LOT of sense to +/// convert this to a full-blown class (and delete copy constructor/copy +/// assignement OR adopt reference counting). /// //===----------------------------------------------------------------------===// #ifndef UTILS_FROZENKEYIDXBIMAP_HPP @@ -105,40 +108,51 @@ struct FrozenKeyIdxBiMap{ /// Constructs a new FrozenKeyIdxBiMap /// -/// @param[out] out Pointer where the allocated type is stored /// @param[in] keys Sequence of 1 or more unique strings. Each string must /// include at least 1 non-null character and be null-terminated /// @param[in] key_count The length of keys /// @param[in] mode specifies handling of keys. This will be passed on to any /// clones that are made. -inline int new_FrozenKeyIdxBiMap( - FrozenKeyIdxBiMap** out, const char* keys[], int key_count, - BiMapMode mode +/// +/// > [!note] +/// > If this function returns `bimap`, then the caller should invoke +/// > `FrozenKeyIdxBiMap_is_ok(&bimap)` to test whether there was an error. +/// > This is pretty ugly/clunky, but its the only practical way to achieve +/// > comparable behavior to other internal datatypes (ideally, we would make +/// > this a simple C++ class instead) +inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( + const char* keys[], int key_count, BiMapMode mode ) { + // this will be returned if there is an error + FrozenKeyIdxBiMap erroneous_obj{0, nullptr, BiMapMode::REFS_KEYDATA}; // check the specified keys long long max_keys = static_cast(bimap::invalid_val) - 1LL; if (key_count < 1 || static_cast(key_count) > max_keys) { - return GrPrintAndReturnErr( + GrPrintErrMsg( "key_count must be positive and cannot exceed %lld", max_keys ); + return erroneous_obj; } else if (keys == nullptr) { - return GrPrintAndReturnErr("keys must not be a nullptr"); + GrPrintErrMsg("keys must not be a nullptr"); + return erroneous_obj; } for (int i = 0; i < key_count; i++) { GR_INTERNAL_REQUIRE(keys[i] != nullptr, "Can't specify a nullptr key"); std::size_t n_chrs_without_nul = std::strlen(keys[i]); if (n_chrs_without_nul == 0 || n_chrs_without_nul > bimap::keylen_max) { - return GrPrintAndReturnErr( + GrPrintErrMsg( "calling strlen on \"%s\", the key @ index %d, yields 0 or a length " "exceeding %d", keys[i], i, bimap::keylen_max ); + return erroneous_obj; } // check uniqueness for (int j = 0; j < i; j++) { if (strcmp(keys[i], keys[j]) == 0) { - return GrPrintAndReturnErr("\"%s\" key repeats", keys[i]); + GrPrintErrMsg("\"%s\" key repeats", keys[i]); + return erroneous_obj; } } } @@ -163,14 +177,22 @@ inline int new_FrozenKeyIdxBiMap( out_keys = (const char**)tmp_keys; break; } - default: return GrPrintAndReturnErr("unknown mode"); + default: { + GrPrintErrMsg("unknown mode"); + return erroneous_obj; + } } - (*out) = new FrozenKeyIdxBiMap; - (*out)->length = key_count; - (*out)->keys = out_keys; + return FrozenKeyIdxBiMap{ + /* length = */ key_count, + /* keys = */ out_keys, + /* mode = */ mode + }; +} - return GR_SUCCESS; +/// returns whether new_FrozenKeyIdxBiMap constructed a valid object +inline bool FrozenKeyIdxBiMap_is_ok(FrozenKeyIdxBiMap* ptr) { + return (ptr->length > 0); } /// Destroys the specified FrozenKeyIdxBiMap @@ -180,16 +202,23 @@ inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { delete[] ptr->keys[i]; } } - delete[] ptr->keys; - delete ptr; + if (ptr->keys != nullptr) { + delete[] ptr->keys; + } } /// Makes a clone of the specified FrozenKeyIdxBiMap (the clone inherites the /// original BiMapMode). -int FrozenKeyIdxBiMap_clone(FrozenKeyIdxBiMap** out, - const FrozenKeyIdxBiMap* ptr) { - return new_FrozenKeyIdxBiMap(out, ptr->keys, ptr->length, ptr->mode); +/// +/// > [!note] +/// > If this function returns `bimap`, then the caller should invoke +/// > `FrozenKeyIdxBiMap_is_ok(&bimap)` to test whether there was an error. +/// > This is pretty ugly/clunky, but its the only practical way to achieve +/// > comparable behavior to other internal datatypes (ideally, we would make +/// > this a simple C++ class instead) +FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { + return new_FrozenKeyIdxBiMap(ptr->keys, ptr->length, ptr->mode); }; /// returns the value associated with the key or (if the key can't be found) diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 94a977e9d..8bfe41a68 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -26,49 +26,49 @@ class FrozenKeyIdxBiMapConstructorSuite : }; TEST_P(FrozenKeyIdxBiMapConstructorSuite, Simple) { - grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; const char* keys[] = {"denisty", "internal_energy"}; - EXPECT_EQ(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); - ASSERT_NE(tmp, nullptr); - grackle::impl::drop_FrozenKeyIdxBiMap(tmp); + grackle::impl::FrozenKeyIdxBiMap tmp + = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + + EXPECT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); + grackle::impl::drop_FrozenKeyIdxBiMap(&tmp); } TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { - grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; - const char* first_key = "density"; std::string long_key(grackle::impl::bimap::keylen_max, 'A'); const char* keys[2] = {first_key, long_key.data()}; - EXPECT_EQ(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); - ASSERT_NE(tmp, nullptr); - grackle::impl::drop_FrozenKeyIdxBiMap(tmp); + + grackle::impl::FrozenKeyIdxBiMap tmp + = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + + ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); + grackle::impl::drop_FrozenKeyIdxBiMap(&tmp); } TEST_P(FrozenKeyIdxBiMapConstructorSuite, TooLongKey) { - grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; - const char* first_key = "density"; std::string long_key(grackle::impl::bimap::keylen_max+1, 'A'); const char* keys[2] = {first_key, long_key.data()}; - EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); - ASSERT_EQ(tmp, nullptr); + + grackle::impl::FrozenKeyIdxBiMap tmp + = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } TEST_P(FrozenKeyIdxBiMapConstructorSuite, 0LenKey) { - grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; - const char* keys[2] = {"density",""}; - EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, keys, 2, GetParam()), GR_SUCCESS); - ASSERT_EQ(tmp, nullptr); + grackle::impl::FrozenKeyIdxBiMap tmp + = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } TEST_P(FrozenKeyIdxBiMapConstructorSuite, NoKeys) { - grackle::impl::FrozenKeyIdxBiMap* tmp = nullptr; - EXPECT_NE(new_FrozenKeyIdxBiMap(&tmp, nullptr, 0, GetParam()), GR_SUCCESS); - ASSERT_EQ(tmp, nullptr); // if this fails, we'll leak memory (but not much - // can be done) + grackle::impl::FrozenKeyIdxBiMap tmp + = grackle::impl::new_FrozenKeyIdxBiMap(nullptr, 0, GetParam()); + ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } INSTANTIATE_TEST_SUITE_P( @@ -86,9 +86,8 @@ INSTANTIATE_TEST_SUITE_P( /// helper function to initialize a map from a vector -int new_FrozenKeyIdxBiMap(grackle::impl::FrozenKeyIdxBiMap** out, - const std::vector& vec_, - grackle::impl::BiMapMode mode) +grackle::impl::FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( + const std::vector& vec_, grackle::impl::BiMapMode mode) { std::size_t key_count = vec_.size(); @@ -98,7 +97,7 @@ int new_FrozenKeyIdxBiMap(grackle::impl::FrozenKeyIdxBiMap** out, key_ptr_l[i] = vec_[i].c_str(); } - return new_FrozenKeyIdxBiMap(out, key_ptr_l.data(), key_count, mode); + return new_FrozenKeyIdxBiMap(key_ptr_l.data(), key_count, mode); } class FrozenKeyIdxBiMapGeneralSuite : @@ -116,15 +115,19 @@ class FrozenKeyIdxBiMapGeneralSuite : }; grackle::impl::BiMapMode mode = this->GetParam(); - ASSERT_EQ( - new_FrozenKeyIdxBiMap(&this->bimap_p, ordered_keys, mode), - GR_SUCCESS - ); + grackle::impl::FrozenKeyIdxBiMap tmp + = new_FrozenKeyIdxBiMap(ordered_keys, mode); + ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); + bimap_p = new grackle::impl::FrozenKeyIdxBiMap; + (*bimap_p) = tmp; } void TearDown() override { - if (bimap_p != nullptr) { grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); } + if (bimap_p != nullptr) { + grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); + delete bimap_p; + } } bool ReusesOriginalKeyPtrs(const grackle::impl::FrozenKeyIdxBiMap* p) const { @@ -206,12 +209,10 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { } TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { - grackle::impl::FrozenKeyIdxBiMap* clone_p = nullptr; - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_clone(&clone_p, bimap_p), - GR_SUCCESS - ); - ASSERT_NE(clone_p, nullptr); + grackle::impl::FrozenKeyIdxBiMap clone = + grackle::impl::FrozenKeyIdxBiMap_clone(bimap_p); + ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&clone)); + grackle::impl::FrozenKeyIdxBiMap* clone_p = &clone; // for the sake of robustly checking everything, we delete bimap_p grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); From 1f42941e364f142eb27ade9ad9e88d29ff7c897c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 10:51:08 -0500 Subject: [PATCH 005/111] restore clang-tidy setting from a few commits back --- .clang-tidy | 1 + tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index fc03db36d..34b430c8a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -84,6 +84,7 @@ Checks: > readability-reference-to-constructed-temporary, readability-simplify-boolean-expr, readability-simplify-subscript-expr, + readability-static-accessed-through-instance, readability-string-compare, readability-uniqueptr-delete-release, diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 8bfe41a68..dfff5ba99 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -114,7 +114,7 @@ class FrozenKeyIdxBiMapGeneralSuite : "internal_energy", "density", "metal_density" }; - grackle::impl::BiMapMode mode = this->GetParam(); + grackle::impl::BiMapMode mode = GetParam(); grackle::impl::FrozenKeyIdxBiMap tmp = new_FrozenKeyIdxBiMap(ordered_keys, mode); ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); From a6aa793ff5c1eb81d827e5dda4924d5df70ad0ed Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 10:53:21 -0500 Subject: [PATCH 006/111] apply clang-format --- src/clib/utils/FrozenKeyIdxBiMap.hpp | 55 +++---- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 181 +++++++++------------ 2 files changed, 99 insertions(+), 137 deletions(-) diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp index a7eb21a37..c884c9bbf 100644 --- a/src/clib/utils/FrozenKeyIdxBiMap.hpp +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -43,7 +43,7 @@ inline constexpr std::uint16_t invalid_val = /// specifies maximum allowed length of a key (excluding the null character). inline constexpr std::uint16_t keylen_max = 29; -} +} // namespace grackle::impl::bimap // these are just here for to make it easier for us to adopt changes from PR // #270 (then we can delete these macros) @@ -52,10 +52,7 @@ inline constexpr std::uint16_t keylen_max = 29; namespace grackle::impl { -enum class BiMapMode { - REFS_KEYDATA = 0, - COPIES_KEYDATA = 1 -}; +enum class BiMapMode { REFS_KEYDATA = 0, COPIES_KEYDATA = 1 }; /// @brief This is a bidirectional map (bimap). It is specialized to map `n` /// unique string keys to unique indexes with values of `0` through `n-1` and @@ -94,7 +91,7 @@ enum class BiMapMode { /// > The contents of this struct should be considered an implementation /// > detail! Always prefer the associated functions (they are defined in such /// > a way that they should be inlined -struct FrozenKeyIdxBiMap{ +struct FrozenKeyIdxBiMap { // don't forget to update FrozenKeyIdxBiMap_clone when changing members /// the number of contained strings @@ -120,18 +117,16 @@ struct FrozenKeyIdxBiMap{ /// > This is pretty ugly/clunky, but its the only practical way to achieve /// > comparable behavior to other internal datatypes (ideally, we would make /// > this a simple C++ class instead) -inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( - const char* keys[], int key_count, BiMapMode mode -) { +inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], + int key_count, BiMapMode mode) { // this will be returned if there is an error FrozenKeyIdxBiMap erroneous_obj{0, nullptr, BiMapMode::REFS_KEYDATA}; // check the specified keys long long max_keys = static_cast(bimap::invalid_val) - 1LL; if (key_count < 1 || static_cast(key_count) > max_keys) { - GrPrintErrMsg( - "key_count must be positive and cannot exceed %lld", max_keys - ); + GrPrintErrMsg("key_count must be positive and cannot exceed %lld", + max_keys); return erroneous_obj; } else if (keys == nullptr) { GrPrintErrMsg("keys must not be a nullptr"); @@ -142,10 +137,9 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( std::size_t n_chrs_without_nul = std::strlen(keys[i]); if (n_chrs_without_nul == 0 || n_chrs_without_nul > bimap::keylen_max) { GrPrintErrMsg( - "calling strlen on \"%s\", the key @ index %d, yields 0 or a length " - "exceeding %d", - keys[i], i, bimap::keylen_max - ); + "calling strlen on \"%s\", the key @ index %d, yields 0 or a length " + "exceeding %d", + keys[i], i, bimap::keylen_max); return erroneous_obj; } // check uniqueness @@ -183,11 +177,9 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( } } - return FrozenKeyIdxBiMap{ - /* length = */ key_count, - /* keys = */ out_keys, - /* mode = */ mode - }; + return FrozenKeyIdxBiMap{/* length = */ key_count, + /* keys = */ out_keys, + /* mode = */ mode}; } /// returns whether new_FrozenKeyIdxBiMap constructed a valid object @@ -207,7 +199,6 @@ inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { } } - /// Makes a clone of the specified FrozenKeyIdxBiMap (the clone inherites the /// original BiMapMode). /// @@ -224,9 +215,7 @@ FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { /// returns the value associated with the key or (if the key can't be found) /// @ref grackle::impl::bimap::invalid_val inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( - const FrozenKeyIdxBiMap* map, const char* key -) -{ + const FrozenKeyIdxBiMap* map, const char* key) { GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); for (int i = 0; i < map->length; i++) { if (std::strcmp(map->keys[i], key) == 0) { @@ -242,15 +231,17 @@ inline int FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, return FrozenKeyIdxBiMap_idx_from_key(map, key) != bimap::invalid_val; } -inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) -{ return map->length; } +inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) { + return map->length; +} /// Return the ith key (this is effectively a reverse lookup) -inline const char* FrozenKeyIdxBiMap_key_from_idx( - const FrozenKeyIdxBiMap* map, std::uint16_t i -) { - if (i >= map->length) { return nullptr; } - return map->keys[i]; // this can't be a nullptr +inline const char* FrozenKeyIdxBiMap_key_from_idx(const FrozenKeyIdxBiMap* map, + std::uint16_t i) { + if (i >= map->length) { + return nullptr; + } + return map->keys[i]; // this can't be a nullptr } } // namespace grackle::impl diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index dfff5ba99..61e45cf60 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -17,19 +17,18 @@ #include "utils/FrozenKeyIdxBiMap.hpp" #include "grackle.h" -class FrozenKeyIdxBiMapConstructorSuite : - public testing::TestWithParam { +class FrozenKeyIdxBiMapConstructorSuite + : public testing::TestWithParam { // You can implement all the usual fixture class members here. // To access the test parameter, call GetParam() from class // TestWithParam. - }; TEST_P(FrozenKeyIdxBiMapConstructorSuite, Simple) { const char* keys[] = {"denisty", "internal_energy"}; - grackle::impl::FrozenKeyIdxBiMap tmp - = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + grackle::impl::FrozenKeyIdxBiMap tmp = + grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); EXPECT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); grackle::impl::drop_FrozenKeyIdxBiMap(&tmp); @@ -40,8 +39,8 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { std::string long_key(grackle::impl::bimap::keylen_max, 'A'); const char* keys[2] = {first_key, long_key.data()}; - grackle::impl::FrozenKeyIdxBiMap tmp - = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + grackle::impl::FrozenKeyIdxBiMap tmp = + grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); grackle::impl::drop_FrozenKeyIdxBiMap(&tmp); @@ -49,46 +48,44 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { TEST_P(FrozenKeyIdxBiMapConstructorSuite, TooLongKey) { const char* first_key = "density"; - std::string long_key(grackle::impl::bimap::keylen_max+1, 'A'); + std::string long_key(grackle::impl::bimap::keylen_max + 1, 'A'); const char* keys[2] = {first_key, long_key.data()}; - grackle::impl::FrozenKeyIdxBiMap tmp - = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + grackle::impl::FrozenKeyIdxBiMap tmp = + grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } TEST_P(FrozenKeyIdxBiMapConstructorSuite, 0LenKey) { - const char* keys[2] = {"density",""}; - grackle::impl::FrozenKeyIdxBiMap tmp - = grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); + const char* keys[2] = {"density", ""}; + grackle::impl::FrozenKeyIdxBiMap tmp = + grackle::impl::new_FrozenKeyIdxBiMap(keys, 2, GetParam()); ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } TEST_P(FrozenKeyIdxBiMapConstructorSuite, NoKeys) { - - grackle::impl::FrozenKeyIdxBiMap tmp - = grackle::impl::new_FrozenKeyIdxBiMap(nullptr, 0, GetParam()); + grackle::impl::FrozenKeyIdxBiMap tmp = + grackle::impl::new_FrozenKeyIdxBiMap(nullptr, 0, GetParam()); ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } INSTANTIATE_TEST_SUITE_P( - , /* <- leaving Instantiation name empty */ - FrozenKeyIdxBiMapConstructorSuite, - testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, grackle::impl::BiMapMode::COPIES_KEYDATA), - [](const testing::TestParamInfo& info){ - if (info.param == grackle::impl::BiMapMode::REFS_KEYDATA) { - return std::string("BIMAP_REFS_KEYDATA"); - } else { - return std::string("BIMAP_COPIES_KEYDATA"); - } - } -); - + , /* <- leaving Instantiation name empty */ + FrozenKeyIdxBiMapConstructorSuite, + testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, + grackle::impl::BiMapMode::COPIES_KEYDATA), + [](const testing::TestParamInfo< + FrozenKeyIdxBiMapConstructorSuite::ParamType>& info) { + if (info.param == grackle::impl::BiMapMode::REFS_KEYDATA) { + return std::string("BIMAP_REFS_KEYDATA"); + } else { + return std::string("BIMAP_COPIES_KEYDATA"); + } + }); /// helper function to initialize a map from a vector grackle::impl::FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( - const std::vector& vec_, grackle::impl::BiMapMode mode) -{ + const std::vector& vec_, grackle::impl::BiMapMode mode) { std::size_t key_count = vec_.size(); // create a vector of pointers @@ -100,9 +97,8 @@ grackle::impl::FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap( return new_FrozenKeyIdxBiMap(key_ptr_l.data(), key_count, mode); } -class FrozenKeyIdxBiMapGeneralSuite : - public testing::TestWithParam -{ +class FrozenKeyIdxBiMapGeneralSuite + : public testing::TestWithParam { protected: std::vector ordered_keys; grackle::impl::FrozenKeyIdxBiMap* bimap_p = nullptr; @@ -110,13 +106,12 @@ class FrozenKeyIdxBiMapGeneralSuite : // we use SetUp/Teardown instead of constructor and destructor so we can // perform some sanity checks with ASSERTIONs void SetUp() override { - ordered_keys = std::vector{ - "internal_energy", "density", "metal_density" - }; + ordered_keys = + std::vector{"internal_energy", "density", "metal_density"}; grackle::impl::BiMapMode mode = GetParam(); - grackle::impl::FrozenKeyIdxBiMap tmp - = new_FrozenKeyIdxBiMap(ordered_keys, mode); + grackle::impl::FrozenKeyIdxBiMap tmp = + new_FrozenKeyIdxBiMap(ordered_keys, mode); ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); bimap_p = new grackle::impl::FrozenKeyIdxBiMap; @@ -139,66 +134,50 @@ class FrozenKeyIdxBiMapGeneralSuite : } return true; } - }; TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "density"), + 1); EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "density"), - 1 - ); + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "internal_energy"), + 0); EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "internal_energy"), - 0 - ); - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "metal_density"), - 2 - ); + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "metal_density"), + 2); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), - grackle::impl::bimap::invalid_val - ); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), + grackle::impl::bimap::invalid_val); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), - grackle::impl::bimap::invalid_val - ); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), + grackle::impl::bimap::invalid_val); - std::string key(grackle::impl::bimap::keylen_max+1, 'A'); - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, key.data()), - grackle::impl::bimap::invalid_val - ); + std::string key(grackle::impl::bimap::keylen_max + 1, 'A'); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, key.data()), + grackle::impl::bimap::invalid_val); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 3), nullptr); - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_key_from_idx( - bimap_p, grackle::impl::bimap::invalid_val), - nullptr - ); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx( + bimap_p, grackle::impl::bimap::invalid_val), + nullptr); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 2)), - std::string("metal_density") - ); + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 2)), + std::string("metal_density")); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 1)), - std::string("density") - ); + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 1)), + std::string("density")); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 0)), - std::string("internal_energy") - ); + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 0)), + std::string("internal_energy")); // check whether the bimap is using pointers to the keys used during init if (GetParam() == grackle::impl::BiMapMode::REFS_KEYDATA) { @@ -209,8 +188,8 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { } TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { - grackle::impl::FrozenKeyIdxBiMap clone = - grackle::impl::FrozenKeyIdxBiMap_clone(bimap_p); + grackle::impl::FrozenKeyIdxBiMap clone = + grackle::impl::FrozenKeyIdxBiMap_clone(bimap_p); ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&clone)); grackle::impl::FrozenKeyIdxBiMap* clone_p = &clone; @@ -219,22 +198,15 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { bimap_p = nullptr; EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "internal_energy"), - 0 - ); - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "notAKey"), - grackle::impl::bimap::invalid_val - ); + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "internal_energy"), + 0); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "notAKey"), + grackle::impl::bimap::invalid_val); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 3), nullptr); EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 3), - nullptr - ); - EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 1)), - std::string("density") - ); + std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 1)), + std::string("density")); // check whether the clone is using pointers to the keys used during init if (GetParam() == grackle::impl::BiMapMode::REFS_KEYDATA) { @@ -247,17 +219,16 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { grackle::impl::drop_FrozenKeyIdxBiMap(clone_p); } - INSTANTIATE_TEST_SUITE_P( - , /* <- leaving Instantiation name empty */ - FrozenKeyIdxBiMapGeneralSuite, - testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, - grackle::impl::BiMapMode::COPIES_KEYDATA), - [](const testing::TestParamInfo& info){ - if (info.param == grackle::impl::BiMapMode::REFS_KEYDATA) { - return std::string("BIMAP_REFS_KEYDATA"); - } else { - return std::string("BIMAP_COPIES_KEYDATA"); - } - } -); + , /* <- leaving Instantiation name empty */ + FrozenKeyIdxBiMapGeneralSuite, + testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, + grackle::impl::BiMapMode::COPIES_KEYDATA), + [](const testing::TestParamInfo& + info) { + if (info.param == grackle::impl::BiMapMode::REFS_KEYDATA) { + return std::string("BIMAP_REFS_KEYDATA"); + } else { + return std::string("BIMAP_COPIES_KEYDATA"); + } + }); From 19d4f7e64948cf1fbf6a9062a2aa66d28f4bb6c4 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 19 Nov 2025 12:31:00 -0500 Subject: [PATCH 007/111] a minor tweak to rerun CI --- src/clib/utils/FrozenKeyIdxBiMap.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp index c884c9bbf..a9537a5c0 100644 --- a/src/clib/utils/FrozenKeyIdxBiMap.hpp +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -18,8 +18,8 @@ /// be tweaked) /// /// If we decide to more fully embrace C++, it would make a LOT of sense to -/// convert this to a full-blown class (and delete copy constructor/copy -/// assignement OR adopt reference counting). +/// convert this to a full-blown class (we would probably delete the copy +/// constructor And copy assignement methods OR adopt reference counting). /// //===----------------------------------------------------------------------===// #ifndef UTILS_FROZENKEYIDXBIMAP_HPP From 9d2b9cf4dd94ae09d8bb7a78f25e464188b03e5b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 12:17:32 -0500 Subject: [PATCH 008/111] convert interp_table_utils.{h->hpp} --- .clang-format-ignore | 2 +- src/clib/CMakeLists.txt | 2 +- src/clib/init_misc_species_cool_rates.cpp | 2 +- src/clib/initialize_chemistry_data.cpp | 12 +++--- src/clib/interp_table_utils.h | 43 --------------------- src/clib/interp_table_utils.hpp | 46 +++++++++++++++++++++++ 6 files changed, 56 insertions(+), 51 deletions(-) delete mode 100644 src/clib/interp_table_utils.h create mode 100644 src/clib/interp_table_utils.hpp diff --git a/.clang-format-ignore b/.clang-format-ignore index ab4b6b6f1..4cda5afa3 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -36,7 +36,7 @@ src/clib/initialize_dust_yields.cpp src/clib/initialize_rates.cpp src/clib/internal_types.hpp src/clib/internal_units.h -src/clib/interp_table_utils.h +src/clib/interp_table_utils.hpp src/clib/interpolate.hpp src/clib/phys_constants.h src/clib/rate_functions.c diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index c9ae9f141..07734e2d6 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -118,6 +118,7 @@ add_library(Grackle_Grackle initialize_dust_yields.cpp initialize_dust_yields.hpp initialize_rates.cpp initialize_rates.hpp internal_types.cpp internal_types.hpp + interp_table_utils.hpp lookup_cool_rates1d.hpp make_consistent.cpp make_consistent.hpp opaque_storage.hpp @@ -173,7 +174,6 @@ add_library(Grackle_Grackle grackle_chemistry_data_fields.def # <-- acts as a C header grackle_macros.h index_helper.h - interp_table_utils.h phys_constants.h collisional_rxn_rate_members.def # <-- acts as a C header utils.h diff --git a/src/clib/init_misc_species_cool_rates.cpp b/src/clib/init_misc_species_cool_rates.cpp index 83e1dd9c4..90393711a 100644 --- a/src/clib/init_misc_species_cool_rates.cpp +++ b/src/clib/init_misc_species_cool_rates.cpp @@ -17,7 +17,7 @@ #include "grackle.h" #include "grackle_macros.h" -#include "interp_table_utils.h" // free_interp_grid_ +#include "interp_table_utils.hpp" // free_interp_grid_ #include "init_misc_species_cool_rates.hpp" // forward declarations #include "internal_units.h" #include "phys_constants.h" diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index b8b39fabf..44d253348 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -19,7 +19,7 @@ #include "grackle.h" #include "grackle_macros.h" #include "auto_general.h" -#include "interp_table_utils.h" // free_interp_grid_ +#include "interp_table_utils.hpp" // free_interp_grid_ #include "init_misc_species_cool_rates.hpp" // free_misc_species_cool_rates #include "initialize_cloudy_data.h" #include "initialize_dust_yields.hpp" // free_dust_yields @@ -574,13 +574,13 @@ extern "C" int local_free_chemistry_data(chemistry_data *my_chemistry, GRACKLE_FREE(my_rates->gas_grain); GRACKLE_FREE(my_rates->gas_grain2); - free_interp_grid_(&my_rates->LH2); - free_interp_grid_(&my_rates->LHD); + grackle::impl::free_interp_grid_(&my_rates->LH2); + grackle::impl::free_interp_grid_(&my_rates->LHD); // we deal with freeing other interp grids inside of // free_misc_species_cool_rates - free_interp_grid_(&my_rates->alphap); + grackle::impl::free_interp_grid_(&my_rates->alphap); GRACKLE_FREE(my_rates->gr_N); @@ -647,7 +647,9 @@ extern "C" int local_free_chemistry_data(chemistry_data *my_chemistry, // delete contents of h2dust_grain_interp_props (automatically handles the // case where we didn't allocate anything) - free_interp_grid_props_(&my_rates->opaque_storage->h2dust_grain_interp_props); + grackle::impl::free_interp_grid_props_( + &my_rates->opaque_storage->h2dust_grain_interp_props, + /* use_delete = */ false); // since h2dust_grain_interp_props isn't a pointer, there is nothing more to // allocate right here diff --git a/src/clib/interp_table_utils.h b/src/clib/interp_table_utils.h deleted file mode 100644 index a9ad59147..000000000 --- a/src/clib/interp_table_utils.h +++ /dev/null @@ -1,43 +0,0 @@ -/*********************************************************************** -/ -/ Declare utility functions related to the interpolation tables -/ -/ -/ Copyright (c) 2013, Enzo/Grackle Development Team. -/ -/ Distributed under the terms of the Enzo Public Licence. -/ -/ The full license is in the file LICENSE, distributed with this -/ software. -************************************************************************/ - -#ifndef INTERP_TABLE_UTILS_H -#define INTERP_TABLE_UTILS_H - -#include "grackle.h" // gr_interp_grid, GRACKLE_CLOUDY_TABLE_MAX_DIMENSION -#include "grackle_macros.h" // GRACKLE_FREE - -#ifdef __cplusplus -extern "C" { -#endif - -/// Free memory associated with a #gr_interp_grid_props instance -static inline void free_interp_grid_props_(gr_interp_grid_props* props) -{ - for (int i = 0; i < GRACKLE_CLOUDY_TABLE_MAX_DIMENSION; i++) { - GRACKLE_FREE(props->parameters[i]); - } -} - -/// Free memory associated with a #gr_interp_grid -static inline void free_interp_grid_(gr_interp_grid* grid) -{ - free_interp_grid_props_(&(grid->props)); - GRACKLE_FREE(grid->data); -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif /* INTERP_TABLE_UTILS_H */ diff --git a/src/clib/interp_table_utils.hpp b/src/clib/interp_table_utils.hpp new file mode 100644 index 000000000..243d61876 --- /dev/null +++ b/src/clib/interp_table_utils.hpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Declare utility functions related to the interpolation tables +/// +//===----------------------------------------------------------------------===// + +#ifndef INTERP_TABLE_UTILS_HPP +#define INTERP_TABLE_UTILS_HPP + +#include "grackle.h" // gr_interp_grid, GRACKLE_CLOUDY_TABLE_MAX_DIMENSION +#include "grackle_macros.h" // GRACKLE_FREE + +namespace grackle::impl { + +/// Free memory associated with a #gr_interp_grid_props instance +inline void free_interp_grid_props_(gr_interp_grid_props* props, + bool use_delete) +{ + for (int i = 0; i < GRACKLE_CLOUDY_TABLE_MAX_DIMENSION; i++) { + if (use_delete) { + if (props->parameters[i] != nullptr) { + delete[] props->parameters[i]; + props->parameters[i] = nullptr; + } + } else { + GRACKLE_FREE(props->parameters[i]); + } + } +} + +/// Free memory associated with a #gr_interp_grid +inline void free_interp_grid_(gr_interp_grid* grid) +{ + free_interp_grid_props_(&(grid->props), /* use_delete = */ false); + GRACKLE_FREE(grid->data); +} + +} // namespace grackle::impl + +#endif /* INTERP_TABLE_UTILS_HPP */ From d7727b33a6a666b3f68f297f915c64c7b15eb835 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 12:18:56 -0500 Subject: [PATCH 009/111] apply clang-format to src/clib/interp_table_utils.hpp --- .clang-format-ignore | 1 - src/clib/interp_table_utils.hpp | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.clang-format-ignore b/.clang-format-ignore index 4cda5afa3..d15536e08 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -36,7 +36,6 @@ src/clib/initialize_dust_yields.cpp src/clib/initialize_rates.cpp src/clib/internal_types.hpp src/clib/internal_units.h -src/clib/interp_table_utils.hpp src/clib/interpolate.hpp src/clib/phys_constants.h src/clib/rate_functions.c diff --git a/src/clib/interp_table_utils.hpp b/src/clib/interp_table_utils.hpp index 243d61876..c799c851e 100644 --- a/src/clib/interp_table_utils.hpp +++ b/src/clib/interp_table_utils.hpp @@ -13,15 +13,14 @@ #ifndef INTERP_TABLE_UTILS_HPP #define INTERP_TABLE_UTILS_HPP -#include "grackle.h" // gr_interp_grid, GRACKLE_CLOUDY_TABLE_MAX_DIMENSION -#include "grackle_macros.h" // GRACKLE_FREE +#include "grackle.h" // gr_interp_grid, GRACKLE_CLOUDY_TABLE_MAX_DIMENSION +#include "grackle_macros.h" // GRACKLE_FREE namespace grackle::impl { /// Free memory associated with a #gr_interp_grid_props instance inline void free_interp_grid_props_(gr_interp_grid_props* props, - bool use_delete) -{ + bool use_delete) { for (int i = 0; i < GRACKLE_CLOUDY_TABLE_MAX_DIMENSION; i++) { if (use_delete) { if (props->parameters[i] != nullptr) { @@ -35,8 +34,7 @@ inline void free_interp_grid_props_(gr_interp_grid_props* props, } /// Free memory associated with a #gr_interp_grid -inline void free_interp_grid_(gr_interp_grid* grid) -{ +inline void free_interp_grid_(gr_interp_grid* grid) { free_interp_grid_props_(&(grid->props), /* use_delete = */ false); GRACKLE_FREE(grid->data); } From 0cd4082fdd3104e9d3b28ef2c78c54af5b5fa52b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 13:01:45 -0500 Subject: [PATCH 010/111] shift 2 functions out of src/clib/initialize_chemistry_data into interp_table_utils.hpp --- src/clib/initialize_chemistry_data.cpp | 39 ++++++++------------------ src/clib/interp_table_utils.hpp | 17 +++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 44d253348..e9089c782 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -19,7 +19,7 @@ #include "grackle.h" #include "grackle_macros.h" #include "auto_general.h" -#include "interp_table_utils.hpp" // free_interp_grid_ +#include "interp_table_utils.hpp" #include "init_misc_species_cool_rates.hpp" // free_misc_species_cool_rates #include "initialize_cloudy_data.h" #include "initialize_dust_yields.hpp" // free_dust_yields @@ -49,23 +49,6 @@ static void show_version(FILE *fp) fprintf (fp, "\n"); } -/// initialize an empty #gr_interp_grid_props -static void init_empty_interp_grid_props_(gr_interp_grid_props* props) { - props->rank = 0; - for (int i = 0; i < GRACKLE_CLOUDY_TABLE_MAX_DIMENSION; i++){ - props->dimension[i] = 0; - props->parameters[i] = nullptr; - props->parameter_spacing[i] = 0.0; - } - props->data_size = 0; -} - -/// Initialize an empty #gr_interp_grid -static void initialize_empty_interp_grid_(gr_interp_grid* grid) -{ - init_empty_interp_grid_props_(&(grid->props)); - grid->data=NULL; -} /** * Initializes an empty #chemistry_data_storage struct with zeros and NULLs. @@ -152,18 +135,18 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag my_rates->cieY06 = NULL; - initialize_empty_interp_grid_(&my_rates->LH2); - initialize_empty_interp_grid_(&my_rates->LHD); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LH2); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LHD); - initialize_empty_interp_grid_(&my_rates->LCI); - initialize_empty_interp_grid_(&my_rates->LCII); - initialize_empty_interp_grid_(&my_rates->LOI); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LCI); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LCII); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LOI); - initialize_empty_interp_grid_(&my_rates->LCO); - initialize_empty_interp_grid_(&my_rates->LOH); - initialize_empty_interp_grid_(&my_rates->LH2O); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LCO); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LOH); + grackle::impl::initialize_empty_interp_grid_(&my_rates->LH2O); - initialize_empty_interp_grid_(&my_rates->alphap); + grackle::impl::initialize_empty_interp_grid_(&my_rates->alphap); my_rates->gr_N = NULL; my_rates->gr_Size = 0; @@ -400,7 +383,7 @@ extern "C" int local_initialize_chemistry_data(chemistry_data *my_chemistry, my_rates->opaque_storage->kcol_rate_tables = nullptr; my_rates->opaque_storage->used_kcol_rate_indices = nullptr; my_rates->opaque_storage->n_kcol_rate_indices = 0; - init_empty_interp_grid_props_( + grackle::impl::init_empty_interp_grid_props_( &my_rates->opaque_storage->h2dust_grain_interp_props); my_rates->opaque_storage->grain_species_info = nullptr; diff --git a/src/clib/interp_table_utils.hpp b/src/clib/interp_table_utils.hpp index c799c851e..121767c09 100644 --- a/src/clib/interp_table_utils.hpp +++ b/src/clib/interp_table_utils.hpp @@ -18,6 +18,23 @@ namespace grackle::impl { +/// initialize an empty #gr_interp_grid_props +inline void init_empty_interp_grid_props_(gr_interp_grid_props* props) { + props->rank = 0; + for (int i = 0; i < GRACKLE_CLOUDY_TABLE_MAX_DIMENSION; i++) { + props->dimension[i] = 0; + props->parameters[i] = nullptr; + props->parameter_spacing[i] = 0.0; + } + props->data_size = 0; +} + +/// Initialize an empty #gr_interp_grid +inline void initialize_empty_interp_grid_(gr_interp_grid* grid) { + init_empty_interp_grid_props_(&(grid->props)); + grid->data = nullptr; +} + /// Free memory associated with a #gr_interp_grid_props instance inline void free_interp_grid_props_(gr_interp_grid_props* props, bool use_delete) { From 44438b74d4dd03920db005e3ee3632a7f2d6a70d Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 5 Nov 2025 10:44:31 -0500 Subject: [PATCH 011/111] Begin introducing GrainMetalInjectPathways There's still a lot of work to be done (the type is incomplete and isn't filled by anything at all) --- src/clib/CMakeLists.txt | 1 + src/clib/grain_metal_inject_pathways.hpp | 148 +++++++++++++++++++++++ src/clib/initialize_chemistry_data.cpp | 12 +- src/clib/initialize_dust_yields.cpp | 18 ++- src/clib/opaque_storage.hpp | 5 + 5 files changed, 178 insertions(+), 6 deletions(-) create mode 100644 src/clib/grain_metal_inject_pathways.hpp diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 77fe17e03..52557be3f 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -113,6 +113,7 @@ add_library(Grackle_Grackle cool_multi_time_g.cpp cool_multi_time_g.h dust_props.hpp dust/grain_species_info.cpp dust/grain_species_info.hpp + grain_metal_inject_pathways.hpp init_misc_species_cool_rates.cpp init_misc_species_cool_rates.hpp initialize_chemistry_data.cpp initialize_dust_yields.cpp initialize_dust_yields.hpp diff --git a/src/clib/grain_metal_inject_pathways.hpp b/src/clib/grain_metal_inject_pathways.hpp new file mode 100644 index 000000000..3ec9af073 --- /dev/null +++ b/src/clib/grain_metal_inject_pathways.hpp @@ -0,0 +1,148 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Defines the GrainMetalInjectPathways type +/// +//===----------------------------------------------------------------------===// +#ifndef GRAIN_METAL_INJECT_PATHWAYS_HPP +#define GRAIN_METAL_INJECT_PATHWAYS_HPP + +// after dealing with GH Issue #446, move this file into the dust subdirectory + +#include "LUT.hpp" +#include "internal_types.hpp" +#include "visitor/common.hpp" + +// this is a separate namespace because we are probably going to delete the +// contents (when we deal with GH Issue #446) +namespace grackle::impl::yields { + +/// Tables of values for each metal nuclide known to Grackle. Each table +/// has an entry for each injection pathway modelled in the current +/// configuration +/// +/// @note +/// When we deal with GH Issue #446, we'll almost certainly delete this. We +/// avoid using the visitor pattern here since this is very much an ephemeral +/// type introduced as a stopgap solution (and because types used to implement +/// the visitor pattern, namely ``vis::idx_range_len_multiple``) should probably +/// be renamed to have a more general-sounding name +struct MetalTables { + double* C; + double* O; + double* Mg; + double* Al; + double* Si; + double* S; + double* Fe; +}; + +/// allocates the contents of a new MetalTable +/// +/// @param nelem The number of elements in each buffer +inline MetalTables new_MetalTables(int nelem) { + MetalTables out; + + out.C = new double[nelem]; + out.O = new double[nelem]; + out.Mg = new double[nelem]; + out.Al = new double[nelem]; + out.Si = new double[nelem]; + out.S = new double[nelem]; + out.Fe = new double[nelem]; + + return out; +} + +/// performs cleanup of the contents of MetalTable +/// +/// This effectively invokes a destructor +inline void drop_MetalTables(MetalTables* ptr) { + delete[] ptr->C; + delete[] ptr->O; + delete[] ptr->Mg; + delete[] ptr->Al; + delete[] ptr->Si; + delete[] ptr->S; + delete[] ptr->Fe; +} + +} // namespace grackle::impl::yields + +namespace grackle::impl { + +/// The basic premise is that this tracks tables of data pertaining to the +/// list of injection pathways for dust grains and metal species +/// +/// @note +/// The organization of data is a little suboptimal. But, we can reorganize +/// later. +struct GrainMetalInjectPathways { + /// the number of modelled injection pathways + int n_pathways; + + /// holds 1D tables (tabulated with respect to each injection pathway) that + /// tracks the fraction of the injected mass density corresponding to + /// occurences of given metal nuclide in both the gas phase **AND** as part + /// of dust grains + /// + /// @important + /// This counts up occurences of nulcides (i.e. a nuclide is allowed to occur + /// multiple times within a single molecule) + /// + /// @note + /// this variables holds information that is somewhat actually redundant with + /// other tables that we are tracking + yields::MetalTables total_metal_nuclide_yields; + + /// holds 1D tables that tracks the fraction of the injected mass density + /// that corresponds to the **INITIAL** occurences of given metal nuclide in + /// the gas phase. + /// + /// This holds a separate table for each metal nuclide and each table has an + /// entry for each injection pathway. + /// + /// @important + /// This counts up occurences of nulcides (i.e. a nuclide is allowed to occur + /// multiple times within a single molecule) + yields::MetalTables gas_metal_nuclide_yields; + + /// holds 1D tables (tabulated with respect to each injection pathway) that + /// tracks the fraction of the injected mass density that corresponds to the + /// **INITIAL** occurences of a given grain species + /// + /// This holds a separate table for each grain species and every table has an + /// entry for each injection pathway. + GrainSpeciesCollection grain_yields; +}; + +/// allocates the contents of a new GrainMetalInjectPathways +/// +/// @param n_pathways The number of modeled injection pathways +inline GrainMetalInjectPathways new_GrainMetalInjectPathways(int n_pathways) { + GrainMetalInjectPathways out; + out.n_pathways = n_pathways; + out.total_metal_nuclide_yields = yields::new_MetalTables(n_pathways); + out.gas_metal_nuclide_yields = yields::new_MetalTables(n_pathways); + out.grain_yields = new_GrainSpeciesCollection(n_pathways); + + return out; +} + +/// performs cleanup of the contents of GrainMetalInjectPathways +/// +/// This effectively invokes a destructor +inline void drop_GrainMetalInjectPathways(GrainMetalInjectPathways* ptr) { + yields::drop_MetalTables(&ptr->total_metal_nuclide_yields); + yields::drop_MetalTables(&ptr->gas_metal_nuclide_yields); + drop_GrainSpeciesCollection(&ptr->grain_yields); +} + +} // namespace grackle::impl + +#endif // GRAIN_METAL_INJECT_PATHWAYS_HPP diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index e9089c782..1968feb8f 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -19,6 +19,7 @@ #include "grackle.h" #include "grackle_macros.h" #include "auto_general.h" +#include "grain_metal_inject_pathways.hpp" #include "interp_table_utils.hpp" #include "init_misc_species_cool_rates.hpp" // free_misc_species_cool_rates #include "initialize_cloudy_data.h" @@ -386,6 +387,7 @@ extern "C" int local_initialize_chemistry_data(chemistry_data *my_chemistry, grackle::impl::init_empty_interp_grid_props_( &my_rates->opaque_storage->h2dust_grain_interp_props); my_rates->opaque_storage->grain_species_info = nullptr; + my_rates->opaque_storage->inject_pathway_props = nullptr; double co_length_units, co_density_units; if (my_units->comoving_coordinates == TRUE) { @@ -640,10 +642,18 @@ extern "C" int local_free_chemistry_data(chemistry_data *my_chemistry, // delete contents of grain_species_info grackle::impl::drop_GrainSpeciesInfo( my_rates->opaque_storage->grain_species_info); - // delete kcol_rate_tables, itself + // delete grain_species_info, itself delete my_rates->opaque_storage->grain_species_info; } + if (my_rates->opaque_storage->inject_pathway_props != nullptr) { + // delete contents of inject_pathway_props + grackle::impl::drop_GrainMetalInjectPathways( + my_rates->opaque_storage->inject_pathway_props); + // delete inject_pathway_props, itself + delete my_rates->opaque_storage->inject_pathway_props; + } + delete my_rates->opaque_storage; my_rates->opaque_storage = nullptr; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 41f137ca5..fdb44cefb 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -16,6 +16,7 @@ #include "grackle_macros.h" #include "grackle_chemistry_data.h" #include "initialize_dust_yields.hpp" // forward declarations +#include "opaque_storage.hpp" // forward declare some functions @@ -47,12 +48,19 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, return SUCCESS; } - int NSN, NTd, Nmom; - double Td0, dTd; - int iSN, iTd, imom, itab; + int n_pathways = 12; + my_rates->opaque_storage->inject_pathway_props = + new grackle::impl::GrainMetalInjectPathways; + *(my_rates->opaque_storage->inject_pathway_props) = + new_GrainMetalInjectPathways(n_pathways); - NSN = 12; - my_rates->SN0_N = NSN; + + int NTd, Nmom; + double Td0, dTd; + int iSN, iTd, imom, itab; + + int NSN = n_pathways; // todo: delete me! + my_rates->SN0_N = n_pathways; my_rates->SN0_XC = (double*)malloc(NSN * sizeof(double)); my_rates->SN0_XO = (double*)malloc(NSN * sizeof(double)); diff --git a/src/clib/opaque_storage.hpp b/src/clib/opaque_storage.hpp index a118d42c4..c30030b21 100644 --- a/src/clib/opaque_storage.hpp +++ b/src/clib/opaque_storage.hpp @@ -15,6 +15,7 @@ #include "grackle.h" #include "dust/grain_species_info.hpp" +#include "grain_metal_inject_pathways.hpp" #include "internal_types.hpp" /// a struct that used to wrap some private storage details @@ -95,6 +96,10 @@ struct gr_opaque_storage { /// > calculations). An alternative would be to briefly initialize an /// > instance during setup and then repack the data. grackle::impl::GrainSpeciesInfo* grain_species_info; + + /// Tracks metal and grain yields for each modeled injection pathway as well + /// as other grain properties + grackle::impl::GrainMetalInjectPathways* inject_pathway_props; }; #endif /* OPAQUE_STORAGE_HPP */ From dac21ea4a3aac2a2f752d263bb778e8a3ab5a2ee Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 6 Nov 2025 11:37:12 -0500 Subject: [PATCH 012/111] an incremental step towards adopting GrainMetalInjectPathways --- src/clib/initialize_dust_yields.cpp | 99 ++++++++++++++++------------- 1 file changed, 55 insertions(+), 44 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index fdb44cefb..44c89edbd 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -54,6 +54,9 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, *(my_rates->opaque_storage->inject_pathway_props) = new_GrainMetalInjectPathways(n_pathways); + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + int NTd, Nmom; double Td0, dTd; @@ -62,35 +65,39 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int NSN = n_pathways; // todo: delete me! my_rates->SN0_N = n_pathways; - my_rates->SN0_XC = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_XO = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_XMg = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_XAl = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_XSi = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_XS = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_XFe = (double*)malloc(NSN * sizeof(double)); - - my_rates->SN0_fC = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fO = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMg = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fAl = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fSi = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fS = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFe = (double*)malloc(NSN * sizeof(double)); - - my_rates->SN0_fSiM = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFeM = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMg2SiO4 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMgSiO3 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFe3O4 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fAC = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fSiO2D = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMgO = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFeS = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fAl2O3 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_freforg = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fvolorg = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fH2Oice = (double*)malloc(NSN * sizeof(double)); + // crude hack (until we delete all of chemistry_data_storage's SN0_X* and + // SN0_f* members -- this has to wait until after we merge in the + // transcription of make_consistent) + my_rates->SN0_XC = inject_pathway_props->total_metal_nuclide_yields.C; + my_rates->SN0_XO = inject_pathway_props->total_metal_nuclide_yields.O; + my_rates->SN0_XMg = inject_pathway_props->total_metal_nuclide_yields.Mg; + my_rates->SN0_XAl = inject_pathway_props->total_metal_nuclide_yields.Al; + my_rates->SN0_XSi = inject_pathway_props->total_metal_nuclide_yields.Si; + my_rates->SN0_XS = inject_pathway_props->total_metal_nuclide_yields.S; + my_rates->SN0_XFe = inject_pathway_props->total_metal_nuclide_yields.Fe; + + my_rates->SN0_fC = inject_pathway_props->gas_metal_nuclide_yields.C; + my_rates->SN0_fO = inject_pathway_props->gas_metal_nuclide_yields.O; + my_rates->SN0_fMg = inject_pathway_props->gas_metal_nuclide_yields.Mg; + my_rates->SN0_fAl = inject_pathway_props->gas_metal_nuclide_yields.Al; + my_rates->SN0_fSi = inject_pathway_props->gas_metal_nuclide_yields.Si; + my_rates->SN0_fS = inject_pathway_props->gas_metal_nuclide_yields.S; + my_rates->SN0_fFe = inject_pathway_props->gas_metal_nuclide_yields.Fe; + + // we can simply delete these when we have the oportunity + my_rates->SN0_fSiM = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fFeM = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fMg2SiO4 = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fMgSiO3 = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fFe3O4 = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fAC = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fSiO2D = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fMgO = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fFeS = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fAl2O3 = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_freforg = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fvolorg = (double*)malloc(NSN * sizeof(double)); + my_rates->SN0_fH2Oice = (double*)malloc(NSN * sizeof(double)); for(iSN = 0; iSN < NSN; iSN++) { my_rates->SN0_XC [iSN] = 0.0; @@ -231,21 +238,25 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, if (my_chemistry->metal_chemistry == 0) return SUCCESS; - GRACKLE_FREE(my_rates->SN0_XC); - GRACKLE_FREE(my_rates->SN0_XO); - GRACKLE_FREE(my_rates->SN0_XMg); - GRACKLE_FREE(my_rates->SN0_XAl); - GRACKLE_FREE(my_rates->SN0_XSi); - GRACKLE_FREE(my_rates->SN0_XS); - GRACKLE_FREE(my_rates->SN0_XFe); - - GRACKLE_FREE(my_rates->SN0_fC); - GRACKLE_FREE(my_rates->SN0_fO); - GRACKLE_FREE(my_rates->SN0_fMg); - GRACKLE_FREE(my_rates->SN0_fAl); - GRACKLE_FREE(my_rates->SN0_fSi); - GRACKLE_FREE(my_rates->SN0_fS); - GRACKLE_FREE(my_rates->SN0_fFe); + // reminder: we have adopted a crude hack (until we delete all of + // chemistry_data_storage's SN0_X* and SN0_f* members -- this has to wait + // until after we merge in the transcription of make_consistent), where + // the yield fraction for each metal nuclide is an alias to a pointer + my_rates->SN0_XC = nullptr; + my_rates->SN0_XO = nullptr; + my_rates->SN0_XMg = nullptr; + my_rates->SN0_XAl = nullptr; + my_rates->SN0_XSi = nullptr; + my_rates->SN0_XS = nullptr; + my_rates->SN0_XFe = nullptr; + + my_rates->SN0_fC = nullptr; + my_rates->SN0_fO = nullptr; + my_rates->SN0_fMg = nullptr; + my_rates->SN0_fAl = nullptr; + my_rates->SN0_fSi = nullptr; + my_rates->SN0_fS = nullptr; + my_rates->SN0_fFe = nullptr; GRACKLE_FREE(my_rates->SN0_fSiM); GRACKLE_FREE(my_rates->SN0_fFeM); From 43e246480751f17f05324312d7043110205ddae5 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 6 Nov 2025 11:55:57 -0500 Subject: [PATCH 013/111] another step --- src/clib/initialize_dust_yields.cpp | 464 +++++++++++++++------------- 1 file changed, 250 insertions(+), 214 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 44c89edbd..1eb709dce 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -60,7 +60,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int NTd, Nmom; double Td0, dTd; - int iSN, iTd, imom, itab; + int iTd, imom, itab; int NSN = n_pathways; // todo: delete me! my_rates->SN0_N = n_pathways; @@ -99,37 +99,37 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fvolorg = (double*)malloc(NSN * sizeof(double)); my_rates->SN0_fH2Oice = (double*)malloc(NSN * sizeof(double)); - for(iSN = 0; iSN < NSN; iSN++) { - my_rates->SN0_XC [iSN] = 0.0; - my_rates->SN0_XO [iSN] = 0.0; - my_rates->SN0_XMg[iSN] = 0.0; - my_rates->SN0_XAl[iSN] = 0.0; - my_rates->SN0_XSi[iSN] = 0.0; - my_rates->SN0_XS [iSN] = 0.0; - my_rates->SN0_XFe[iSN] = 0.0; - - my_rates->SN0_fC [iSN] = 0.0; - my_rates->SN0_fO [iSN] = 0.0; - my_rates->SN0_fMg[iSN] = 0.0; - my_rates->SN0_fAl[iSN] = 0.0; - my_rates->SN0_fSi[iSN] = 0.0; - my_rates->SN0_fS [iSN] = 0.0; - my_rates->SN0_fFe[iSN] = 0.0; - - my_rates->SN0_fSiM [iSN] = 0.0; - my_rates->SN0_fFeM [iSN] = 0.0; - my_rates->SN0_fMg2SiO4 [iSN] = 0.0; - my_rates->SN0_fMgSiO3 [iSN] = 0.0; - my_rates->SN0_fFe3O4 [iSN] = 0.0; - my_rates->SN0_fAC [iSN] = 0.0; - my_rates->SN0_fSiO2D [iSN] = 0.0; - my_rates->SN0_fMgO [iSN] = 0.0; - my_rates->SN0_fFeS [iSN] = 0.0; - my_rates->SN0_fAl2O3 [iSN] = 0.0; - my_rates->SN0_freforg [iSN] = 0.0; - my_rates->SN0_fvolorg [iSN] = 0.0; - my_rates->SN0_fH2Oice [iSN] = 0.0; - } + for(int iSN = 0; iSN < NSN; iSN++) { + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 0.0; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 0.0; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 0.0; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 0.0; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 0.0; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.0; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 0.0; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 0.0; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 0.0; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 0.0; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 0.0; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 0.0; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.0; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 0.0; + + my_rates->SN0_fSiM [iSN] = 0.0; + my_rates->SN0_fFeM [iSN] = 0.0; + my_rates->SN0_fMg2SiO4 [iSN] = 0.0; + my_rates->SN0_fMgSiO3 [iSN] = 0.0; + my_rates->SN0_fFe3O4 [iSN] = 0.0; + my_rates->SN0_fAC [iSN] = 0.0; + my_rates->SN0_fSiO2D [iSN] = 0.0; + my_rates->SN0_fMgO [iSN] = 0.0; + my_rates->SN0_fFeS [iSN] = 0.0; + my_rates->SN0_fAl2O3 [iSN] = 0.0; + my_rates->SN0_freforg [iSN] = 0.0; + my_rates->SN0_fvolorg [iSN] = 0.0; + my_rates->SN0_fH2Oice [iSN] = 0.0; + } my_rates->SN0_r0SiM = (double*)malloc(NSN * 3 * sizeof(double)); my_rates->SN0_r0FeM = (double*)malloc(NSN * 3 * sizeof(double)); @@ -146,7 +146,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_r0H2Oice = (double*)malloc(NSN * 3 * sizeof(double)); itab = 0; - for(iSN = 0; iSN < NSN; iSN++) { + for(int iSN = 0; iSN < NSN; iSN++) { for(imom = 0; imom < 3; imom++) { my_rates->SN0_r0SiM [itab] = 0.0; my_rates->SN0_r0FeM [itab] = 0.0; @@ -193,7 +193,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_kpH2Oice = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); itab = 0; - for(iSN = 0; iSN < NSN; iSN++) { + for(int iSN = 0; iSN < NSN; iSN++) { for(imom = 0; imom < Nmom; imom++) { for(iTd = 0; iTd < NTd; iTd++) { my_rates->SN0_kpSiM [itab] = 0.0; @@ -313,21 +313,24 @@ int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 1.79042e-01; - my_rates->SN0_XO [iSN] = 5.11524e-01; - my_rates->SN0_XMg[iSN] = 3.46246e-02; - my_rates->SN0_XAl[iSN] = 3.07922e-03; - my_rates->SN0_XSi[iSN] = 3.76121e-02; - my_rates->SN0_XS [iSN] = 2.21374e-02; - my_rates->SN0_XFe[iSN] = 6.77017e-02; - - my_rates->SN0_fC [iSN] = 5.01317e-02; - my_rates->SN0_fO [iSN] = 2.78491e-01; - my_rates->SN0_fMg[iSN] = 0.00000e+00; - my_rates->SN0_fAl[iSN] = 3.07922e-03; - my_rates->SN0_fSi[iSN] = 3.50813e-03; - my_rates->SN0_fS [iSN] = 0.00000e+00; - my_rates->SN0_fFe[iSN] = 1.66568e-04; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 1.79042e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 5.11524e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.46246e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 3.07922e-03; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 3.76121e-02; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 2.21374e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 6.77017e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 5.01317e-02; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 2.78491e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 3.07922e-03; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 3.50813e-03; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.66568e-04; my_rates->SN0_fFeM [iSN] = 1.35403e-02; my_rates->SN0_fMg2SiO4 [iSN] = 1.36165e-01; @@ -650,21 +653,24 @@ int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 2.65314e-01; - my_rates->SN0_XO [iSN] = 3.00982e-01; - my_rates->SN0_XMg[iSN] = 3.06651e-02; - my_rates->SN0_XAl[iSN] = 2.47296e-04; - my_rates->SN0_XSi[iSN] = 6.38319e-02; - my_rates->SN0_XS [iSN] = 3.40910e-02; - my_rates->SN0_XFe[iSN] = 9.62448e-02; - - my_rates->SN0_fC [iSN] = 2.16731e-01; - my_rates->SN0_fO [iSN] = 2.99231e-01; - my_rates->SN0_fMg[iSN] = 3.03586e-02; - my_rates->SN0_fAl[iSN] = 2.47296e-04; - my_rates->SN0_fSi[iSN] = 4.59041e-02; - my_rates->SN0_fS [iSN] = 3.40903e-02; - my_rates->SN0_fFe[iSN] = 7.22586e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.65314e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 3.00982e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.06651e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.47296e-04; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 6.38319e-02; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 3.40910e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 9.62448e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 2.16731e-01; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 2.99231e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 3.03586e-02; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.47296e-04; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 4.59041e-02; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 3.40903e-02; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 7.22586e-02; my_rates->SN0_fSiM [iSN] = 1.65746e-02; my_rates->SN0_fFeM [iSN] = 2.39849e-02; @@ -1029,21 +1035,24 @@ int calc_rates_dust_C20(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 1.00183e-01; - my_rates->SN0_XO [iSN] = 6.06515e-01; - my_rates->SN0_XMg[iSN] = 2.75968e-02; - my_rates->SN0_XAl[iSN] = 1.87118e-04; - my_rates->SN0_XSi[iSN] = 1.00051e-01; - my_rates->SN0_XS [iSN] = 6.02208e-02; - my_rates->SN0_XFe[iSN] = 3.07560e-02; - - my_rates->SN0_fC [iSN] = 8.74563e-02; - my_rates->SN0_fO [iSN] = 6.04383e-01; - my_rates->SN0_fMg[iSN] = 2.63753e-02; - my_rates->SN0_fAl[iSN] = 1.87118e-04; - my_rates->SN0_fSi[iSN] = 6.44592e-02; - my_rates->SN0_fS [iSN] = 6.02018e-02; - my_rates->SN0_fFe[iSN] = 2.69505e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 1.00183e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 6.06515e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 2.75968e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.87118e-04; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.00051e-01; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 6.02208e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 3.07560e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 8.74563e-02; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 6.04383e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.63753e-02; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.87118e-04; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 6.44592e-02; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 6.02018e-02; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 2.69505e-02; my_rates->SN0_fSiM [iSN] = 3.44388e-02; my_rates->SN0_fFeM [iSN] = 3.77223e-03; @@ -1450,21 +1459,24 @@ int calc_rates_dust_C25(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 1.75488e-01; - my_rates->SN0_XO [iSN] = 5.69674e-01; - my_rates->SN0_XMg[iSN] = 3.12340e-02; - my_rates->SN0_XAl[iSN] = 2.98415e-04; - my_rates->SN0_XSi[iSN] = 8.33205e-02; - my_rates->SN0_XS [iSN] = 4.73930e-02; - my_rates->SN0_XFe[iSN] = 1.98197e-02; - - my_rates->SN0_fC [iSN] = 1.34092e-01; - my_rates->SN0_fO [iSN] = 5.53726e-01; - my_rates->SN0_fMg[iSN] = 2.48100e-02; - my_rates->SN0_fAl[iSN] = 2.98415e-04; - my_rates->SN0_fSi[iSN] = 3.47760e-02; - my_rates->SN0_fS [iSN] = 4.72556e-02; - my_rates->SN0_fFe[iSN] = 1.46955e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 1.75488e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 5.69674e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.12340e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.98415e-04; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 8.33205e-02; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 4.73930e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 1.98197e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 1.34092e-01; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 5.53726e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.48100e-02; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.98415e-04; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 3.47760e-02; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 4.72556e-02; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.46955e-02; my_rates->SN0_fSiM [iSN] = 3.83373e-02; my_rates->SN0_fFeM [iSN] = 4.88366e-03; @@ -1871,21 +1883,24 @@ int calc_rates_dust_C30(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 4.99965e-02; - my_rates->SN0_XO [iSN] = 7.32832e-01; - my_rates->SN0_XMg[iSN] = 3.87430e-02; - my_rates->SN0_XAl[iSN] = 8.61678e-04; - my_rates->SN0_XSi[iSN] = 7.18810e-02; - my_rates->SN0_XS [iSN] = 3.70455e-02; - my_rates->SN0_XFe[iSN] = 1.45822e-02; - - my_rates->SN0_fC [iSN] = 4.93773e-02; - my_rates->SN0_fO [iSN] = 7.29130e-01; - my_rates->SN0_fMg[iSN] = 3.76731e-02; - my_rates->SN0_fAl[iSN] = 8.61678e-04; - my_rates->SN0_fSi[iSN] = 4.01269e-02; - my_rates->SN0_fS [iSN] = 3.68812e-02; - my_rates->SN0_fFe[iSN] = 1.23641e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 4.99965e-02; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 7.32832e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.87430e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 8.61678e-04; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 7.18810e-02; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 3.70455e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 1.45822e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 4.93773e-02; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 7.29130e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 3.76731e-02; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 8.61678e-04; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 4.01269e-02; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 3.68812e-02; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.23641e-02; my_rates->SN0_fSiM [iSN] = 2.91389e-02; my_rates->SN0_fFeM [iSN] = 1.93065e-03; @@ -2292,21 +2307,24 @@ int calc_rates_dust_F13(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 6.69235e-01; - my_rates->SN0_XO [iSN] = 3.30556e-01; - my_rates->SN0_XMg[iSN] = 1.86824e-04; - my_rates->SN0_XAl[iSN] = 1.97017e-07; - my_rates->SN0_XSi[iSN] = 1.30184e-05; - my_rates->SN0_XS [iSN] = 0.00000e+00; - my_rates->SN0_XFe[iSN] = 8.90341e-06; - - my_rates->SN0_fC [iSN] = 4.93693e-01; - my_rates->SN0_fO [iSN] = 3.30556e-01; - my_rates->SN0_fMg[iSN] = 1.86824e-04; - my_rates->SN0_fAl[iSN] = 1.97017e-07; - my_rates->SN0_fSi[iSN] = 1.30184e-05; - my_rates->SN0_fS [iSN] = 0.00000e+00; - my_rates->SN0_fFe[iSN] = 8.90341e-06; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 6.69235e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 3.30556e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 1.86824e-04; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.97017e-07; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.30184e-05; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 8.90341e-06; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 4.93693e-01; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 3.30556e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 1.86824e-04; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.97017e-07; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.30184e-05; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 8.90341e-06; my_rates->SN0_fFeM [iSN] = 6.31648e-26; my_rates->SN0_fMg2SiO4 [iSN] = 2.06081e-16; @@ -2629,21 +2647,24 @@ int calc_rates_dust_F15(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 6.46299e-01; - my_rates->SN0_XO [iSN] = 3.53548e-01; - my_rates->SN0_XMg[iSN] = 1.29204e-04; - my_rates->SN0_XAl[iSN] = 2.22729e-07; - my_rates->SN0_XSi[iSN] = 1.32242e-05; - my_rates->SN0_XS [iSN] = 0.00000e+00; - my_rates->SN0_XFe[iSN] = 9.66658e-06; - - my_rates->SN0_fC [iSN] = 4.57071e-01; - my_rates->SN0_fO [iSN] = 3.53548e-01; - my_rates->SN0_fMg[iSN] = 1.29204e-04; - my_rates->SN0_fAl[iSN] = 2.22729e-07; - my_rates->SN0_fSi[iSN] = 1.32242e-05; - my_rates->SN0_fS [iSN] = 0.00000e+00; - my_rates->SN0_fFe[iSN] = 9.66658e-06; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 6.46299e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 3.53548e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 1.29204e-04; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.22729e-07; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.32242e-05; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 9.66658e-06; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 4.57071e-01; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 3.53548e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 1.29204e-04; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.22729e-07; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.32242e-05; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 9.66658e-06; my_rates->SN0_fFeM [iSN] = 1.53361e-25; my_rates->SN0_fMg2SiO4 [iSN] = 1.56864e-15; @@ -2966,21 +2987,24 @@ int calc_rates_dust_F50(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 2.79167e-01; - my_rates->SN0_XO [iSN] = 7.20575e-01; - my_rates->SN0_XMg[iSN] = 2.49794e-04; - my_rates->SN0_XAl[iSN] = 1.66468e-08; - my_rates->SN0_XSi[iSN] = 4.01099e-06; - my_rates->SN0_XS [iSN] = 0.00000e+00; - my_rates->SN0_XFe[iSN] = 4.15804e-06; - - my_rates->SN0_fC [iSN] = 2.79057e-01; - my_rates->SN0_fO [iSN] = 7.20575e-01; - my_rates->SN0_fMg[iSN] = 2.49793e-04; - my_rates->SN0_fAl[iSN] = 1.66468e-08; - my_rates->SN0_fSi[iSN] = 4.01058e-06; - my_rates->SN0_fS [iSN] = 0.00000e+00; - my_rates->SN0_fFe[iSN] = 4.15804e-06; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.79167e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 7.20575e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 2.49794e-04; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.66468e-08; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 4.01099e-06; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 4.15804e-06; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 2.79057e-01; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 7.20575e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.49793e-04; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.66468e-08; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 4.01058e-06; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 4.15804e-06; my_rates->SN0_fFeM [iSN] = 2.33171e-24; my_rates->SN0_fMg2SiO4 [iSN] = 2.62486e-10; @@ -3303,21 +3327,24 @@ int calc_rates_dust_F80(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 2.52563e-01; - my_rates->SN0_XO [iSN] = 7.46061e-01; - my_rates->SN0_XMg[iSN] = 1.36917e-03; - my_rates->SN0_XAl[iSN] = 1.55602e-08; - my_rates->SN0_XSi[iSN] = 3.63906e-06; - my_rates->SN0_XS [iSN] = 0.00000e+00; - my_rates->SN0_XFe[iSN] = 2.43915e-06; - - my_rates->SN0_fC [iSN] = 2.43883e-01; - my_rates->SN0_fO [iSN] = 7.46061e-01; - my_rates->SN0_fMg[iSN] = 1.36917e-03; - my_rates->SN0_fAl[iSN] = 1.55602e-08; - my_rates->SN0_fSi[iSN] = 3.63906e-06; - my_rates->SN0_fS [iSN] = 0.00000e+00; - my_rates->SN0_fFe[iSN] = 2.43915e-06; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.52563e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 7.46061e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 1.36917e-03; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.55602e-08; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 3.63906e-06; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 2.43915e-06; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 2.43883e-01; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 7.46061e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 1.36917e-03; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.55602e-08; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 3.63906e-06; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 2.43915e-06; my_rates->SN0_fFeM [iSN] = 3.87590e-26; my_rates->SN0_fMg2SiO4 [iSN] = 2.36180e-13; @@ -3640,21 +3667,24 @@ int calc_rates_dust_P170(int iSN, chemistry_data *my_chemistry, chemistry_data_s int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 5.29975e-02; - my_rates->SN0_XO [iSN] = 5.60864e-01; - my_rates->SN0_XMg[iSN] = 3.58367e-02; - my_rates->SN0_XAl[iSN] = 3.27680e-04; - my_rates->SN0_XSi[iSN] = 1.52750e-01; - my_rates->SN0_XS [iSN] = 8.06035e-02; - my_rates->SN0_XFe[iSN] = 5.29729e-02; - - my_rates->SN0_fC [iSN] = 5.29528e-02; - my_rates->SN0_fO [iSN] = 5.60799e-01; - my_rates->SN0_fMg[iSN] = 3.58366e-02; - my_rates->SN0_fAl[iSN] = 3.27680e-04; - my_rates->SN0_fSi[iSN] = 1.39585e-01; - my_rates->SN0_fS [iSN] = 8.06035e-02; - my_rates->SN0_fFe[iSN] = 5.29394e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 5.29975e-02; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 5.60864e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.58367e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 3.27680e-04; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.52750e-01; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 8.06035e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 5.29729e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 5.29528e-02; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 5.60799e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 3.58366e-02; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 3.27680e-04; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.39585e-01; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 8.06035e-02; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 5.29394e-02; my_rates->SN0_fSiM [iSN] = 1.31079e-02; my_rates->SN0_fFeM [iSN] = 3.34688e-05; @@ -3977,21 +4007,24 @@ int calc_rates_dust_P200(int iSN, chemistry_data *my_chemistry, chemistry_data_s int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 3.65050e-02; - my_rates->SN0_XO [iSN] = 4.88552e-01; - my_rates->SN0_XMg[iSN] = 2.69665e-02; - my_rates->SN0_XAl[iSN] = 1.36872e-04; - my_rates->SN0_XSi[iSN] = 1.87324e-01; - my_rates->SN0_XS [iSN] = 1.15582e-01; - my_rates->SN0_XFe[iSN] = 6.79294e-02; - - my_rates->SN0_fC [iSN] = 3.64677e-02; - my_rates->SN0_fO [iSN] = 4.88307e-01; - my_rates->SN0_fMg[iSN] = 2.69665e-02; - my_rates->SN0_fAl[iSN] = 1.36872e-04; - my_rates->SN0_fSi[iSN] = 1.87051e-01; - my_rates->SN0_fS [iSN] = 1.15582e-01; - my_rates->SN0_fFe[iSN] = 6.75026e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 3.65050e-02; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 4.88552e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 2.69665e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.36872e-04; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.87324e-01; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 1.15582e-01; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 6.79294e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 3.64677e-02; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 4.88307e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.69665e-02; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.36872e-04; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.87051e-01; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 1.15582e-01; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 6.75026e-02; my_rates->SN0_fSiM [iSN] = 5.90622e-05; my_rates->SN0_fFeM [iSN] = 4.26809e-04; @@ -4272,21 +4305,24 @@ int calc_rates_dust_Y19(int iSN, chemistry_data *my_chemistry, chemistry_data_st int NTd, Nmom; int iTd, imom, itab0, itab; - my_rates->SN0_XC [iSN] = 2.50000e-01; - my_rates->SN0_XO [iSN] = 2.93867e-01; - my_rates->SN0_XMg[iSN] = 6.00000e-02; - my_rates->SN0_XAl[iSN] = 2.85361e-03; - my_rates->SN0_XSi[iSN] = 7.00000e-02; - my_rates->SN0_XS [iSN] = 1.58191e-02; - my_rates->SN0_XFe[iSN] = 6.64078e-02; - - my_rates->SN0_fC [iSN] = 0.00000e+00; - my_rates->SN0_fO [iSN] = 1.73867e-01; - my_rates->SN0_fMg[iSN] = 0.00000e+00; - my_rates->SN0_fAl[iSN] = 2.85361e-03; - my_rates->SN0_fSi[iSN] = 0.00000e+00; - my_rates->SN0_fS [iSN] = 1.58191e-02; - my_rates->SN0_fFe[iSN] = 6.64078e-02; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.50000e-01; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 2.93867e-01; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 6.00000e-02; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.85361e-03; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 7.00000e-02; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 1.58191e-02; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 6.64078e-02; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 1.73867e-01; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.85361e-03; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 0.00000e+00; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 1.58191e-02; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 6.64078e-02; my_rates->SN0_fMgSiO3 [iSN] = 2.50000e-01; my_rates->SN0_fAC [iSN] = 2.50000e-01; From e67ee1b6b5b0bb148878aac17777204e30ac19ce Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 6 Nov 2025 13:42:19 -0500 Subject: [PATCH 014/111] transition to using grain_yields stored within GrainMetalInjectPathways --- src/clib/fortran_func_wrappers.hpp | 19 ++- src/clib/initialize_chemistry_data.cpp | 41 ++--- src/clib/initialize_dust_yields.cpp | 226 +++++++++++-------------- src/include/grackle_chemistry_data.h | 3 - 4 files changed, 128 insertions(+), 161 deletions(-) diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index e311723a3..cd561e8f5 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -25,10 +25,12 @@ #include "grackle.h" #include "dust_props.hpp" #include "fortran_func_decls.h" +#include "grain_metal_inject_pathways.hpp" #include "index_helper.h" #include "internal_types.hpp" #include "internal_units.h" #include "LUT.hpp" +#include "opaque_storage.hpp" #include "utils-cpp.hpp" // callers of these functions are generally expected to locally shorten the @@ -107,10 +109,19 @@ inline void calc_grain_size_increment_1d ( my_fields->fsn13_metal_density, my_fields->fsn15_metal_density, my_fields->fsn50_metal_density, my_fields->fsn80_metal_density, my_fields->pisn170_metal_density, my_fields->pisn200_metal_density, my_fields->y19_metal_density, &my_rates->SN0_N, - my_rates->SN0_fSiM, my_rates->SN0_fFeM, my_rates->SN0_fMg2SiO4, my_rates->SN0_fMgSiO3, - my_rates->SN0_fFe3O4, my_rates->SN0_fAC, my_rates->SN0_fSiO2D, my_rates->SN0_fMgO, - my_rates->SN0_fFeS, my_rates->SN0_fAl2O3, - my_rates->SN0_freforg, my_rates->SN0_fvolorg, my_rates->SN0_fH2Oice, + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust], + my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], my_rates->SN0_r0SiM, my_rates->SN0_r0FeM, my_rates->SN0_r0Mg2SiO4, my_rates->SN0_r0MgSiO3, my_rates->SN0_r0Fe3O4, my_rates->SN0_r0AC, my_rates->SN0_r0SiO2D, my_rates->SN0_r0MgO, my_rates->SN0_r0FeS, my_rates->SN0_r0Al2O3, diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 1968feb8f..273b317c1 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -154,33 +154,20 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag my_rates->gr_dT = 0.; my_rates->gr_Td = NULL; my_rates->SN0_N = 0; - my_rates->SN0_XC = NULL; - my_rates->SN0_XO = NULL; - my_rates->SN0_XMg = NULL; - my_rates->SN0_XAl = NULL; - my_rates->SN0_XSi = NULL; - my_rates->SN0_XS = NULL; - my_rates->SN0_XFe = NULL; - my_rates->SN0_fC = NULL; - my_rates->SN0_fO = NULL; - my_rates->SN0_fMg = NULL; - my_rates->SN0_fAl = NULL; - my_rates->SN0_fSi = NULL; - my_rates->SN0_fS = NULL; - my_rates->SN0_fFe = NULL; - my_rates->SN0_fSiM = NULL; - my_rates->SN0_fFeM = NULL; - my_rates->SN0_fMg2SiO4 = NULL; - my_rates->SN0_fMgSiO3 = NULL; - my_rates->SN0_fFe3O4 = NULL; - my_rates->SN0_fAC = NULL; - my_rates->SN0_fSiO2D = NULL; - my_rates->SN0_fMgO = NULL; - my_rates->SN0_fFeS = NULL; - my_rates->SN0_fAl2O3 = NULL; - my_rates->SN0_freforg = NULL; - my_rates->SN0_fvolorg = NULL; - my_rates->SN0_fH2Oice = NULL; + my_rates->SN0_XC = nullptr; + my_rates->SN0_XO = nullptr; + my_rates->SN0_XMg = nullptr; + my_rates->SN0_XAl = nullptr; + my_rates->SN0_XSi = nullptr; + my_rates->SN0_XS = nullptr; + my_rates->SN0_XFe = nullptr; + my_rates->SN0_fC = nullptr; + my_rates->SN0_fO = nullptr; + my_rates->SN0_fMg = nullptr; + my_rates->SN0_fAl = nullptr; + my_rates->SN0_fSi = nullptr; + my_rates->SN0_fS = nullptr; + my_rates->SN0_fFe = nullptr; my_rates->SN0_r0SiM = NULL; my_rates->SN0_r0FeM = NULL; my_rates->SN0_r0Mg2SiO4 = NULL; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 1eb709dce..dfd7c0d78 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -16,6 +16,7 @@ #include "grackle_macros.h" #include "grackle_chemistry_data.h" #include "initialize_dust_yields.hpp" // forward declarations +#include "LUT.hpp" #include "opaque_storage.hpp" // forward declare some functions @@ -84,21 +85,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = inject_pathway_props->gas_metal_nuclide_yields.S; my_rates->SN0_fFe = inject_pathway_props->gas_metal_nuclide_yields.Fe; - // we can simply delete these when we have the oportunity - my_rates->SN0_fSiM = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFeM = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMg2SiO4 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMgSiO3 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFe3O4 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fAC = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fSiO2D = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fMgO = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fFeS = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fAl2O3 = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_freforg = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fvolorg = (double*)malloc(NSN * sizeof(double)); - my_rates->SN0_fH2Oice = (double*)malloc(NSN * sizeof(double)); - for(int iSN = 0; iSN < NSN; iSN++) { inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 0.0; inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 0.0; @@ -116,19 +102,19 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.0; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 0.0; - my_rates->SN0_fSiM [iSN] = 0.0; - my_rates->SN0_fFeM [iSN] = 0.0; - my_rates->SN0_fMg2SiO4 [iSN] = 0.0; - my_rates->SN0_fMgSiO3 [iSN] = 0.0; - my_rates->SN0_fFe3O4 [iSN] = 0.0; - my_rates->SN0_fAC [iSN] = 0.0; - my_rates->SN0_fSiO2D [iSN] = 0.0; - my_rates->SN0_fMgO [iSN] = 0.0; - my_rates->SN0_fFeS [iSN] = 0.0; - my_rates->SN0_fAl2O3 [iSN] = 0.0; - my_rates->SN0_freforg [iSN] = 0.0; - my_rates->SN0_fvolorg [iSN] = 0.0; - my_rates->SN0_fH2Oice [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust] [iSN] = 0.0; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust] [iSN] = 0.0; } my_rates->SN0_r0SiM = (double*)malloc(NSN * 3 * sizeof(double)); @@ -258,20 +244,6 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = nullptr; my_rates->SN0_fFe = nullptr; - GRACKLE_FREE(my_rates->SN0_fSiM); - GRACKLE_FREE(my_rates->SN0_fFeM); - GRACKLE_FREE(my_rates->SN0_fMg2SiO4); - GRACKLE_FREE(my_rates->SN0_fMgSiO3); - GRACKLE_FREE(my_rates->SN0_fFe3O4); - GRACKLE_FREE(my_rates->SN0_fAC); - GRACKLE_FREE(my_rates->SN0_fSiO2D); - GRACKLE_FREE(my_rates->SN0_fMgO); - GRACKLE_FREE(my_rates->SN0_fFeS); - GRACKLE_FREE(my_rates->SN0_fAl2O3); - GRACKLE_FREE(my_rates->SN0_freforg); - GRACKLE_FREE(my_rates->SN0_fvolorg); - GRACKLE_FREE(my_rates->SN0_fH2Oice); - GRACKLE_FREE(my_rates->SN0_r0SiM); GRACKLE_FREE(my_rates->SN0_r0FeM); GRACKLE_FREE(my_rates->SN0_r0Mg2SiO4); @@ -332,13 +304,13 @@ int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.66568e-04; - my_rates->SN0_fFeM [iSN] = 1.35403e-02; - my_rates->SN0_fMg2SiO4 [iSN] = 1.36165e-01; - my_rates->SN0_fMgSiO3 [iSN] = 3.84003e-02; - my_rates->SN0_fFeS [iSN] = 3.04389e-02; - my_rates->SN0_freforg [iSN] = 1.86114e-01; - my_rates->SN0_fvolorg [iSN] = 3.81956e-02; - my_rates->SN0_fH2Oice [iSN] = 6.33011e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.35403e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust][iSN] = 1.36165e-01; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 3.84003e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 3.04389e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust][iSN] = 1.86114e-01; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust][iSN] = 3.81956e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust][iSN] = 6.33011e-02; itab0 = 3 * iSN; my_rates->SN0_r0FeM [itab0 + 0] = 8.33039e-07; @@ -672,14 +644,14 @@ int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 3.40903e-02; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 7.22586e-02; - my_rates->SN0_fSiM [iSN] = 1.65746e-02; - my_rates->SN0_fFeM [iSN] = 2.39849e-02; - my_rates->SN0_fMg2SiO4 [iSN] = 8.69522e-04; - my_rates->SN0_fMgSiO3 [iSN] = 2.87802e-06; - my_rates->SN0_fAC [iSN] = 4.85826e-02; - my_rates->SN0_fSiO2D [iSN] = 2.52534e-03; - my_rates->SN0_fMgO [iSN] = 1.28672e-05; - my_rates->SN0_fFeS [iSN] = 2.09730e-06; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 1.65746e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 2.39849e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 8.69522e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.87802e-06; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 4.85826e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 2.52534e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.28672e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 2.09730e-06; itab0 = 3 * iSN; my_rates->SN0_r0SiM [itab0 + 0] = 1.68557e-06; @@ -1054,15 +1026,15 @@ int calc_rates_dust_C20(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 6.02018e-02; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 2.69505e-02; - my_rates->SN0_fSiM [iSN] = 3.44388e-02; - my_rates->SN0_fFeM [iSN] = 3.77223e-03; - my_rates->SN0_fMg2SiO4 [iSN] = 1.90086e-03; - my_rates->SN0_fMgSiO3 [iSN] = 2.57266e-06; - my_rates->SN0_fAC [iSN] = 1.27270e-02; - my_rates->SN0_fSiO2D [iSN] = 1.65484e-03; - my_rates->SN0_fMgO [iSN] = 9.48713e-04; - my_rates->SN0_fFeS [iSN] = 5.23050e-05; - my_rates->SN0_fAl2O3 [iSN] = 1.31693e-29; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 3.44388e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.77223e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.90086e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.57266e-06; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.27270e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.65484e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 9.48713e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 5.23050e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 1.31693e-29; itab0 = 3 * iSN; my_rates->SN0_r0SiM [itab0 + 0] = 1.24861e-05; @@ -1478,15 +1450,15 @@ int calc_rates_dust_C25(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 4.72556e-02; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.46955e-02; - my_rates->SN0_fSiM [iSN] = 3.83373e-02; - my_rates->SN0_fFeM [iSN] = 4.88366e-03; - my_rates->SN0_fMg2SiO4 [iSN] = 1.68068e-02; - my_rates->SN0_fMgSiO3 [iSN] = 2.49736e-05; - my_rates->SN0_fAC [iSN] = 4.13961e-02; - my_rates->SN0_fSiO2D [iSN] = 1.46546e-02; - my_rates->SN0_fMgO [iSN] = 1.09289e-03; - my_rates->SN0_fFeS [iSN] = 3.77935e-04; - my_rates->SN0_fAl2O3 [iSN] = 1.65550e-31; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 3.83373e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 4.88366e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.68068e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.49736e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 4.13961e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.46546e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.09289e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 3.77935e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 1.65550e-31; itab0 = 3 * iSN; my_rates->SN0_r0SiM [itab0 + 0] = 1.72153e-05; @@ -1902,15 +1874,15 @@ int calc_rates_dust_C30(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 3.68812e-02; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.23641e-02; - my_rates->SN0_fSiM [iSN] = 2.91389e-02; - my_rates->SN0_fFeM [iSN] = 1.93065e-03; - my_rates->SN0_fMg2SiO4 [iSN] = 7.73041e-04; - my_rates->SN0_fMgSiO3 [iSN] = 4.17376e-06; - my_rates->SN0_fAC [iSN] = 6.19235e-04; - my_rates->SN0_fSiO2D [iSN] = 5.27016e-03; - my_rates->SN0_fMgO [iSN] = 1.33978e-03; - my_rates->SN0_fFeS [iSN] = 4.51744e-04; - my_rates->SN0_fAl2O3 [iSN] = 5.79251e-12; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 2.91389e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.93065e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 7.73041e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 4.17376e-06; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 6.19235e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 5.27016e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.33978e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 4.51744e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 5.79251e-12; itab0 = 3 * iSN; my_rates->SN0_r0SiM [itab0 + 0] = 2.56305e-05; @@ -2326,13 +2298,13 @@ int calc_rates_dust_F13(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 8.90341e-06; - my_rates->SN0_fFeM [iSN] = 6.31648e-26; - my_rates->SN0_fMg2SiO4 [iSN] = 2.06081e-16; - my_rates->SN0_fMgSiO3 [iSN] = 3.19262e-15; - my_rates->SN0_fFe3O4 [iSN] = 4.37192e-15; - my_rates->SN0_fAC [iSN] = 1.75542e-01; - my_rates->SN0_fSiO2D [iSN] = 1.92019e-16; - my_rates->SN0_fAl2O3 [iSN] = 6.23283e-17; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 6.31648e-26; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.06081e-16; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 3.19262e-15; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 4.37192e-15; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.75542e-01; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.92019e-16; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 6.23283e-17; itab0 = 3 * iSN; my_rates->SN0_r0FeM [itab0 + 0] = 4.02937e-08; @@ -2666,13 +2638,13 @@ int calc_rates_dust_F15(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 9.66658e-06; - my_rates->SN0_fFeM [iSN] = 1.53361e-25; - my_rates->SN0_fMg2SiO4 [iSN] = 1.56864e-15; - my_rates->SN0_fMgSiO3 [iSN] = 2.13810e-14; - my_rates->SN0_fFe3O4 [iSN] = 1.22287e-14; - my_rates->SN0_fAC [iSN] = 1.89229e-01; - my_rates->SN0_fSiO2D [iSN] = 1.47463e-15; - my_rates->SN0_fAl2O3 [iSN] = 2.15191e-16; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.53361e-25; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.56864e-15; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.13810e-14; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 1.22287e-14; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.89229e-01; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.47463e-15; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 2.15191e-16; itab0 = 3 * iSN; my_rates->SN0_r0FeM [itab0 + 0] = 4.02634e-08; @@ -3006,13 +2978,13 @@ int calc_rates_dust_F50(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 4.15804e-06; - my_rates->SN0_fFeM [iSN] = 2.33171e-24; - my_rates->SN0_fMg2SiO4 [iSN] = 2.62486e-10; - my_rates->SN0_fMgSiO3 [iSN] = 1.21446e-09; - my_rates->SN0_fFe3O4 [iSN] = 2.41799e-13; - my_rates->SN0_fAC [iSN] = 1.09849e-04; - my_rates->SN0_fSiO2D [iSN] = 3.41863e-11; - my_rates->SN0_fAl2O3 [iSN] = 2.53950e-17; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 2.33171e-24; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.62486e-10; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 1.21446e-09; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 2.41799e-13; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.09849e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 3.41863e-11; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 2.53950e-17; itab0 = 3 * iSN; my_rates->SN0_r0FeM [itab0 + 0] = 4.02891e-08; @@ -3346,13 +3318,13 @@ int calc_rates_dust_F80(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 2.43915e-06; - my_rates->SN0_fFeM [iSN] = 3.87590e-26; - my_rates->SN0_fMg2SiO4 [iSN] = 2.36180e-13; - my_rates->SN0_fMgSiO3 [iSN] = 2.48190e-12; - my_rates->SN0_fFe3O4 [iSN] = 3.01120e-15; - my_rates->SN0_fAC [iSN] = 8.68025e-03; - my_rates->SN0_fSiO2D [iSN] = 3.70132e-14; - my_rates->SN0_fAl2O3 [iSN] = 3.77811e-18; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.87590e-26; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.36180e-13; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.48190e-12; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 3.01120e-15; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 8.68025e-03; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 3.70132e-14; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 3.77811e-18; itab0 = 3 * iSN; my_rates->SN0_r0FeM [itab0 + 0] = 4.02891e-08; @@ -3686,13 +3658,13 @@ int calc_rates_dust_P170(int iSN, chemistry_data *my_chemistry, chemistry_data_s inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 8.06035e-02; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 5.29394e-02; - my_rates->SN0_fSiM [iSN] = 1.31079e-02; - my_rates->SN0_fFeM [iSN] = 3.34688e-05; - my_rates->SN0_fMg2SiO4 [iSN] = 2.84952e-13; - my_rates->SN0_fMgSiO3 [iSN] = 7.72302e-25; - my_rates->SN0_fAC [iSN] = 4.47758e-05; - my_rates->SN0_fSiO2D [iSN] = 1.23405e-04; - my_rates->SN0_fMgO [iSN] = 1.41247e-07; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 1.31079e-02; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.34688e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.84952e-13; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 7.72302e-25; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 4.47758e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.23405e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.41247e-07; itab0 = 3 * iSN; my_rates->SN0_r0SiM [itab0 + 0] = 2.72050e-06; @@ -4026,12 +3998,12 @@ int calc_rates_dust_P200(int iSN, chemistry_data *my_chemistry, chemistry_data_s inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 1.15582e-01; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 6.75026e-02; - my_rates->SN0_fSiM [iSN] = 5.90622e-05; - my_rates->SN0_fFeM [iSN] = 4.26809e-04; - my_rates->SN0_fMg2SiO4 [iSN] = 4.08246e-15; - my_rates->SN0_fAC [iSN] = 3.72287e-05; - my_rates->SN0_fSiO2D [iSN] = 4.59330e-04; - my_rates->SN0_fMgO [iSN] = 5.38389e-09; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 5.90622e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 4.26809e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 4.08246e-15; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 3.72287e-05; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 4.59330e-04; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 5.38389e-09; itab0 = 3 * iSN; my_rates->SN0_r0SiM [itab0 + 0] = 8.86269e-07; @@ -4324,8 +4296,8 @@ int calc_rates_dust_Y19(int iSN, chemistry_data *my_chemistry, chemistry_data_st inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 1.58191e-02; inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 6.64078e-02; - my_rates->SN0_fMgSiO3 [iSN] = 2.50000e-01; - my_rates->SN0_fAC [iSN] = 2.50000e-01; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust][iSN] = 2.50000e-01; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 2.50000e-01; itab0 = 3 * iSN; my_rates->SN0_r0MgSiO3 [itab0 + 0] = 1.00000e-05; diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index 82da80112..d34a1e323 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -611,9 +611,6 @@ typedef struct int SN0_N; double *SN0_XC , *SN0_XO , *SN0_XMg, *SN0_XAl, *SN0_XSi, *SN0_XS , *SN0_XFe; double *SN0_fC , *SN0_fO , *SN0_fMg, *SN0_fAl, *SN0_fSi, *SN0_fS , *SN0_fFe; - double *SN0_fSiM, *SN0_fFeM, *SN0_fMg2SiO4, *SN0_fMgSiO3, *SN0_fFe3O4 - , *SN0_fAC, *SN0_fSiO2D, *SN0_fMgO, *SN0_fFeS, *SN0_fAl2O3 - , *SN0_freforg , *SN0_fvolorg , *SN0_fH2Oice; double *SN0_r0SiM, *SN0_r0FeM, *SN0_r0Mg2SiO4, *SN0_r0MgSiO3, *SN0_r0Fe3O4 , *SN0_r0AC, *SN0_r0SiO2D, *SN0_r0MgO, *SN0_r0FeS, *SN0_r0Al2O3 , *SN0_r0reforg , *SN0_r0volorg , *SN0_r0H2Oice; From 40031e67de7093add80c4c327b940b791d63631f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 12 Nov 2025 08:11:55 -0500 Subject: [PATCH 015/111] calc_grain_size_increment_species_1d: comment the code and add a very minor tweak --- src/clib/calc_grain_size_increment_1d.F | 133 ++++++++++++++++++++---- 1 file changed, 112 insertions(+), 21 deletions(-) diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index 7dd050d0b..530035ac1 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -444,7 +444,17 @@ subroutine calc_grain_size_increment_species_1d( & , gr_N, gr_Size, gr_dT, gr_Td, SN_kp0sp & ) - +! +! Calculates properties that are derived from the grain size increment +! for a single grain species. +! +! NOTE: the subroutine's name should be more descriptive +! +! INPUTS: +! ssp - the density of an individual dust grain species. At the time +! of writing it has units of g/cm^3 +! +! implicit NONE #include "grackle_fortran_types.def" @@ -469,6 +479,7 @@ subroutine calc_grain_size_increment_species_1d( ! local integer i real*8 coef0, coef1, coef2, coef3 + real*8 dsp_inject_sum real*8 dsp0, SN_sgsp, SN_kpsp real*8 SN_dsp0(SN0_N), SN_nsp0(SN0_N) real*8 drsp(in) @@ -496,6 +507,10 @@ subroutine calc_grain_size_increment_species_1d( !!!!!!!!!!!!! !!!! if( dsp(i,j,k) .gt. 1.d-15*d(i,j,k) ) then !!!!!!!!!!!!! + +! Step 1: compute the total mass density of the current grain species +! that was injected (by summing the amounts injected by each +! injection pathway) do iSN = 1, nSN if(SN_fsp(iSN) .gt. 0.d0) then SN_dsp0(iSN) = SN_fsp(iSN) * SN_metal(i, iSN) @@ -504,63 +519,139 @@ subroutine calc_grain_size_increment_species_1d( endif enddo +! Step 2: Compute the size increment for the grain species +! +! Let's go into detail: +! - todo: maybe we move most of this description into the docstring +! and possibly move some of it into the narrative documentation +! - let's define some notation: +! - for some time t, let φ(r,t) denote the grain species's +! differential size distribution at time t, ρ(t) denote the grain +! species's mass density, and n(t) denote it number density. +! - we define (t) as the `p`th order moment of `φ(r,t)`. In +! other words, ⱼ = ∫ rᵖ φⱼ dr, where the integral is taken +! from 0 to infinity +! - for additional context: +! - φ(r,t) is normalized such that the p=0 moment is 1 +! - n(t)*φ(r,t) specifies the number density of the grain with +! radii between r and r+dr +! - given the mass density of a single grain, ζ, the variables +! are related via ρ(t) = (4π/3) ζ n(t) (t). +! - we define Φⱼ(r) as the grain species's initial differential +! size distribution when distributed by injection pathway j. +! - for notational convenience, we define ⱼ as the `p`th order +! moment of `Φⱼ(r)` +! - NOTE: we don't explicitly track φ(r,t) or Φⱼ(r), instead we +! track moments +! - The underlying model assumes that all injection pathways inject +! the grain species at a single time t_inj. +! - In other words: φ(r,t_inj) = (∑ⱼ nⱼ Φⱼ(r)) / (∑ⱼ nⱼ) +! - Consequently: +! (t_inj) = (∑ⱼ nⱼ ⱼ) / (∑ⱼ nⱼ) +! OR +! (t_inj) = (∑ⱼ ⱼ ρⱼ/ⱼ) / (∑ⱼ ρⱼ/ⱼ) +! - Furthermore we assume that: +! - grains can only be created via injection (i.e. the number +! density of the grain species is frozen) +! - φ(r,t) can't be deformed. However it can be translated (which +! is exactly what happens when grains undergo growth). +! - Thus, when we model growth, φ(r,t) = φ(r - δr(t), t_inj) where +! we call δr(t) the "size increment" +! +! Anybody reading this might notice that several limitations to this +! model. This is discussed in detail in GH Issue 444 (the description +! should be made part of the narrative docs + if(igrgr .eq. 0) then +! the model is constructed such that δr(t) = 0 if we aren't +! modelling grain growth drsp(i) = 0.d0 else -!!! TEST !!!!!! TEST !!!!!! TEST !!!!!! TEST !!!!!! TEST !!!!!! TEST !!! -!!! dsp(i,j,k) = 3.d0 * dsp(i,j,k) -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -! calculate grain size increment from the conservation of mass - - coef0 = 0.d0 +! here we calculate the current grain size increment, δr(t), using +! conservation of grain number (i.e. grains are only created via +! injection pathways) +! - recall that to model growth we effectively assume that each +! occurrence of a grain species was injected at a single time, t_inj +! - conservation of grain number tells us that +! (t) = (t_inj) * ρ(t) / ρ(t_inj), +! where ρ(t_inj) = ∑ⱼ ρⱼ +! - Equation A3 of Chiaki & Wise 2019 indicates that the grain-size +! increment is the root of the following cubic equation +! [(t_inj) - (t)] + [3 * (t_inj)] * δr(t) +! + [3 * (t_inj)] * δr²(t) + δr³(t) = 0 +! - Let's rewrite the expression ((t_inj) - (t)). First, +! let's plug in the equation from conservation of grain number: +! (t_inj) - (t) = (t_inj) * [ 1 - (ρ(t)/∑ⱼρⱼ)] +! Now, let's plug in (t_inj) = (∑ⱼρⱼ) / (∑ⱼ ρⱼ/ⱼ), which +! comes from the generic formula for (t_inj) defined earlier: +! (t_inj) - (t) = [(∑ⱼρⱼ) - ρ(t)] / (∑ⱼ ρⱼ/ⱼ) +! - If we plug this into the preceding cubic equation and multiply the +! resulting equation by (∑ⱼ ρⱼ/ⱼ), we get: +! coef0 + coef1 * δr(t) + coef2 * δr²(t) + coef3 * δr³(t) = 0 +! where: +! - coef0 = (∑ⱼ ρⱼ) - ρ(t) +! - coef1 = ∑ⱼ 3 ⱼ ρⱼ/ⱼ +! - coef2 = ∑ⱼ 3 ⱼ ρⱼ/ⱼ +! - coef3 = ∑ⱼ ρⱼ/ⱼ + +! Let's compute these coefficients + dsp_inject_sum = 0.d0 +! We'll use dsp_inject_sum to compute coef0 coef1 = 0.d0 coef2 = 0.d0 coef3 = 0.d0 + +! Loop over each injection pathway do iSN = 1, nSN if(SN_fsp(iSN) .gt. 0.d0) then +! Calculate 4πζnⱼ/3 = ρⱼ/ⱼ +! -> recall: that ζ is the mass density of a single grain of the +! current grain species (i.e. it's a constant) +! -> TODO: its very confusing that we store the result within SN_nsp0 +! since that variable is later reused to directly hold nⱼ SN_nsp0(iSN) = SN_dsp0(iSN) / SN_r0sp(3,iSN) - coef0 = coef0 + SN_dsp0(iSN) + + dsp_inject_sum = dsp_inject_sum + SN_dsp0(iSN) coef1 = coef1 + 3.d0 * SN_nsp0(iSN) * SN_r0sp(2,iSN) coef2 = coef2 + 3.d0 * SN_nsp0(iSN) * SN_r0sp(1,iSN) coef3 = coef3 + SN_nsp0(iSN) endif enddo -!! write(*,*) coef0, dsp(i,j,k) - coef0 = coef0 - dsp(i,j,k) -!! write(*,*) coef0, coef1, coef2, coef3 + coef0 = dsp_inject_sum - dsp(i,j,k) + +! Let's actually solve for the δr(t), the root of the cubic equation +! - before we do that, we divide both sides of the equation by the +! value of coef3. This ensures that the rescaled value of coef3 is +! exactly 1 (a requirement of the solve_cubic_equation routine) +! - todo: consider not modifying the variables in-place or performing +! this operation within the solve_cubic_equation coef0 = coef0 / coef3 coef1 = coef1 / coef3 coef2 = coef2 / coef3 - + call solve_cubic_equation(coef2, coef1, coef0, drsp(i)) -!! write(*,*) coef0, coef1, coef2, coef3, drsp(i) drsp(i) = max(drsp(i), 0.d0) endif -! calculate number density (code_density / g) +! Step 3: calculate number density (code_density / g) do iSN = 1, nSN if(SN_fsp(iSN) .gt. 0.d0) then SN_nsp0(iSN) = SN_dsp0(iSN) & / (4.d0*pi/3.d0 * ssp * SN_r0sp(3,iSN)) -! if(iSN.eq.1) -! & write(*,*) 'aa', SN_dsp0(iSN), dsp(i,j,k) -! & , (4.d0*pi/3.d0 * ssp * SN_r0sp(3,iSN)) -! & , SN_nsp0(iSN) else SN_nsp0(iSN) = 0.d0 endif enddo -! calculate geometrical cross-section per unit gas mass +! Step 4: calculate geometrical cross-section per unit gas mass sgsp(i) = 0.d0 do iSN = 1, nSN if( SN_fsp(iSN) .gt. 0.d0) then @@ -581,7 +672,7 @@ subroutine calc_grain_size_increment_species_1d( enddo sgsp(i) = sgsp(i) / d(i,j,k) -! calculate optical cross-section per unit gas mass +! Step 5: calculate optical cross-section per unit gas mass do iTd = 1, gr_N(2) iTd0 = (iTd-1)*gr_N(1) alsp(iTd,i) = 0.d0 From 55aa77a11dc0c2b5af6b93d71e4536f02617c8a9 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 12 Nov 2025 08:42:00 -0500 Subject: [PATCH 016/111] remove some commented out debugging code from calc_grain_size_increment_species_1d --- src/clib/calc_grain_size_increment_1d.F | 62 ------------------------- 1 file changed, 62 deletions(-) diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index 530035ac1..40724fa0b 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -485,28 +485,10 @@ subroutine calc_grain_size_increment_species_1d( real*8 drsp(in) real*8, parameter :: pi = pi_val real*8, parameter :: mh = mass_h -! debug - real*8 SN_dsp(SN0_N), SN_msp(SN0_N), dsp1 integer iTd, iTd0 - -! write(*,*) SN_fsp(1) -! write(*,*) SN_r0sp(1,1) -! & , SN_r0sp(2,1) -! & , SN_r0sp(3,1) -! do iTd = 1, gr_N(2) -! iTd0 = (iTd-1)*gr_N(1) -! write(*,*) gr_Td(iTd) -! & , SN_kp0sp(iTd0+1,1) -! & , SN_kp0sp(iTd0+2,1) -! & , SN_kp0sp(iTd0+3,1) -! & , SN_kp0sp(iTd0+4,1) -! enddo do i = is+1, ie+1 if ( itmask(i) .ne. MASK_FALSE ) then -!!!!!!!!!!!!! -!!!! if( dsp(i,j,k) .gt. 1.d-15*d(i,j,k) ) then -!!!!!!!!!!!!! ! Step 1: compute the total mass density of the current grain species ! that was injected (by summing the amounts injected by each @@ -514,8 +496,6 @@ subroutine calc_grain_size_increment_species_1d( do iSN = 1, nSN if(SN_fsp(iSN) .gt. 0.d0) then SN_dsp0(iSN) = SN_fsp(iSN) * SN_metal(i, iSN) -!! write(*,*) iSN, SN_fsp(iSN) -!! & , SN_metal(i, iSN) endif enddo @@ -664,11 +644,6 @@ subroutine calc_grain_size_increment_species_1d( SN_sgsp = 0.d0 endif sgsp(i) = sgsp(i) + SN_nsp0(iSN) * SN_sgsp -!! if(iSN.eq.1) -!! & write(*,*) dsp(i,j,k)/d(i,j,k) -!! & , SN_dsp0(iSN)/d(i,j,k) -!! & , ssp, SN_r0sp(3, iSN), SN_r0sp(2,iSN) -!! & , drsp(i), sgsp(i)/d(i,j,k) enddo sgsp(i) = sgsp(i) / d(i,j,k) @@ -688,47 +663,10 @@ subroutine calc_grain_size_increment_species_1d( SN_kpsp = 0.d0 endif alsp(iTd,i) = alsp(iTd,i) + SN_nsp0(iSN) * SN_kpsp -! if(iSN.eq.1) -! & write(*,*) gr_Td(iTd) -! & , SN_dsp0(iSN)/d(i,j,k) -! & , (4.d0*pi/3.d0 * ssp * SN_kp0sp(iTd0+4,iSN)) -! & / (4.d0*pi/3.d0 * ssp * SN_r0sp(3,iSN)) enddo alsp(iTd,i) = alsp(iTd,i) / d(i,j,k) enddo -! decompose grain mass density for each SN model !!!!!!!!!!!!!!!!!!!!!!! -! dsp0 = 0.d0 -! dsp1 = 0.d0 -! do iSN = 1, nSN -! dsp0 = dsp0 + SN_dsp0(iSN) -! if( SN_fsp(iSN) .gt. 0.d0) then -! SN_dsp(iSN) = 4.d0*pi/3.d0 * ssp * ( -! & SN_nsp0(iSN) * SN_r0sp(3,iSN) -! & + 3.d0 * SN_nsp0(iSN) * SN_r0sp(2,iSN) * drsp(i) -! & + 3.d0 * SN_nsp0(iSN) * SN_r0sp(1,iSN) * drsp(i)**2 -! & + SN_nsp0(iSN) * drsp(i)**3 -! & ) -! SN_msp(iSN) = 4.d0*pi/3.d0 * ssp * ( -! & SN_r0sp(3,iSN) -! & + 3.d0 * SN_r0sp(2,iSN) * drsp(i) -! & + 3.d0 * SN_r0sp(1,iSN) * drsp(i)**2 -! & + drsp(i)**3 -! & ) -!! if(iSN.eq.2) -!! & write(*,*) iSN, (SN_dsp(iSN)/SN_msp(iSN))/SN_nsp0(iSN) -! dsp1 = dsp1 + SN_dsp(iSN) -! endif -! enddo -! write(*,*) drsp(i), dsp1/dsp(i,j,k) -!!!!!!!!!!!!! -!!!! else - -!!!! sgsp (i) = tiny8 -!!!! alsp(:,i) = tiny8 - -!!!! endif -!!!!!!!!!!!!! endif ! itmask enddo From 97f90d599c4661eb74c1e762d717e8ccf7883dda Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 12 Nov 2025 09:32:26 -0500 Subject: [PATCH 017/111] minor tweaks --- src/clib/initialize_dust_yields.cpp | 50 +++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index dfd7c0d78..670f8dff0 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -59,10 +59,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, = my_rates->opaque_storage->inject_pathway_props; - int NTd, Nmom; - double Td0, dTd; - int iTd, imom, itab; - int NSN = n_pathways; // todo: delete me! my_rates->SN0_N = n_pathways; @@ -131,9 +127,9 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_r0volorg = (double*)malloc(NSN * 3 * sizeof(double)); my_rates->SN0_r0H2Oice = (double*)malloc(NSN * 3 * sizeof(double)); - itab = 0; + int itab = 0; for(int iSN = 0; iSN < NSN; iSN++) { - for(imom = 0; imom < 3; imom++) { + for(int imom = 0; imom < 3; imom++) { my_rates->SN0_r0SiM [itab] = 0.0; my_rates->SN0_r0FeM [itab] = 0.0; my_rates->SN0_r0Mg2SiO4 [itab] = 0.0; @@ -151,18 +147,41 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, } } - NTd = 35; - Td0 = 0.0000000; - dTd = 0.1000000; - Nmom = 4; - + // write out the opacity related quantities + + // todo: consider renaming Nmom -> Ncoef + int Nmom = 4; // todo: remove me! + // todo: more this into GrainMetalInjectPathways + // - essentially, each SN0_kpGRSP array is a 3D array of shape + // (n_pathways, NTd, Nmom). This shape uses numpy conventions (i.e. Nmom is + // the fast-axis). + // - In more detail: + // - n_pathways is the number of injection pathways + // - NTd corresponds to the number of dust temperatures we consider + // - Nmom corresponds to the number of coefficients that we track for + // computing an opacity related quantity. This quantity is given by + // 4πζ/3 * ( SN0_kpGRSP[path_j, iTd, 3] + + // SN0_kpGRSP[path_j, iTd, 2] * δr(t) + + // SN0_kpGRSP[path_j, iTd, 1] * δr²(t) + + // SN0_kpGRSP[path_j, iTd, 0] * δr³(t)) + // where + // - ζ is the mass density of a single grain (in g/cm³) + // - δr(t) refers to the derived "size increment" (it is a central + // quantity in the model) + // - I **think** the resulting quantity is the optical cross-section + double NTd = 35; // todo: remove me! + double Td0 = 0.0000000; // todo: remove me! + double dTd = 0.1000000; // todo: remove me! + + // todo: rename gr_Td, dTd since they are related to log10(Tdust) or ln(Tdust) my_rates->gr_Td = (double*)malloc(NTd * Nmom * sizeof(double)); my_rates->gr_Size = NTd * Nmom; my_rates->gr_N[0] = Nmom; my_rates->gr_N[1] = NTd; my_rates->gr_dT = dTd; - for(iTd = 0; iTd < NTd; iTd++) + for(int iTd = 0; iTd < NTd; iTd++) { my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; + } my_rates->SN0_kpSiM = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); my_rates->SN0_kpFeM = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); @@ -180,8 +199,11 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, itab = 0; for(int iSN = 0; iSN < NSN; iSN++) { - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { + // TODO: I'm pretty sure we want to flip the order of inner loops + // - while it doesn't actually effect the result this is extremely + // confusing if the grain-temperature axis isn't the fast axis. + for(int imom = 0; imom < Nmom; imom++) { + for(int iTd = 0; iTd < NTd; iTd++) { my_rates->SN0_kpSiM [itab] = 0.0; my_rates->SN0_kpFeM [itab] = 0.0; my_rates->SN0_kpMg2SiO4 [itab] = 0.0; From c1a54e31ae6c0f59ee1ce0799974e4166541e811 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 14 Nov 2025 11:21:19 -0500 Subject: [PATCH 018/111] add more commentary to calc_grain_size_increment_1d --- src/clib/calc_grain_size_increment_1d.F | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index 40724fa0b..89dce70e0 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -632,6 +632,7 @@ subroutine calc_grain_size_increment_species_1d( enddo ! Step 4: calculate geometrical cross-section per unit gas mass +! -> units of cm^2/g sgsp(i) = 0.d0 do iSN = 1, nSN if( SN_fsp(iSN) .gt. 0.d0) then @@ -647,7 +648,14 @@ subroutine calc_grain_size_increment_species_1d( enddo sgsp(i) = sgsp(i) / d(i,j,k) -! Step 5: calculate optical cross-section per unit gas mass +! Step 5: calculate optical opacity related quantities +! -> we are effectively constructing a 1d table of values, at various +! possible grain temperature for each injection pathway (in other +! words, its a 2D table) +! -> I'm pretty sure that the values we are the opacity (per unit gas +! mass) +! -> I'm pretty confident that the units are independent of code units +! (I think the units are cm^2/g) do iTd = 1, gr_N(2) iTd0 = (iTd-1)*gr_N(1) alsp(iTd,i) = 0.d0 From 2a1a6d5cf554e8304b44a98ef5f2bc557a5db8dd Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 14 Nov 2025 11:24:53 -0500 Subject: [PATCH 019/111] spruce up some commentary --- src/clib/dust_props.hpp | 2 +- src/clib/phys_constants.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/clib/dust_props.hpp b/src/clib/dust_props.hpp index 8639b3833..dcba84235 100644 --- a/src/clib/dust_props.hpp +++ b/src/clib/dust_props.hpp @@ -87,7 +87,7 @@ struct InternalDustPropBuf { /// - the fact that this holds a 1d table of values for each zone for each /// species seems extremely inefficient! /// - If we really do need to construct the full table, then (if possible) - /// we restructuring the algorithm so that: + /// we should restructure the algorithm so that: /// - we can reuse the buffer for different species /// - we can also reuse the buffer for different zones (this would probably /// involve reorganizing the tables of data for each metal-source in diff --git a/src/clib/phys_constants.h b/src/clib/phys_constants.h index a2362296a..5121d314e 100644 --- a/src/clib/phys_constants.h +++ b/src/clib/phys_constants.h @@ -122,6 +122,11 @@ * are hardcoded based on the values currently held by these constants. */ +// these constants are give the intrinsic density of an individual grain for +// each grain species in units of g/cm^3. +// - Equation A1 of Chiaki & Wise 2019 represents these quantities using the +// zeta_i variable. Equation 2 of Chiaki+15 denotes the variable as s_i + #define sSiM 2.34118e0 #define sFeM 7.95995e0 #define sMg2SiO4 3.22133e0 From a92e11d965c3331af5d124c89de52395281307a9 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 14 Nov 2025 11:25:45 -0500 Subject: [PATCH 020/111] add some commentary explaining how calc_tdust_1d_g.F actually works --- src/clib/calc_tdust_1d_g.F | 41 +++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/clib/calc_tdust_1d_g.F b/src/clib/calc_tdust_1d_g.F index 502dd9f78..bbeb792ec 100644 --- a/src/clib/calc_tdust_1d_g.F +++ b/src/clib/calc_tdust_1d_g.F @@ -18,6 +18,13 @@ subroutine calc_tdust_1d_g( ! PURPOSE: ! Calculate dust temperature. ! +! TODO: +! this docstring, and the docstrings of all helper functions should +! EXPLICITLY document how the meaning of arguments change based on +! whether we are using the single-field dust model or the +! multi-species dust model. The different meaning of each variable +! gets VERY confusing +! ! INPUTS: ! in - dimension of 1D slice ! @@ -347,11 +354,22 @@ subroutine calc_kappa_gr_g( ! ! written by: Britton Smith ! date: September, 2011 -! modified1: ! ! PURPOSE: ! Calculate grain plank mean opacity ! +! TODO: +! this docstring should EXPLICITLY document how the action of this +! function changes based on whether we are using the single-field +! dust model or the multi-species dust model. +! +! In the classic single single-field model, the returned opacities +! have units of cm^2/g and they are measured "per unit grain mass" +! +! In the multi-species dust model, I THINK that the returned +! opacities have units of cm^2/g and they are measured "per unit +! gas mass." +! ! INPUTS: ! in - i dimension of 3D fields ! @@ -472,6 +490,19 @@ subroutine calc_gr_balance_g( ! ! PURPOSE: ! Calculate grain heating/cooling balance + +! TODO: +! this docstring should EXPLICITLY document how the action of this +! function changes based on whether we are using the single-field +! dust model or the multi-species dust model. +! +! In the classic single single-field model, the returned values +! are emission/absorption rate per unit grain mass with units of +! erg/s/g +! +! In the multi-species dust model, I **THINK** that the returned +! values are emission/absorption rate per unit gas mass with units +! of erg/s/g (But I'm not entirely unsure). ! ! INPUTS: ! in - i dimension of 3D fields @@ -531,8 +562,12 @@ subroutine calc_gr_balance_g( & (trad4 - tdust(i)**4) + & (gasgr(i) * nh(i) * & (tgas(i) - tdust(i))) - ! emission/absorption rate per unit grain mass [erg/s/g] - ! for Z = Zsun (default) + ! Historically, the following comment was present here: + ! emission/absorption rate per unit grain mass [erg/s/g] + ! for Z = Zsun (default) + ! This comment is **ONLY** correct when the function used as + ! part of the single-field dust model. See the docstring for + ! more details. endif enddo From d251a232184eaecd5fd5dc1d82f27a7f2019a76a Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 14 Nov 2025 14:19:01 -0500 Subject: [PATCH 021/111] lay ground work for size_moments --- src/clib/grain_metal_inject_pathways.hpp | 57 +++++++++++++++++++++--- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/src/clib/grain_metal_inject_pathways.hpp b/src/clib/grain_metal_inject_pathways.hpp index 3ec9af073..e0c8e0c00 100644 --- a/src/clib/grain_metal_inject_pathways.hpp +++ b/src/clib/grain_metal_inject_pathways.hpp @@ -88,12 +88,12 @@ struct GrainMetalInjectPathways { /// holds 1D tables (tabulated with respect to each injection pathway) that /// tracks the fraction of the injected mass density corresponding to - /// occurences of given metal nuclide in both the gas phase **AND** as part + /// occurrences of given metal nuclide in both the gas phase **AND** as part /// of dust grains /// /// @important - /// This counts up occurences of nulcides (i.e. a nuclide is allowed to occur - /// multiple times within a single molecule) + /// This counts up occurrences of nulcides (i.e. a nuclide is allowed to + /// occur multiple times within a single molecule) /// /// @note /// this variables holds information that is somewhat actually redundant with @@ -101,24 +101,65 @@ struct GrainMetalInjectPathways { yields::MetalTables total_metal_nuclide_yields; /// holds 1D tables that tracks the fraction of the injected mass density - /// that corresponds to the **INITIAL** occurences of given metal nuclide in + /// that corresponds to the **INITIAL** occurrences of given metal nuclide in /// the gas phase. /// /// This holds a separate table for each metal nuclide and each table has an /// entry for each injection pathway. /// /// @important - /// This counts up occurences of nulcides (i.e. a nuclide is allowed to occur - /// multiple times within a single molecule) + /// This counts up occurrences of nulcides (i.e. a nuclide is allowed to + /// occur multiple times within a single molecule) yields::MetalTables gas_metal_nuclide_yields; /// holds 1D tables (tabulated with respect to each injection pathway) that /// tracks the fraction of the injected mass density that corresponds to the - /// **INITIAL** occurences of a given grain species + /// **INITIAL** occurrences of a given grain species /// /// This holds a separate table for each grain species and every table has an /// entry for each injection pathway. GrainSpeciesCollection grain_yields; + + /// holds 1D tables (tabulated with respect to each injection pathway) that + /// tracks the 3 coefficients, derived from the 1st, 2nd, and 3rd order + /// moments of the initial size distribution for a given grain species. + /// + /// This holds a separate table for each grain species and every table has 3 + /// contiguous entries for each pathway. In other words, each table has the + /// shape ``(n_pathways, 3)`` using numpy conventions for a C-ordered array + /// (to pass the array to Fortran, we would say a table has the shape + /// ``(3, n_pathways)``. + /// + /// For a given grain species, I'm pretty confident that the entry at: + /// - ``[j, 0]`` specifies \f$\langle r^1 \rangle_j\f$. This is the grain + /// species's average **INITIAL** radius, when injected by pathway ``j``. + /// The value has units of cm. + /// - ``[j, 1]`` specifies \f$\langle r^2 \rangle_j\f$. The product of this + /// value and π gives the grain species's average **INITIAL** + /// cross-section, when injected by pathway ``j``. The value has units of + /// centimeters squared. + /// - ``[j, 2]`` specifies \f$\langle r^3 \rangle_j\f$. The product of this + /// value and (4π/3) is the grain species's average **INITIAL** volume, + /// when injected by pathway ``j``. The value has units of centimeters + /// cubed. + /// + /// @todo + /// What are the units of each quantity? (the dimensionality is obvious) + /// + /// where \f$\langle r^2 \rangle_j=\int_0^\infty r^p \Phi_j(r)\, {\rm d}r\f$ + /// is an abbreviation for the ``p``th moment of the \f$\Phi_j(r)\f$, or the + /// initial differential grain size distribution for pathway ``j`` (this + /// differs for each grain species). For added context: + /// - \f$\Phi_j(r)\f$ is normalized such that the ``p=0`` moment is 1 + /// - if the number density of the given grain species injected by pathway + /// ``j`` is \f$n_j\f$, then \f$n_j\Phi_j(r)\f$ gives the initial number + /// density of the grain species with radii between ``r`` and ``r + dr`` + /// + /// @todo + /// We should move the detailed descriptions of the size distribution + /// functions to the narrative docs and refer the reader to the appropriate + /// section of documentation + GrainSpeciesCollection size_moments; }; /// allocates the contents of a new GrainMetalInjectPathways @@ -130,6 +171,7 @@ inline GrainMetalInjectPathways new_GrainMetalInjectPathways(int n_pathways) { out.total_metal_nuclide_yields = yields::new_MetalTables(n_pathways); out.gas_metal_nuclide_yields = yields::new_MetalTables(n_pathways); out.grain_yields = new_GrainSpeciesCollection(n_pathways); + out.size_moments = new_GrainSpeciesCollection(3 * n_pathways); return out; } @@ -141,6 +183,7 @@ inline void drop_GrainMetalInjectPathways(GrainMetalInjectPathways* ptr) { yields::drop_MetalTables(&ptr->total_metal_nuclide_yields); yields::drop_MetalTables(&ptr->gas_metal_nuclide_yields); drop_GrainSpeciesCollection(&ptr->grain_yields); + drop_GrainSpeciesCollection(&ptr->size_moments); } } // namespace grackle::impl From 024c0da25b8a306e52e82ca47b1ded1ae1b840dd Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 15 Nov 2025 16:24:30 -0500 Subject: [PATCH 022/111] incremental commit --- src/clib/initialize_dust_yields.cpp | 221 +++++++++++++++++++++++++++- 1 file changed, 219 insertions(+), 2 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 670f8dff0..6e10a0cf3 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -10,6 +10,7 @@ /// //===----------------------------------------------------------------------===// +#include #include #include #include @@ -18,11 +19,80 @@ #include "initialize_dust_yields.hpp" // forward declarations #include "LUT.hpp" #include "opaque_storage.hpp" +#include "status_reporting.h" // GrPrintAndReturnErr -// forward declare some functions +static constexpr int N_Tdust_Opacity_Table = 35; +static constexpr int N_Opacity_Coef = 4; namespace { // stuff inside an anonymous namespace is local to this file +struct MetalNuclideYieldProps; +struct GrainSpeciesYieldProps; + +/// This is used to organize the storage of the injection pathway data +/// +/// Essentially, this dictates how the data is organized on disk (as part of +/// the Grackle library). This data will be somewhat reordered to actually +/// perform calculations +/// +/// There are a few reasons why it makes some sense to store this data in a +/// a slightly different format than the way is organized during the core +/// calculations: +/// - the way we organize it here (which has some similarities to a struct of +/// arrays) is a lot less error-prone. +/// - the way we organize it here allows us to use a more sparse representation +/// (i.e. we omit yields from pathways when the yields are 0) +/// +/// @note +/// The plan is to eventually shift the data into a file loaded at runtime +struct InjectionPathwayInputData { + const char* name; + + const MetalNuclideYieldProps* metal_nuclide_yields; + int n_metal_nuclide_yields; + + const GrainSpeciesYieldProps* initial_grain_props; + int n_injected_grain_species; +}; + + +struct MetalNuclideYieldProps { + /// name of the nuclide + const char* name; + + /// total fraction of non-primordial injection corresponding to the nuclide + double total_yield; + + /// fraction of non-primordial injection corresponding to the nuclide in + /// the gas phase + double gas_yield; +}; + +/// Each injection array will hold an array of these structs +struct GrainSpeciesYieldProps { + /// name of the Grain Species + const char* name; + + /// Initial yield + double nonprimoridal_yield_frac; + + /// the 1st, 2nd, and 3rd order moments of the initial size distribution for + /// the grain species. + /// + /// - Element 0 specifies \f$\langle r^1 \rangle_j\f$. This is the grain + /// species's average **INITIAL** radius. Has units of cm. + /// - Element 1 specifies \f$\langle r^2 \rangle_j\f$. The product of this + /// value and π gives the grain species's average **INITIAL** + /// cross-section. Has units of centimeters squared. + /// - Element 2 specifies \f$\langle r^3 \rangle_j\f$. The product of this + /// value and (4π/3) is the grain species's average **INITIAL** volume. + /// Has units of centimeters cubed. + double size_moments[3]; + + double opacity_coef_table[N_Tdust_Opacity_Table][N_Opacity_Coef]; +}; + +// forward declare some functions int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); int calc_rates_dust_C20(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); @@ -169,7 +239,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // - δr(t) refers to the derived "size increment" (it is a central // quantity in the model) // - I **think** the resulting quantity is the optical cross-section - double NTd = 35; // todo: remove me! + double NTd = N_Tdust_Opacity_Table; // todo: remove me! double Td0 = 0.0000000; // todo: remove me! double dTd = 0.1000000; // todo: remove me! @@ -301,6 +371,153 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, namespace { // stuff inside an anonymous namespace is local to this file +int setup_yield_table_helper( + int pathway_idx, + chemistry_data_storage *my_rates, + const InjectionPathwayInputData *input) +{ + + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + // record each metal nuclide yield + // -> there is less value to using string keys in this case, but it makes + // some sense to be semi-consistent with the handling of the dust species + // yields + for (int i = 0; i < input->n_metal_nuclide_yields; i++) { + const MetalNuclideYieldProps& yield_info = input->metal_nuclide_yields[i]; + + double* total_yield = nullptr; + double* gas_yield = nullptr; + + // todo: refactor to use a map (I have a rough plan) + if (std::strcmp("C", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.C; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.C; + } else if (std::strcmp("O", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.O; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.O; + } else if (std::strcmp("Mg", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Mg; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Mg; + } else if (std::strcmp("Al", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Al; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Al; + } else if (std::strcmp("Si", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Si; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Si; + } else if (std::strcmp("S", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.S; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.S; + } else if (std::strcmp("Fe", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Fe; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Fe; + } else { + return GrPrintAndReturnErr( + "`%s` not a known metal nuclide", yield_info.name); + } + + total_yield[pathway_idx] = yield_info.total_yield; + gas_yield[pathway_idx] = yield_info.gas_yield; + } + + // record each grain species yield + for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; + yield_idx++) { + const GrainSpeciesYieldProps& yield_info = + input->initial_grain_props[yield_idx]; + + int grain_species_idx = -1; + double* size_mom_table = nullptr; + double* opac_coef_table = nullptr; + + // with a little refactoring, this will get a lot more concise + if (std::strcmp("MgSiO3_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; + size_mom_table = my_rates->SN0_r0MgSiO3; + opac_coef_table = my_rates->SN0_kpMgSiO3; + } else if (std::strcmp("AC_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::AC_dust; + size_mom_table = my_rates->SN0_r0AC; + opac_coef_table = my_rates->SN0_kpAC; + } else if (std::strcmp("SiM_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::SiM_dust; + size_mom_table = my_rates->SN0_r0SiM; + opac_coef_table = my_rates->SN0_kpSiM; + } else if (std::strcmp("FeM_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::FeM_dust; + size_mom_table = my_rates->SN0_r0FeM; + opac_coef_table = my_rates->SN0_kpFeM; + } else if (std::strcmp("Mg2SiO4_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; + size_mom_table = my_rates->SN0_r0Mg2SiO4; + opac_coef_table = my_rates->SN0_kpMg2SiO4; + } else if (std::strcmp("Fe3O4_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; + size_mom_table = my_rates->SN0_r0Fe3O4; + opac_coef_table = my_rates->SN0_kpFe3O4; + } else if (std::strcmp("SiO2_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::SiO2_dust; + size_mom_table = my_rates->SN0_r0SiO2D; + opac_coef_table = my_rates->SN0_kpSiO2D; + } else if (std::strcmp("MgO_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::MgO_dust; + size_mom_table = my_rates->SN0_r0MgO; + opac_coef_table = my_rates->SN0_kpMgO; + } else if (std::strcmp("FeS_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::FeS_dust; + size_mom_table = my_rates->SN0_r0FeS; + opac_coef_table = my_rates->SN0_kpFeS; + } else if (std::strcmp("Al2O3_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; + size_mom_table = my_rates->SN0_r0Al2O3; + opac_coef_table = my_rates->SN0_kpAl2O3; + } else if (std::strcmp("ref_org_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::ref_org_dust; + size_mom_table = my_rates->SN0_r0reforg; + opac_coef_table = my_rates->SN0_kpreforg; + } else if (std::strcmp("vol_org_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::vol_org_dust; + size_mom_table = my_rates->SN0_r0volorg; + opac_coef_table = my_rates->SN0_kpvolorg; + } else if (std::strcmp("H2O_ice_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; + size_mom_table = my_rates->SN0_r0H2Oice; + opac_coef_table = my_rates->SN0_kpH2Oice; + } else { + return GrPrintAndReturnErr( + "`%s` not a known grain species", yield_info.name); + } + + // copy the nonprimordial yield fraction + inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] + = yield_info.nonprimoridal_yield_frac; + + /* + // copy the 1st, 2nd, and 3rd moments of the size distribution + // (the 0th moment isn't recorded anywhere + for (int i = 0; i < 3; i++) { + size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; + } + + // copy over the opacity coefficients table + { + int n_Td = N_Tdust_Opacity_Table; + int n_coef = N_Opacity_Coef; + + for (int i_Td = 0; i_Td < n_Td; i_Td++) { + for (int i_coef = 0; i_coef < n_coef; i_coef++) { + int i = (pathway_idx * n_Td * n_coef) + (i_Td * n_coef) + i_coef; + opac_coef_table[i] = yield_info.opacity_coef_table[i_Td][i_coef]; + } + } + } + */ + } + + return GR_SUCCESS; +} + int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) { From 2a56c85415fd3d3a3a10fbd6167119836192852f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 13:22:54 -0500 Subject: [PATCH 023/111] light refactoring --- src/clib/initialize_dust_yields.cpp | 40 +++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 6e10a0cf3..9efe2bef6 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -11,7 +11,8 @@ //===----------------------------------------------------------------------===// #include -#include +#include +#include #include #include #include "grackle_macros.h" @@ -21,10 +22,22 @@ #include "opaque_storage.hpp" #include "status_reporting.h" // GrPrintAndReturnErr -static constexpr int N_Tdust_Opacity_Table = 35; +/// datastructures declared in this namespace are a temporarily introduced for +/// encoding the injection model data, until we shift to using HDF5 +/// +/// @note +/// At this point, the main barrier to adopting HDF5 is that I would like to +/// first remove all usage of MetalNuclideYieldProps::total_yield (so that we +/// don't need to encode it in the HDF5 file). +namespace grackle::impl::inj_model_input { + +/// the number of opacity-related coefficients that are grouped together +/// in the opacity table static constexpr int N_Opacity_Coef = 4; -namespace { // stuff inside an anonymous namespace is local to this file +/// the number of Tdust values in an opacity table for a given grain species +/// and injection pathway. For each Tdust, there are N_Opacity_Coef coefficients +static constexpr int N_Tdust_Opacity_Table = 35; struct MetalNuclideYieldProps; struct GrainSpeciesYieldProps; @@ -60,12 +73,13 @@ struct MetalNuclideYieldProps { /// name of the nuclide const char* name; - /// total fraction of non-primordial injection corresponding to the nuclide - double total_yield; - /// fraction of non-primordial injection corresponding to the nuclide in /// the gas phase double gas_yield; + + /// total fraction of non-primordial injection corresponding to the nuclide + /// - I'm pretty sure we can get rid of this information in the future + double total_yield; }; /// Each injection array will hold an array of these structs @@ -92,6 +106,10 @@ struct GrainSpeciesYieldProps { double opacity_coef_table[N_Tdust_Opacity_Table][N_Opacity_Coef]; }; +} // namespace grackle::impl::inj_model_input + +namespace { // stuff inside an anonymous namespace is local to this file + // forward declare some functions int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); @@ -239,7 +257,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // - δr(t) refers to the derived "size increment" (it is a central // quantity in the model) // - I **think** the resulting quantity is the optical cross-section - double NTd = N_Tdust_Opacity_Table; // todo: remove me! + double NTd = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; double Td0 = 0.0000000; // todo: remove me! double dTd = 0.1000000; // todo: remove me! @@ -374,8 +392,9 @@ namespace { // stuff inside an anonymous namespace is local to this file int setup_yield_table_helper( int pathway_idx, chemistry_data_storage *my_rates, - const InjectionPathwayInputData *input) + const grackle::impl::inj_model_input::InjectionPathwayInputData *input) { + namespace inj_input = ::grackle::impl::inj_model_input; grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; @@ -385,7 +404,8 @@ int setup_yield_table_helper( // some sense to be semi-consistent with the handling of the dust species // yields for (int i = 0; i < input->n_metal_nuclide_yields; i++) { - const MetalNuclideYieldProps& yield_info = input->metal_nuclide_yields[i]; + const inj_input::MetalNuclideYieldProps& yield_info = + input->metal_nuclide_yields[i]; double* total_yield = nullptr; double* gas_yield = nullptr; @@ -424,7 +444,7 @@ int setup_yield_table_helper( // record each grain species yield for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; yield_idx++) { - const GrainSpeciesYieldProps& yield_info = + const inj_input::GrainSpeciesYieldProps& yield_info = input->initial_grain_props[yield_idx]; int grain_species_idx = -1; From 74ded6e5be695bae89e30fd976e3f7750f6fbb33 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 16:11:00 -0500 Subject: [PATCH 024/111] shift around some files --- src/clib/CMakeLists.txt | 2 +- src/clib/fortran_func_wrappers.hpp | 2 +- src/clib/initialize_chemistry_data.cpp | 2 +- src/clib/inject_model/README.md | 6 ++++++ src/clib/{ => inject_model}/grain_metal_inject_pathways.hpp | 2 -- src/clib/opaque_storage.hpp | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 src/clib/inject_model/README.md rename src/clib/{ => inject_model}/grain_metal_inject_pathways.hpp (98%) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 52557be3f..6de54f165 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -113,11 +113,11 @@ add_library(Grackle_Grackle cool_multi_time_g.cpp cool_multi_time_g.h dust_props.hpp dust/grain_species_info.cpp dust/grain_species_info.hpp - grain_metal_inject_pathways.hpp init_misc_species_cool_rates.cpp init_misc_species_cool_rates.hpp initialize_chemistry_data.cpp initialize_dust_yields.cpp initialize_dust_yields.hpp initialize_rates.cpp initialize_rates.hpp + inject_model/grain_metal_inject_pathways.hpp internal_types.cpp internal_types.hpp interp_table_utils.hpp lookup_cool_rates1d.hpp diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index cd561e8f5..d6d893edc 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -25,8 +25,8 @@ #include "grackle.h" #include "dust_props.hpp" #include "fortran_func_decls.h" -#include "grain_metal_inject_pathways.hpp" #include "index_helper.h" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" #include "internal_units.h" #include "LUT.hpp" diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 273b317c1..462d5d59a 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -19,7 +19,7 @@ #include "grackle.h" #include "grackle_macros.h" #include "auto_general.h" -#include "grain_metal_inject_pathways.hpp" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "interp_table_utils.hpp" #include "init_misc_species_cool_rates.hpp" // free_misc_species_cool_rates #include "initialize_cloudy_data.h" diff --git a/src/clib/inject_model/README.md b/src/clib/inject_model/README.md new file mode 100644 index 000000000..b257bbe5e --- /dev/null +++ b/src/clib/inject_model/README.md @@ -0,0 +1,6 @@ +This subdirectory defines data structures (and routines for initializing the data structures) that pertain to the injection models. + +At the time of writing, the injection model is used by any Grackle configuration using metal chemistry. + +After we address GH Issue #446, the injection model will **ONLY** be used with the multigrain species dust model. At that point, we should move the contents of this directory into the dust subdirectory. + diff --git a/src/clib/grain_metal_inject_pathways.hpp b/src/clib/inject_model/grain_metal_inject_pathways.hpp similarity index 98% rename from src/clib/grain_metal_inject_pathways.hpp rename to src/clib/inject_model/grain_metal_inject_pathways.hpp index e0c8e0c00..1fb39e9e5 100644 --- a/src/clib/grain_metal_inject_pathways.hpp +++ b/src/clib/inject_model/grain_metal_inject_pathways.hpp @@ -12,8 +12,6 @@ #ifndef GRAIN_METAL_INJECT_PATHWAYS_HPP #define GRAIN_METAL_INJECT_PATHWAYS_HPP -// after dealing with GH Issue #446, move this file into the dust subdirectory - #include "LUT.hpp" #include "internal_types.hpp" #include "visitor/common.hpp" diff --git a/src/clib/opaque_storage.hpp b/src/clib/opaque_storage.hpp index c30030b21..585620817 100644 --- a/src/clib/opaque_storage.hpp +++ b/src/clib/opaque_storage.hpp @@ -15,7 +15,7 @@ #include "grackle.h" #include "dust/grain_species_info.hpp" -#include "grain_metal_inject_pathways.hpp" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" /// a struct that used to wrap some private storage details From ffe87a5bc5ed1774fc4f6c8b6f3eb5402cb2e481 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 16:22:01 -0500 Subject: [PATCH 025/111] move some machinery out of initialize_dust_yields.cpp --- src/clib/CMakeLists.txt | 1 + src/clib/initialize_dust_yields.cpp | 87 +---------------------- src/clib/inject_model/raw_data.hpp | 103 ++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 86 deletions(-) create mode 100644 src/clib/inject_model/raw_data.hpp diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 6de54f165..3a1ee38c8 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -118,6 +118,7 @@ add_library(Grackle_Grackle initialize_dust_yields.cpp initialize_dust_yields.hpp initialize_rates.cpp initialize_rates.hpp inject_model/grain_metal_inject_pathways.hpp + inject_model/raw_data.hpp internal_types.cpp internal_types.hpp interp_table_utils.hpp lookup_cool_rates1d.hpp diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 9efe2bef6..34620d3fc 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -18,96 +18,11 @@ #include "grackle_macros.h" #include "grackle_chemistry_data.h" #include "initialize_dust_yields.hpp" // forward declarations +#include "inject_model/raw_data.hpp" #include "LUT.hpp" #include "opaque_storage.hpp" #include "status_reporting.h" // GrPrintAndReturnErr -/// datastructures declared in this namespace are a temporarily introduced for -/// encoding the injection model data, until we shift to using HDF5 -/// -/// @note -/// At this point, the main barrier to adopting HDF5 is that I would like to -/// first remove all usage of MetalNuclideYieldProps::total_yield (so that we -/// don't need to encode it in the HDF5 file). -namespace grackle::impl::inj_model_input { - -/// the number of opacity-related coefficients that are grouped together -/// in the opacity table -static constexpr int N_Opacity_Coef = 4; - -/// the number of Tdust values in an opacity table for a given grain species -/// and injection pathway. For each Tdust, there are N_Opacity_Coef coefficients -static constexpr int N_Tdust_Opacity_Table = 35; - -struct MetalNuclideYieldProps; -struct GrainSpeciesYieldProps; - -/// This is used to organize the storage of the injection pathway data -/// -/// Essentially, this dictates how the data is organized on disk (as part of -/// the Grackle library). This data will be somewhat reordered to actually -/// perform calculations -/// -/// There are a few reasons why it makes some sense to store this data in a -/// a slightly different format than the way is organized during the core -/// calculations: -/// - the way we organize it here (which has some similarities to a struct of -/// arrays) is a lot less error-prone. -/// - the way we organize it here allows us to use a more sparse representation -/// (i.e. we omit yields from pathways when the yields are 0) -/// -/// @note -/// The plan is to eventually shift the data into a file loaded at runtime -struct InjectionPathwayInputData { - const char* name; - - const MetalNuclideYieldProps* metal_nuclide_yields; - int n_metal_nuclide_yields; - - const GrainSpeciesYieldProps* initial_grain_props; - int n_injected_grain_species; -}; - - -struct MetalNuclideYieldProps { - /// name of the nuclide - const char* name; - - /// fraction of non-primordial injection corresponding to the nuclide in - /// the gas phase - double gas_yield; - - /// total fraction of non-primordial injection corresponding to the nuclide - /// - I'm pretty sure we can get rid of this information in the future - double total_yield; -}; - -/// Each injection array will hold an array of these structs -struct GrainSpeciesYieldProps { - /// name of the Grain Species - const char* name; - - /// Initial yield - double nonprimoridal_yield_frac; - - /// the 1st, 2nd, and 3rd order moments of the initial size distribution for - /// the grain species. - /// - /// - Element 0 specifies \f$\langle r^1 \rangle_j\f$. This is the grain - /// species's average **INITIAL** radius. Has units of cm. - /// - Element 1 specifies \f$\langle r^2 \rangle_j\f$. The product of this - /// value and π gives the grain species's average **INITIAL** - /// cross-section. Has units of centimeters squared. - /// - Element 2 specifies \f$\langle r^3 \rangle_j\f$. The product of this - /// value and (4π/3) is the grain species's average **INITIAL** volume. - /// Has units of centimeters cubed. - double size_moments[3]; - - double opacity_coef_table[N_Tdust_Opacity_Table][N_Opacity_Coef]; -}; - -} // namespace grackle::impl::inj_model_input - namespace { // stuff inside an anonymous namespace is local to this file // forward declare some functions diff --git a/src/clib/inject_model/raw_data.hpp b/src/clib/inject_model/raw_data.hpp new file mode 100644 index 000000000..97f9e0c33 --- /dev/null +++ b/src/clib/inject_model/raw_data.hpp @@ -0,0 +1,103 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Declares some data structures used for organizing the raw input injection +/// model data, which is currently embedded as part of the Grackle library) and +/// declares a function for accessing this data. +/// +/// @note +/// It's worth emphasizing that all machinery declared in this file are only +/// introduced temporarily. The long-term plan is to drop all of the machinery +/// once we start encoding the data within HDF5 files. The main barrier to +/// adopting HDF5 for this purpose is that I would like to first remove all +/// usage of the data currently encoded in MetalNuclideYieldProps::total_yield +/// (so that we can avoid encoding it in the HDF5 file). +/// +//===----------------------------------------------------------------------===// + +#ifndef INJECT_MODEL_RAW_DATA_HPP +#define INJECT_MODEL_RAW_DATA_HPP +namespace grackle::impl::inj_model_input { + +/// the number of opacity-related coefficients that are grouped together +/// in the opacity table +static constexpr int N_Opacity_Coef = 4; + +/// the number of Tdust values in an opacity table for a given grain species +/// and injection pathway. For each Tdust, there are N_Opacity_Coef coefficients +static constexpr int N_Tdust_Opacity_Table = 35; + +struct MetalNuclideYieldProps; +struct GrainSpeciesYieldProps; + +/// This is used to organize the storage of the injection pathway data +/// +/// Essentially, this dictates how the data is organized on disk (as part of +/// the Grackle library). This data will be somewhat reordered to actually +/// perform calculations +/// +/// There are a few reasons why it makes some sense to store this data in a +/// a slightly different format than the way is organized during the core +/// calculations: +/// - the way we organize it here (which has some similarities to a struct of +/// arrays) is a lot less error-prone. +/// - the way we organize it here allows us to use a more sparse representation +/// (i.e. we omit yields from pathways when the yields are 0) +/// +/// @note +/// The plan is to eventually shift the data into a file loaded at runtime +struct InjectionPathwayInputData { + const char* name; + + const MetalNuclideYieldProps* metal_nuclide_yields; + int n_metal_nuclide_yields; + + const GrainSpeciesYieldProps* initial_grain_props; + int n_injected_grain_species; +}; + +struct MetalNuclideYieldProps { + /// name of the nuclide + const char* name; + + /// fraction of non-primordial injection corresponding to the nuclide in + /// the gas phase + double gas_yield; + + /// total fraction of non-primordial injection corresponding to the nuclide + /// - I'm pretty sure we can get rid of this information in the future + double total_yield; +}; + +/// Each injection array will hold an array of these structs +struct GrainSpeciesYieldProps { + /// name of the Grain Species + const char* name; + + /// Initial yield + double nonprimoridal_yield_frac; + + /// the 1st, 2nd, and 3rd order moments of the initial size distribution for + /// the grain species. + /// + /// - Element 0 specifies \f$\langle r^1 \rangle_j\f$. This is the grain + /// species's average **INITIAL** radius. Has units of cm. + /// - Element 1 specifies \f$\langle r^2 \rangle_j\f$. The product of this + /// value and π gives the grain species's average **INITIAL** + /// cross-section. Has units of centimeters squared. + /// - Element 2 specifies \f$\langle r^3 \rangle_j\f$. The product of this + /// value and (4π/3) is the grain species's average **INITIAL** volume. + /// Has units of centimeters cubed. + double size_moments[3]; + + double opacity_coef_table[N_Tdust_Opacity_Table][N_Opacity_Coef]; +}; + +} // namespace grackle::impl::inj_model_input + +#endif // INJECT_MODEL_RAW_DATA_HPP From be60a507f9923c666aa679fa19313abd651c17d9 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 17:44:19 -0500 Subject: [PATCH 026/111] incremental progress --- src/clib/initialize_dust_yields.cpp | 304 ++++++++++++++-------------- src/clib/inject_model/raw_data.hpp | 41 +++- 2 files changed, 188 insertions(+), 157 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 34620d3fc..fae89780c 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -43,6 +43,160 @@ int calc_rates_dust_Y19(int iSN, chemistry_data *my_chemistry, chemistry_data_st typedef int calc_yield_rate_fn(int, chemistry_data*, chemistry_data_storage*); + +namespace { // stuff inside an anonymous namespace is local to this file + +int setup_yield_table_helper( + int pathway_idx, + chemistry_data_storage *my_rates, + const grackle::impl::inj_model_input::InjectionPathwayInputData *input) +{ + namespace inj_input = ::grackle::impl::inj_model_input; + + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + // record each metal nuclide yield + // -> there is less value to using string keys in this case, but it makes + // some sense to be semi-consistent with the handling of the dust species + // yields + for (int i = 0; i < input->n_metal_nuclide_yields; i++) { + const inj_input::MetalNuclideYieldProps& yield_info = + input->metal_nuclide_yields[i]; + + double* total_yield = nullptr; + double* gas_yield = nullptr; + + // todo: refactor to use a map (I have a rough plan) + if (std::strcmp("C", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.C; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.C; + } else if (std::strcmp("O", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.O; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.O; + } else if (std::strcmp("Mg", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Mg; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Mg; + } else if (std::strcmp("Al", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Al; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Al; + } else if (std::strcmp("Si", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Si; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Si; + } else if (std::strcmp("S", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.S; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.S; + } else if (std::strcmp("Fe", yield_info.name) == 0) { + total_yield = inject_pathway_props->total_metal_nuclide_yields.Fe; + gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Fe; + } else { + return GrPrintAndReturnErr( + "`%s` not a known metal nuclide", yield_info.name); + } + + total_yield[pathway_idx] = yield_info.total_yield; + gas_yield[pathway_idx] = yield_info.gas_yield; + } + + // record each grain species yield + for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; + yield_idx++) { + const inj_input::GrainSpeciesYieldProps& yield_info = + input->initial_grain_props[yield_idx]; + + int grain_species_idx = -1; + double* size_mom_table = nullptr; + double* opac_coef_table = nullptr; + + // with a little refactoring, this will get a lot more concise + if (std::strcmp("MgSiO3_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; + size_mom_table = my_rates->SN0_r0MgSiO3; + opac_coef_table = my_rates->SN0_kpMgSiO3; + } else if (std::strcmp("AC_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::AC_dust; + size_mom_table = my_rates->SN0_r0AC; + opac_coef_table = my_rates->SN0_kpAC; + } else if (std::strcmp("SiM_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::SiM_dust; + size_mom_table = my_rates->SN0_r0SiM; + opac_coef_table = my_rates->SN0_kpSiM; + } else if (std::strcmp("FeM_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::FeM_dust; + size_mom_table = my_rates->SN0_r0FeM; + opac_coef_table = my_rates->SN0_kpFeM; + } else if (std::strcmp("Mg2SiO4_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; + size_mom_table = my_rates->SN0_r0Mg2SiO4; + opac_coef_table = my_rates->SN0_kpMg2SiO4; + } else if (std::strcmp("Fe3O4_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; + size_mom_table = my_rates->SN0_r0Fe3O4; + opac_coef_table = my_rates->SN0_kpFe3O4; + } else if (std::strcmp("SiO2_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::SiO2_dust; + size_mom_table = my_rates->SN0_r0SiO2D; + opac_coef_table = my_rates->SN0_kpSiO2D; + } else if (std::strcmp("MgO_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::MgO_dust; + size_mom_table = my_rates->SN0_r0MgO; + opac_coef_table = my_rates->SN0_kpMgO; + } else if (std::strcmp("FeS_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::FeS_dust; + size_mom_table = my_rates->SN0_r0FeS; + opac_coef_table = my_rates->SN0_kpFeS; + } else if (std::strcmp("Al2O3_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; + size_mom_table = my_rates->SN0_r0Al2O3; + opac_coef_table = my_rates->SN0_kpAl2O3; + } else if (std::strcmp("ref_org_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::ref_org_dust; + size_mom_table = my_rates->SN0_r0reforg; + opac_coef_table = my_rates->SN0_kpreforg; + } else if (std::strcmp("vol_org_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::vol_org_dust; + size_mom_table = my_rates->SN0_r0volorg; + opac_coef_table = my_rates->SN0_kpvolorg; + } else if (std::strcmp("H2O_ice_dust", yield_info.name) == 0) { + grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; + size_mom_table = my_rates->SN0_r0H2Oice; + opac_coef_table = my_rates->SN0_kpH2Oice; + } else { + return GrPrintAndReturnErr( + "`%s` not a known grain species", yield_info.name); + } + + // copy the nonprimordial yield fraction + inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] + = yield_info.nonprimoridal_yield_frac; + + /* + // copy the 1st, 2nd, and 3rd moments of the size distribution + // (the 0th moment isn't recorded anywhere + for (int i = 0; i < 3; i++) { + size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; + } + + // copy over the opacity coefficients table + { + int n_Td = N_Tdust_Opacity_Table; + int n_coef = N_Opacity_Coef; + + for (int i_Td = 0; i_Td < n_Td; i_Td++) { + for (int i_coef = 0; i_coef < n_coef; i_coef++) { + int i = (pathway_idx * n_Td * n_coef) + (i_Td * n_coef) + i_coef; + opac_coef_table[i] = yield_info.opacity_coef_table[i_Td][i_coef]; + } + } + } + */ + } + + return GR_SUCCESS; +} + +} // anonymous namespace + int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, chemistry_data_storage *my_rates, code_units *my_units) @@ -302,156 +456,8 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, return SUCCESS; } -namespace { // stuff inside an anonymous namespace is local to this file - -int setup_yield_table_helper( - int pathway_idx, - chemistry_data_storage *my_rates, - const grackle::impl::inj_model_input::InjectionPathwayInputData *input) -{ - namespace inj_input = ::grackle::impl::inj_model_input; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - // record each metal nuclide yield - // -> there is less value to using string keys in this case, but it makes - // some sense to be semi-consistent with the handling of the dust species - // yields - for (int i = 0; i < input->n_metal_nuclide_yields; i++) { - const inj_input::MetalNuclideYieldProps& yield_info = - input->metal_nuclide_yields[i]; - - double* total_yield = nullptr; - double* gas_yield = nullptr; - - // todo: refactor to use a map (I have a rough plan) - if (std::strcmp("C", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.C; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.C; - } else if (std::strcmp("O", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.O; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.O; - } else if (std::strcmp("Mg", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Mg; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Mg; - } else if (std::strcmp("Al", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Al; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Al; - } else if (std::strcmp("Si", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Si; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Si; - } else if (std::strcmp("S", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.S; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.S; - } else if (std::strcmp("Fe", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Fe; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Fe; - } else { - return GrPrintAndReturnErr( - "`%s` not a known metal nuclide", yield_info.name); - } - - total_yield[pathway_idx] = yield_info.total_yield; - gas_yield[pathway_idx] = yield_info.gas_yield; - } - - // record each grain species yield - for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; - yield_idx++) { - const inj_input::GrainSpeciesYieldProps& yield_info = - input->initial_grain_props[yield_idx]; - - int grain_species_idx = -1; - double* size_mom_table = nullptr; - double* opac_coef_table = nullptr; - - // with a little refactoring, this will get a lot more concise - if (std::strcmp("MgSiO3_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; - size_mom_table = my_rates->SN0_r0MgSiO3; - opac_coef_table = my_rates->SN0_kpMgSiO3; - } else if (std::strcmp("AC_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::AC_dust; - size_mom_table = my_rates->SN0_r0AC; - opac_coef_table = my_rates->SN0_kpAC; - } else if (std::strcmp("SiM_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::SiM_dust; - size_mom_table = my_rates->SN0_r0SiM; - opac_coef_table = my_rates->SN0_kpSiM; - } else if (std::strcmp("FeM_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::FeM_dust; - size_mom_table = my_rates->SN0_r0FeM; - opac_coef_table = my_rates->SN0_kpFeM; - } else if (std::strcmp("Mg2SiO4_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; - size_mom_table = my_rates->SN0_r0Mg2SiO4; - opac_coef_table = my_rates->SN0_kpMg2SiO4; - } else if (std::strcmp("Fe3O4_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; - size_mom_table = my_rates->SN0_r0Fe3O4; - opac_coef_table = my_rates->SN0_kpFe3O4; - } else if (std::strcmp("SiO2_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::SiO2_dust; - size_mom_table = my_rates->SN0_r0SiO2D; - opac_coef_table = my_rates->SN0_kpSiO2D; - } else if (std::strcmp("MgO_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::MgO_dust; - size_mom_table = my_rates->SN0_r0MgO; - opac_coef_table = my_rates->SN0_kpMgO; - } else if (std::strcmp("FeS_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::FeS_dust; - size_mom_table = my_rates->SN0_r0FeS; - opac_coef_table = my_rates->SN0_kpFeS; - } else if (std::strcmp("Al2O3_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; - size_mom_table = my_rates->SN0_r0Al2O3; - opac_coef_table = my_rates->SN0_kpAl2O3; - } else if (std::strcmp("ref_org_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::ref_org_dust; - size_mom_table = my_rates->SN0_r0reforg; - opac_coef_table = my_rates->SN0_kpreforg; - } else if (std::strcmp("vol_org_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::vol_org_dust; - size_mom_table = my_rates->SN0_r0volorg; - opac_coef_table = my_rates->SN0_kpvolorg; - } else if (std::strcmp("H2O_ice_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; - size_mom_table = my_rates->SN0_r0H2Oice; - opac_coef_table = my_rates->SN0_kpH2Oice; - } else { - return GrPrintAndReturnErr( - "`%s` not a known grain species", yield_info.name); - } - - // copy the nonprimordial yield fraction - inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] - = yield_info.nonprimoridal_yield_frac; - - /* - // copy the 1st, 2nd, and 3rd moments of the size distribution - // (the 0th moment isn't recorded anywhere - for (int i = 0; i < 3; i++) { - size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; - } - - // copy over the opacity coefficients table - { - int n_Td = N_Tdust_Opacity_Table; - int n_coef = N_Opacity_Coef; - for (int i_Td = 0; i_Td < n_Td; i_Td++) { - for (int i_coef = 0; i_coef < n_coef; i_coef++) { - int i = (pathway_idx * n_Td * n_coef) + (i_Td * n_coef) + i_coef; - opac_coef_table[i] = yield_info.opacity_coef_table[i_Td][i_coef]; - } - } - } - */ - } - - return GR_SUCCESS; -} +namespace { // stuff inside an anonymous namespace is local to this file int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) { diff --git a/src/clib/inject_model/raw_data.hpp b/src/clib/inject_model/raw_data.hpp index 97f9e0c33..aad12e52c 100644 --- a/src/clib/inject_model/raw_data.hpp +++ b/src/clib/inject_model/raw_data.hpp @@ -11,17 +11,21 @@ /// declares a function for accessing this data. /// /// @note -/// It's worth emphasizing that all machinery declared in this file are only -/// introduced temporarily. The long-term plan is to drop all of the machinery -/// once we start encoding the data within HDF5 files. The main barrier to -/// adopting HDF5 for this purpose is that I would like to first remove all -/// usage of the data currently encoded in MetalNuclideYieldProps::total_yield -/// (so that we can avoid encoding it in the HDF5 file). +/// It's worth emphasizing that all machinery declared in this file is only +/// intended to be temporary. The long-term plan is to drop all of the +/// machinery once we start encoding the data within HDF5 files. The main +/// barrier to adopting HDF5 for this purpose is that I would like to first +/// remove all usage of the data currently encoded in +/// MetalNuclideYieldProps::total_yield (so that we can avoid encoding it in +/// the HDF5 file). /// //===----------------------------------------------------------------------===// #ifndef INJECT_MODEL_RAW_DATA_HPP #define INJECT_MODEL_RAW_DATA_HPP + +#include "grackle.h" // GR_SUCCESS + namespace grackle::impl::inj_model_input { /// the number of opacity-related coefficients that are grouped together @@ -52,8 +56,6 @@ struct GrainSpeciesYieldProps; /// @note /// The plan is to eventually shift the data into a file loaded at runtime struct InjectionPathwayInputData { - const char* name; - const MetalNuclideYieldProps* metal_nuclide_yields; int n_metal_nuclide_yields; @@ -98,6 +100,29 @@ struct GrainSpeciesYieldProps { double opacity_coef_table[N_Tdust_Opacity_Table][N_Opacity_Coef]; }; +extern "C" { +/// protoype for callback function used with input_inject_model_iterate +typedef int (*inj_iterate_t)(const char* name, InjectionPathwayInputData* input, + void* op_data); +} + +/// iterates over injection model input data packs with user callback routine +/// +/// @param[in] op Callback function +/// @param[inout] op_data User-defined callback function context +/// +/// @returns GR_SUCCESS if all calls to @p op returns GR_SUCCESS. Any other +/// value denotes an error. +/// +/// If any call to @p op is not `GR_SUCCESS`, this function exits immediately +/// +/// @note +/// we choose to provide access to each injection model's raw input data via +/// callback routines since the equivalent HDF5 (when we eventually shift) will +/// also involve callbacks (i.e. via `H5Literate`). By initially writing the +/// code using callbacks, the transition to HDF5 should be easier. +int input_inject_model_iterate(inj_iterate_t op, void* op_data); + } // namespace grackle::impl::inj_model_input #endif // INJECT_MODEL_RAW_DATA_HPP From 08ecd6ba0ee95de1de553d5b66cf794dd9033a59 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 21:11:34 -0500 Subject: [PATCH 027/111] Major progress in restructuring format of injection pathway raw data We don't yet use the new format, but we are just about ready to start doing so --- src/clib/CMakeLists.txt | 2 +- src/clib/initialize_dust_yields.cpp | 67 +- src/clib/inject_model/raw_data.cpp | 3850 +++++++++++++++++++++++++++ src/clib/inject_model/raw_data.hpp | 3 +- 4 files changed, 3912 insertions(+), 10 deletions(-) create mode 100644 src/clib/inject_model/raw_data.cpp diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 3a1ee38c8..67f545d74 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -118,7 +118,7 @@ add_library(Grackle_Grackle initialize_dust_yields.cpp initialize_dust_yields.hpp initialize_rates.cpp initialize_rates.hpp inject_model/grain_metal_inject_pathways.hpp - inject_model/raw_data.hpp + inject_model/raw_data.cpp inject_model/raw_data.hpp internal_types.cpp internal_types.hpp interp_table_utils.hpp lookup_cool_rates1d.hpp diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index fae89780c..153934cbc 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -46,13 +46,56 @@ typedef int calc_yield_rate_fn(int, chemistry_data*, chemistry_data_storage*); namespace { // stuff inside an anonymous namespace is local to this file -int setup_yield_table_helper( - int pathway_idx, - chemistry_data_storage *my_rates, - const grackle::impl::inj_model_input::InjectionPathwayInputData *input) +int lookup_pathway_idx(const char* name) { + const char * known_names[12] = { + "local_ISM", "ccsn13", "ccsn20", "ccsn25", "ccsn30", "fsn13", + "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", + }; + + for (int i = 0; i < 12; i++){ + if (std::strcmp(known_names[i], name) == 0){ + return i; + } + } + return -1; +} + +/// the context object for setup_yield_table_callback +struct SetupCallbackCtx{ + chemistry_data_storage *my_rates; + int setup_counter; +}; + +/// a callback function that sets up the appropriate parts of +/// GrainMetalInjectPathways given data for a particular injection pathway +/// +/// @param[in] name Name of the current injection pathway +/// @param[in] input Holds the data for the current injection pathway. +/// @param[inout] ctx A pointer to a SetupCallbackCtx instance +/// +/// @note +/// This function has C linkage because that's the expectation of the function +/// receiving this callback +extern "C" int setup_yield_table_callback( + const char* name, + const grackle::impl::inj_model_input::InjectionPathwayInputData *input, + void* ctx) { namespace inj_input = ::grackle::impl::inj_model_input; + + int pathway_idx = lookup_pathway_idx(name); + + if (pathway_idx < 0) { + return GrPrintAndReturnErr( + "`%s` is an unexpected injection pathway name", name); + } + //printf("encounterd: `%s`, pathway_idx: %d\n", name, pathway_idx); + //fflush(stdout); + + chemistry_data_storage *my_rates = + static_cast(ctx)->my_rates; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; @@ -94,8 +137,8 @@ int setup_yield_table_helper( "`%s` not a known metal nuclide", yield_info.name); } - total_yield[pathway_idx] = yield_info.total_yield; - gas_yield[pathway_idx] = yield_info.gas_yield; + //total_yield[pathway_idx] = yield_info.total_yield; + //gas_yield[pathway_idx] = yield_info.gas_yield; } // record each grain species yield @@ -166,11 +209,11 @@ int setup_yield_table_helper( "`%s` not a known grain species", yield_info.name); } + /* // copy the nonprimordial yield fraction inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] = yield_info.nonprimoridal_yield_frac; - /* // copy the 1st, 2nd, and 3rd moments of the size distribution // (the 0th moment isn't recorded anywhere for (int i = 0; i < 3; i++) { @@ -392,8 +435,16 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int rv = fn_list[i](i, my_chemistry, my_rates); if (rv != SUCCESS) { return rv; } } + SetupCallbackCtx ctx = {my_rates, 0}; - return SUCCESS; + int ret = grackle::impl::inj_model_input::input_inject_model_iterate( + &setup_yield_table_callback, static_cast(&ctx)); + if (ret != GR_SUCCESS) { + GRIMPL_ERROR("THERE WAS AN ERROR"); + } + //return GR_FAIL; + + return GR_SUCCESS; } int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, diff --git a/src/clib/inject_model/raw_data.cpp b/src/clib/inject_model/raw_data.cpp new file mode 100644 index 000000000..2d5a7b72d --- /dev/null +++ b/src/clib/inject_model/raw_data.cpp @@ -0,0 +1,3850 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Implements some data structures used for organizing the raw input injection +/// model data, which is currently embedded as part of the Grackle library) and +/// a function for accessing this data. +/// +/// @note +/// It's worth mentioning that this file is intended to be temporary. For more +/// details, see the file-level docstring in the header-file associated with +/// this file. +/// +//===----------------------------------------------------------------------===// + +#include "raw_data.hpp" + +#define ARR_LEN(var_name, type) (sizeof(var_name) / sizeof(type)) +namespace grackle::impl::inj_model_input { +// declare/initialize static constant variables holding data for each known +// injection model (in namespaces named for each model) + +// clang-format off: disable reformatting of data tables + +namespace local_ISM { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 5.01317e-02, 1.79042e-01}, + {"O", 2.78491e-01, 5.11524e-01}, + {"Mg", 0.00000e+00, 3.46246e-02}, + {"Al", 3.07922e-03, 3.07922e-03}, + {"Si", 3.50813e-03, 3.76121e-02}, + {"S", 0.00000e+00, 2.21374e-02}, + {"Fe", 1.66568e-04, 6.77017e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 1.35403e-02, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {2.45237e-01, 1.46287e-07, 1.48927e-13, 1.14540e-18}, + {3.08964e-01, 1.84301e-07, 1.87627e-13, 1.44311e-18}, + {3.89192e-01, 2.32158e-07, 2.36348e-13, 1.81790e-18}, + {4.90193e-01, 2.92406e-07, 2.97684e-13, 2.28974e-18}, + {6.33568e-01, 3.77932e-07, 3.84757e-13, 2.95995e-18}, + {8.28859e-01, 4.94426e-07, 5.03359e-13, 3.87306e-18}, + {1.13002e+00, 6.74071e-07, 6.86261e-13, 5.28188e-18}, + {1.63064e+00, 9.72699e-07, 9.90315e-13, 7.62608e-18}, + {2.46680e+00, 1.47148e-06, 1.49820e-12, 1.15475e-17}, + {3.79604e+00, 2.26439e-06, 2.30565e-12, 1.77932e-17}, + {5.92492e+00, 3.53430e-06, 3.59906e-12, 2.78297e-17}, + {9.23920e+00, 5.51134e-06, 5.61323e-12, 4.35401e-17}, + {1.42293e+01, 8.48802e-06, 8.64701e-12, 6.73899e-17}, + {2.16427e+01, 1.29103e-05, 1.31570e-11, 1.03293e-16}, + {3.24523e+01, 1.93586e-05, 1.97391e-11, 1.56579e-16}, + {4.78595e+01, 2.85497e-05, 2.91302e-11, 2.33879e-16}, + {7.00593e+01, 4.17932e-05, 4.26757e-11, 3.46486e-16}, + {1.06051e+02, 6.32653e-05, 6.46560e-11, 5.28640e-16}, + {1.74267e+02, 1.03964e-04, 1.06329e-10, 8.68729e-16}, + {3.02053e+02, 1.80203e-04, 1.84359e-10, 1.49313e-15}, + {5.00593e+02, 2.98655e-04, 3.05537e-10, 2.44653e-15}, + {7.45698e+02, 4.44894e-04, 4.55158e-10, 3.61190e-15}, + {1.00149e+03, 5.97517e-04, 6.11446e-10, 4.82507e-15}, + {1.23701e+03, 7.38051e-04, 7.55475e-10, 5.93849e-15}, + {1.39749e+03, 8.33819e-04, 8.53626e-10, 6.68589e-15}, + {1.41344e+03, 8.43342e-04, 8.63374e-10, 6.74095e-15}, + {1.26599e+03, 7.55370e-04, 7.73283e-10, 6.02512e-15}, + {1.01032e+03, 6.02819e-04, 6.17127e-10, 4.80541e-15}, + {7.30148e+02, 4.35656e-04, 4.46054e-10, 3.47626e-15}, + {4.87070e+02, 2.90623e-04, 2.97653e-10, 2.32554e-15}, + {3.05625e+02, 1.82365e-04, 1.86919e-10, 1.46881e-15}, + {1.84266e+02, 1.09966e-04, 1.12993e-10, 9.02608e-16}, + {1.10340e+02, 6.58826e-05, 6.82482e-11, 5.72358e-16}, + {6.91207e+01, 4.13300e-05, 4.36913e-11, 4.08010e-16}, + {4.77899e+01, 2.86629e-05, 3.13943e-11, 3.40524e-16}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.36165e-01, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {5.12401e-02, 3.05654e-08, 3.11170e-14, 2.39327e-19}, + {9.10229e-02, 5.42964e-08, 5.52765e-14, 4.25193e-19}, + {1.41106e-01, 8.41719e-08, 8.56916e-14, 6.59185e-19}, + {2.04158e-01, 1.21783e-07, 1.23982e-13, 9.53762e-19}, + {3.33897e-01, 1.99174e-07, 2.02773e-13, 1.56024e-18}, + {5.10947e-01, 3.04787e-07, 3.10298e-13, 2.38807e-18}, + {7.83563e-01, 4.67406e-07, 4.75863e-13, 3.66337e-18}, + {1.19854e+00, 7.14943e-07, 7.27902e-13, 5.60698e-18}, + {1.85772e+00, 1.10816e-06, 1.12831e-12, 8.70099e-18}, + {2.92247e+00, 1.74330e-06, 1.77515e-12, 1.37124e-17}, + {4.74091e+00, 2.82803e-06, 2.88010e-12, 2.23096e-17}, + {7.79816e+00, 4.65174e-06, 4.73847e-12, 3.68720e-17}, + {1.27207e+01, 7.58818e-06, 7.73243e-12, 6.06033e-17}, + {2.05556e+01, 1.22619e-05, 1.25020e-11, 9.90816e-17}, + {3.30490e+01, 1.97147e-05, 2.01153e-11, 1.61650e-16}, + {5.32277e+01, 3.17524e-05, 3.24225e-11, 2.63830e-16}, + {8.64944e+01, 5.15982e-05, 5.27236e-11, 4.32162e-16}, + {1.43144e+02, 8.53944e-05, 8.73076e-11, 7.16006e-16}, + {2.41992e+02, 1.44367e-04, 1.47663e-10, 1.20379e-15}, + {4.08980e+02, 2.43996e-04, 2.49602e-10, 2.01287e-15}, + {6.57282e+02, 3.92138e-04, 4.01100e-10, 3.19447e-15}, + {9.65951e+02, 5.76298e-04, 5.89371e-10, 4.64306e-15}, + {1.30489e+03, 7.78527e-04, 7.96032e-10, 6.21292e-15}, + {1.65692e+03, 9.88559e-04, 1.01028e-09, 7.80402e-15}, + {1.95936e+03, 1.16899e-03, 1.19360e-09, 9.11030e-15}, + {2.08639e+03, 1.24475e-03, 1.26965e-09, 9.58003e-15}, + {1.95845e+03, 1.16840e-03, 1.19068e-09, 8.90255e-15}, + {1.62353e+03, 9.68572e-04, 9.86379e-10, 7.32855e-15}, + {1.20759e+03, 7.20421e-04, 7.33336e-10, 5.42763e-15}, + {8.22295e+02, 4.90559e-04, 4.99228e-10, 3.68795e-15}, + {5.22496e+02, 3.11708e-04, 3.17198e-10, 2.34267e-15}, + {3.14915e+02, 1.87872e-04, 1.91211e-10, 1.41447e-15}, + {1.82496e+02, 1.08876e-04, 1.10875e-10, 8.23864e-16}, + {1.02901e+02, 6.13959e-05, 6.26109e-11, 4.69856e-16}, + {5.73186e+01, 3.42174e-05, 3.50508e-11, 2.68356e-16}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 3.84003e-02, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {1.20726e-01, 7.20182e-08, 7.35280e-14, 5.95267e-19}, + {2.32766e-01, 1.38854e-07, 1.41735e-13, 1.14369e-18}, + {3.73816e-01, 2.22995e-07, 2.27602e-13, 1.83408e-18}, + {5.51388e-01, 3.28923e-07, 3.35702e-13, 2.70320e-18}, + {8.55868e-01, 5.10557e-07, 5.21179e-13, 4.21168e-18}, + {1.24954e+00, 7.45400e-07, 7.61051e-13, 6.17189e-18}, + {1.78078e+00, 1.06231e-06, 1.08497e-12, 8.85200e-18}, + {2.44607e+00, 1.45920e-06, 1.49119e-12, 1.23029e-17}, + {3.21763e+00, 1.91949e-06, 1.96357e-12, 1.65254e-17}, + {4.06334e+00, 2.42404e-06, 2.48333e-12, 2.14914e-17}, + {4.90080e+00, 2.92371e-06, 3.00112e-12, 2.69365e-17}, + {5.64261e+00, 3.36638e-06, 3.46359e-12, 3.23217e-17}, + {6.21740e+00, 3.70948e-06, 3.82669e-12, 3.70749e-17}, + {6.56246e+00, 3.91565e-06, 4.05361e-12, 4.08425e-17}, + {6.75396e+00, 4.03063e-06, 4.20072e-12, 4.47151e-17}, + {7.17709e+00, 4.28498e-06, 4.53461e-12, 5.31551e-17}, + {8.60795e+00, 5.14313e-06, 5.58433e-12, 7.44632e-17}, + {1.17764e+01, 7.04212e-06, 7.86423e-12, 1.17214e-16}, + {1.64787e+01, 9.86444e-06, 1.14471e-11, 1.95038e-16}, + {2.14143e+01, 1.28476e-05, 1.62848e-11, 3.61550e-16}, + {2.51760e+01, 1.51720e-05, 2.28477e-11, 7.25431e-16}, + {2.71833e+01, 1.64950e-05, 3.14267e-11, 1.35273e-15}, + {2.77234e+01, 1.69657e-05, 4.09753e-11, 2.14916e-15}, + {2.74221e+01, 1.69259e-05, 4.94400e-11, 2.89997e-15}, + {2.68227e+01, 1.66816e-05, 5.53227e-11, 3.43309e-15}, + {2.62247e+01, 1.64266e-05, 5.86985e-11, 3.72279e-15}, + {2.58704e+01, 1.64543e-05, 6.22578e-11, 3.90038e-15}, + {2.71342e+01, 1.84130e-05, 7.74409e-11, 4.33089e-15}, + {3.69065e+01, 2.84578e-05, 1.28908e-10, 5.42457e-15}, + {7.78838e+01, 6.43091e-05, 2.58063e-10, 7.39401e-15}, + {1.96086e+02, 1.59699e-04, 5.23332e-10, 1.03910e-14}, + {4.47749e+02, 3.52292e-04, 9.69286e-10, 1.44002e-14}, + {8.75250e+02, 6.66973e-04, 1.60576e-09, 1.92445e-14}, + {1.50099e+03, 1.11385e-03, 2.41814e-09, 2.47015e-14}, + {2.33693e+03, 1.69566e-03, 3.38124e-09, 3.05222e-14}, + } + }, + { + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 3.04389e-02, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {4.68555e-02, 2.79499e-08, 2.84543e-14, 2.18837e-19}, + {6.66016e-02, 3.97287e-08, 4.04457e-14, 3.11065e-19}, + {9.14604e-02, 5.45574e-08, 5.55420e-14, 4.27173e-19}, + {1.22756e-01, 7.32255e-08, 7.45471e-14, 5.73344e-19}, + {2.39395e-01, 1.42802e-07, 1.45382e-13, 1.11857e-18}, + {4.33638e-01, 2.58671e-07, 2.63349e-13, 2.02683e-18}, + {8.54269e-01, 5.09583e-07, 5.18807e-13, 3.99441e-18}, + {1.71749e+00, 1.02450e-06, 1.04308e-12, 8.03545e-18}, + {3.29447e+00, 1.96520e-06, 2.00091e-12, 1.54275e-17}, + {5.86107e+00, 3.49621e-06, 3.55997e-12, 2.74796e-17}, + {9.98591e+00, 5.95675e-06, 6.06595e-12, 4.69112e-17}, + {1.64428e+01, 9.80839e-06, 9.98976e-12, 7.74960e-17}, + {2.63091e+01, 1.56939e-05, 1.59880e-11, 1.24634e-16}, + {4.13343e+01, 2.46568e-05, 2.51287e-11, 1.97408e-16}, + {6.41346e+01, 3.82579e-05, 3.90120e-11, 3.09791e-16}, + {9.87636e+01, 5.89156e-05, 6.01167e-11, 4.83037e-16}, + {1.51958e+02, 9.06488e-05, 9.25564e-11, 7.50644e-16}, + {2.34417e+02, 1.39841e-04, 1.42858e-10, 1.16365e-15}, + {3.57697e+02, 2.13387e-04, 2.18076e-10, 1.77561e-15}, + {5.28819e+02, 3.15479e-04, 3.22528e-10, 2.61825e-15}, + {7.52235e+02, 4.48774e-04, 4.59023e-10, 3.71332e-15}, + {1.02632e+03, 6.12308e-04, 6.26695e-10, 5.05587e-15}, + {1.32111e+03, 7.88218e-04, 8.07423e-10, 6.50989e-15}, + {1.57574e+03, 9.40185e-04, 9.64291e-10, 7.80218e-15}, + {1.73868e+03, 1.03748e-03, 1.06621e-09, 8.71453e-15}, + {1.80162e+03, 1.07516e-03, 1.10855e-09, 9.23861e-15}, + {1.79360e+03, 1.07058e-03, 1.10965e-09, 9.55041e-15}, + {1.76388e+03, 1.05316e-03, 1.10040e-09, 9.92949e-15}, + {1.76147e+03, 1.05218e-03, 1.11104e-09, 1.06225e-14}, + {1.80062e+03, 1.07614e-03, 1.14939e-09, 1.16303e-14}, + {1.85114e+03, 1.10702e-03, 1.19518e-09, 1.26854e-14}, + {1.87614e+03, 1.12283e-03, 1.22470e-09, 1.35171e-14}, + {1.86911e+03, 1.11985e-03, 1.23456e-09, 1.40796e-14}, + {1.85783e+03, 1.11511e-03, 1.24487e-09, 1.45610e-14}, + {1.90737e+03, 1.14893e-03, 1.30468e-09, 1.53873e-14}, + } + }, + { + /* name = */ "ref_org_dust", + /* nonprimoridal_yield_frac = */ 1.86114e-01, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {7.02832e-02, 4.19249e-08, 4.26814e-14, 3.28255e-19}, + {9.99024e-02, 5.95931e-08, 6.06685e-14, 4.66597e-19}, + {1.37191e-01, 8.18361e-08, 8.33130e-14, 6.40759e-19}, + {1.84134e-01, 1.09838e-07, 1.11821e-13, 8.60016e-19}, + {3.59093e-01, 2.14204e-07, 2.18074e-13, 1.67786e-18}, + {6.50459e-01, 3.88007e-07, 3.95023e-13, 3.04025e-18}, + {1.28140e+00, 7.64376e-07, 7.78212e-13, 5.99162e-18}, + {2.57622e+00, 1.53675e-06, 1.56462e-12, 1.20532e-17}, + {4.94170e+00, 2.94779e-06, 3.00137e-12, 2.31413e-17}, + {8.79162e+00, 5.24433e-06, 5.33996e-12, 4.12194e-17}, + {1.49789e+01, 8.93514e-06, 9.09893e-12, 7.03669e-17}, + {2.46641e+01, 1.47126e-05, 1.49846e-11, 1.16244e-16}, + {3.94637e+01, 2.35409e-05, 2.39820e-11, 1.86951e-16}, + {6.20013e+01, 3.69851e-05, 3.76930e-11, 2.96113e-16}, + {9.62020e+01, 5.73870e-05, 5.85180e-11, 4.64688e-16}, + {1.48145e+02, 8.83735e-05, 9.01751e-11, 7.24557e-16}, + {2.27937e+02, 1.35973e-04, 1.38835e-10, 1.12597e-15}, + {3.51626e+02, 2.09762e-04, 2.14288e-10, 1.74548e-15}, + {5.36545e+02, 3.20081e-04, 3.27114e-10, 2.66341e-15}, + {7.93228e+02, 4.73218e-04, 4.83793e-10, 3.92738e-15}, + {1.12835e+03, 6.73161e-04, 6.88534e-10, 5.56999e-15}, + {1.53947e+03, 9.18463e-04, 9.40042e-10, 7.58380e-15}, + {1.98167e+03, 1.18233e-03, 1.21114e-09, 9.76484e-15}, + {2.36362e+03, 1.41028e-03, 1.44644e-09, 1.17033e-14}, + {2.60802e+03, 1.55622e-03, 1.59931e-09, 1.30718e-14}, + {2.70242e+03, 1.61274e-03, 1.66283e-09, 1.38579e-14}, + {2.69039e+03, 1.60586e-03, 1.66448e-09, 1.43256e-14}, + {2.64583e+03, 1.57974e-03, 1.65060e-09, 1.48942e-14}, + {2.64222e+03, 1.57827e-03, 1.66657e-09, 1.59338e-14}, + {2.70093e+03, 1.61421e-03, 1.72408e-09, 1.74454e-14}, + {2.77670e+03, 1.66053e-03, 1.79277e-09, 1.90281e-14}, + {2.81420e+03, 1.68424e-03, 1.83704e-09, 2.02756e-14}, + {2.80366e+03, 1.67977e-03, 1.85184e-09, 2.11194e-14}, + {2.78675e+03, 1.67267e-03, 1.86731e-09, 2.18416e-14}, + {2.86105e+03, 1.72339e-03, 1.95702e-09, 2.30809e-14}, + } + }, + { + /* name = */ "vol_org_dust", + /* nonprimoridal_yield_frac = */ 3.81956e-02, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {6.30862e-02, 3.76318e-08, 3.83108e-14, 2.94648e-19}, + {1.09691e-01, 6.54321e-08, 6.66131e-14, 5.12363e-19}, + {1.68363e-01, 1.00431e-07, 1.02243e-13, 7.86449e-19}, + {2.42226e-01, 1.44491e-07, 1.47099e-13, 1.13150e-18}, + {3.92991e-01, 2.34424e-07, 2.38657e-13, 1.83595e-18}, + {6.03026e-01, 3.59713e-07, 3.66210e-13, 2.81745e-18}, + {9.41509e-01, 5.61623e-07, 5.71771e-13, 4.39959e-18}, + {1.54206e+00, 9.19862e-07, 9.36500e-13, 7.20849e-18}, + {2.75198e+00, 1.64160e-06, 1.67135e-12, 1.28735e-17}, + {5.12965e+00, 3.05991e-06, 3.11550e-12, 2.40170e-17}, + {9.67703e+00, 5.77249e-06, 5.87767e-12, 4.53565e-17}, + {1.70842e+01, 1.01910e-05, 1.03775e-11, 8.02010e-17}, + {2.87858e+01, 1.71712e-05, 1.74882e-11, 1.35552e-16}, + {5.22985e+01, 3.11971e-05, 3.17818e-11, 2.47506e-16}, + {1.08421e+02, 6.46756e-05, 6.59042e-11, 5.15083e-16}, + {2.29694e+02, 1.37018e-04, 1.39634e-10, 1.09171e-15}, + {4.35888e+02, 2.60019e-04, 2.64976e-10, 2.06803e-15}, + {6.94501e+02, 4.14288e-04, 4.22159e-10, 3.28761e-15}, + {9.21763e+02, 5.49857e-04, 5.60297e-10, 4.35726e-15}, + {1.06208e+03, 6.33565e-04, 6.45702e-10, 5.02330e-15}, + {1.17460e+03, 7.00699e-04, 7.14492e-10, 5.57174e-15}, + {1.41297e+03, 8.42922e-04, 8.60130e-10, 6.71698e-15}, + {1.86068e+03, 1.11004e-03, 1.13311e-09, 8.82123e-15}, + {2.38031e+03, 1.42005e-03, 1.44954e-09, 1.12234e-14}, + {2.71131e+03, 1.61753e-03, 1.65107e-09, 1.27373e-14}, + {2.72120e+03, 1.62346e-03, 1.65757e-09, 1.27900e-14}, + {2.53189e+03, 1.51058e-03, 1.54284e-09, 1.19191e-14}, + {2.48249e+03, 1.48118e-03, 1.51103e-09, 1.15227e-14}, + {2.89111e+03, 1.72503e-03, 1.75260e-09, 1.28501e-14}, + {3.66301e+03, 2.18553e-03, 2.21015e-09, 1.55022e-14}, + {4.27842e+03, 2.55260e-03, 2.57302e-09, 1.74959e-14}, + {4.29745e+03, 2.56387e-03, 2.57944e-09, 1.72213e-14}, + {3.71668e+03, 2.21732e-03, 2.22839e-09, 1.47266e-14}, + {2.83563e+03, 1.69168e-03, 1.69914e-09, 1.11685e-14}, + {1.96048e+03, 1.16958e-03, 1.17438e-09, 7.69912e-15}, + } + }, + { + /* name = */ "H2O_ice_dust", + /* nonprimoridal_yield_frac = */ 6.33011e-02, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {3.03937e-04, 1.23816e-09, 4.62094e-14, 3.72497e-18}, + {5.33931e-04, 1.94666e-09, 6.42306e-14, 4.92267e-18}, + {8.23085e-04, 2.82715e-09, 8.64655e-14, 6.40508e-18}, + {1.18689e-03, 3.92926e-09, 1.14201e-13, 8.25547e-18}, + {1.93090e-03, 5.86828e-09, 1.50433e-13, 1.02764e-17}, + {2.95251e-03, 8.43657e-09, 1.95467e-13, 1.27089e-17}, + {4.55033e-03, 1.22013e-08, 2.52591e-13, 1.54880e-17}, + {7.04895e-03, 1.77533e-08, 3.26595e-13, 1.87358e-17}, + {1.09337e-02, 2.59554e-08, 4.24054e-13, 2.26060e-17}, + {1.67787e-02, 3.77909e-08, 5.51941e-13, 2.72576e-17}, + {2.56790e-02, 5.50228e-08, 7.20688e-13, 3.28090e-17}, + {3.89780e-02, 7.95600e-08, 9.39516e-13, 3.93285e-17}, + {5.82741e-02, 1.13372e-07, 1.21633e-12, 4.68721e-17}, + {8.58228e-02, 1.58873e-07, 1.55917e-12, 5.54857e-17}, + {1.24511e-01, 2.18724e-07, 1.97549e-12, 6.52470e-17}, + {1.78164e-01, 2.96038e-07, 2.47229e-12, 7.62244e-17}, + {2.51965e-01, 3.94501e-07, 3.05495e-12, 8.84292e-17}, + {3.53706e-01, 5.19228e-07, 3.72904e-12, 1.01872e-16}, + {4.96690e-01, 6.79268e-07, 4.51008e-12, 1.16807e-16}, + {7.06391e-01, 8.93298e-07, 5.44240e-12, 1.34078e-16}, + {1.03345e+00, 1.19958e-06, 6.62440e-12, 1.55520e-16}, + {1.58058e+00, 1.67481e-06, 8.24715e-12, 1.84604e-16}, + {2.55750e+00, 2.47088e-06, 1.06606e-11, 2.27517e-16}, + {4.39505e+00, 3.88891e-06, 1.44836e-11, 2.94492e-16}, + {7.97338e+00, 6.52370e-06, 2.07697e-11, 4.00081e-16}, + {1.50676e+01, 1.15419e-05, 3.12837e-11, 5.61771e-16}, + {2.91750e+01, 2.11959e-05, 4.90431e-11, 7.99872e-16}, + {5.69546e+01, 3.97177e-05, 7.93362e-11, 1.14279e-15}, + {1.10473e+02, 7.47151e-05, 1.31340e-10, 1.63629e-15}, + {2.10337e+02, 1.39130e-04, 2.20345e-10, 2.35251e-15}, + {3.89661e+02, 2.53753e-04, 3.70677e-10, 3.39830e-15}, + {6.99152e+02, 4.50456e-04, 6.19407e-10, 4.92457e-15}, + {1.21457e+03, 7.76739e-04, 1.02057e-09, 7.13090e-15}, + {2.05022e+03, 1.30302e-03, 1.64745e-09, 1.02322e-14}, + {3.38793e+03, 2.13731e-03, 2.59306e-09, 1.43690e-14}, + } + }, +}; + +} // namespace local_ISM + +namespace ccsn13 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 2.16731e-01, 2.65314e-01}, + {"O", 2.99231e-01, 3.00982e-01}, + {"Mg", 3.03586e-02, 3.06651e-02}, + {"Al", 2.47296e-04, 2.47296e-04}, + {"Si", 4.59041e-02, 6.38319e-02}, + {"S", 3.40903e-02, 3.40910e-02}, + {"Fe", 7.22586e-02, 9.62448e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "SiM_dust", + /* nonprimoridal_yield_frac = */ 1.65746e-02, + /* size_moments = */ {1.68557e-06, 9.75226e-12, 1.74046e-16}, + /* opacity_coef_table = */ { + {5.88921e-03, 6.87770e-08, 1.06227e-12, 2.02349e-17}, + {1.01153e-02, 1.15444e-07, 1.74157e-12, 3.24501e-17}, + {1.53919e-02, 1.73359e-07, 2.57952e-12, 4.74426e-17}, + {2.20096e-02, 2.45791e-07, 3.62468e-12, 6.61001e-17}, + {3.50047e-02, 3.82752e-07, 5.51942e-12, 9.85221e-17}, + {5.25286e-02, 5.65069e-07, 8.00632e-12, 1.40508e-16}, + {7.91090e-02, 8.36026e-07, 1.16179e-11, 2.00078e-16}, + {1.19191e-01, 1.23677e-06, 1.68430e-11, 2.84365e-16}, + {1.79251e-01, 1.82633e-06, 2.43704e-11, 4.03226e-16}, + {2.66584e-01, 2.66955e-06, 3.49349e-11, 5.66851e-16}, + {3.94058e-01, 3.87941e-06, 4.97989e-11, 7.92464e-16}, + {5.74681e-01, 5.56462e-06, 7.01108e-11, 1.09474e-15}, + {8.20409e-01, 7.81996e-06, 9.68130e-11, 1.48491e-15}, + {1.14378e+00, 1.07400e-05, 1.30804e-10, 1.97313e-15}, + {1.55566e+00, 1.44006e-05, 1.72756e-10, 2.56649e-15}, + {2.06561e+00, 1.88620e-05, 2.23158e-10, 3.26978e-15}, + {2.68069e+00, 2.41572e-05, 2.82187e-10, 4.08370e-15}, + {3.40683e+00, 3.03006e-05, 3.49792e-10, 5.00618e-15}, + {4.25797e+00, 3.73606e-05, 4.26499e-10, 6.04358e-15}, + {5.27551e+00, 4.56092e-05, 5.14976e-10, 7.23179e-15}, + {6.55438e+00, 5.57066e-05, 6.21908e-10, 8.66078e-15}, + {8.27812e+00, 6.89310e-05, 7.60263e-10, 1.05052e-14}, + {1.07753e+01, 8.75306e-05, 9.52770e-10, 1.30714e-14}, + {1.46156e+01, 1.15279e-04, 1.23703e-09, 1.68635e-14}, + {2.07765e+01, 1.58349e-04, 1.67242e-09, 2.26556e-14}, + {3.09403e+01, 2.26776e-04, 2.35074e-09, 3.15878e-14}, + {4.80249e+01, 3.37152e-04, 3.41710e-09, 4.53799e-14}, + {7.70965e+01, 5.17359e-04, 5.10858e-09, 6.67630e-14}, + {1.26831e+02, 8.14201e-04, 7.81618e-09, 1.00160e-13}, + {2.11638e+02, 1.30438e-03, 1.21704e-08, 1.52564e-13}, + {3.54644e+02, 2.11006e-03, 1.91598e-08, 2.34688e-13}, + {5.91556e+02, 3.41851e-03, 3.02724e-08, 3.62228e-13}, + {9.74370e+02, 5.49677e-03, 4.75739e-08, 5.56235e-13}, + {1.56930e+03, 8.65788e-03, 7.33192e-08, 8.38100e-13}, + {2.44406e+03, 1.31389e-02, 1.08763e-07, 1.21599e-12}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 2.39849e-02, + /* size_moments = */ {4.62542e-06, 3.82292e-11, 4.68445e-16}, + /* opacity_coef_table = */ { + {1.05240e-01, 1.91709e-07, 6.14415e-13, 3.80291e-18}, + {1.32588e-01, 2.41526e-07, 7.74078e-13, 4.79114e-18}, + {1.67016e-01, 3.04243e-07, 9.75080e-13, 6.03524e-18}, + {2.10360e-01, 3.83198e-07, 1.22813e-12, 7.60148e-18}, + {2.71887e-01, 4.95279e-07, 1.58734e-12, 9.82485e-18}, + {3.55694e-01, 6.47944e-07, 2.07663e-12, 1.28533e-17}, + {4.84932e-01, 8.83369e-07, 2.83116e-12, 1.75235e-17}, + {6.99767e-01, 1.27472e-06, 4.08543e-12, 2.52870e-17}, + {1.05860e+00, 1.92838e-06, 6.18042e-12, 3.82543e-17}, + {1.62902e+00, 2.96748e-06, 9.51075e-12, 5.88683e-17}, + {2.54260e+00, 4.63171e-06, 1.48447e-11, 9.18851e-17}, + {3.96490e+00, 7.22268e-06, 2.31492e-11, 1.43293e-16}, + {6.10635e+00, 1.11237e-05, 3.56530e-11, 2.20699e-16}, + {9.28776e+00, 1.69193e-05, 5.42303e-11, 3.35716e-16}, + {1.39267e+01, 2.53704e-05, 8.13220e-11, 5.03475e-16}, + {2.05388e+01, 3.74163e-05, 1.19943e-10, 7.42685e-16}, + {3.00662e+01, 5.47749e-05, 1.75612e-10, 1.08767e-15}, + {4.55134e+01, 8.29222e-05, 2.65919e-10, 1.64778e-15}, + {7.47928e+01, 1.36281e-04, 4.37190e-10, 2.71088e-15}, + {1.29641e+02, 2.36241e-04, 7.58090e-10, 4.70339e-15}, + {2.14861e+02, 3.91558e-04, 1.25676e-09, 7.80036e-15}, + {3.20074e+02, 5.83333e-04, 1.87266e-09, 1.16272e-14}, + {4.29885e+02, 7.83522e-04, 2.51590e-09, 1.56273e-14}, + {5.31008e+02, 9.67906e-04, 3.10866e-09, 1.93168e-14}, + {5.99926e+02, 1.09359e-03, 3.51289e-09, 2.18342e-14}, + {6.06790e+02, 1.10614e-03, 3.55349e-09, 2.20891e-14}, + {5.43501e+02, 9.90793e-04, 3.18304e-09, 1.97873e-14}, + {4.33743e+02, 7.90717e-04, 2.54035e-09, 1.57927e-14}, + {3.13466e+02, 5.71463e-04, 1.83604e-09, 1.14151e-14}, + {2.09115e+02, 3.81238e-04, 1.22500e-09, 7.61738e-15}, + {1.31224e+02, 2.39260e-04, 7.69004e-10, 4.78403e-15}, + {7.91470e+01, 1.44373e-04, 4.64502e-10, 2.89404e-15}, + {4.74663e+01, 8.67304e-05, 2.80053e-10, 1.75354e-15}, + {2.98668e+01, 5.48299e-05, 1.78713e-10, 1.13252e-15}, + {2.08636e+01, 3.86952e-05, 1.28439e-10, 8.30592e-16}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 8.69522e-04, + /* size_moments = */ {1.82163e-06, 5.83823e-12, 3.61356e-17}, + /* opacity_coef_table = */ { + {2.19890e-02, 1.59707e-08, 1.64886e-14, 3.46350e-20}, + {3.90612e-02, 2.83703e-08, 2.92903e-14, 6.15261e-20}, + {6.05539e-02, 4.39805e-08, 4.54068e-14, 9.53799e-20}, + {8.76116e-02, 6.36326e-08, 6.56961e-14, 1.37999e-19}, + {1.43288e-01, 1.04070e-07, 1.07445e-13, 2.25699e-19}, + {2.19266e-01, 1.59254e-07, 1.64418e-13, 3.45380e-19}, + {3.36256e-01, 2.44223e-07, 2.52144e-13, 5.29662e-19}, + {5.14336e-01, 3.73564e-07, 3.85679e-13, 8.10191e-19}, + {7.97216e-01, 5.79021e-07, 5.97800e-13, 1.25585e-18}, + {1.25414e+00, 9.10886e-07, 9.40430e-13, 1.97579e-18}, + {2.03450e+00, 1.47766e-06, 1.52560e-12, 3.20555e-18}, + {3.34648e+00, 2.43056e-06, 2.50942e-12, 5.27367e-18}, + {5.45894e+00, 3.96485e-06, 4.09354e-12, 8.60504e-18}, + {8.82118e+00, 6.40687e-06, 6.61493e-12, 1.39111e-17}, + {1.41825e+01, 1.03009e-05, 1.06356e-11, 2.23816e-17}, + {2.28420e+01, 1.65903e-05, 1.71302e-11, 3.60870e-17}, + {3.71180e+01, 2.69593e-05, 2.78383e-11, 5.87421e-17}, + {6.14285e+01, 4.46166e-05, 4.60756e-11, 9.74574e-17}, + {1.03848e+02, 7.54274e-05, 7.79023e-11, 1.65248e-16}, + {1.75510e+02, 1.27478e-04, 1.31675e-10, 2.80026e-16}, + {2.82066e+02, 2.04875e-04, 2.11635e-10, 4.50867e-16}, + {4.14529e+02, 3.01090e-04, 3.11041e-10, 6.63478e-16}, + {5.59986e+02, 4.06746e-04, 4.20208e-10, 8.97036e-16}, + {7.11059e+02, 5.16484e-04, 5.33582e-10, 1.13854e-15}, + {8.40851e+02, 6.10764e-04, 6.30953e-10, 1.34372e-15}, + {8.95368e+02, 6.50365e-04, 6.71811e-10, 1.42700e-15}, + {8.40461e+02, 6.10482e-04, 6.30563e-10, 1.33611e-15}, + {6.96732e+02, 5.06082e-04, 5.22696e-10, 1.10542e-15}, + {5.18234e+02, 3.76427e-04, 3.88766e-10, 8.21088e-16}, + {3.52885e+02, 2.56323e-04, 2.64719e-10, 5.58648e-16}, + {2.24228e+02, 1.62872e-04, 1.68207e-10, 3.54873e-16}, + {1.35145e+02, 9.81654e-05, 1.01382e-10, 2.13970e-16}, + {7.83182e+01, 5.68892e-05, 5.87587e-11, 1.24192e-16}, + {4.41610e+01, 3.20799e-05, 3.31421e-11, 7.03026e-17}, + {2.46026e+01, 1.78814e-05, 1.84973e-11, 3.95672e-17}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.87802e-06, + /* size_moments = */ {7.26303e-07, 7.49856e-13, 1.57511e-18}, + /* opacity_coef_table = */ { + {3.27960e-01, 1.58173e-06, 1.28346e-11, 1.68940e-16}, + {4.38754e-01, 2.11613e-06, 1.71717e-11, 2.26045e-16}, + {5.78236e-01, 2.78890e-06, 2.26319e-11, 2.97935e-16}, + {7.53833e-01, 3.63586e-06, 2.95057e-11, 3.88440e-16}, + {1.04018e+00, 5.01714e-06, 4.07179e-11, 5.36095e-16}, + {1.41744e+00, 6.83702e-06, 5.54910e-11, 7.30661e-16}, + {1.95305e+00, 9.42082e-06, 7.64677e-11, 1.00698e-15}, + {2.71551e+00, 1.30993e-05, 1.06337e-10, 1.40054e-15}, + {3.79716e+00, 1.83183e-05, 1.48729e-10, 1.95931e-15}, + {5.29823e+00, 2.55621e-05, 2.07584e-10, 2.73540e-15}, + {7.37977e+00, 3.56090e-05, 2.89250e-10, 3.81296e-15}, + {1.02196e+01, 4.93202e-05, 4.00773e-10, 5.28580e-15}, + {1.40471e+01, 6.78071e-05, 5.51275e-10, 7.27585e-15}, + {1.92118e+01, 9.27674e-05, 7.54736e-10, 9.97084e-15}, + {2.61798e+01, 1.26469e-04, 1.02994e-09, 1.36251e-14}, + {3.55647e+01, 1.71912e-04, 1.40197e-09, 1.85822e-14}, + {4.82256e+01, 2.33320e-04, 1.90655e-09, 2.53388e-14}, + {6.54391e+01, 3.17003e-04, 2.59771e-09, 3.46585e-14}, + {8.90003e+01, 4.31918e-04, 3.55359e-09, 4.76706e-14}, + {1.21150e+02, 5.89447e-04, 4.87725e-09, 6.59296e-14}, + {1.64482e+02, 8.03274e-04, 6.70152e-09, 9.15912e-14}, + {2.22238e+02, 1.09138e-03, 9.21653e-09, 1.27994e-13}, + {2.99304e+02, 1.48143e-03, 1.27247e-08, 1.80612e-13}, + {4.02975e+02, 2.01378e-03, 1.76517e-08, 2.56967e-13}, + {5.41945e+02, 2.73383e-03, 2.44284e-08, 3.63965e-13}, + {7.24087e+02, 3.67841e-03, 3.33149e-08, 5.04207e-13}, + {9.57733e+02, 4.88178e-03, 4.44353e-08, 6.76055e-13}, + {1.25789e+03, 6.40887e-03, 5.80974e-08, 8.78814e-13}, + {1.65268e+03, 8.39077e-03, 7.51368e-08, 1.11835e-12}, + {2.18798e+03, 1.10499e-02, 9.71231e-08, 1.40975e-12}, + {2.93400e+03, 1.47364e-02, 1.26617e-07, 1.77953e-12}, + {3.99924e+03, 2.00041e-02, 1.67709e-07, 2.27029e-12}, + {5.55224e+03, 2.77223e-02, 2.26777e-07, 2.94699e-12}, + {7.83754e+03, 3.91330e-02, 3.12657e-07, 3.89444e-12}, + {1.11477e+04, 5.56050e-02, 4.34205e-07, 5.18557e-12}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 4.85826e-02, + /* size_moments = */ {4.82296e-06, 3.91353e-11, 5.15140e-16}, + /* opacity_coef_table = */ { + {7.60358e-02, 1.01529e-07, 4.49989e-13, 4.04236e-18}, + {9.07205e-02, 1.21137e-07, 5.36902e-13, 4.82320e-18}, + {1.09207e-01, 1.45823e-07, 6.46320e-13, 5.80621e-18}, + {1.32481e-01, 1.76900e-07, 7.84068e-13, 7.04376e-18}, + {1.58907e-01, 2.12188e-07, 9.40480e-13, 8.44905e-18}, + {1.91565e-01, 2.55795e-07, 1.13377e-12, 1.01857e-17}, + {2.30490e-01, 3.07773e-07, 1.36416e-12, 1.22557e-17}, + {2.76795e-01, 3.69605e-07, 1.63824e-12, 1.47181e-17}, + {3.33074e-01, 4.44757e-07, 1.97136e-12, 1.77112e-17}, + {4.05326e-01, 5.41239e-07, 2.39905e-12, 2.15541e-17}, + {5.08162e-01, 6.78559e-07, 3.00776e-12, 2.70236e-17}, + {6.72474e-01, 8.97974e-07, 3.98043e-12, 3.57640e-17}, + {9.48554e-01, 1.26665e-06, 5.61486e-12, 5.04526e-17}, + {1.41789e+00, 1.89344e-06, 8.39396e-12, 7.54321e-17}, + {2.19504e+00, 2.93130e-06, 1.29962e-11, 1.16808e-16}, + {3.46727e+00, 4.63056e-06, 2.05341e-11, 1.84616e-16}, + {5.76879e+00, 7.70562e-06, 3.41883e-11, 3.07633e-16}, + {1.17206e+01, 1.56620e-05, 6.95719e-11, 6.27184e-16}, + {3.16503e+01, 4.23092e-05, 1.88132e-10, 1.69866e-15}, + {8.68466e+01, 1.16104e-04, 5.16371e-10, 4.66366e-15}, + {1.92342e+02, 2.57132e-04, 1.14345e-09, 1.03252e-14}, + {3.36302e+02, 4.49562e-04, 1.99868e-09, 1.80397e-14}, + {5.05933e+02, 6.76162e-04, 3.00294e-09, 2.70549e-14}, + {7.20757e+02, 9.62603e-04, 4.26374e-09, 3.82441e-14}, + {9.77487e+02, 1.30417e-03, 5.75586e-09, 5.13190e-14}, + {1.18647e+03, 1.58150e-03, 6.95698e-09, 6.16931e-14}, + {1.23844e+03, 1.64960e-03, 7.23901e-09, 6.39380e-14}, + {1.11176e+03, 1.48010e-03, 6.48454e-09, 5.71201e-14}, + {8.76276e+02, 1.16622e-03, 5.10394e-09, 4.48799e-14}, + {6.22103e+02, 8.27770e-04, 3.62020e-09, 3.17970e-14}, + {4.07211e+02, 5.41759e-04, 2.36830e-09, 2.07862e-14}, + {2.50522e+02, 3.33268e-04, 1.45648e-09, 1.27774e-14}, + {1.47042e+02, 1.95598e-04, 8.54671e-10, 7.49580e-15}, + {8.32958e+01, 1.10803e-04, 4.84133e-10, 4.24560e-15}, + {4.59515e+01, 6.11325e-05, 2.67142e-10, 2.34298e-15}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 2.52534e-03, + /* size_moments = */ {1.33530e-06, 5.91862e-12, 5.31739e-17}, + /* opacity_coef_table = */ { + {2.25390e-04, 3.58434e-10, 1.62608e-15, 1.09114e-20}, + {4.04968e-04, 6.44015e-10, 2.92166e-15, 1.96051e-20}, + {6.31043e-04, 1.00354e-09, 4.55270e-15, 3.05498e-20}, + {9.15654e-04, 1.45615e-09, 6.60605e-15, 4.43284e-20}, + {1.52197e-03, 2.42038e-09, 1.09804e-14, 7.36816e-20}, + {2.37407e-03, 3.77546e-09, 1.71280e-14, 1.14934e-19}, + {3.77208e-03, 5.99871e-09, 2.72141e-14, 1.82615e-19}, + {6.14347e-03, 9.76990e-09, 4.43228e-14, 2.97421e-19}, + {1.01907e-02, 1.62062e-08, 7.35223e-14, 4.93362e-19}, + {1.68896e-02, 2.68594e-08, 1.21853e-13, 8.17686e-19}, + {2.96122e-02, 4.70930e-08, 2.13650e-13, 1.43371e-18}, + {6.10599e-02, 9.71067e-08, 4.40563e-13, 2.95653e-18}, + {1.43395e-01, 2.28052e-07, 1.03468e-12, 6.94381e-18}, + {3.27370e-01, 5.20656e-07, 2.36231e-12, 1.58544e-17}, + {6.39417e-01, 1.01697e-06, 4.61437e-12, 3.09706e-17}, + {1.05137e+00, 1.67234e-06, 7.58927e-12, 5.09499e-17}, + {1.55802e+00, 2.48015e-06, 1.12675e-11, 7.57604e-17}, + {2.94085e+00, 4.69147e-06, 2.13703e-11, 1.44197e-16}, + {1.32769e+01, 2.11739e-05, 9.63657e-11, 6.49212e-16}, + {7.10101e+01, 1.13066e-04, 5.13371e-10, 3.44675e-15}, + {2.54818e+02, 4.05363e-04, 1.83807e-09, 1.23170e-14}, + {6.00377e+02, 9.54596e-04, 4.32539e-09, 2.89547e-14}, + {9.94365e+02, 1.58056e-03, 7.15868e-09, 4.78926e-14}, + {1.24259e+03, 1.97471e-03, 8.94139e-09, 5.97968e-14}, + {1.24573e+03, 1.97945e-03, 8.96134e-09, 5.99160e-14}, + {1.05442e+03, 1.67534e-03, 7.58381e-09, 5.06979e-14}, + {7.85160e+02, 1.24742e-03, 5.64619e-09, 3.77407e-14}, + {5.31062e+02, 8.43677e-04, 3.81852e-09, 2.55222e-14}, + {3.34296e+02, 5.31069e-04, 2.40355e-09, 1.60640e-14}, + {1.99427e+02, 3.16805e-04, 1.43378e-09, 9.58224e-15}, + {1.14271e+02, 1.81526e-04, 8.21530e-10, 5.49033e-15}, + {6.35097e+01, 1.00887e-04, 4.56573e-10, 3.05124e-15}, + {3.44902e+01, 5.47882e-05, 2.47947e-10, 1.65699e-15}, + {1.84022e+01, 2.92323e-05, 1.32292e-10, 8.84081e-16}, + {9.68612e+00, 1.53865e-05, 6.96321e-11, 4.65335e-16}, + } + }, + { + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.28672e-05, + /* size_moments = */ {1.59029e-06, 7.21459e-12, 4.84120e-17}, + /* opacity_coef_table = */ { + {5.18081e-02, 3.19144e-08, 2.36505e-14, 2.15886e-20}, + {9.98885e-02, 6.15325e-08, 4.55993e-14, 4.16239e-20}, + {1.60418e-01, 9.88194e-08, 7.32312e-14, 6.68467e-20}, + {2.36621e-01, 1.45761e-07, 1.08018e-13, 9.86004e-20}, + {3.67284e-01, 2.26251e-07, 1.67666e-13, 1.53048e-19}, + {5.36223e-01, 3.30320e-07, 2.44787e-13, 2.23446e-19}, + {7.64198e-01, 4.70755e-07, 3.48859e-13, 3.18445e-19}, + {1.04970e+00, 6.46627e-07, 4.79190e-13, 4.37414e-19}, + {1.38080e+00, 8.50591e-07, 6.30340e-13, 5.75387e-19}, + {1.74373e+00, 1.07416e-06, 7.96018e-13, 7.26623e-19}, + {2.10311e+00, 1.29554e-06, 9.60079e-13, 8.76383e-19}, + {2.42144e+00, 1.49164e-06, 1.10541e-12, 1.00905e-18}, + {2.66810e+00, 1.64360e-06, 1.21802e-12, 1.11185e-18}, + {2.81617e+00, 1.73481e-06, 1.28563e-12, 1.17358e-18}, + {2.89834e+00, 1.78545e-06, 1.32317e-12, 1.20789e-18}, + {3.07987e+00, 1.89732e-06, 1.40614e-12, 1.28370e-18}, + {3.69380e+00, 2.27562e-06, 1.68664e-12, 1.53995e-18}, + {5.05331e+00, 3.11331e-06, 2.30770e-12, 2.10726e-18}, + {7.07089e+00, 4.35648e-06, 3.22940e-12, 2.94918e-18}, + {9.18826e+00, 5.66121e-06, 4.19684e-12, 3.83303e-18}, + {1.08014e+01, 6.65544e-06, 4.93433e-12, 4.50719e-18}, + {1.16611e+01, 7.18584e-06, 5.32843e-12, 4.86833e-18}, + {1.18910e+01, 7.32863e-06, 5.43584e-12, 4.96854e-18}, + {1.17598e+01, 7.24978e-06, 5.38006e-12, 4.92122e-18}, + {1.15004e+01, 7.09317e-06, 5.26837e-12, 4.82521e-18}, + {1.12405e+01, 6.93914e-06, 5.16238e-12, 4.73954e-18}, + {1.10769e+01, 6.85905e-06, 5.13138e-12, 4.75017e-18}, + {1.15509e+01, 7.24181e-06, 5.54113e-12, 5.30090e-18}, + {1.54818e+01, 9.90289e-06, 7.85008e-12, 7.89232e-18}, + {3.23248e+01, 2.09189e-05, 1.69099e-11, 1.74499e-17}, + {8.13876e+01, 5.27406e-05, 4.27128e-11, 4.41701e-17}, + {1.86528e+02, 1.20594e-04, 9.72543e-11, 9.99819e-17}, + {3.66028e+02, 2.35977e-04, 1.89337e-10, 1.93263e-16}, + {6.29868e+02, 4.05043e-04, 3.23450e-10, 3.27929e-16}, + {9.83739e+02, 6.31245e-04, 5.01948e-10, 5.05703e-16}, + } + }, + { + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 2.09730e-06, + /* size_moments = */ {6.16010e-07, 4.56500e-13, 4.16699e-19}, + /* opacity_coef_table = */ { + {1.54619e-01, 2.60128e-07, 1.49475e-12, 2.65148e-17}, + {1.94656e-01, 3.27554e-07, 1.88361e-12, 3.34351e-17}, + {2.45059e-01, 4.12439e-07, 2.37316e-12, 4.21472e-17}, + {3.08513e-01, 5.19301e-07, 2.98947e-12, 5.31150e-17}, + {3.88404e-01, 6.53894e-07, 3.76675e-12, 6.69643e-17}, + {4.88982e-01, 8.23350e-07, 4.74559e-12, 8.44087e-17}, + {6.15605e-01, 1.03673e-06, 5.97899e-12, 1.06403e-16}, + {7.75006e-01, 1.30539e-06, 7.53301e-12, 1.34131e-16}, + {9.75366e-01, 1.64315e-06, 9.48791e-12, 1.69031e-16}, + {1.22493e+00, 2.06392e-06, 1.19246e-11, 2.12553e-16}, + {1.52116e+00, 2.56344e-06, 1.48192e-11, 2.64285e-16}, + {1.83681e+00, 3.09586e-06, 1.79072e-11, 3.19511e-16}, + {2.15662e+00, 3.63549e-06, 2.10413e-11, 3.75635e-16}, + {2.55502e+00, 4.30820e-06, 2.49580e-11, 4.45921e-16}, + {3.22790e+00, 5.44497e-06, 3.15890e-11, 5.65115e-16}, + {4.33126e+00, 7.30995e-06, 4.24882e-11, 7.61352e-16}, + {5.81498e+00, 9.82030e-06, 5.72103e-11, 1.02723e-15}, + {7.48294e+00, 1.26484e-05, 7.39233e-11, 1.33106e-15}, + {9.21324e+00, 1.55973e-05, 9.16644e-11, 1.65851e-15}, + {1.11943e+01, 1.90119e-05, 1.13021e-10, 2.06536e-15}, + {1.39990e+01, 2.39150e-05, 1.45136e-10, 2.69938e-15}, + {1.78867e+01, 3.08010e-05, 1.92146e-10, 3.65687e-15}, + {2.17798e+01, 3.79266e-05, 2.45744e-10, 4.82338e-15}, + {2.38104e+01, 4.23268e-05, 2.93339e-10, 6.06677e-15}, + {2.31200e+01, 4.26489e-05, 3.30423e-10, 7.40538e-15}, + {2.05061e+01, 3.98990e-05, 3.56330e-10, 8.76054e-15}, + {1.74011e+01, 3.59849e-05, 3.69684e-10, 9.86673e-15}, + {1.47227e+01, 3.22080e-05, 3.69774e-10, 1.04731e-14}, + {1.27456e+01, 2.91368e-05, 3.59951e-10, 1.05598e-14}, + {1.18944e+01, 2.82426e-05, 3.62521e-10, 1.07315e-14}, + {1.43878e+01, 3.74123e-05, 4.87177e-10, 1.37994e-14}, + {2.85377e+01, 9.23385e-05, 1.20077e-09, 3.00478e-14}, + {7.93256e+01, 3.11569e-04, 3.91124e-09, 8.56317e-14}, + {2.33021e+02, 9.78251e-04, 1.15601e-08, 2.28453e-13}, + {6.42052e+02, 2.55294e-03, 2.77058e-08, 5.06000e-13}, + } + }, +}; + +} // namespace ccsn13 + +namespace ccsn20 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 8.74563e-02, 1.00183e-01}, + {"O", 6.04383e-01, 6.06515e-01}, + {"Mg", 2.63753e-02, 2.75968e-02}, + {"Al", 1.87118e-04, 1.87118e-04}, + {"Si", 6.44592e-02, 1.00051e-01}, + {"S", 6.02018e-02, 6.02208e-02}, + {"Fe", 2.69505e-02, 3.07560e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "SiM_dust", + /* nonprimoridal_yield_frac = */ 3.44388e-02, + /* size_moments = */ {1.24861e-05, 2.86508e-10, 1.01028e-14}, + /* opacity_coef_table = */ { + {1.10506e-02, 1.69983e-07, 3.50089e-12, 9.16404e-17}, + {1.85837e-02, 2.76971e-07, 5.53036e-12, 1.40642e-16}, + {2.79449e-02, 4.08949e-07, 8.01809e-12, 2.00458e-16}, + {3.96605e-02, 5.73574e-07, 1.11125e-11, 2.74730e-16}, + {6.19392e-02, 8.69904e-07, 1.63567e-11, 3.93140e-16}, + {9.16817e-02, 1.25867e-06, 2.31128e-11, 5.43193e-16}, + {1.36080e-01, 1.82251e-06, 3.26005e-11, 7.47226e-16}, + {2.02056e-01, 2.63811e-06, 4.59129e-11, 1.02492e-15}, + {2.99593e-01, 3.81390e-06, 6.45602e-11, 1.40281e-15}, + {4.39758e-01, 5.46636e-06, 9.01024e-11, 1.90718e-15}, + {6.41903e-01, 7.79581e-06, 1.25163e-10, 2.58082e-15}, + {9.24985e-01, 1.09870e-05, 1.71974e-10, 3.45658e-15}, + {1.30585e+00, 1.51941e-05, 2.32250e-10, 4.55695e-15}, + {1.80164e+00, 2.05666e-05, 3.07564e-10, 5.90101e-15}, + {2.42648e+00, 2.72192e-05, 3.99035e-10, 7.50126e-15}, + {3.19207e+00, 3.52384e-05, 5.07449e-10, 9.36601e-15}, + {4.10565e+00, 4.46618e-05, 6.32978e-10, 1.14947e-14}, + {5.17172e+00, 5.54917e-05, 7.75385e-10, 1.38820e-14}, + {6.40478e+00, 6.78244e-05, 9.35760e-10, 1.65481e-14}, + {7.85614e+00, 8.21045e-05, 1.11980e-09, 1.95943e-14}, + {9.64785e+00, 9.94326e-05, 1.34166e-09, 2.32660e-14}, + {1.20159e+01, 1.21941e-04, 1.62875e-09, 2.80374e-14}, + {1.53778e+01, 1.53371e-04, 2.02922e-09, 3.47445e-14}, + {2.04423e+01, 1.99938e-04, 2.62238e-09, 4.47607e-14}, + {2.83887e+01, 2.71546e-04, 3.53030e-09, 6.01372e-14}, + {4.11773e+01, 3.83718e-04, 4.93303e-09, 8.37180e-14}, + {6.21107e+01, 5.61284e-04, 7.10254e-09, 1.19520e-13}, + {9.68132e+01, 8.45164e-04, 1.04719e-08, 1.73689e-13}, + {1.54804e+02, 1.30324e-03, 1.57446e-08, 2.55980e-13}, + {2.51780e+02, 2.04562e-03, 2.40381e-08, 3.81486e-13}, + {4.12838e+02, 3.24595e-03, 3.70714e-08, 5.72650e-13}, + {6.76592e+02, 5.16747e-03, 5.73792e-08, 8.61246e-13}, + {1.09863e+03, 8.17937e-03, 8.83910e-08, 1.28821e-12}, + {1.74646e+03, 1.26954e-02, 1.33666e-07, 1.89228e-12}, + {2.67882e+03, 1.89754e-02, 1.94753e-07, 2.68226e-12}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 3.77223e-03, + /* size_moments = */ {6.67024e-06, 7.50596e-11, 1.22752e-15}, + /* opacity_coef_table = */ { + {1.05240e-01, 1.48654e-07, 5.02591e-13, 3.24156e-18}, + {1.32588e-01, 1.87284e-07, 6.33194e-13, 4.08391e-18}, + {1.67016e-01, 2.35915e-07, 7.97614e-13, 5.14437e-18}, + {2.10360e-01, 2.97139e-07, 1.00461e-12, 6.47941e-18}, + {2.71887e-01, 3.84048e-07, 1.29844e-12, 8.37459e-18}, + {3.55694e-01, 5.02428e-07, 1.69868e-12, 1.09560e-17}, + {4.84932e-01, 6.84981e-07, 2.31589e-12, 1.49369e-17}, + {6.99767e-01, 9.88442e-07, 3.34188e-12, 2.15544e-17}, + {1.05860e+00, 1.49530e-06, 5.05559e-12, 3.26077e-17}, + {1.62902e+00, 2.30104e-06, 7.77981e-12, 5.01791e-17}, + {2.54260e+00, 3.59152e-06, 1.21430e-11, 7.83229e-17}, + {3.96490e+00, 5.60062e-06, 1.89363e-11, 1.22144e-16}, + {6.10634e+00, 8.62558e-06, 2.91646e-11, 1.88128e-16}, + {9.28774e+00, 1.31196e-05, 4.43615e-11, 2.86175e-16}, + {1.39267e+01, 1.96729e-05, 6.65240e-11, 4.29191e-16}, + {2.05387e+01, 2.90138e-05, 9.81191e-11, 6.33137e-16}, + {3.00660e+01, 4.24748e-05, 1.43665e-10, 9.27312e-16}, + {4.55128e+01, 6.43028e-05, 2.17560e-10, 1.40505e-15}, + {7.47912e+01, 1.05684e-04, 3.57721e-10, 2.31202e-15}, + {1.29637e+02, 1.83206e-04, 6.20346e-10, 4.01209e-15}, + {2.14853e+02, 3.03661e-04, 1.02847e-09, 6.65466e-15}, + {3.20060e+02, 4.52395e-04, 1.53258e-09, 9.92043e-15}, + {4.29862e+02, 6.07661e-04, 2.05913e-09, 1.33350e-14}, + {5.30972e+02, 7.50675e-04, 2.54443e-09, 1.64851e-14}, + {5.99878e+02, 8.48166e-04, 2.87540e-09, 1.86348e-14}, + {6.06737e+02, 8.57905e-04, 2.90867e-09, 1.88528e-14}, + {5.43451e+02, 7.68444e-04, 2.60547e-09, 1.68884e-14}, + {4.33701e+02, 6.13270e-04, 2.07941e-09, 1.34791e-14}, + {3.13436e+02, 4.43222e-04, 1.50292e-09, 9.74306e-15}, + {2.09092e+02, 2.95687e-04, 1.00276e-09, 6.50192e-15}, + {1.31208e+02, 1.85574e-04, 6.29536e-10, 4.08396e-15}, + {7.91293e+01, 1.11988e-04, 3.80343e-10, 2.47142e-15}, + {4.74361e+01, 6.72978e-05, 2.29477e-10, 1.49906e-15}, + {2.98121e+01, 4.25812e-05, 1.46690e-10, 9.70392e-16}, + {2.07674e+01, 3.01013e-05, 1.05718e-10, 7.13724e-16}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.90086e-03, + /* size_moments = */ {1.41253e-06, 4.77566e-12, 3.08016e-17}, + /* opacity_coef_table = */ { + {2.19890e-02, 2.22393e-08, 2.89570e-14, 6.37012e-20}, + {3.90612e-02, 3.95059e-08, 5.14391e-14, 1.13159e-19}, + {6.05539e-02, 6.12433e-08, 7.97425e-14, 1.75423e-19}, + {8.76116e-02, 8.86090e-08, 1.15374e-13, 2.53808e-19}, + {1.43288e-01, 1.44919e-07, 1.88693e-13, 4.15103e-19}, + {2.19266e-01, 2.21762e-07, 2.88749e-13, 6.35214e-19}, + {3.36256e-01, 3.40084e-07, 4.42810e-13, 9.74136e-19}, + {5.14336e-01, 5.20191e-07, 6.77322e-13, 1.49005e-18}, + {7.97217e-01, 8.06292e-07, 1.04985e-12, 2.30962e-18}, + {1.25414e+00, 1.26842e-06, 1.65157e-12, 3.63350e-18}, + {2.03450e+00, 2.05766e-06, 2.67923e-12, 5.89467e-18}, + {3.34648e+00, 3.38458e-06, 4.40703e-12, 9.69677e-18}, + {5.45894e+00, 5.52111e-06, 7.18906e-12, 1.58199e-17}, + {8.82120e+00, 8.92167e-06, 1.16172e-11, 2.55686e-17}, + {1.41826e+01, 1.43441e-05, 1.86785e-11, 4.11217e-17}, + {2.28421e+01, 2.31025e-05, 3.00847e-11, 6.62628e-17}, + {3.71183e+01, 3.75417e-05, 4.88915e-11, 1.07761e-16}, + {6.14292e+01, 6.21307e-05, 8.09232e-11, 1.78540e-16}, + {1.03850e+02, 1.05037e-04, 1.36825e-10, 3.02237e-16}, + {1.75513e+02, 1.77524e-04, 2.31276e-10, 5.11420e-16}, + {2.82073e+02, 2.85307e-04, 3.71726e-10, 8.22603e-16}, + {4.14541e+02, 4.19298e-04, 5.46336e-10, 1.20964e-15}, + {5.60007e+02, 5.66440e-04, 7.38095e-10, 1.63478e-15}, + {7.11090e+02, 7.19267e-04, 9.37240e-10, 2.07555e-15}, + {8.40892e+02, 8.50566e-04, 1.10826e-09, 2.45241e-15}, + {8.95414e+02, 9.05715e-04, 1.18001e-09, 2.60842e-15}, + {8.40504e+02, 8.50170e-04, 1.10753e-09, 2.44576e-15}, + {6.96768e+02, 7.04778e-04, 9.18057e-10, 2.02574e-15}, + {5.18260e+02, 5.24216e-04, 6.82816e-10, 1.50584e-15}, + {3.52903e+02, 3.56958e-04, 4.64940e-10, 1.02501e-15}, + {2.24241e+02, 2.26818e-04, 2.95430e-10, 6.51237e-16}, + {1.35153e+02, 1.36707e-04, 1.78065e-10, 3.92585e-16}, + {7.83236e+01, 7.92263e-05, 1.03204e-10, 2.27687e-16}, + {4.41657e+01, 4.46783e-05, 5.82153e-11, 1.28647e-16}, + {2.46133e+01, 2.49140e-05, 3.25047e-11, 7.21799e-17}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.57266e-06, + /* size_moments = */ {1.01138e-06, 1.31688e-12, 2.89696e-18}, + /* opacity_coef_table = */ { + {3.27960e-01, 2.60760e-07, 8.23594e-13, 1.38274e-17}, + {4.38752e-01, 3.48855e-07, 1.10197e-12, 1.85031e-17}, + {5.78230e-01, 4.59761e-07, 1.45242e-12, 2.43895e-17}, + {7.53824e-01, 5.99382e-07, 1.89361e-12, 3.18000e-17}, + {1.04013e+00, 8.27053e-07, 2.61333e-12, 4.38935e-17}, + {1.41735e+00, 1.12702e-06, 3.56171e-12, 5.98308e-17}, + {1.95293e+00, 1.55292e-06, 4.90855e-12, 8.24705e-17}, + {2.71532e+00, 2.15922e-06, 6.82677e-12, 1.14729e-16}, + {3.79677e+00, 3.01935e-06, 9.54991e-12, 1.60553e-16}, + {5.29747e+00, 4.21303e-06, 1.33318e-11, 2.24238e-16}, + {7.37841e+00, 5.86846e-06, 1.85820e-11, 3.12737e-16}, + {1.02169e+01, 8.12703e-06, 2.57565e-11, 4.33854e-16}, + {1.40423e+01, 1.11717e-05, 3.54480e-11, 5.97791e-16}, + {1.92026e+01, 1.52804e-05, 4.85668e-11, 8.20344e-16}, + {2.61626e+01, 2.08251e-05, 6.63455e-11, 1.12316e-15}, + {3.55324e+01, 2.82955e-05, 9.04435e-11, 1.53595e-15}, + {4.81644e+01, 3.83784e-05, 1.23253e-10, 2.10252e-15}, + {6.53233e+01, 5.20969e-05, 1.68441e-10, 2.89162e-15}, + {8.87789e+01, 7.08925e-05, 2.31406e-10, 4.00785e-15}, + {1.20729e+02, 9.65780e-05, 3.19528e-10, 5.60280e-15}, + {1.63666e+02, 1.31274e-04, 4.42922e-10, 7.90380e-15}, + {2.20664e+02, 1.77696e-04, 6.17150e-10, 1.12922e-14}, + {2.96276e+02, 2.39957e-04, 8.67756e-10, 1.64168e-14}, + {3.97347e+02, 3.24130e-04, 1.23022e-09, 2.41672e-14}, + {5.32072e+02, 4.37186e-04, 1.73755e-09, 3.52998e-14}, + {7.07827e+02, 5.84876e-04, 2.40229e-09, 4.99094e-14}, + {9.32126e+02, 7.72477e-04, 3.21611e-09, 6.73490e-14}, + {1.21808e+03, 1.00957e-03, 4.17439e-09, 8.68091e-14}, + {1.58941e+03, 1.31461e-03, 5.30260e-09, 1.07984e-13}, + {2.08259e+03, 1.71725e-03, 6.66833e-09, 1.31338e-13}, + {2.74876e+03, 2.26047e-03, 8.38813e-09, 1.58137e-13}, + {3.65886e+03, 3.00609e-03, 1.06436e-08, 1.90525e-13}, + {4.91536e+03, 4.04510e-03, 1.37047e-08, 2.31589e-13}, + {6.67260e+03, 5.51150e-03, 1.79301e-08, 2.84849e-13}, + {9.16963e+03, 7.59478e-03, 2.36873e-08, 3.52355e-13}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.27270e-02, + /* size_moments = */ {7.95099e-07, 2.51133e-12, 4.21640e-17}, + /* opacity_coef_table = */ { + {7.60358e-02, 1.06666e-07, 3.03247e-13, 1.47482e-18}, + {9.07206e-02, 1.27267e-07, 3.61815e-13, 1.75967e-18}, + {1.09208e-01, 1.53201e-07, 4.35546e-13, 2.11827e-18}, + {1.32481e-01, 1.85851e-07, 5.28369e-13, 2.56972e-18}, + {1.58907e-01, 2.22922e-07, 6.33765e-13, 3.08233e-18}, + {1.91565e-01, 2.68735e-07, 7.64012e-13, 3.71581e-18}, + {2.30490e-01, 3.23342e-07, 9.19258e-13, 4.47087e-18}, + {2.76795e-01, 3.88301e-07, 1.10394e-12, 5.36908e-18}, + {3.33074e-01, 4.67253e-07, 1.32840e-12, 6.46082e-18}, + {4.05326e-01, 5.68613e-07, 1.61658e-12, 7.86245e-18}, + {5.08161e-01, 7.12876e-07, 2.02672e-12, 9.85731e-18}, + {6.72474e-01, 9.43381e-07, 2.68206e-12, 1.30448e-17}, + {9.48552e-01, 1.33068e-06, 3.78319e-12, 1.84008e-17}, + {1.41789e+00, 1.98912e-06, 5.65528e-12, 2.75074e-17}, + {2.19503e+00, 3.07934e-06, 8.75500e-12, 4.25864e-17}, + {3.46724e+00, 4.86415e-06, 1.38300e-11, 6.72794e-17}, + {5.76869e+00, 8.09313e-06, 2.30131e-11, 1.11983e-16}, + {1.17202e+01, 1.64442e-05, 4.67706e-11, 2.27727e-16}, + {3.16486e+01, 4.44090e-05, 1.26336e-10, 6.15454e-16}, + {8.68419e+01, 1.21859e-04, 3.46686e-10, 1.68908e-15}, + {1.92333e+02, 2.69887e-04, 7.67805e-10, 3.74058e-15}, + {3.36287e+02, 4.71894e-04, 1.34247e-09, 6.53939e-15}, + {5.05924e+02, 7.09951e-04, 2.01945e-09, 9.83185e-15}, + {7.20787e+02, 1.01144e-03, 2.87594e-09, 1.39829e-14}, + {9.77602e+02, 1.37169e-03, 3.89813e-09, 1.89179e-14}, + {1.18669e+03, 1.66488e-03, 4.72879e-09, 2.29108e-14}, + {1.23874e+03, 1.73774e-03, 4.93372e-09, 2.38742e-14}, + {1.11204e+03, 1.55988e-03, 4.42750e-09, 2.14067e-14}, + {8.76525e+02, 1.22945e-03, 3.48896e-09, 1.68597e-14}, + {6.22287e+02, 8.72816e-04, 2.47658e-09, 1.19634e-14}, + {4.07334e+02, 5.71310e-04, 1.62094e-09, 7.82836e-15}, + {2.50598e+02, 3.51474e-04, 9.97166e-10, 4.81513e-15}, + {1.47088e+02, 2.06293e-04, 5.85254e-10, 2.82583e-15}, + {8.33219e+01, 1.16862e-04, 3.31541e-10, 1.60077e-15}, + {4.59660e+01, 6.44731e-05, 1.82924e-10, 8.83269e-16}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.65484e-03, + /* size_moments = */ {1.40285e-06, 3.98828e-12, 1.93974e-17}, + /* opacity_coef_table = */ { + {2.25389e-04, 2.91423e-10, 2.39426e-15, 3.55346e-20}, + {4.04967e-04, 5.23622e-10, 4.30206e-15, 6.38511e-20}, + {6.31042e-04, 8.15942e-10, 6.70384e-15, 9.94996e-20}, + {9.15653e-04, 1.18395e-09, 9.72751e-15, 1.44378e-19}, + {1.52197e-03, 1.96795e-09, 1.61693e-14, 2.39993e-19}, + {2.37407e-03, 3.06977e-09, 2.52225e-14, 3.74371e-19}, + {3.77209e-03, 4.87751e-09, 4.00763e-14, 5.94853e-19}, + {6.14348e-03, 7.94395e-09, 6.52733e-14, 9.68874e-19}, + {1.01907e-02, 1.31776e-08, 1.08281e-13, 1.60732e-18}, + {1.68897e-02, 2.18408e-08, 1.79477e-13, 2.66430e-18}, + {2.96125e-02, 3.82967e-08, 3.14746e-13, 4.67293e-18}, + {6.10610e-02, 7.89818e-08, 6.49304e-13, 9.64262e-18}, + {1.43400e-01, 1.85524e-07, 1.52569e-12, 2.26652e-17}, + {3.27383e-01, 4.23645e-07, 3.48510e-12, 5.17901e-17}, + {6.39452e-01, 8.27698e-07, 6.81196e-12, 1.01271e-16}, + {1.05149e+00, 1.36261e-06, 1.12352e-11, 1.67335e-16}, + {1.55882e+00, 2.03505e-06, 1.69775e-11, 2.55740e-16}, + {2.94474e+00, 3.91135e-06, 3.34978e-11, 5.17225e-16}, + {1.32877e+01, 1.75173e-05, 1.48167e-10, 2.26035e-15}, + {7.10035e+01, 9.20831e-05, 7.58876e-10, 1.12902e-14}, + {2.54672e+02, 3.27285e-04, 2.65806e-09, 3.89823e-14}, + {5.99878e+02, 7.67225e-04, 6.18279e-09, 8.99815e-14}, + {9.93398e+02, 1.26701e-03, 1.01648e-08, 1.47279e-13}, + {1.24125e+03, 1.58042e-03, 1.26439e-08, 1.82695e-13}, + {1.24435e+03, 1.58257e-03, 1.26385e-08, 1.82292e-13}, + {1.05321e+03, 1.33853e-03, 1.06770e-08, 1.53820e-13}, + {7.84243e+02, 9.96171e-04, 7.93973e-09, 1.14294e-13}, + {5.30434e+02, 6.73540e-04, 5.36536e-09, 7.71941e-14}, + {3.33897e+02, 4.23882e-04, 3.37536e-09, 4.85451e-14}, + {1.99187e+02, 2.52825e-04, 2.01271e-09, 2.89397e-14}, + {1.14133e+02, 1.44851e-04, 1.15293e-09, 1.65742e-14}, + {6.34329e+01, 8.04978e-05, 6.40626e-10, 9.20833e-15}, + {3.44484e+01, 4.37133e-05, 3.47851e-10, 4.99954e-15}, + {1.83799e+01, 2.33224e-05, 1.85579e-10, 2.66709e-15}, + {9.67434e+00, 1.22756e-05, 9.76752e-11, 1.40372e-15}, + } + }, + { + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 9.48713e-04, + /* size_moments = */ {1.29303e-06, 1.06240e-11, 1.57687e-16}, + /* opacity_coef_table = */ { + {5.18099e-02, 8.75057e-08, 1.64042e-13, 3.48481e-19}, + {9.98914e-02, 1.68714e-07, 3.16278e-13, 6.71882e-19}, + {1.60422e-01, 2.70949e-07, 5.07932e-13, 1.07902e-18}, + {2.36626e-01, 3.99656e-07, 7.49210e-13, 1.59157e-18}, + {3.67294e-01, 6.20351e-07, 1.16293e-12, 2.47046e-18}, + {5.36239e-01, 9.05695e-07, 1.69785e-12, 3.60681e-18}, + {7.64225e-01, 1.29076e-06, 2.41970e-12, 5.14028e-18}, + {1.04974e+00, 1.77298e-06, 3.32371e-12, 7.06072e-18}, + {1.38085e+00, 2.33223e-06, 4.37210e-12, 9.28786e-18}, + {1.74382e+00, 2.94529e-06, 5.52140e-12, 1.17294e-17}, + {2.10325e+00, 3.55236e-06, 6.65945e-12, 1.41471e-17}, + {2.42167e+00, 4.09020e-06, 7.66778e-12, 1.62893e-17}, + {2.66848e+00, 4.50708e-06, 8.44938e-12, 1.79499e-17}, + {2.81672e+00, 4.75754e-06, 8.91905e-12, 1.89480e-17}, + {2.89933e+00, 4.89720e-06, 9.18118e-12, 1.95057e-17}, + {3.08200e+00, 5.20610e-06, 9.76116e-12, 2.07399e-17}, + {3.69875e+00, 6.24871e-06, 1.17179e-11, 2.49020e-17}, + {5.06356e+00, 8.55561e-06, 1.60466e-11, 3.41079e-17}, + {7.08905e+00, 1.19792e-05, 2.24709e-11, 4.77704e-17}, + {9.21663e+00, 1.55761e-05, 2.92218e-11, 6.21311e-17}, + {1.08429e+01, 1.83272e-05, 3.43894e-11, 7.31341e-17}, + {1.17217e+01, 1.98178e-05, 3.71989e-11, 7.91392e-17}, + {1.19809e+01, 2.02656e-05, 3.80618e-11, 8.10292e-17}, + {1.18982e+01, 2.01424e-05, 3.78698e-11, 8.07160e-17}, + {1.17194e+01, 1.98680e-05, 3.74208e-11, 7.99219e-17}, + {1.16101e+01, 1.97358e-05, 3.72971e-11, 7.99631e-17}, + {1.19784e+01, 2.05514e-05, 3.92888e-11, 8.53362e-17}, + {1.49136e+01, 2.65380e-05, 5.30405e-11, 1.20988e-16}, + {2.57980e+01, 4.84122e-05, 1.02966e-10, 2.50769e-16}, + {6.12919e+01, 1.18083e-04, 2.58706e-10, 6.49359e-16}, + {1.55902e+02, 3.00837e-04, 6.60279e-10, 1.66030e-15}, + {3.47036e+02, 6.65409e-04, 1.45009e-09, 3.62025e-15}, + {6.57260e+02, 1.25056e-03, 2.70176e-09, 6.68619e-15}, + {1.09327e+03, 2.06455e-03, 4.42254e-09, 1.08501e-14}, + {1.65394e+03, 3.10062e-03, 6.58692e-09, 1.60229e-14}, + } + }, + { + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 5.23050e-05, + /* size_moments = */ {1.68897e-06, 3.16618e-12, 6.72598e-18}, + /* opacity_coef_table = */ { + {9.93250e-04, 9.14846e-11, 8.97410e-18, 9.30612e-25}, + {1.81240e-03, 1.66933e-10, 1.63752e-17, 1.69810e-24}, + {2.84365e-03, 2.61918e-10, 2.56926e-17, 2.66432e-24}, + {4.14191e-03, 3.81496e-10, 3.74225e-17, 3.88071e-24}, + {7.18271e-03, 6.61573e-10, 6.48964e-17, 6.72974e-24}, + {1.13364e-02, 1.04415e-09, 1.02425e-16, 1.06215e-23}, + {1.77361e-02, 1.63360e-09, 1.60247e-16, 1.66176e-23}, + {2.59477e-02, 2.38995e-09, 2.34440e-16, 2.43114e-23}, + {3.45425e-02, 3.18159e-09, 3.12095e-16, 3.23642e-23}, + {4.22006e-02, 3.88695e-09, 3.81286e-16, 3.95393e-23}, + {4.71420e-02, 4.34208e-09, 4.25932e-16, 4.41691e-23}, + {4.91934e-02, 4.53102e-09, 4.44466e-16, 4.60911e-23}, + {5.05162e-02, 4.65286e-09, 4.56418e-16, 4.73304e-23}, + {5.78201e-02, 5.32560e-09, 5.22410e-16, 5.41738e-23}, + {8.84237e-02, 8.14438e-09, 7.98916e-16, 8.28474e-23}, + {1.78786e-01, 1.64673e-08, 1.61535e-15, 1.67511e-22}, + {4.36404e-01, 4.01956e-08, 3.94295e-15, 4.08884e-22}, + {1.63796e+00, 1.50867e-07, 1.47992e-14, 1.53467e-21}, + {8.50819e+00, 7.83659e-07, 7.68723e-14, 7.97165e-21}, + {3.92751e+01, 3.61749e-06, 3.54854e-13, 3.67984e-20}, + {1.41439e+02, 1.30275e-05, 1.27792e-12, 1.32520e-19}, + {3.83709e+02, 3.53420e-05, 3.46684e-12, 3.59511e-19}, + {7.70411e+02, 7.09598e-05, 6.96073e-12, 7.21827e-19}, + {1.16399e+03, 1.07211e-04, 1.05167e-11, 1.09058e-18}, + {1.37566e+03, 1.26707e-04, 1.24292e-11, 1.28891e-18}, + {1.33070e+03, 1.22566e-04, 1.20230e-11, 1.24678e-18}, + {1.09978e+03, 1.01297e-04, 9.93663e-12, 1.03043e-18}, + {8.05638e+02, 7.42044e-05, 7.27901e-12, 7.54832e-19}, + {5.38690e+02, 4.96167e-05, 4.86711e-12, 5.04718e-19}, + {3.36338e+02, 3.09789e-05, 3.03884e-12, 3.15127e-19}, + {1.99460e+02, 1.83715e-05, 1.80214e-12, 1.86881e-19}, + {1.13787e+02, 1.04805e-05, 1.02808e-12, 1.06611e-19}, + {6.30411e+01, 5.80648e-06, 5.69582e-13, 5.90655e-20}, + {3.41529e+01, 3.14570e-06, 3.08575e-13, 3.19991e-20}, + {1.81893e+01, 1.67535e-06, 1.64342e-13, 1.70422e-20}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 1.31693e-29, + /* size_moments = */ {9.21063e-08, 9.03508e-15, 9.36936e-22}, + /* opacity_coef_table = */ { + {1.53894e-01, 1.90916e-06, 4.34900e-11, 1.52207e-15}, + {1.93844e-01, 2.40648e-06, 5.48634e-11, 1.92178e-15}, + {2.44138e-01, 3.03256e-06, 6.91797e-11, 2.42474e-15}, + {3.07454e-01, 3.82073e-06, 8.72020e-11, 3.05783e-15}, + {3.87243e-01, 4.81526e-06, 1.09978e-10, 3.85936e-15}, + {4.87709e-01, 6.06778e-06, 1.38669e-10, 4.86916e-15}, + {6.14251e-01, 7.64642e-06, 1.74856e-10, 6.14383e-15}, + {7.73625e-01, 9.63590e-06, 2.20495e-10, 7.75268e-15}, + {9.74036e-01, 1.21392e-05, 2.77959e-10, 9.78002e-15}, + {1.22376e+00, 1.52600e-05, 3.49642e-10, 1.23105e-14}, + {1.52029e+00, 1.89682e-05, 4.34881e-10, 1.53223e-14}, + {1.83650e+00, 2.29254e-05, 5.25941e-10, 1.85447e-14}, + {2.15714e+00, 2.69443e-05, 6.18616e-10, 2.18354e-14}, + {2.55729e+00, 3.19712e-05, 7.34846e-10, 2.59753e-14}, + {3.23398e+00, 4.04866e-05, 9.32032e-10, 3.30022e-14}, + {4.34499e+00, 5.44911e-05, 1.25683e-09, 4.45846e-14}, + {5.84259e+00, 7.34292e-05, 1.69748e-09, 6.03345e-14}, + {7.53509e+00, 9.49825e-05, 2.20255e-09, 7.84868e-14}, + {9.31292e+00, 1.17996e-04, 2.75076e-09, 9.84428e-14}, + {1.14053e+01, 1.46050e-04, 3.44207e-09, 1.24265e-13}, + {1.44699e+01, 1.88865e-04, 4.53802e-09, 1.66375e-13}, + {1.88525e+01, 2.52409e-04, 6.22006e-09, 2.32633e-13}, + {2.35897e+01, 3.27106e-04, 8.33967e-09, 3.20293e-13}, + {2.71065e+01, 3.99935e-04, 1.08043e-08, 4.33797e-13}, + {2.87408e+01, 4.69399e-04, 1.38602e-08, 5.94648e-13}, + {2.88428e+01, 5.34587e-04, 1.74785e-08, 8.07129e-13}, + {2.80514e+01, 5.86377e-04, 2.09655e-08, 1.03092e-12}, + {2.67893e+01, 6.13530e-04, 2.33810e-08, 1.20137e-12}, + {2.53851e+01, 6.14601e-04, 2.43011e-08, 1.28034e-12}, + {2.53848e+01, 6.23633e-04, 2.48207e-08, 1.31287e-12}, + {3.52560e+01, 8.08661e-04, 3.01974e-08, 1.52398e-12}, + {9.64731e+01, 1.84326e-03, 5.73265e-08, 2.51143e-12}, + {3.56496e+02, 5.70937e-03, 1.44867e-07, 5.33930e-12}, + {1.16716e+03, 1.65654e-02, 3.60906e-07, 1.15456e-11}, + {3.02792e+03, 3.93985e-02, 7.71226e-07, 2.22345e-11}, + } + }, +}; + +} // namespace ccsn20 + +namespace ccsn25 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 1.34092e-01, 1.75488e-01}, + {"O", 5.53726e-01, 5.69674e-01}, + {"Mg", 2.48100e-02, 3.12340e-02}, + {"Al", 2.98415e-04, 2.98415e-04}, + {"Si", 3.47760e-02, 8.33205e-02}, + {"S", 4.72556e-02, 4.73930e-02}, + {"Fe", 1.46955e-02, 1.98197e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "SiM_dust", + /* nonprimoridal_yield_frac = */ 3.83373e-02, + /* size_moments = */ {1.72153e-05, 6.33208e-10, 4.04318e-14}, + /* opacity_coef_table = */ { + {7.05387e-02, 2.70513e-06, 1.33741e-10, 7.96280e-15}, + {1.06564e-01, 3.93018e-06, 1.88633e-10, 1.09924e-14}, + {1.50619e-01, 5.42584e-06, 2.55756e-10, 1.47090e-14}, + {2.05371e-01, 7.28371e-06, 3.39206e-10, 1.93364e-14}, + {2.90528e-01, 9.90213e-06, 4.47050e-10, 2.49139e-14}, + {3.98319e-01, 1.31460e-05, 5.78557e-10, 3.16454e-14}, + {5.44029e-01, 1.73143e-05, 7.40062e-10, 3.96165e-14}, + {7.41852e-01, 2.27123e-05, 9.40496e-10, 4.91736e-14}, + {1.01111e+00, 2.97427e-05, 1.19128e-09, 6.07485e-14}, + {1.37135e+00, 3.87934e-05, 1.50307e-09, 7.47433e-14}, + {1.85427e+00, 5.04362e-05, 1.88890e-09, 9.15116e-14}, + {2.48538e+00, 6.50566e-05, 2.35529e-09, 1.11141e-13}, + {3.28338e+00, 8.28882e-05, 2.90473e-09, 1.33599e-13}, + {4.26495e+00, 1.04109e-04, 3.53805e-09, 1.58791e-13}, + {5.44209e+00, 1.28847e-04, 4.25649e-09, 1.86722e-13}, + {6.82357e+00, 1.57201e-04, 5.06195e-09, 2.17471e-13}, + {8.41130e+00, 1.89169e-04, 5.95453e-09, 2.51081e-13}, + {1.02033e+01, 2.24714e-04, 6.93482e-09, 2.87663e-13}, + {1.22164e+01, 2.64256e-04, 8.01879e-09, 3.27999e-13}, + {1.45282e+01, 3.09507e-04, 9.26157e-09, 3.74467e-13}, + {1.73262e+01, 3.64447e-04, 1.07851e-08, 4.32120e-13}, + {2.09720e+01, 4.36715e-04, 1.28220e-08, 5.10543e-13}, + {2.61035e+01, 5.39852e-04, 1.57872e-08, 6.26923e-13}, + {3.37725e+01, 6.96147e-04, 2.03646e-08, 8.09666e-13}, + {4.55764e+01, 9.38083e-04, 2.75201e-08, 1.09797e-12}, + {6.37992e+01, 1.30793e-03, 3.84014e-08, 1.53493e-12}, + {9.17796e+01, 1.86084e-03, 5.43135e-08, 2.16276e-12}, + {1.34749e+02, 2.67751e-03, 7.69998e-08, 3.03160e-12}, + {2.01156e+02, 3.88432e-03, 1.09109e-07, 4.21570e-12}, + {3.04328e+02, 5.67395e-03, 1.54550e-07, 5.82179e-12}, + {4.64551e+02, 8.32593e-03, 2.18657e-07, 7.98599e-12}, + {7.11390e+02, 1.22244e-02, 3.08194e-07, 1.08633e-11}, + {1.08442e+03, 1.78487e-02, 4.30797e-07, 1.46043e-11}, + {1.62442e+03, 2.56300e-02, 5.92006e-07, 1.92777e-11}, + {2.34943e+03, 3.56242e-02, 7.89629e-07, 2.47479e-11}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 4.88366e-03, + /* size_moments = */ {1.96666e-05, 5.88305e-10, 2.42323e-14}, + /* opacity_coef_table = */ { + {1.05240e-01, 2.45433e-07, 2.61677e-12, 4.51929e-17}, + {1.32588e-01, 3.09211e-07, 3.29676e-12, 5.69367e-17}, + {1.67016e-01, 3.89504e-07, 4.15283e-12, 7.17213e-17}, + {2.10360e-01, 4.90585e-07, 5.23055e-12, 9.03341e-17}, + {2.71887e-01, 6.34079e-07, 6.76050e-12, 1.16758e-16}, + {3.55694e-01, 8.29533e-07, 8.84446e-12, 1.52750e-16}, + {4.84933e-01, 1.13094e-06, 1.20582e-11, 2.08253e-16}, + {6.99770e-01, 1.63200e-06, 1.74006e-11, 3.00524e-16}, + {1.05860e+00, 2.46891e-06, 2.63246e-11, 4.54655e-16}, + {1.62903e+00, 3.79938e-06, 4.05116e-11, 6.99697e-16}, + {2.54264e+00, 5.93041e-06, 6.32372e-11, 1.09224e-15}, + {3.96499e+00, 9.24857e-06, 9.86269e-11, 1.70359e-15}, + {6.10655e+00, 1.42452e-05, 1.51927e-10, 2.62446e-15}, + {9.28824e+00, 2.16706e-05, 2.31158e-10, 3.99359e-15}, + {1.39278e+01, 3.25027e-05, 3.46790e-10, 5.99240e-15}, + {2.05413e+01, 4.79530e-05, 5.11839e-10, 8.84697e-15}, + {3.00722e+01, 7.02477e-05, 7.50339e-10, 1.29761e-14}, + {4.55290e+01, 1.06478e-04, 1.13881e-09, 1.97131e-14}, + {7.48333e+01, 1.75301e-04, 1.87829e-09, 3.25565e-14}, + {1.29734e+02, 3.04341e-04, 3.26603e-09, 5.66753e-14}, + {2.15039e+02, 5.04949e-04, 5.42460e-09, 9.42056e-14}, + {3.20373e+02, 7.52945e-04, 8.09632e-09, 1.40698e-13}, + {4.30336e+02, 1.01240e-03, 1.08979e-08, 1.89530e-13}, + {5.31620e+02, 1.25190e-03, 1.34895e-08, 2.34771e-13}, + {6.00659e+02, 1.41538e-03, 1.52608e-08, 2.65718e-13}, + {6.07548e+02, 1.43203e-03, 1.54444e-08, 2.68965e-13}, + {5.44184e+02, 1.28282e-03, 1.38365e-08, 2.40975e-13}, + {4.34292e+02, 1.02387e-03, 1.10444e-08, 1.92359e-13}, + {3.13872e+02, 7.40120e-04, 7.98523e-09, 1.39097e-13}, + {2.09392e+02, 4.93970e-04, 5.33184e-09, 9.29066e-14}, + {1.31415e+02, 3.10355e-04, 3.35361e-09, 5.84810e-14}, + {7.92901e+01, 1.87957e-04, 2.03808e-09, 3.56245e-14}, + {4.76038e+01, 1.14252e-04, 1.25235e-09, 2.20472e-14}, + {3.00283e+01, 7.42825e-05, 8.34278e-10, 1.49154e-14}, + {2.10539e+01, 5.48540e-05, 6.37875e-10, 1.16338e-14}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.68068e-02, + /* size_moments = */ {2.33213e-06, 2.48648e-11, 4.29427e-16}, + /* opacity_coef_table = */ { + {2.19890e-02, 3.41795e-08, 9.45655e-14, 4.23439e-19}, + {3.90612e-02, 6.07164e-08, 1.67986e-13, 7.52197e-19}, + {6.05539e-02, 9.41245e-08, 2.60417e-13, 1.16608e-18}, + {8.76116e-02, 1.36183e-07, 3.76781e-13, 1.68713e-18}, + {1.43288e-01, 2.22725e-07, 6.16221e-13, 2.75928e-18}, + {2.19266e-01, 3.40825e-07, 9.42974e-13, 4.22240e-18}, + {3.36256e-01, 5.22673e-07, 1.44610e-12, 6.47526e-18}, + {5.14336e-01, 7.99479e-07, 2.21195e-12, 9.90458e-18}, + {7.97217e-01, 1.23919e-06, 3.42851e-12, 1.53521e-17}, + {1.25414e+00, 1.94943e-06, 5.39358e-12, 2.41515e-17}, + {2.03450e+00, 3.16241e-06, 8.74964e-12, 3.91798e-17}, + {3.34649e+00, 5.20178e-06, 1.43922e-11, 6.44481e-17}, + {5.45897e+00, 8.48547e-06, 2.34778e-11, 1.05137e-16}, + {8.82126e+00, 1.37119e-05, 3.79391e-11, 1.69905e-16}, + {1.41827e+01, 2.20461e-05, 6.10001e-11, 2.73202e-16}, + {2.28425e+01, 3.55077e-05, 9.82519e-11, 4.40095e-16}, + {3.71193e+01, 5.77019e-05, 1.59676e-10, 7.15351e-16}, + {6.14319e+01, 9.54994e-05, 2.64297e-10, 1.18434e-15}, + {1.03856e+02, 1.61458e-04, 4.46893e-10, 2.00314e-15}, + {1.75529e+02, 2.72897e-04, 7.55426e-10, 3.38696e-15}, + {2.82103e+02, 4.38604e-04, 1.21423e-09, 5.44494e-15}, + {4.14591e+02, 6.44612e-04, 1.78465e-09, 8.00387e-15}, + {5.60087e+02, 8.70868e-04, 2.41120e-09, 1.08148e-14}, + {7.11212e+02, 1.10590e-03, 3.06203e-09, 1.37338e-14}, + {8.41053e+02, 1.30782e-03, 3.62100e-09, 1.62382e-14}, + {8.95593e+02, 1.39263e-03, 3.85557e-09, 1.72860e-14}, + {8.40674e+02, 1.30722e-03, 3.61884e-09, 1.62210e-14}, + {6.96909e+02, 1.08365e-03, 2.99976e-09, 1.34436e-14}, + {5.18364e+02, 8.06018e-04, 2.23111e-09, 9.99751e-15}, + {3.52974e+02, 5.48846e-04, 1.51920e-09, 6.80696e-15}, + {2.24287e+02, 3.48752e-04, 9.65345e-10, 4.32526e-15}, + {1.35182e+02, 2.10204e-04, 5.81862e-10, 2.60719e-15}, + {7.83444e+01, 1.21833e-04, 3.37284e-10, 1.51159e-15}, + {4.41840e+01, 6.87277e-05, 1.90332e-10, 8.53442e-16}, + {2.46537e+01, 3.84248e-05, 1.06643e-10, 4.79266e-16}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.49736e-05, + /* size_moments = */ {1.55439e-06, 4.30058e-12, 1.92568e-17}, + /* opacity_coef_table = */ { + {3.27960e-01, 2.60233e-07, 1.15896e-12, 3.41207e-17}, + {4.38752e-01, 3.48153e-07, 1.55085e-12, 4.56711e-17}, + {5.78230e-01, 4.58837e-07, 2.04421e-12, 6.02121e-17}, + {7.53824e-01, 5.98180e-07, 2.66530e-12, 7.85179e-17}, + {1.04013e+00, 8.25404e-07, 3.67884e-12, 1.08416e-16}, + {1.41735e+00, 1.12479e-06, 5.01451e-12, 1.47828e-16}, + {1.95293e+00, 1.54986e-06, 6.91189e-12, 2.03855e-16}, + {2.71532e+00, 2.15499e-06, 9.61533e-12, 2.83773e-16}, + {3.79678e+00, 3.01350e-06, 1.34554e-11, 3.97470e-16}, + {5.29747e+00, 4.20498e-06, 1.87919e-11, 5.55745e-16}, + {7.37842e+00, 5.85746e-06, 2.62073e-11, 7.76231e-16}, + {1.02169e+01, 8.11222e-06, 3.63532e-11, 1.07888e-15}, + {1.40424e+01, 1.11520e-05, 5.00793e-11, 1.48986e-15}, + {1.92027e+01, 1.52549e-05, 6.86959e-11, 2.04983e-15}, + {2.61627e+01, 2.07929e-05, 9.39920e-11, 2.81528e-15}, + {3.55327e+01, 2.82565e-05, 1.28407e-10, 3.86530e-15}, + {4.81650e+01, 3.83349e-05, 1.75518e-10, 5.31971e-15}, + {6.53244e+01, 5.20561e-05, 2.40904e-10, 7.37173e-15}, + {8.87808e+01, 7.08733e-05, 3.33003e-10, 1.03268e-14}, + {1.20733e+02, 9.66248e-05, 4.63924e-10, 1.46567e-14}, + {1.63674e+02, 1.31491e-04, 6.51645e-10, 2.11366e-14}, + {2.20677e+02, 1.78321e-04, 9.26445e-10, 3.11929e-14}, + {2.96305e+02, 2.41503e-04, 1.34108e-09, 4.74137e-14}, + {3.97405e+02, 3.27522e-04, 1.97072e-09, 7.35006e-14}, + {5.32189e+02, 4.43695e-04, 2.88200e-09, 1.12542e-13}, + {7.08046e+02, 5.95675e-04, 4.08283e-09, 1.64175e-13}, + {9.32526e+02, 7.88039e-04, 5.50980e-09, 2.23600e-13}, + {1.21879e+03, 1.02941e-03, 7.08050e-09, 2.84124e-13}, + {1.59074e+03, 1.33766e-03, 8.76094e-09, 3.40697e-13}, + {2.08510e+03, 1.74270e-03, 1.05986e-08, 3.91613e-13}, + {2.75362e+03, 2.28917e-03, 1.27282e-08, 4.38283e-13}, + {3.66839e+03, 3.04259e-03, 1.53805e-08, 4.84412e-13}, + {4.93379e+03, 4.10065e-03, 1.89004e-08, 5.35144e-13}, + {6.70658e+03, 5.60645e-03, 2.37440e-08, 5.95776e-13}, + {9.22668e+03, 7.75494e-03, 3.03854e-08, 6.69355e-13}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 4.13961e-02, + /* size_moments = */ {7.93494e-07, 3.53402e-12, 1.04050e-16}, + /* opacity_coef_table = */ { + {7.60344e-02, 1.95196e-07, 3.66716e-12, 1.92423e-16}, + {9.07191e-02, 2.32906e-07, 4.37632e-12, 2.29682e-16}, + {1.09206e-01, 2.80380e-07, 5.26909e-12, 2.76586e-16}, + {1.32480e-01, 3.40146e-07, 6.39301e-12, 3.35635e-16}, + {1.58906e-01, 4.08019e-07, 7.66999e-12, 4.02759e-16}, + {1.91564e-01, 4.91897e-07, 9.24810e-12, 4.85715e-16}, + {2.30489e-01, 5.91872e-07, 1.11292e-11, 5.84611e-16}, + {2.76795e-01, 7.10808e-07, 1.33674e-11, 7.02310e-16}, + {3.33075e-01, 8.55378e-07, 1.60886e-11, 8.45443e-16}, + {4.05328e-01, 1.04100e-06, 1.95833e-11, 1.02932e-15}, + {5.08167e-01, 1.30521e-06, 2.45600e-11, 1.29133e-15}, + {6.72485e-01, 1.72749e-06, 3.25210e-11, 1.71095e-15}, + {9.48580e-01, 2.43730e-06, 4.59219e-11, 2.41877e-15}, + {1.41796e+00, 3.64482e-06, 6.87751e-11, 3.63027e-15}, + {2.19521e+00, 5.64613e-06, 1.06783e-10, 5.65494e-15}, + {3.46773e+00, 8.92808e-06, 1.69393e-10, 9.00627e-15}, + {5.77034e+00, 1.48887e-05, 2.83967e-10, 1.51653e-14}, + {1.17273e+01, 3.03917e-05, 5.84644e-10, 3.13500e-14}, + {3.16762e+01, 8.23694e-05, 1.59258e-09, 8.53491e-14}, + {8.69213e+01, 2.26080e-04, 4.36458e-09, 2.32841e-13}, + {1.92500e+02, 5.00291e-04, 9.62913e-09, 5.11437e-13}, + {3.36556e+02, 8.73556e-04, 1.67531e-08, 8.86507e-13}, + {5.06180e+02, 1.30807e-03, 2.48422e-08, 1.30609e-12}, + {7.20631e+02, 1.84289e-03, 3.42245e-08, 1.77586e-12}, + {9.76452e+02, 2.46285e-03, 4.43878e-08, 2.26306e-12}, + {1.18428e+03, 2.95079e-03, 5.17620e-08, 2.59653e-12}, + {1.23545e+03, 3.05120e-03, 5.24657e-08, 2.59989e-12}, + {1.10864e+03, 2.72192e-03, 4.61791e-08, 2.26949e-12}, + {8.73605e+02, 2.13674e-03, 3.59368e-08, 1.75670e-12}, + {6.20107e+02, 1.51303e-03, 2.53058e-08, 1.23288e-12}, + {4.05864e+02, 9.88756e-04, 1.64791e-08, 8.01183e-13}, + {2.49677e+02, 6.07668e-04, 1.01055e-08, 4.90701e-13}, + {1.46540e+02, 3.56444e-04, 5.92003e-09, 2.87265e-13}, + {8.30108e+01, 2.01877e-04, 3.35130e-09, 1.62587e-13}, + {4.57957e+01, 1.11407e-04, 1.85045e-09, 8.98118e-14}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.46546e-02, + /* size_moments = */ {2.56804e-06, 4.82971e-11, 2.53766e-15}, + /* opacity_coef_table = */ { + {2.25388e-04, 8.07807e-10, 6.97998e-15, 9.10286e-20}, + {4.04965e-04, 1.45145e-09, 1.25417e-14, 1.63564e-19}, + {6.31040e-04, 2.26174e-09, 1.95435e-14, 2.54881e-19}, + {9.15651e-04, 3.28184e-09, 2.83582e-14, 3.69842e-19}, + {1.52197e-03, 5.45504e-09, 4.71373e-14, 6.14765e-19}, + {2.37408e-03, 8.50921e-09, 7.35292e-14, 9.58978e-19}, + {3.77210e-03, 1.35201e-08, 1.16831e-13, 1.52374e-18}, + {6.14351e-03, 2.20201e-08, 1.90284e-13, 2.48178e-18}, + {1.01908e-02, 3.65275e-08, 3.15657e-13, 4.11707e-18}, + {1.68899e-02, 6.05411e-08, 5.23195e-13, 6.82425e-18}, + {2.96134e-02, 1.06156e-07, 9.17483e-13, 1.19682e-17}, + {6.10648e-02, 2.18932e-07, 1.89256e-12, 2.46925e-17}, + {1.43413e-01, 5.14257e-07, 4.44656e-12, 5.80289e-17}, + {3.27427e-01, 1.17431e-06, 1.01561e-11, 1.32572e-16}, + {6.39567e-01, 2.29431e-06, 1.98486e-11, 2.59169e-16}, + {1.05188e+00, 3.77698e-06, 3.27186e-11, 4.27780e-16}, + {1.56137e+00, 5.64036e-06, 4.92651e-11, 6.49403e-16}, + {2.95878e+00, 1.08379e-05, 9.64135e-11, 1.29373e-15}, + {1.33369e+01, 4.85546e-05, 4.28194e-10, 5.69626e-15}, + {7.10715e+01, 2.55311e-04, 2.21076e-09, 2.88829e-14}, + {2.54519e+02, 9.07495e-04, 7.77715e-09, 1.00557e-13}, + {5.99024e+02, 2.12736e-03, 1.81309e-08, 2.33128e-13}, + {9.91502e+02, 3.51313e-03, 2.98462e-08, 3.82528e-13}, + {1.23853e+03, 4.38206e-03, 3.71546e-08, 4.75243e-13}, + {1.24134e+03, 4.38799e-03, 3.71575e-08, 4.74666e-13}, + {1.05053e+03, 3.71132e-03, 3.14012e-08, 4.00789e-13}, + {7.82169e+02, 2.76204e-03, 2.33559e-08, 2.97932e-13}, + {5.28995e+02, 1.86748e-03, 1.57854e-08, 2.01282e-13}, + {3.32978e+02, 1.17527e-03, 9.93166e-09, 1.26606e-13}, + {1.98632e+02, 7.00988e-04, 5.92262e-09, 7.54858e-14}, + {1.13813e+02, 4.01617e-04, 3.39280e-09, 4.32365e-14}, + {6.32536e+01, 2.23189e-04, 1.88528e-09, 2.40230e-14}, + {3.43507e+01, 1.21200e-04, 1.02371e-09, 1.30436e-14}, + {1.83277e+01, 6.46641e-05, 5.46160e-10, 6.95860e-15}, + {9.64683e+00, 3.40355e-05, 2.87461e-10, 3.66245e-15}, + } + }, + { + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.09289e-03, + /* size_moments = */ {3.58420e-06, 3.09713e-11, 4.03929e-16}, + /* opacity_coef_table = */ { + {5.18089e-02, 4.97944e-08, 1.27767e-13, 7.39409e-19}, + {9.98898e-02, 9.60047e-08, 2.46329e-13, 1.42543e-18}, + {1.60420e-01, 1.54180e-07, 3.95589e-13, 2.28909e-18}, + {2.36623e-01, 2.27418e-07, 5.83496e-13, 3.37637e-18}, + {3.67289e-01, 3.53003e-07, 9.05730e-13, 5.24118e-18}, + {5.36230e-01, 5.15376e-07, 1.32237e-12, 7.65247e-18}, + {7.64209e-01, 7.34494e-07, 1.88465e-12, 1.09071e-17}, + {1.04972e+00, 1.00891e-06, 2.58893e-12, 1.49849e-17}, + {1.38083e+00, 1.32717e-06, 3.40583e-12, 1.97167e-17}, + {1.74377e+00, 1.67607e-06, 4.30174e-12, 2.49099e-17}, + {2.10317e+00, 2.02159e-06, 5.18938e-12, 3.00615e-17}, + {2.42155e+00, 2.32777e-06, 5.97696e-12, 3.46445e-17}, + {2.66826e+00, 2.56519e-06, 6.58920e-12, 3.82277e-17}, + {2.81642e+00, 2.70807e-06, 6.96112e-12, 4.04503e-17}, + {2.89877e+00, 2.78835e-06, 7.17920e-12, 4.18739e-17}, + {3.08081e+00, 2.96627e-06, 7.66777e-12, 4.51307e-17}, + {3.69596e+00, 3.56434e-06, 9.27486e-12, 5.54010e-17}, + {5.05776e+00, 4.88601e-06, 1.28025e-11, 7.76522e-17}, + {7.07898e+00, 6.85096e-06, 1.80991e-11, 1.11855e-16}, + {9.20178e+00, 8.93168e-06, 2.39573e-11, 1.53397e-16}, + {1.08226e+01, 1.05533e-05, 2.89938e-11, 1.96013e-16}, + {1.16924e+01, 1.14675e-05, 3.24020e-11, 2.32497e-16}, + {1.19355e+01, 1.17825e-05, 3.42098e-11, 2.58640e-16}, + {1.18230e+01, 1.17613e-05, 3.49907e-11, 2.75275e-16}, + {1.15929e+01, 1.16487e-05, 3.54453e-11, 2.86649e-16}, + {1.13868e+01, 1.16310e-05, 3.63433e-11, 2.99851e-16}, + {1.14199e+01, 1.23167e-05, 4.12834e-11, 3.50696e-16}, + {1.29371e+01, 1.75436e-05, 7.43145e-11, 6.75730e-16}, + {2.05440e+01, 3.98903e-05, 2.16132e-10, 2.04334e-15}, + {4.78755e+01, 1.10160e-04, 6.39249e-10, 5.90057e-15}, + {1.21252e+02, 2.78758e-04, 1.57840e-09, 1.39121e-14}, + {2.69644e+02, 5.88705e-04, 3.18490e-09, 2.68674e-14}, + {5.11453e+02, 1.05406e-03, 5.44914e-09, 4.43131e-14}, + {8.53209e+02, 1.66585e-03, 8.25940e-09, 6.51454e-14}, + {1.29539e+03, 2.40455e-03, 1.14623e-08, 8.80401e-14}, + } + }, + { + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 3.77935e-04, + /* size_moments = */ {9.61035e-07, 2.46507e-12, 1.42549e-17}, + /* opacity_coef_table = */ { + {9.93250e-04, 1.98179e-11, 3.95420e-19, 7.88967e-27}, + {1.81240e-03, 3.61621e-11, 7.21529e-19, 1.43964e-26}, + {2.84365e-03, 5.67382e-11, 1.13208e-18, 2.25879e-26}, + {4.14191e-03, 8.26420e-11, 1.64892e-18, 3.29004e-26}, + {7.18271e-03, 1.43314e-10, 2.85949e-18, 5.70543e-26}, + {1.13364e-02, 2.26190e-10, 4.51309e-18, 9.00479e-26}, + {1.77361e-02, 3.53881e-10, 7.06085e-18, 1.40883e-25}, + {2.59477e-02, 5.17725e-10, 1.03300e-17, 2.06110e-25}, + {3.45425e-02, 6.89214e-10, 1.37516e-17, 2.74381e-25}, + {4.22006e-02, 8.42014e-10, 1.68004e-17, 3.35212e-25}, + {4.71420e-02, 9.40607e-10, 1.87676e-17, 3.74462e-25}, + {4.91934e-02, 9.81537e-10, 1.95842e-17, 3.90757e-25}, + {5.05162e-02, 1.00793e-09, 2.01109e-17, 4.01264e-25}, + {5.78201e-02, 1.15366e-09, 2.30186e-17, 4.59282e-25}, + {8.84237e-02, 1.76428e-09, 3.52021e-17, 7.02374e-25}, + {1.78786e-01, 3.56725e-09, 7.11761e-17, 1.42015e-24}, + {4.36404e-01, 8.70740e-09, 1.73736e-16, 3.46648e-24}, + {1.63796e+00, 3.26816e-08, 6.52083e-16, 1.30108e-23}, + {8.50817e+00, 1.69760e-07, 3.38716e-15, 6.75828e-23}, + {3.92751e+01, 7.83641e-07, 1.56357e-14, 3.11973e-22}, + {1.41433e+02, 2.82196e-06, 5.63055e-14, 1.12344e-21}, + {3.83709e+02, 7.65599e-06, 1.52757e-13, 3.04791e-21}, + {7.70411e+02, 1.53717e-05, 3.06706e-13, 6.11959e-21}, + {1.16399e+03, 2.32246e-05, 4.63392e-13, 9.24589e-21}, + {1.37566e+03, 2.74481e-05, 5.47662e-13, 1.09273e-20}, + {1.33070e+03, 2.65509e-05, 5.29761e-13, 1.05701e-20}, + {1.09978e+03, 2.19435e-05, 4.37830e-13, 8.73585e-21}, + {8.05638e+02, 1.60746e-05, 3.20730e-13, 6.39941e-21}, + {5.38690e+02, 1.07483e-05, 2.14456e-13, 4.27897e-21}, + {3.36338e+02, 6.71083e-06, 1.33899e-13, 2.67163e-21}, + {1.99460e+02, 3.97975e-06, 7.94065e-14, 1.58437e-21}, + {1.13787e+02, 2.27035e-06, 4.52995e-14, 9.03844e-22}, + {6.30411e+01, 1.25784e-06, 2.50971e-14, 5.00753e-22}, + {3.41529e+01, 6.81441e-07, 1.35965e-14, 2.71286e-22}, + {1.81893e+01, 3.62924e-07, 7.24128e-15, 1.44483e-22}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 1.65550e-31, + /* size_moments = */ {1.99526e-08, 3.98107e-16, 7.94328e-24}, + /* opacity_coef_table = */ { + {1.53307e-01, 2.58151e-06, 8.97185e-11, 5.13410e-15}, + {1.93187e-01, 3.26103e-06, 1.14053e-10, 6.60852e-15}, + {2.43381e-01, 4.11484e-06, 1.44443e-10, 8.42753e-15}, + {3.06566e-01, 5.18903e-06, 1.82603e-10, 1.07022e-14}, + {3.86268e-01, 6.55217e-06, 2.31853e-10, 1.37374e-14}, + {4.86630e-01, 8.26891e-06, 2.93869e-10, 1.75576e-14}, + {6.13093e-01, 1.04376e-05, 3.72751e-10, 2.24815e-14}, + {7.72441e-01, 1.31779e-05, 4.73205e-10, 2.88483e-14}, + {9.72908e-01, 1.66348e-05, 6.00927e-10, 3.70670e-14}, + {1.22279e+00, 2.09532e-05, 7.61455e-10, 4.75186e-14}, + {1.51967e+00, 2.61010e-05, 9.54694e-10, 6.03376e-14}, + {1.83660e+00, 3.16418e-05, 1.16836e-09, 7.52509e-14}, + {2.15883e+00, 3.73832e-05, 1.40366e-09, 9.34936e-14}, + {2.56188e+00, 4.46730e-05, 1.71564e-09, 1.19386e-13}, + {3.24331e+00, 5.69556e-05, 2.23297e-09, 1.61351e-13}, + {4.36192e+00, 7.70449e-05, 3.06366e-09, 2.26659e-13}, + {5.87089e+00, 1.04185e-04, 4.17746e-09, 3.12654e-13}, + {7.58000e+00, 1.35161e-04, 5.44737e-09, 4.09330e-13}, + {9.38530e+00, 1.68565e-04, 6.82760e-09, 5.12932e-13}, + {1.15371e+01, 2.10285e-04, 8.59830e-09, 6.44799e-13}, + {1.47388e+01, 2.75860e-04, 1.14755e-08, 8.58985e-13}, + {1.93877e+01, 3.75887e-04, 1.59953e-08, 1.19600e-12}, + {2.46008e+01, 5.00971e-04, 2.20360e-08, 1.65571e-12}, + {2.90408e+01, 6.45456e-04, 3.01610e-08, 2.31085e-12}, + {3.23701e+01, 8.27330e-04, 4.23216e-08, 3.35508e-12}, + {3.49305e+01, 1.05238e-03, 5.92405e-08, 4.87268e-12}, + {3.68020e+01, 1.28200e-03, 7.79075e-08, 6.59988e-12}, + {3.76194e+01, 1.45174e-03, 9.27975e-08, 8.01634e-12}, + {3.72617e+01, 1.52446e-03, 1.00177e-07, 8.74632e-12}, + {3.76576e+01, 1.55784e-03, 1.02687e-07, 8.96074e-12}, + {4.91245e+01, 1.84545e-03, 1.14505e-07, 9.64022e-12}, + {1.17100e+02, 3.32870e-03, 1.70057e-07, 1.27411e-11}, + {3.93519e+02, 8.31574e-03, 3.27938e-07, 2.07522e-11}, + {1.23314e+03, 2.12665e-02, 6.72506e-07, 3.61691e-11}, + {3.12736e+03, 4.71942e-02, 1.26825e-06, 5.97225e-11}, + } + }, +}; + +} // namespace ccsn25 + +namespace ccsn30 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 4.93773e-02, 4.99965e-02}, + {"O", 7.29130e-01, 7.32832e-01}, + {"Mg", 3.76731e-02, 3.87430e-02}, + {"Al", 8.61678e-04, 8.61678e-04}, + {"Si", 4.01269e-02, 7.18810e-02}, + {"S", 3.68812e-02, 3.70455e-02}, + {"Fe", 1.23641e-02, 1.45822e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "SiM_dust", + /* nonprimoridal_yield_frac = */ 2.91389e-02, + /* size_moments = */ {2.56305e-05, 1.02092e-09, 5.78476e-14}, + /* opacity_coef_table = */ { + {7.21495e-02, 2.58300e-06, 1.19134e-10, 6.77090e-15}, + {1.09797e-01, 3.79107e-06, 1.69411e-10, 9.39020e-15}, + {1.55805e-01, 5.26522e-06, 2.30859e-10, 1.26025e-14}, + {2.12966e-01, 7.09577e-06, 3.07229e-10, 1.66015e-14}, + {3.02975e-01, 9.74053e-06, 4.08459e-10, 2.15040e-14}, + {4.17015e-01, 1.30295e-05, 5.32431e-10, 2.74392e-14}, + {5.71703e-01, 1.73021e-05, 6.86687e-10, 3.45374e-14}, + {7.82114e-01, 2.28860e-05, 8.80449e-10, 4.31318e-14}, + {1.06869e+00, 3.02137e-05, 1.12556e-09, 5.36402e-14}, + {1.45194e+00, 3.97008e-05, 1.43310e-09, 6.64513e-14}, + {1.96519e+00, 5.19736e-05, 1.81745e-09, 8.19495e-14}, + {2.63479e+00, 6.74573e-05, 2.28640e-09, 1.00267e-13}, + {3.47952e+00, 8.64064e-05, 2.84327e-09, 1.21406e-13}, + {4.51582e+00, 1.09014e-04, 3.48958e-09, 1.45307e-13}, + {5.75506e+00, 1.35409e-04, 4.22673e-09, 1.71980e-13}, + {7.20522e+00, 1.65686e-04, 5.05643e-09, 2.01492e-13}, + {8.86719e+00, 1.99826e-04, 5.97834e-09, 2.33868e-13}, + {1.07378e+01, 2.37775e-04, 6.99239e-09, 2.69183e-13}, + {1.28337e+01, 2.79956e-04, 8.11382e-09, 3.08137e-13}, + {1.52347e+01, 3.28163e-04, 9.39756e-09, 3.52929e-13}, + {1.81342e+01, 3.86588e-04, 1.09665e-08, 4.08289e-13}, + {2.19061e+01, 4.63288e-04, 1.30553e-08, 4.83202e-13}, + {2.72090e+01, 5.72531e-04, 1.60822e-08, 5.93756e-13}, + {3.51270e+01, 7.37785e-04, 2.07358e-08, 7.66520e-13}, + {4.72945e+01, 9.93265e-04, 2.79935e-08, 1.03837e-12}, + {6.60183e+01, 1.38363e-03, 3.90367e-08, 1.45073e-12}, + {9.46224e+01, 1.96740e-03, 5.52478e-08, 2.04604e-12}, + {1.38263e+02, 2.83025e-03, 7.85071e-08, 2.87658e-12}, + {2.05210e+02, 4.10585e-03, 1.11674e-07, 4.02015e-12}, + {3.08399e+02, 5.99700e-03, 1.58965e-07, 5.58896e-12}, + {4.67338e+02, 8.79616e-03, 2.26155e-07, 7.72827e-12}, + {7.10129e+02, 1.29022e-02, 3.20597e-07, 1.06077e-11}, + {1.07381e+03, 1.88070e-02, 4.50609e-07, 1.43975e-11}, + {1.59524e+03, 2.69407e-02, 6.22216e-07, 1.91854e-11}, + {2.28747e+03, 3.73289e-02, 8.32996e-07, 2.48404e-11}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 1.93065e-03, + /* size_moments = */ {2.05800e-05, 5.92424e-10, 2.26690e-14}, + /* opacity_coef_table = */ { + {1.05240e-01, 4.94867e-08, 6.62401e-14, 1.80043e-19}, + {1.32588e-01, 6.23464e-08, 8.34533e-14, 2.26830e-19}, + {1.67016e-01, 7.85357e-08, 1.05123e-13, 2.85730e-19}, + {2.10360e-01, 9.89168e-08, 1.32405e-13, 3.59881e-19}, + {2.71887e-01, 1.27849e-07, 1.71131e-13, 4.65142e-19}, + {3.55694e-01, 1.67257e-07, 2.23881e-13, 6.08518e-19}, + {4.84932e-01, 2.28028e-07, 3.05226e-13, 8.29619e-19}, + {6.99767e-01, 3.29050e-07, 4.40448e-13, 1.19716e-18}, + {1.05860e+00, 4.97781e-07, 6.66304e-13, 1.81105e-18}, + {1.62902e+00, 7.66009e-07, 1.02534e-12, 2.78694e-18}, + {2.54260e+00, 1.19560e-06, 1.60037e-12, 4.34992e-18}, + {3.96488e+00, 1.86440e-06, 2.49561e-12, 6.78334e-18}, + {6.10630e+00, 2.87136e-06, 3.84349e-12, 1.04472e-17}, + {9.28767e+00, 4.36734e-06, 5.84598e-12, 1.58906e-17}, + {1.39265e+01, 6.54868e-06, 8.76595e-12, 2.38284e-17}, + {2.05383e+01, 9.65780e-06, 1.29279e-11, 3.51435e-17}, + {3.00651e+01, 1.41377e-05, 1.89253e-11, 5.14515e-17}, + {4.55105e+01, 2.14011e-05, 2.86497e-11, 7.79011e-17}, + {7.47848e+01, 3.51681e-05, 4.70833e-11, 1.28054e-16}, + {1.29623e+02, 6.09573e-05, 8.16150e-11, 2.22014e-16}, + {2.14824e+02, 1.01026e-04, 1.35269e-10, 3.68020e-16}, + {3.20010e+02, 1.50495e-04, 2.01516e-10, 5.48326e-16}, + {4.29781e+02, 2.02124e-04, 2.70665e-10, 7.36593e-16}, + {5.30850e+02, 2.49665e-04, 3.34350e-10, 9.10050e-16}, + {5.99723e+02, 2.82064e-04, 3.77759e-10, 1.02832e-15}, + {6.06569e+02, 2.85288e-04, 3.82090e-10, 1.04017e-15}, + {5.43292e+02, 2.55531e-04, 3.42243e-10, 9.31723e-16}, + {4.33571e+02, 2.03926e-04, 2.73131e-10, 7.43589e-16}, + {3.13340e+02, 1.47377e-04, 1.97394e-10, 5.37419e-16}, + {2.09022e+02, 9.83146e-05, 1.31685e-10, 3.58547e-16}, + {1.31159e+02, 6.16930e-05, 8.26409e-11, 2.25056e-16}, + {7.90789e+01, 3.72049e-05, 4.98596e-11, 1.35886e-16}, + {4.73566e+01, 2.23007e-05, 2.99370e-11, 8.18168e-17}, + {2.96727e+01, 1.40105e-05, 1.88993e-11, 5.20353e-17}, + {2.05268e+01, 9.75253e-06, 1.32995e-11, 3.71721e-17}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 7.73041e-04, + /* size_moments = */ {4.70227e-07, 6.29420e-13, 1.71079e-18}, + /* opacity_coef_table = */ { + {2.19890e-02, 2.24631e-08, 2.89738e-14, 5.78493e-20}, + {3.90612e-02, 3.99034e-08, 5.14691e-14, 1.02764e-19}, + {6.05539e-02, 6.18594e-08, 7.97889e-14, 1.59308e-19}, + {8.76116e-02, 8.95004e-08, 1.15442e-13, 2.30492e-19}, + {1.43288e-01, 1.46377e-07, 1.88803e-13, 3.76970e-19}, + {2.19266e-01, 2.23993e-07, 2.88916e-13, 5.76861e-19}, + {3.36256e-01, 3.43505e-07, 4.43068e-13, 8.84648e-19}, + {5.14336e-01, 5.25424e-07, 6.77716e-13, 1.35317e-18}, + {7.97217e-01, 8.14404e-07, 1.05046e-12, 2.09745e-18}, + {1.25414e+00, 1.28118e-06, 1.65253e-12, 3.29971e-18}, + {2.03450e+00, 2.07836e-06, 2.68078e-12, 5.35315e-18}, + {3.34648e+00, 3.41863e-06, 4.40956e-12, 8.80595e-18}, + {5.45894e+00, 5.57665e-06, 7.19317e-12, 1.43665e-17}, + {8.82120e+00, 9.01141e-06, 1.16237e-11, 2.32195e-17}, + {1.41826e+01, 1.44884e-05, 1.86888e-11, 3.73434e-17}, + {2.28421e+01, 2.33348e-05, 3.01009e-11, 6.01739e-17}, + {3.71183e+01, 3.79191e-05, 4.89167e-11, 9.78570e-17}, + {6.14292e+01, 6.27552e-05, 8.09620e-11, 1.62128e-16}, + {1.03850e+02, 1.06093e-04, 1.36885e-10, 2.74448e-16}, + {1.75514e+02, 1.79307e-04, 2.31368e-10, 4.64387e-16}, + {2.82073e+02, 2.88172e-04, 3.71865e-10, 7.46941e-16}, + {4.14542e+02, 4.23507e-04, 5.46530e-10, 1.09837e-15}, + {5.60007e+02, 5.72126e-04, 7.38347e-10, 1.48437e-15}, + {7.11091e+02, 7.26489e-04, 9.37565e-10, 1.88456e-15}, + {8.40894e+02, 8.59108e-04, 1.10867e-09, 2.22674e-15}, + {8.95416e+02, 9.14814e-04, 1.18049e-09, 2.36840e-15}, + {8.40506e+02, 8.58713e-04, 1.10802e-09, 2.22074e-15}, + {6.96770e+02, 7.11863e-04, 9.18488e-10, 1.83938e-15}, + {5.18262e+02, 5.29487e-04, 6.83149e-10, 1.36732e-15}, + {3.52905e+02, 3.60548e-04, 4.65172e-10, 9.30726e-16}, + {2.24242e+02, 2.29099e-04, 2.95579e-10, 5.91332e-16}, + {1.35153e+02, 1.38081e-04, 1.78153e-10, 3.56469e-16}, + {7.83239e+01, 8.00228e-05, 1.03253e-10, 2.06735e-16}, + {4.41660e+01, 4.51272e-05, 5.82391e-11, 1.16797e-16}, + {2.46140e+01, 2.51643e-05, 3.25109e-11, 6.54871e-17}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 4.17376e-06, + /* size_moments = */ {1.02156e-06, 1.31765e-12, 2.63083e-18}, + /* opacity_coef_table = */ { + {3.27960e-01, 3.83729e-07, 7.77768e-13, 2.49208e-18}, + {4.38752e-01, 5.13360e-07, 1.04052e-12, 3.33400e-18}, + {5.78230e-01, 6.76557e-07, 1.37130e-12, 4.39392e-18}, + {7.53823e-01, 8.82009e-07, 1.78773e-12, 5.72828e-18}, + {1.04013e+00, 1.21701e-06, 2.46677e-12, 7.90427e-18}, + {1.41736e+00, 1.65839e-06, 3.36142e-12, 1.07712e-17}, + {1.95293e+00, 2.28504e-06, 4.63158e-12, 1.48415e-17}, + {2.71531e+00, 3.17707e-06, 6.43967e-12, 2.06359e-17}, + {3.79677e+00, 4.44245e-06, 9.00459e-12, 2.88564e-17}, + {5.29746e+00, 6.19839e-06, 1.25639e-11, 4.02650e-17}, + {7.37839e+00, 8.63325e-06, 1.74996e-11, 5.60866e-17}, + {1.02169e+01, 1.19546e-05, 2.42326e-11, 7.76741e-17}, + {1.40423e+01, 1.64308e-05, 3.33069e-11, 1.06774e-16}, + {1.92025e+01, 2.24692e-05, 4.55495e-11, 1.46048e-16}, + {2.61625e+01, 3.06137e-05, 6.20638e-11, 1.99051e-16}, + {3.55322e+01, 4.15788e-05, 8.43006e-11, 2.70467e-16}, + {4.81640e+01, 5.63626e-05, 1.14288e-10, 3.66871e-16}, + {6.53224e+01, 7.64461e-05, 1.55039e-10, 4.98051e-16}, + {8.87770e+01, 1.03904e-04, 2.10775e-10, 6.77818e-16}, + {1.20724e+02, 1.41310e-04, 2.86753e-10, 9.23530e-16}, + {1.63658e+02, 1.91596e-04, 3.88991e-10, 1.25555e-15}, + {2.20645e+02, 2.58372e-04, 5.24942e-10, 1.69987e-15}, + {2.96236e+02, 3.47007e-04, 7.05751e-10, 2.29590e-15}, + {3.97277e+02, 4.65581e-04, 9.48153e-10, 3.10191e-15}, + {5.32000e+02, 6.23846e-04, 1.27229e-09, 4.18567e-15}, + {7.07873e+02, 8.30738e-04, 1.69662e-09, 5.60591e-15}, + {9.32623e+02, 1.09569e-03, 2.24083e-09, 7.42175e-15}, + {1.21977e+03, 1.43532e-03, 2.93992e-09, 9.74128e-15}, + {1.59377e+03, 1.87988e-03, 3.85840e-09, 1.27719e-14}, + {2.09261e+03, 2.47712e-03, 5.09977e-09, 1.68549e-14}, + {2.77023e+03, 3.29669e-03, 6.81899e-09, 2.25141e-14}, + {3.70299e+03, 4.44048e-03, 9.24971e-09, 3.05579e-14}, + {5.00261e+03, 6.06097e-03, 1.27486e-08, 4.22365e-14}, + {6.83605e+03, 8.38300e-03, 1.78358e-08, 5.93501e-14}, + {9.45120e+03, 1.17154e-02, 2.51744e-08, 8.40301e-14}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 6.19235e-04, + /* size_moments = */ {1.17005e-06, 2.37154e-12, 7.59875e-18}, + /* opacity_coef_table = */ { + {7.60354e-02, 1.23833e-07, 8.53754e-13, 1.45191e-17}, + {9.07201e-02, 1.47751e-07, 1.01868e-12, 1.73242e-17}, + {1.09207e-01, 1.77861e-07, 1.22631e-12, 2.08557e-17}, + {1.32481e-01, 2.15768e-07, 1.48770e-12, 2.53015e-17}, + {1.58907e-01, 2.58811e-07, 1.78454e-12, 3.03507e-17}, + {1.91564e-01, 3.12003e-07, 2.15137e-12, 3.65904e-17}, + {2.30490e-01, 3.75405e-07, 2.58860e-12, 4.40274e-17}, + {2.76795e-01, 4.50827e-07, 3.10875e-12, 5.28751e-17}, + {3.33074e-01, 5.42499e-07, 3.74099e-12, 6.36301e-17}, + {4.05326e-01, 6.60191e-07, 4.55275e-12, 7.74389e-17}, + {5.08163e-01, 8.27703e-07, 5.70817e-12, 9.70950e-17}, + {6.72477e-01, 1.09537e-06, 7.55468e-12, 1.28511e-16}, + {9.48561e-01, 1.54515e-06, 1.06581e-11, 1.81319e-16}, + {1.41791e+00, 2.30989e-06, 1.59363e-11, 2.71154e-16}, + {2.19508e+00, 3.57636e-06, 2.46813e-11, 4.20045e-16}, + {3.46738e+00, 5.65063e-06, 3.90198e-11, 6.64369e-16}, + {5.76921e+00, 9.40776e-06, 6.50678e-11, 1.10919e-15}, + {1.17225e+01, 1.91430e-05, 1.32874e-10, 2.27105e-15}, + {3.16576e+01, 5.17610e-05, 3.60367e-10, 6.17301e-15}, + {8.68678e+01, 1.42065e-04, 9.89621e-10, 1.69586e-14}, + {1.92388e+02, 3.14591e-04, 2.19062e-09, 3.75294e-14}, + {3.36374e+02, 5.49866e-04, 3.82570e-09, 6.54980e-14}, + {5.05999e+02, 8.26100e-04, 5.72796e-09, 9.78085e-14}, + {7.20701e+02, 1.17289e-03, 8.06418e-09, 1.36816e-13}, + {9.77142e+02, 1.58336e-03, 1.07627e-08, 1.81003e-13}, + {1.18576e+03, 1.91391e-03, 1.28756e-08, 2.14810e-13}, + {1.23749e+03, 1.99168e-03, 1.32966e-08, 2.20518e-13}, + {1.11076e+03, 1.78423e-03, 1.18503e-08, 1.95740e-13}, + {8.75424e+02, 1.40444e-03, 9.29642e-09, 1.53150e-13}, + {6.21466e+02, 9.96201e-04, 6.57984e-09, 1.08212e-13}, + {4.06780e+02, 6.51722e-04, 4.29860e-09, 7.06171e-14}, + {2.50252e+02, 4.00808e-04, 2.64130e-09, 4.33611e-14}, + {1.46882e+02, 2.35201e-04, 1.54913e-09, 2.54207e-14}, + {8.32048e+01, 1.33228e-04, 8.77332e-10, 1.43944e-14}, + {4.59015e+01, 7.35091e-05, 4.84195e-10, 7.94538e-15}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 5.27016e-03, + /* size_moments = */ {1.62875e-06, 1.12314e-11, 1.91031e-16}, + /* opacity_coef_table = */ { + {2.25389e-04, 5.23412e-10, 3.15038e-15, 3.37599e-20}, + {4.04967e-04, 9.40443e-10, 5.66055e-15, 6.06603e-20}, + {6.31042e-04, 1.46545e-09, 8.82067e-15, 9.45260e-20}, + {9.15653e-04, 2.12641e-09, 1.27990e-14, 1.37160e-19}, + {1.52197e-03, 3.53447e-09, 2.12745e-14, 2.27991e-19}, + {2.37407e-03, 5.51331e-09, 3.31857e-14, 3.55642e-19}, + {3.77209e-03, 8.75995e-09, 5.27284e-14, 5.65083e-19}, + {6.14348e-03, 1.42671e-08, 8.58786e-14, 9.20363e-19}, + {1.01907e-02, 2.36663e-08, 1.42459e-13, 1.52677e-18}, + {1.68897e-02, 3.92242e-08, 2.36116e-13, 2.53063e-18}, + {2.96125e-02, 6.87744e-08, 4.14030e-13, 4.43787e-18}, + {6.10613e-02, 1.41824e-07, 8.53932e-13, 9.15481e-18}, + {1.43400e-01, 3.33097e-07, 2.00598e-12, 2.15106e-17}, + {3.27386e-01, 7.60540e-07, 4.58100e-12, 4.91345e-17}, + {6.39460e-01, 1.48568e-06, 8.95096e-12, 9.60338e-17}, + {1.05151e+00, 2.44421e-06, 1.47414e-11, 1.58361e-16}, + {1.55897e+00, 3.63523e-06, 2.20702e-11, 2.39002e-16}, + {2.94595e+00, 6.92078e-06, 4.26541e-11, 4.70201e-16}, + {1.32939e+01, 3.11374e-05, 1.90589e-10, 2.08296e-15}, + {7.10280e+01, 1.65213e-04, 9.96517e-10, 1.06988e-14}, + {2.54734e+02, 5.90224e-04, 3.53091e-09, 3.75292e-14}, + {5.99997e+02, 1.38734e-03, 8.26333e-09, 8.73603e-14}, + {9.93558e+02, 2.29460e-03, 1.36329e-08, 1.43684e-13}, + {1.24146e+03, 2.86493e-03, 1.69946e-08, 1.78772e-13}, + {1.24450e+03, 2.87058e-03, 1.70110e-08, 1.78725e-13}, + {1.05332e+03, 2.42888e-03, 1.43842e-08, 1.51004e-13}, + {7.84315e+02, 1.80814e-03, 1.07031e-08, 1.12298e-13}, + {5.30478e+02, 1.22276e-03, 7.23576e-09, 7.58903e-14}, + {3.33924e+02, 7.69623e-04, 4.55334e-09, 4.77443e-14}, + {1.99202e+02, 4.59084e-04, 2.71568e-09, 2.84703e-14}, + {1.14141e+02, 2.63040e-04, 1.55583e-09, 1.63087e-14}, + {6.34373e+01, 1.46185e-04, 8.64588e-10, 9.06207e-15}, + {3.44508e+01, 7.93863e-05, 4.69493e-10, 4.92062e-15}, + {1.83812e+01, 4.23560e-05, 2.50488e-10, 2.62517e-15}, + {9.67501e+00, 2.22941e-05, 1.31841e-10, 1.38170e-15}, + } + }, + { + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.33978e-03, + /* size_moments = */ {2.32229e-06, 1.39783e-11, 1.49800e-16}, + /* opacity_coef_table = */ { + {5.18102e-02, 8.79700e-08, 3.32172e-13, 2.28308e-18}, + {9.98920e-02, 1.69607e-07, 6.40403e-13, 4.40131e-18}, + {1.60423e-01, 2.72381e-07, 1.02844e-12, 7.06800e-18}, + {2.36628e-01, 4.01766e-07, 1.51696e-12, 1.04252e-17}, + {3.67296e-01, 6.23631e-07, 2.35471e-12, 1.61832e-17}, + {5.36243e-01, 9.10491e-07, 3.43791e-12, 2.36285e-17}, + {7.64229e-01, 1.29761e-06, 4.89979e-12, 3.36782e-17}, + {1.04975e+00, 1.78244e-06, 6.73094e-12, 4.62695e-17}, + {1.38087e+00, 2.34473e-06, 8.85504e-12, 6.08809e-17}, + {1.74385e+00, 2.96123e-06, 1.11849e-11, 7.69178e-17}, + {2.10328e+00, 3.57180e-06, 1.34937e-11, 9.28279e-17}, + {2.42172e+00, 4.11304e-06, 1.55431e-11, 1.06984e-16}, + {2.66854e+00, 4.53297e-06, 1.71379e-11, 1.18057e-16}, + {2.81685e+00, 4.78622e-06, 1.81100e-11, 1.24934e-16}, + {2.89955e+00, 4.92990e-06, 1.86888e-11, 1.29362e-16}, + {3.08249e+00, 5.24916e-06, 1.99900e-11, 1.39496e-16}, + {3.69977e+00, 6.31698e-06, 2.42367e-11, 1.71353e-16}, + {5.06558e+00, 8.67290e-06, 3.35347e-11, 2.40280e-16}, + {7.09332e+00, 1.21816e-05, 4.75377e-11, 3.46171e-16}, + {9.22649e+00, 1.59270e-05, 6.32195e-11, 4.74390e-16}, + {1.08624e+01, 1.89007e-05, 7.70051e-11, 6.04198e-16}, + {1.17514e+01, 2.06434e-05, 8.66021e-11, 7.12327e-16}, + {1.20172e+01, 2.13237e-05, 9.19108e-11, 7.86989e-16}, + {1.19350e+01, 2.14078e-05, 9.44200e-11, 8.32977e-16}, + {1.17499e+01, 2.13514e-05, 9.60658e-11, 8.64823e-16}, + {1.16255e+01, 2.15518e-05, 9.90976e-11, 9.04821e-16}, + {1.19573e+01, 2.36139e-05, 1.14559e-10, 1.06630e-15}, + {1.51193e+01, 3.80077e-05, 2.17630e-10, 2.11441e-15}, + {2.88990e+01, 9.93223e-05, 6.64795e-10, 6.60023e-15}, + {7.41785e+01, 2.87865e-04, 1.99265e-09, 1.93332e-14}, + {1.88656e+02, 7.26466e-04, 4.90072e-09, 4.57065e-14}, + {4.09136e+02, 1.50900e-03, 9.80616e-09, 8.81118e-14}, + {7.53739e+02, 2.65184e-03, 1.66314e-08, 1.44869e-13}, + {1.22335e+03, 4.11549e-03, 2.50007e-08, 2.12244e-13}, + {1.81062e+03, 5.83587e-03, 3.44214e-08, 2.85851e-13}, + } + }, + { + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 4.51744e-04, + /* size_moments = */ {1.69769e-06, 6.40794e-12, 4.40126e-17}, + /* opacity_coef_table = */ { + {9.93250e-04, 7.58434e-11, 8.82228e-18, 1.41287e-24}, + {1.81240e-03, 1.38393e-10, 1.60982e-17, 2.57809e-24}, + {2.84365e-03, 2.17138e-10, 2.52580e-17, 4.04502e-24}, + {4.14191e-03, 3.16271e-10, 3.67894e-17, 5.89176e-24}, + {7.18271e-03, 5.48463e-10, 6.37986e-17, 1.02172e-23}, + {1.13364e-02, 8.65631e-10, 1.00692e-16, 1.61257e-23}, + {1.77361e-02, 1.35430e-09, 1.57536e-16, 2.52291e-23}, + {2.59477e-02, 1.98134e-09, 2.30474e-16, 3.69100e-23}, + {3.45425e-02, 2.63763e-09, 3.06815e-16, 4.91359e-23}, + {4.22006e-02, 3.22239e-09, 3.74836e-16, 6.00294e-23}, + {4.71420e-02, 3.59971e-09, 4.18726e-16, 6.70583e-23}, + {4.91934e-02, 3.75635e-09, 4.36947e-16, 6.99764e-23}, + {5.05162e-02, 3.85735e-09, 4.48697e-16, 7.18580e-23}, + {5.78201e-02, 4.41508e-09, 5.13572e-16, 8.22477e-23}, + {8.84237e-02, 6.75193e-09, 7.85401e-16, 1.25781e-22}, + {1.78786e-01, 1.36519e-08, 1.58802e-15, 2.54319e-22}, + {4.36405e-01, 3.33234e-08, 3.87627e-15, 6.20781e-22}, + {1.63797e+00, 1.25074e-07, 1.45490e-14, 2.33003e-21}, + {8.50820e+00, 6.49679e-07, 7.55727e-14, 1.21029e-20}, + {3.92752e+01, 2.99901e-06, 3.48854e-13, 5.58686e-20}, + {1.41437e+02, 1.08001e-05, 1.25630e-12, 2.01195e-19}, + {3.83709e+02, 2.92996e-05, 3.40821e-12, 5.45820e-19}, + {7.70412e+02, 5.88278e-05, 6.84300e-12, 1.09590e-18}, + {1.16399e+03, 8.88808e-05, 1.03388e-11, 1.65574e-18}, + {1.37566e+03, 1.05044e-04, 1.22190e-11, 1.95685e-18}, + {1.33070e+03, 1.01611e-04, 1.18196e-11, 1.89289e-18}, + {1.09978e+03, 8.39785e-05, 9.76864e-12, 1.56444e-18}, + {8.05639e+02, 6.15177e-05, 7.15589e-12, 1.14600e-18}, + {5.38690e+02, 4.11337e-05, 4.78477e-12, 7.66273e-19}, + {3.36338e+02, 2.56824e-05, 2.98743e-12, 4.78432e-19}, + {1.99460e+02, 1.52305e-05, 1.77165e-12, 2.83727e-19}, + {1.13787e+02, 8.68865e-06, 1.01068e-12, 1.61859e-19}, + {6.30411e+01, 4.81374e-06, 5.59946e-13, 8.96744e-20}, + {3.41529e+01, 2.60788e-06, 3.03354e-13, 4.85817e-20}, + {1.81893e+01, 1.38891e-06, 1.61561e-13, 2.58738e-20}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 5.79251e-12, + /* size_moments = */ {7.63588e-08, 8.88224e-15, 1.42247e-21}, + /* opacity_coef_table = */ { + {1.52613e-01, 3.87036e-06, 1.51475e-10, 8.34686e-15}, + {1.92410e-01, 4.88554e-06, 1.91604e-10, 1.05937e-14}, + {2.42503e-01, 6.16264e-06, 2.42001e-10, 1.34057e-14}, + {3.05564e-01, 7.77004e-06, 3.05397e-10, 1.69392e-14}, + {3.85174e-01, 9.80462e-06, 3.86046e-10, 2.14732e-14}, + {4.85438e-01, 1.23675e-05, 4.87634e-10, 2.71828e-14}, + {6.11833e-01, 1.56019e-05, 6.16102e-10, 3.44270e-14}, + {7.71157e-01, 1.96838e-05, 7.78585e-10, 4.36231e-14}, + {9.71669e-01, 2.48269e-05, 9.83743e-10, 5.52763e-14}, + {1.22169e+00, 3.12457e-05, 1.24021e-09, 6.98829e-14}, + {1.51883e+00, 3.88844e-05, 1.54619e-09, 8.73862e-14}, + {1.83610e+00, 4.70620e-05, 1.87584e-09, 1.06471e-13}, + {2.15867e+00, 5.54249e-05, 2.21779e-09, 1.26800e-13}, + {2.56252e+00, 6.59468e-05, 2.65228e-09, 1.53070e-13}, + {3.24657e+00, 8.37697e-05, 3.38561e-09, 1.97020e-13}, + {4.37158e+00, 1.13090e-04, 4.58835e-09, 2.68525e-13}, + {5.89356e+00, 1.52861e-04, 6.22099e-09, 3.65325e-13}, + {7.62770e+00, 1.98484e-04, 8.10272e-09, 4.76950e-13}, + {9.48448e+00, 2.48132e-04, 1.01763e-08, 6.00571e-13}, + {1.17614e+01, 3.11117e-04, 1.28785e-08, 7.63878e-13}, + {1.52604e+01, 4.11692e-04, 1.73236e-08, 1.03683e-12}, + {2.04857e+01, 5.67120e-04, 2.43755e-08, 1.47603e-12}, + {2.67121e+01, 7.65926e-04, 3.38756e-08, 2.08532e-12}, + {3.30214e+01, 1.00600e-03, 4.67023e-08, 2.95970e-12}, + {3.94796e+01, 1.32148e-03, 6.59032e-08, 4.35947e-12}, + {4.60630e+01, 1.71870e-03, 9.26057e-08, 6.41018e-12}, + {5.17888e+01, 2.12529e-03, 1.22060e-07, 8.76593e-12}, + {5.52863e+01, 2.42692e-03, 1.45553e-07, 1.07154e-11}, + {5.60930e+01, 2.55895e-03, 1.57221e-07, 1.17347e-11}, + {5.70683e+01, 2.61927e-03, 1.61476e-07, 1.20713e-11}, + {7.25749e+01, 3.09971e-03, 1.82166e-07, 1.32162e-11}, + {1.59194e+02, 5.49929e-03, 2.77545e-07, 1.82852e-11}, + {4.83739e+02, 1.31658e-02, 5.43977e-07, 3.13196e-11}, + {1.39550e+03, 3.19882e-02, 1.11499e-06, 5.65773e-11}, + {3.29912e+03, 6.76125e-02, 2.08154e-06, 9.54501e-11}, + } + }, +}; + +} // namespace ccsn30 + +namespace fsn13 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 4.93693e-01, 6.69235e-01}, + {"O", 3.30556e-01, 3.30556e-01}, + {"Mg", 1.86824e-04, 1.86824e-04}, + {"Al", 1.97017e-07, 1.97017e-07}, + {"Si", 1.30184e-05, 1.30184e-05}, + {"S", 0.00000e+00, 0.00000e+00}, + {"Fe", 8.90341e-06, 8.90341e-06}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 6.31648e-26, + /* size_moments = */ {4.02937e-08, 1.67044e-15, 7.11477e-23}, + /* opacity_coef_table = */ { + {1.05240e-01, 4.24440e-09, 1.76098e-16, 7.50693e-24}, + {1.32588e-01, 5.34735e-09, 2.21859e-16, 9.45769e-24}, + {1.67016e-01, 6.73589e-09, 2.79469e-16, 1.19135e-23}, + {2.10360e-01, 8.48395e-09, 3.51995e-16, 1.50053e-23}, + {2.71887e-01, 1.09654e-08, 4.54949e-16, 1.93941e-23}, + {3.55694e-01, 1.43454e-08, 5.95184e-16, 2.53722e-23}, + {4.84932e-01, 1.95577e-08, 8.11439e-16, 3.45910e-23}, + {6.99767e-01, 2.82221e-08, 1.17092e-15, 4.99155e-23}, + {1.05860e+00, 4.26939e-08, 1.77135e-15, 7.55113e-23}, + {1.62902e+00, 6.56994e-08, 2.72584e-15, 1.16200e-22}, + {2.54260e+00, 1.02545e-07, 4.25454e-15, 1.81368e-22}, + {3.96488e+00, 1.59906e-07, 6.63444e-15, 2.82821e-22}, + {6.10630e+00, 2.46271e-07, 1.02177e-14, 4.35572e-22}, + {9.28766e+00, 3.74578e-07, 1.55411e-14, 6.62503e-22}, + {1.39265e+01, 5.61664e-07, 2.33032e-14, 9.93397e-22}, + {2.05382e+01, 8.28321e-07, 3.43667e-14, 1.46502e-21}, + {3.00649e+01, 1.21254e-06, 5.03077e-14, 2.14458e-21}, + {4.55102e+01, 1.83546e-06, 7.61523e-14, 3.24631e-21}, + {7.47839e+01, 3.01609e-06, 1.25136e-13, 5.33445e-21}, + {1.29621e+02, 5.22769e-06, 2.16895e-13, 9.24605e-21}, + {2.14820e+02, 8.66384e-06, 3.59459e-13, 1.53234e-20}, + {3.20002e+02, 1.29059e-05, 5.35460e-13, 2.28262e-20}, + {4.29768e+02, 1.73329e-05, 7.19133e-13, 3.06560e-20}, + {5.30827e+02, 2.14086e-05, 8.88234e-13, 3.78647e-20}, + {5.99694e+02, 2.41861e-05, 1.00347e-12, 4.27771e-20}, + {6.06537e+02, 2.44620e-05, 1.01492e-12, 4.32652e-20}, + {5.43262e+02, 2.19101e-05, 9.09042e-13, 3.87517e-20}, + {4.33545e+02, 1.74852e-05, 7.25453e-13, 3.09255e-20}, + {3.13324e+02, 1.26366e-05, 5.24285e-13, 2.23499e-20}, + {2.09006e+02, 8.42935e-06, 3.49730e-13, 1.49087e-20}, + {1.31150e+02, 5.28937e-06, 2.19454e-13, 9.35513e-21}, + {7.90681e+01, 3.18887e-06, 1.32305e-13, 5.64006e-21}, + {4.73389e+01, 1.90921e-06, 7.92124e-14, 3.37676e-21}, + {2.96409e+01, 1.19544e-06, 4.95982e-14, 2.11433e-21}, + {2.04708e+01, 8.25601e-07, 3.42539e-14, 1.46021e-21}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.06081e-16, + /* size_moments = */ {4.03307e-08, 1.67330e-15, 7.13316e-23}, + /* opacity_coef_table = */ { + {2.19890e-02, 8.86503e-10, 3.67618e-17, 1.56604e-24}, + {3.90612e-02, 1.57478e-09, 6.53036e-17, 2.78190e-24}, + {6.05539e-02, 2.44128e-09, 1.01236e-16, 4.31259e-24}, + {8.76116e-02, 3.53213e-09, 1.46471e-16, 6.23961e-24}, + {1.43288e-01, 5.77674e-09, 2.39552e-16, 1.02048e-23}, + {2.19266e-01, 8.83988e-09, 3.66575e-16, 1.56159e-23}, + {3.36256e-01, 1.35564e-08, 5.62160e-16, 2.39478e-23}, + {5.14336e-01, 2.07358e-08, 8.59879e-16, 3.66305e-23}, + {7.97216e-01, 3.21404e-08, 1.33281e-15, 5.67770e-23}, + {1.25414e+00, 5.05616e-08, 2.09670e-15, 8.93186e-23}, + {2.03450e+00, 8.20224e-08, 3.40133e-15, 1.44895e-22}, + {3.34648e+00, 1.34916e-07, 5.59472e-15, 2.38333e-22}, + {5.45893e+00, 2.20081e-07, 9.12638e-15, 3.88780e-22}, + {8.82117e+00, 3.55632e-07, 1.47474e-14, 6.28235e-22}, + {1.41825e+01, 5.71778e-07, 2.37106e-14, 1.01006e-21}, + {2.28419e+01, 9.20889e-07, 3.81877e-14, 1.62678e-21}, + {3.71178e+01, 1.49643e-06, 6.20544e-14, 2.64349e-21}, + {6.14272e+01, 2.47648e-06, 1.02696e-13, 4.37479e-21}, + {1.03847e+02, 4.18665e-06, 1.73613e-13, 7.39586e-21}, + {1.75507e+02, 7.07567e-06, 2.93416e-13, 1.24994e-20}, + {2.82060e+02, 1.13715e-05, 4.71555e-13, 2.00880e-20}, + {4.14519e+02, 1.67116e-05, 6.93003e-13, 2.95216e-20}, + {5.59961e+02, 2.25752e-05, 9.36157e-13, 3.98799e-20}, + {7.11024e+02, 2.86655e-05, 1.18871e-12, 5.06385e-20}, + {8.40805e+02, 3.38977e-05, 1.40568e-12, 5.98813e-20}, + {8.95312e+02, 3.60952e-05, 1.49681e-12, 6.37633e-20}, + {8.40415e+02, 3.38819e-05, 1.40503e-12, 5.98535e-20}, + {6.96693e+02, 2.80877e-05, 1.16475e-12, 4.96178e-20}, + {5.18202e+02, 2.08917e-05, 8.66344e-13, 3.69059e-20}, + {3.52864e+02, 1.42260e-05, 5.89927e-13, 2.51306e-20}, + {2.24210e+02, 9.03919e-06, 3.74840e-13, 1.59680e-20}, + {1.35138e+02, 5.44818e-06, 2.25927e-13, 9.62439e-21}, + {7.83119e+01, 3.15720e-06, 1.30924e-13, 5.57730e-21}, + {4.41553e+01, 1.78015e-06, 7.38199e-14, 3.14470e-21}, + {2.45888e+01, 9.91317e-07, 4.11082e-14, 1.75119e-21}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 3.19262e-15, + /* size_moments = */ {4.03157e-08, 1.67182e-15, 7.12190e-23}, + /* opacity_coef_table = */ { + {1.47700e-02, 5.95693e-10, 2.47155e-17, 1.05363e-24}, + {2.47694e-02, 9.98982e-10, 4.14481e-17, 1.76695e-24}, + {3.73580e-02, 1.50669e-09, 6.25133e-17, 2.66496e-24}, + {5.32060e-02, 2.14587e-09, 8.90327e-17, 3.79549e-24}, + {8.50036e-02, 3.42830e-09, 1.42241e-16, 6.06380e-24}, + {1.29213e-01, 5.21132e-09, 2.16220e-16, 9.21750e-24}, + {2.00170e-01, 8.07309e-09, 3.34956e-16, 1.42793e-23}, + {3.15560e-01, 1.27269e-08, 5.28045e-16, 2.25107e-23}, + {5.01384e-01, 2.02214e-08, 8.38995e-16, 3.57666e-23}, + {7.88907e-01, 3.18176e-08, 1.32012e-15, 5.62773e-23}, + {1.24250e+00, 5.01116e-08, 2.07915e-15, 8.86347e-23}, + {1.95225e+00, 7.87365e-08, 3.26681e-15, 1.39265e-22}, + {3.04002e+00, 1.22608e-07, 5.08704e-15, 2.16862e-22}, + {4.68918e+00, 1.89120e-07, 7.84668e-15, 3.34506e-22}, + {7.12599e+00, 2.87400e-07, 1.19243e-14, 5.08338e-22}, + {1.05834e+01, 4.26842e-07, 1.77098e-14, 7.54974e-22}, + {1.52356e+01, 6.14471e-07, 2.54946e-14, 1.08684e-21}, + {2.13345e+01, 8.60449e-07, 3.57003e-14, 1.52192e-21}, + {2.98061e+01, 1.20212e-06, 4.98762e-14, 2.12624e-21}, + {4.27642e+01, 1.72473e-06, 7.15598e-14, 3.05062e-21}, + {6.30370e+01, 2.54236e-06, 1.05483e-13, 4.49679e-21}, + {9.29361e+01, 3.74823e-06, 1.55515e-13, 6.62967e-21}, + {1.32987e+02, 5.36353e-06, 2.22535e-13, 9.48673e-21}, + {1.82150e+02, 7.34635e-06, 3.04803e-13, 1.29938e-20}, + {2.40388e+02, 9.69513e-06, 4.02254e-13, 1.71482e-20}, + {3.12065e+02, 1.25860e-05, 5.22197e-13, 2.22614e-20}, + {4.08414e+02, 1.64718e-05, 6.83423e-13, 2.91345e-20}, + {5.49591e+02, 2.21657e-05, 9.19662e-13, 3.92055e-20}, + {7.67451e+02, 3.09523e-05, 1.28422e-12, 5.47467e-20}, + {1.10725e+03, 4.46570e-05, 1.85283e-12, 7.89869e-20}, + {1.62060e+03, 6.53608e-05, 2.71184e-12, 1.15607e-19}, + {2.33999e+03, 9.43747e-05, 3.91564e-12, 1.66925e-19}, + {3.24367e+03, 1.30821e-04, 5.42783e-12, 2.31390e-19}, + {4.25716e+03, 1.71697e-04, 7.12376e-12, 3.03688e-19}, + {5.34010e+03, 2.15373e-04, 8.93591e-12, 3.80941e-19}, + } + }, + { + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 4.37192e-15, + /* size_moments = */ {4.03312e-08, 1.67336e-15, 7.13357e-23}, + /* opacity_coef_table = */ { + {3.27960e-01, 2.16737e-06, 1.80151e-11, 1.72491e-16}, + {4.38754e-01, 2.89959e-06, 2.41015e-11, 2.30770e-16}, + {5.78235e-01, 3.82140e-06, 3.17638e-11, 3.04139e-16}, + {7.53832e-01, 4.98189e-06, 4.14101e-11, 3.96504e-16}, + {1.04018e+00, 6.87442e-06, 5.71418e-11, 5.47146e-16}, + {1.41746e+00, 9.36786e-06, 7.78688e-11, 7.45623e-16}, + {1.95306e+00, 1.29077e-05, 1.07295e-10, 1.02741e-15}, + {2.71551e+00, 1.79470e-05, 1.49187e-10, 1.42858e-15}, + {3.79717e+00, 2.50964e-05, 2.08623e-10, 1.99781e-15}, + {5.29825e+00, 3.50184e-05, 2.91115e-10, 2.78791e-15}, + {7.37979e+00, 4.87780e-05, 4.05522e-10, 3.88380e-15}, + {1.02197e+01, 6.75525e-05, 5.61646e-10, 5.37953e-15}, + {1.40472e+01, 9.28592e-05, 7.72124e-10, 7.39643e-15}, + {1.92121e+01, 1.27015e-04, 1.05627e-09, 1.01201e-14}, + {2.61803e+01, 1.73108e-04, 1.43985e-09, 1.37985e-14}, + {3.55654e+01, 2.35211e-04, 1.95692e-09, 1.87600e-14}, + {4.82268e+01, 3.19039e-04, 2.65535e-09, 2.54677e-14}, + {6.54410e+01, 4.33093e-04, 3.60654e-09, 3.46142e-14}, + {8.90033e+01, 5.89369e-04, 4.91159e-09, 4.71850e-14}, + {1.21154e+02, 8.02913e-04, 6.69826e-09, 6.44364e-14}, + {1.64484e+02, 1.09135e-03, 9.11847e-09, 8.78899e-14}, + {2.22227e+02, 1.47698e-03, 1.23680e-08, 1.19551e-13}, + {2.99250e+02, 1.99360e-03, 1.67456e-08, 1.62501e-13}, + {4.02841e+02, 2.69134e-03, 2.26888e-08, 2.21192e-13}, + {5.41754e+02, 3.62947e-03, 3.07031e-08, 3.00611e-13}, + {7.24111e+02, 4.86183e-03, 4.12300e-08, 4.04886e-13}, + {9.58822e+02, 6.44664e-03, 5.47294e-08, 5.38055e-13}, + {1.26198e+03, 8.49034e-03, 7.20550e-08, 7.07781e-13}, + {1.66376e+03, 1.11958e-02, 9.48672e-08, 9.29402e-13}, + {2.21388e+03, 1.49013e-02, 1.25959e-07, 1.22898e-12}, + {2.99023e+03, 2.01435e-02, 1.69784e-07, 1.64820e-12}, + {4.11644e+03, 2.77858e-02, 2.33536e-07, 2.25436e-12}, + {5.78855e+03, 3.92074e-02, 3.28708e-07, 3.15462e-12}, + {8.29050e+03, 5.63946e-02, 4.71738e-07, 4.50079e-12}, + {1.19408e+04, 8.14776e-02, 6.79738e-07, 6.44637e-12}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.75542e-01, + /* size_moments = */ {6.60867e-06, 5.49310e-11, 5.25955e-16}, + /* opacity_coef_table = */ { + {7.60360e-02, 3.06536e-09, 1.27110e-16, 5.41456e-24}, + {9.07207e-02, 3.65737e-09, 1.51659e-16, 6.46027e-24}, + {1.09208e-01, 4.40266e-09, 1.82564e-16, 7.77673e-24}, + {1.32481e-01, 5.34093e-09, 2.21471e-16, 9.43407e-24}, + {1.58907e-01, 6.40629e-09, 2.65648e-16, 1.13159e-23}, + {1.91565e-01, 7.72285e-09, 3.20241e-16, 1.36414e-23}, + {2.30490e-01, 9.29212e-09, 3.85313e-16, 1.64133e-23}, + {2.76795e-01, 1.11589e-08, 4.62722e-16, 1.97107e-23}, + {3.33074e-01, 1.34277e-08, 5.56804e-16, 2.37184e-23}, + {4.05325e-01, 1.63405e-08, 6.77586e-16, 2.88634e-23}, + {5.08160e-01, 2.04863e-08, 8.49498e-16, 3.61863e-23}, + {6.72472e-01, 2.71105e-08, 1.12418e-15, 4.78871e-23}, + {9.48549e-01, 3.82404e-08, 1.58570e-15, 6.75467e-23}, + {1.41787e+00, 5.71610e-08, 2.37028e-15, 1.00968e-22}, + {2.19502e+00, 8.84912e-08, 3.66944e-15, 1.56308e-22}, + {3.46719e+00, 1.39778e-07, 5.79615e-15, 2.46901e-22}, + {5.76852e+00, 2.32556e-07, 9.64331e-15, 4.10780e-22}, + {1.17194e+01, 4.72463e-07, 1.95915e-14, 8.34544e-22}, + {3.16449e+01, 1.27575e-06, 5.29012e-14, 2.25345e-21}, + {8.68296e+01, 3.50050e-06, 1.45154e-13, 6.18318e-21}, + {1.92300e+02, 7.75250e-06, 3.21470e-13, 1.36938e-20}, + {3.36231e+02, 1.35550e-05, 5.62081e-13, 2.39432e-20}, + {5.05825e+02, 2.03921e-05, 8.45594e-13, 3.60201e-20}, + {7.20624e+02, 2.90517e-05, 1.20468e-12, 5.13160e-20}, + {9.77376e+02, 3.94025e-05, 1.63389e-12, 6.95995e-20}, + {1.18646e+03, 4.78315e-05, 1.98341e-12, 8.44881e-20}, + {1.23845e+03, 4.99275e-05, 2.07033e-12, 8.81904e-20}, + {1.11188e+03, 4.48251e-05, 1.85875e-12, 7.91777e-20}, + {8.76396e+02, 3.53316e-05, 1.46508e-12, 6.24086e-20}, + {6.22207e+02, 2.50840e-05, 1.04015e-12, 4.43077e-20}, + {4.07290e+02, 1.64197e-05, 6.80872e-13, 2.90033e-20}, + {2.50573e+02, 1.01017e-05, 4.18886e-13, 1.78434e-20}, + {1.47073e+02, 5.92921e-06, 2.45865e-13, 1.04732e-20}, + {8.33122e+01, 3.35870e-06, 1.39274e-13, 5.93271e-21}, + {4.59585e+01, 1.85280e-06, 7.68295e-14, 3.27273e-21}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.92019e-16, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12105e-23}, + /* opacity_coef_table = */ { + {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07299e-26}, + {1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25}, + {2.84365e-03, 1.14641e-10, 4.75376e-18, 2.02498e-25}, + {4.14191e-03, 1.66980e-10, 6.92409e-18, 2.94948e-25}, + {7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11485e-25}, + {1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07269e-25}, + {1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24}, + {2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84775e-24}, + {3.45425e-02, 1.39257e-09, 5.77452e-17, 2.45979e-24}, + {4.22006e-02, 1.70130e-09, 7.05474e-17, 3.00513e-24}, + {4.71420e-02, 1.90051e-09, 7.88079e-17, 3.35701e-24}, + {4.91934e-02, 1.98321e-09, 8.22373e-17, 3.50309e-24}, + {5.05162e-02, 2.03654e-09, 8.44486e-17, 3.59729e-24}, + {5.78201e-02, 2.33100e-09, 9.66587e-17, 4.11740e-24}, + {8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29670e-24}, + {1.78786e-01, 7.20769e-09, 2.98879e-16, 1.27315e-23}, + {4.36404e-01, 1.75935e-08, 7.29542e-16, 3.10766e-23}, + {1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22}, + {8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05872e-22}, + {3.92751e+01, 1.58336e-06, 6.56567e-14, 2.79680e-21}, + {1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20}, + {3.83709e+02, 1.54691e-05, 6.41451e-13, 2.73241e-20}, + {7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48614e-20}, + {1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28883e-20}, + {1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79619e-20}, + {1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47599e-20}, + {1.09978e+03, 4.43371e-05, 1.83851e-12, 7.83159e-20}, + {8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73700e-20}, + {5.38690e+02, 2.17171e-05, 9.00535e-13, 3.83604e-20}, + {3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39508e-20}, + {1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20}, + {1.13787e+02, 4.58728e-06, 1.90220e-13, 8.10285e-21}, + {6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48919e-21}, + {3.41529e+01, 1.37686e-06, 5.70939e-14, 2.43205e-21}, + {1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 6.23283e-17, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, + /* opacity_coef_table = */ { + {1.23621e-05, 4.98941e-13, 2.07173e-20, 8.83710e-28}, + {2.19539e-05, 8.86065e-13, 3.67916e-20, 1.56937e-27}, + {3.40291e-05, 1.37342e-12, 5.70280e-20, 2.43256e-27}, + {4.92310e-05, 1.98698e-12, 8.25041e-20, 3.51925e-27}, + {8.08514e-05, 3.26317e-12, 1.35494e-19, 5.77953e-27}, + {1.25020e-04, 5.04574e-12, 2.09508e-19, 8.93651e-27}, + {1.96586e-04, 7.93387e-12, 3.29418e-19, 1.40509e-26}, + {3.14491e-04, 1.26917e-11, 5.26937e-19, 2.24747e-26}, + {5.06850e-04, 2.04532e-11, 8.49130e-19, 3.62146e-26}, + {8.07286e-04, 3.25749e-11, 1.35229e-18, 5.76710e-26}, + {1.28668e-03, 5.19155e-11, 2.15506e-18, 9.19009e-26}, + {2.05241e-03, 8.28056e-11, 3.43709e-18, 1.46562e-25}, + {3.27026e-03, 1.31928e-10, 5.47555e-18, 2.33466e-25}, + {5.23898e-03, 2.11325e-10, 8.76988e-18, 3.73889e-25}, + {8.45023e-03, 3.40811e-10, 1.41417e-17, 6.02834e-25}, + {1.37158e-02, 5.53101e-10, 2.29473e-17, 9.78076e-25}, + {2.24100e-02, 9.03572e-10, 3.74827e-17, 1.59741e-24}, + {3.70042e-02, 1.49181e-09, 6.18765e-17, 2.63669e-24}, + {6.21585e-02, 2.50559e-09, 1.03913e-16, 4.42746e-24}, + {1.07033e-01, 4.31400e-09, 1.78894e-16, 7.62148e-24}, + {1.90089e-01, 7.66095e-09, 3.17659e-16, 1.35323e-23}, + {3.49470e-01, 1.40834e-08, 5.83928e-16, 2.48739e-23}, + {6.64947e-01, 2.67957e-08, 1.11096e-15, 4.73220e-23}, + {1.30413e+00, 5.25515e-08, 2.17873e-15, 9.28021e-23}, + {2.61640e+00, 1.05429e-07, 4.37088e-15, 1.86172e-22}, + {5.31791e+00, 2.14284e-07, 8.88372e-15, 3.78386e-22}, + {1.08366e+01, 4.36654e-07, 1.81025e-14, 7.71039e-22}, + {2.19132e+01, 8.82975e-07, 3.66056e-14, 1.55913e-21}, + {4.35354e+01, 1.75422e-06, 7.27247e-14, 3.09753e-21}, + {8.42362e+01, 3.39422e-06, 1.40714e-13, 5.99335e-21}, + {1.57704e+02, 6.35452e-06, 2.63439e-13, 1.12205e-20}, + {2.84822e+02, 1.14766e-05, 4.75784e-13, 2.02648e-20}, + {4.96653e+02, 2.00121e-05, 8.29639e-13, 3.53363e-20}, + {8.39966e+02, 3.38455e-05, 1.40313e-12, 5.97626e-20}, + {1.38932e+03, 5.59813e-05, 2.32081e-12, 9.88487e-20}, + } + }, +}; + +} // namespace fsn13 + +namespace fsn15 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 4.57071e-01, 6.46299e-01}, + {"O", 3.53548e-01, 3.53548e-01}, + {"Mg", 1.29204e-04, 1.29204e-04}, + {"Al", 2.22729e-07, 2.22729e-07}, + {"Si", 1.32242e-05, 1.32242e-05}, + {"S", 0.00000e+00, 0.00000e+00}, + {"Fe", 9.66658e-06, 9.66658e-06}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 1.53361e-25, + /* size_moments = */ {4.02634e-08, 1.66860e-15, 7.10566e-23}, + /* opacity_coef_table = */ { + {1.05240e-01, 4.24452e-09, 1.76110e-16, 7.50779e-24}, + {1.32588e-01, 5.34750e-09, 2.21874e-16, 9.45877e-24}, + {1.67016e-01, 6.73607e-09, 2.79487e-16, 1.19149e-23}, + {2.10360e-01, 8.48418e-09, 3.52018e-16, 1.50070e-23}, + {2.71887e-01, 1.09657e-08, 4.54979e-16, 1.93963e-23}, + {3.55694e-01, 1.43458e-08, 5.95222e-16, 2.53751e-23}, + {4.84932e-01, 1.95582e-08, 8.11491e-16, 3.45949e-23}, + {6.99767e-01, 2.82229e-08, 1.17100e-15, 4.99212e-23}, + {1.05860e+00, 4.26950e-08, 1.77146e-15, 7.55199e-23}, + {1.62902e+00, 6.57012e-08, 2.72602e-15, 1.16214e-22}, + {2.54260e+00, 1.02548e-07, 4.25481e-15, 1.81388e-22}, + {3.96488e+00, 1.59911e-07, 6.63487e-15, 2.82853e-22}, + {6.10630e+00, 2.46278e-07, 1.02183e-14, 4.35621e-22}, + {9.28766e+00, 3.74588e-07, 1.55421e-14, 6.62579e-22}, + {1.39265e+01, 5.61679e-07, 2.33047e-14, 9.93510e-22}, + {2.05382e+01, 8.28344e-07, 3.43689e-14, 1.46519e-21}, + {3.00649e+01, 1.21257e-06, 5.03110e-14, 2.14482e-21}, + {4.55102e+01, 1.83551e-06, 7.61572e-14, 3.24668e-21}, + {7.47839e+01, 3.01617e-06, 1.25144e-13, 5.33506e-21}, + {1.29621e+02, 5.22783e-06, 2.16909e-13, 9.24710e-21}, + {2.14820e+02, 8.66407e-06, 3.59482e-13, 1.53252e-20}, + {3.20002e+02, 1.29062e-05, 5.35494e-13, 2.28288e-20}, + {4.29768e+02, 1.73333e-05, 7.19179e-13, 3.06596e-20}, + {5.30827e+02, 2.14092e-05, 8.88291e-13, 3.78690e-20}, + {5.99694e+02, 2.41867e-05, 1.00353e-12, 4.27820e-20}, + {6.06537e+02, 2.44627e-05, 1.01498e-12, 4.32701e-20}, + {5.43262e+02, 2.19107e-05, 9.09100e-13, 3.87561e-20}, + {4.33545e+02, 1.74857e-05, 7.25499e-13, 3.09290e-20}, + {3.13324e+02, 1.26369e-05, 5.24319e-13, 2.23524e-20}, + {2.09006e+02, 8.42958e-06, 3.49753e-13, 1.49104e-20}, + {1.31150e+02, 5.28951e-06, 2.19468e-13, 9.35620e-21}, + {7.90681e+01, 3.18896e-06, 1.32313e-13, 5.64070e-21}, + {4.73389e+01, 1.90926e-06, 7.92175e-14, 3.37715e-21}, + {2.96409e+01, 1.19547e-06, 4.96014e-14, 2.11457e-21}, + {2.04708e+01, 8.25623e-07, 3.42560e-14, 1.46038e-21}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.56864e-15, + /* size_moments = */ {4.03318e-08, 1.67341e-15, 7.13397e-23}, + /* opacity_coef_table = */ { + {2.19890e-02, 8.86506e-10, 3.67621e-17, 1.56606e-24}, + {3.90612e-02, 1.57479e-09, 6.53041e-17, 2.78195e-24}, + {6.05539e-02, 2.44129e-09, 1.01236e-16, 4.31266e-24}, + {8.76116e-02, 3.53214e-09, 1.46473e-16, 6.23971e-24}, + {1.43288e-01, 5.77677e-09, 2.39554e-16, 1.02050e-23}, + {2.19266e-01, 8.83991e-09, 3.66578e-16, 1.56162e-23}, + {3.36256e-01, 1.35564e-08, 5.62165e-16, 2.39482e-23}, + {5.14336e-01, 2.07359e-08, 8.59887e-16, 3.66311e-23}, + {7.97216e-01, 3.21405e-08, 1.33282e-15, 5.67779e-23}, + {1.25414e+00, 5.05618e-08, 2.09672e-15, 8.93200e-23}, + {2.03450e+00, 8.20227e-08, 3.40136e-15, 1.44897e-22}, + {3.34648e+00, 1.34916e-07, 5.59477e-15, 2.38337e-22}, + {5.45893e+00, 2.20082e-07, 9.12646e-15, 3.88786e-22}, + {8.82117e+00, 3.55633e-07, 1.47476e-14, 6.28245e-22}, + {1.41825e+01, 5.71780e-07, 2.37109e-14, 1.01008e-21}, + {2.28419e+01, 9.20892e-07, 3.81880e-14, 1.62680e-21}, + {3.71178e+01, 1.49644e-06, 6.20550e-14, 2.64353e-21}, + {6.14272e+01, 2.47649e-06, 1.02696e-13, 4.37486e-21}, + {1.03847e+02, 4.18667e-06, 1.73615e-13, 7.39597e-21}, + {1.75507e+02, 7.07570e-06, 2.93419e-13, 1.24996e-20}, + {2.82060e+02, 1.13715e-05, 4.71559e-13, 2.00884e-20}, + {4.14519e+02, 1.67117e-05, 6.93009e-13, 2.95221e-20}, + {5.59961e+02, 2.25753e-05, 9.36165e-13, 3.98805e-20}, + {7.11024e+02, 2.86656e-05, 1.18872e-12, 5.06393e-20}, + {8.40805e+02, 3.38978e-05, 1.40569e-12, 5.98823e-20}, + {8.95312e+02, 3.60953e-05, 1.49682e-12, 6.37643e-20}, + {8.40415e+02, 3.38821e-05, 1.40504e-12, 5.98544e-20}, + {6.96693e+02, 2.80878e-05, 1.16476e-12, 4.96186e-20}, + {5.18202e+02, 2.08918e-05, 8.66351e-13, 3.69065e-20}, + {3.52864e+02, 1.42260e-05, 5.89932e-13, 2.51310e-20}, + {2.24210e+02, 9.03922e-06, 3.74843e-13, 1.59683e-20}, + {1.35138e+02, 5.44820e-06, 2.25929e-13, 9.62454e-21}, + {7.83119e+01, 3.15721e-06, 1.30925e-13, 5.57739e-21}, + {4.41553e+01, 1.78016e-06, 7.38206e-14, 3.14475e-21}, + {2.45888e+01, 9.91321e-07, 4.11086e-14, 1.75122e-21}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.13810e-14, + /* size_moments = */ {4.03159e-08, 1.67184e-15, 7.12201e-23}, + /* opacity_coef_table = */ { + {1.47700e-02, 5.95675e-10, 2.47138e-17, 1.05350e-24}, + {2.47694e-02, 9.98953e-10, 4.14453e-17, 1.76673e-24}, + {3.73580e-02, 1.50665e-09, 6.25090e-17, 2.66463e-24}, + {5.32060e-02, 2.14580e-09, 8.90266e-17, 3.79502e-24}, + {8.50036e-02, 3.42820e-09, 1.42232e-16, 6.06304e-24}, + {1.29213e-01, 5.21117e-09, 2.16205e-16, 9.21636e-24}, + {2.00170e-01, 8.07286e-09, 3.34932e-16, 1.42775e-23}, + {3.15560e-01, 1.27266e-08, 5.28008e-16, 2.25079e-23}, + {5.01384e-01, 2.02209e-08, 8.38937e-16, 3.57622e-23}, + {7.88907e-01, 3.18167e-08, 1.32003e-15, 5.62703e-23}, + {1.24250e+00, 5.01101e-08, 2.07900e-15, 8.86237e-23}, + {1.95225e+00, 7.87342e-08, 3.26658e-15, 1.39248e-22}, + {3.04002e+00, 1.22604e-07, 5.08669e-15, 2.16835e-22}, + {4.68918e+00, 1.89115e-07, 7.84613e-15, 3.34465e-22}, + {7.12599e+00, 2.87392e-07, 1.19235e-14, 5.08275e-22}, + {1.05834e+01, 4.26829e-07, 1.77086e-14, 7.54881e-22}, + {1.52356e+01, 6.14453e-07, 2.54928e-14, 1.08671e-21}, + {2.13345e+01, 8.60424e-07, 3.56978e-14, 1.52173e-21}, + {2.98061e+01, 1.20208e-06, 4.98728e-14, 2.12597e-21}, + {4.27642e+01, 1.72468e-06, 7.15548e-14, 3.05024e-21}, + {6.30370e+01, 2.54229e-06, 1.05476e-13, 4.49623e-21}, + {9.29361e+01, 3.74812e-06, 1.55505e-13, 6.62884e-21}, + {1.32987e+02, 5.36337e-06, 2.22519e-13, 9.48555e-21}, + {1.82150e+02, 7.34614e-06, 3.04782e-13, 1.29922e-20}, + {2.40388e+02, 9.69485e-06, 4.02226e-13, 1.71461e-20}, + {3.12065e+02, 1.25856e-05, 5.22160e-13, 2.22586e-20}, + {4.08414e+02, 1.64714e-05, 6.83375e-13, 2.91309e-20}, + {5.49591e+02, 2.21650e-05, 9.19598e-13, 3.92006e-20}, + {7.67451e+02, 3.09514e-05, 1.28413e-12, 5.47399e-20}, + {1.10725e+03, 4.46557e-05, 1.85271e-12, 7.89771e-20}, + {1.62060e+03, 6.53589e-05, 2.71166e-12, 1.15592e-19}, + {2.33999e+03, 9.43719e-05, 3.91537e-12, 1.66904e-19}, + {3.24367e+03, 1.30818e-04, 5.42745e-12, 2.31361e-19}, + {4.25716e+03, 1.71692e-04, 7.12327e-12, 3.03651e-19}, + {5.34010e+03, 2.15367e-04, 8.93529e-12, 3.80893e-19}, + } + }, + { + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 1.22287e-14, + /* size_moments = */ {4.03301e-08, 1.67324e-15, 7.13269e-23}, + /* opacity_coef_table = */ { + {3.27956e-01, 3.75639e-06, 5.26403e-11, 8.37270e-16}, + {4.38770e-01, 5.02579e-06, 7.04309e-11, 1.12026e-15}, + {5.78277e-01, 6.62387e-06, 9.28278e-11, 1.47653e-15}, + {7.53906e-01, 8.63573e-06, 1.21024e-10, 1.92505e-15}, + {1.04036e+00, 1.19174e-05, 1.67020e-10, 2.65676e-15}, + {1.41778e+00, 1.62414e-05, 2.27626e-10, 3.62091e-15}, + {1.95366e+00, 2.23811e-05, 3.13688e-10, 4.99012e-15}, + {2.71664e+00, 3.11237e-05, 4.36248e-10, 6.94018e-15}, + {3.79935e+00, 4.35320e-05, 6.10219e-10, 9.70860e-15}, + {5.30234e+00, 6.07596e-05, 8.51798e-10, 1.35534e-14}, + {7.38743e+00, 8.46654e-05, 1.18710e-09, 1.88910e-14}, + {1.02340e+01, 1.17314e-04, 1.64516e-09, 2.61851e-14}, + {1.40739e+01, 1.61376e-04, 2.26365e-09, 3.60378e-14}, + {1.92619e+01, 2.20951e-04, 3.10040e-09, 4.93757e-14}, + {2.62735e+01, 3.01546e-04, 4.23341e-09, 6.74511e-14}, + {3.57407e+01, 4.10519e-04, 5.76727e-09, 9.19507e-14}, + {4.85587e+01, 5.58361e-04, 7.85200e-09, 1.25306e-13}, + {6.60737e+01, 7.60948e-04, 1.07159e-08, 1.71237e-13}, + {9.02145e+01, 1.04125e-03, 1.46920e-08, 2.35213e-13}, + {1.23479e+02, 1.42959e-03, 2.02271e-08, 3.24675e-13}, + {1.68976e+02, 1.96503e-03, 2.79128e-08, 4.49723e-13}, + {2.30962e+02, 2.70317e-03, 3.86182e-08, 6.25581e-13}, + {3.16043e+02, 3.73154e-03, 5.37252e-08, 8.76701e-13}, + {4.33583e+02, 5.17180e-03, 7.51313e-08, 1.23638e-12}, + {5.93567e+02, 7.14700e-03, 1.04677e-07, 1.73582e-12}, + {8.03334e+02, 9.73553e-03, 1.43375e-07, 2.38969e-12}, + {1.06890e+03, 1.29850e-02, 1.91575e-07, 3.19823e-12}, + {1.40232e+03, 1.70036e-02, 2.50333e-07, 4.17041e-12}, + {1.82952e+03, 2.20557e-02, 3.22829e-07, 5.34792e-12}, + {2.39537e+03, 2.86193e-02, 4.15124e-07, 6.81663e-12}, + {3.17137e+03, 3.74648e-02, 5.37088e-07, 8.71845e-12}, + {4.27121e+03, 4.98190e-02, 7.04376e-07, 1.12776e-11}, + {5.87303e+03, 6.75884e-02, 9.40996e-07, 1.48329e-11}, + {8.22455e+03, 9.33574e-02, 1.27863e-06, 1.98186e-11}, + {1.15719e+04, 1.29494e-01, 1.74429e-06, 2.65764e-11}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.89229e-01, + /* size_moments = */ {1.14540e-05, 1.60512e-10, 2.55303e-15}, + /* opacity_coef_table = */ { + {7.60360e-02, 3.06536e-09, 1.27110e-16, 5.41456e-24}, + {9.07207e-02, 3.65737e-09, 1.51659e-16, 6.46027e-24}, + {1.09208e-01, 4.40266e-09, 1.82564e-16, 7.77673e-24}, + {1.32481e-01, 5.34093e-09, 2.21471e-16, 9.43407e-24}, + {1.58907e-01, 6.40629e-09, 2.65648e-16, 1.13159e-23}, + {1.91565e-01, 7.72285e-09, 3.20241e-16, 1.36414e-23}, + {2.30490e-01, 9.29212e-09, 3.85313e-16, 1.64133e-23}, + {2.76795e-01, 1.11589e-08, 4.62722e-16, 1.97107e-23}, + {3.33074e-01, 1.34277e-08, 5.56804e-16, 2.37184e-23}, + {4.05325e-01, 1.63405e-08, 6.77586e-16, 2.88634e-23}, + {5.08160e-01, 2.04863e-08, 8.49498e-16, 3.61864e-23}, + {6.72472e-01, 2.71105e-08, 1.12418e-15, 4.78871e-23}, + {9.48549e-01, 3.82404e-08, 1.58570e-15, 6.75467e-23}, + {1.41787e+00, 5.71610e-08, 2.37028e-15, 1.00968e-22}, + {2.19502e+00, 8.84912e-08, 3.66944e-15, 1.56308e-22}, + {3.46719e+00, 1.39778e-07, 5.79615e-15, 2.46901e-22}, + {5.76852e+00, 2.32556e-07, 9.64331e-15, 4.10780e-22}, + {1.17194e+01, 4.72463e-07, 1.95915e-14, 8.34544e-22}, + {3.16449e+01, 1.27575e-06, 5.29013e-14, 2.25345e-21}, + {8.68296e+01, 3.50050e-06, 1.45154e-13, 6.18318e-21}, + {1.92300e+02, 7.75250e-06, 3.21470e-13, 1.36938e-20}, + {3.36231e+02, 1.35550e-05, 5.62081e-13, 2.39432e-20}, + {5.05825e+02, 2.03921e-05, 8.45594e-13, 3.60201e-20}, + {7.20624e+02, 2.90517e-05, 1.20468e-12, 5.13160e-20}, + {9.77376e+02, 3.94025e-05, 1.63389e-12, 6.95995e-20}, + {1.18646e+03, 4.78315e-05, 1.98341e-12, 8.44881e-20}, + {1.23845e+03, 4.99275e-05, 2.07033e-12, 8.81904e-20}, + {1.11188e+03, 4.48251e-05, 1.85875e-12, 7.91777e-20}, + {8.76396e+02, 3.53316e-05, 1.46508e-12, 6.24086e-20}, + {6.22207e+02, 2.50840e-05, 1.04015e-12, 4.43077e-20}, + {4.07290e+02, 1.64197e-05, 6.80872e-13, 2.90033e-20}, + {2.50573e+02, 1.01017e-05, 4.18886e-13, 1.78434e-20}, + {1.47073e+02, 5.92921e-06, 2.45865e-13, 1.04732e-20}, + {8.33122e+01, 3.35870e-06, 1.39274e-13, 5.93271e-21}, + {4.59585e+01, 1.85280e-06, 7.68295e-14, 3.27273e-21}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.47463e-15, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12105e-23}, + /* opacity_coef_table = */ { + {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07299e-26}, + {1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25}, + {2.84365e-03, 1.14641e-10, 4.75376e-18, 2.02498e-25}, + {4.14191e-03, 1.66980e-10, 6.92409e-18, 2.94948e-25}, + {7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11485e-25}, + {1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07269e-25}, + {1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24}, + {2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84775e-24}, + {3.45425e-02, 1.39257e-09, 5.77452e-17, 2.45979e-24}, + {4.22006e-02, 1.70130e-09, 7.05474e-17, 3.00513e-24}, + {4.71420e-02, 1.90051e-09, 7.88079e-17, 3.35701e-24}, + {4.91934e-02, 1.98321e-09, 8.22373e-17, 3.50309e-24}, + {5.05162e-02, 2.03654e-09, 8.44486e-17, 3.59729e-24}, + {5.78201e-02, 2.33100e-09, 9.66587e-17, 4.11741e-24}, + {8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29670e-24}, + {1.78786e-01, 7.20769e-09, 2.98879e-16, 1.27315e-23}, + {4.36404e-01, 1.75935e-08, 7.29542e-16, 3.10766e-23}, + {1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22}, + {8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05872e-22}, + {3.92751e+01, 1.58336e-06, 6.56567e-14, 2.79680e-21}, + {1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20}, + {3.83709e+02, 1.54691e-05, 6.41451e-13, 2.73241e-20}, + {7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48614e-20}, + {1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28883e-20}, + {1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79619e-20}, + {1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47599e-20}, + {1.09978e+03, 4.43371e-05, 1.83851e-12, 7.83159e-20}, + {8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73700e-20}, + {5.38690e+02, 2.17171e-05, 9.00535e-13, 3.83604e-20}, + {3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39508e-20}, + {1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20}, + {1.13787e+02, 4.58728e-06, 1.90220e-13, 8.10285e-21}, + {6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48919e-21}, + {3.41529e+01, 1.37686e-06, 5.70939e-14, 2.43205e-21}, + {1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 2.15191e-16, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, + /* opacity_coef_table = */ { + {1.23614e-05, 4.98551e-13, 2.06942e-20, 8.82572e-28}, + {2.19525e-05, 8.85374e-13, 3.67505e-20, 1.56735e-27}, + {3.40270e-05, 1.37235e-12, 5.69643e-20, 2.42942e-27}, + {4.92280e-05, 1.98543e-12, 8.24119e-20, 3.51472e-27}, + {8.08465e-05, 3.26062e-12, 1.35343e-19, 5.77209e-27}, + {1.25012e-04, 5.04181e-12, 2.09274e-19, 8.92500e-27}, + {1.96574e-04, 7.92769e-12, 3.29050e-19, 1.40328e-26}, + {3.14473e-04, 1.26818e-11, 5.26348e-19, 2.24457e-26}, + {5.06822e-04, 2.04373e-11, 8.48182e-19, 3.61680e-26}, + {8.07243e-04, 3.25496e-11, 1.35079e-18, 5.75968e-26}, + {1.28661e-03, 5.18753e-11, 2.15265e-18, 9.17827e-26}, + {2.05232e-03, 8.27416e-11, 3.43325e-18, 1.46374e-25}, + {3.27011e-03, 1.31826e-10, 5.46945e-18, 2.33165e-25}, + {5.23877e-03, 2.11162e-10, 8.76012e-18, 3.73409e-25}, + {8.44994e-03, 3.40550e-10, 1.41259e-17, 6.02059e-25}, + {1.37154e-02, 5.52677e-10, 2.29218e-17, 9.76820e-25}, + {2.24094e-02, 9.02883e-10, 3.74411e-17, 1.59536e-24}, + {3.70035e-02, 1.49068e-09, 6.18079e-17, 2.63331e-24}, + {6.21576e-02, 2.50369e-09, 1.03798e-16, 4.42178e-24}, + {1.07032e-01, 4.31074e-09, 1.78696e-16, 7.61171e-24}, + {1.90087e-01, 7.65516e-09, 3.17308e-16, 1.35149e-23}, + {3.49468e-01, 1.40728e-08, 5.83283e-16, 2.48420e-23}, + {6.64945e-01, 2.67755e-08, 1.10973e-15, 4.72613e-23}, + {1.30413e+00, 5.25119e-08, 2.17633e-15, 9.26832e-23}, + {2.61639e+00, 1.05349e-07, 4.36605e-15, 1.85933e-22}, + {5.31790e+00, 2.14123e-07, 8.87391e-15, 3.77901e-22}, + {1.08366e+01, 4.36326e-07, 1.80825e-14, 7.70051e-22}, + {2.19131e+01, 8.82310e-07, 3.65652e-14, 1.55714e-21}, + {4.35353e+01, 1.75290e-06, 7.26444e-14, 3.09356e-21}, + {8.42362e+01, 3.39166e-06, 1.40558e-13, 5.98567e-21}, + {1.57704e+02, 6.34974e-06, 2.63148e-13, 1.12061e-20}, + {2.84822e+02, 1.14680e-05, 4.75258e-13, 2.02388e-20}, + {4.96653e+02, 1.99971e-05, 8.28723e-13, 3.52910e-20}, + {8.39966e+02, 3.38201e-05, 1.40158e-12, 5.96860e-20}, + {1.38932e+03, 5.59392e-05, 2.31824e-12, 9.87221e-20}, + } + }, +}; + +} // namespace fsn15 + +namespace fsn50 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 2.79057e-01, 2.79167e-01}, + {"O", 7.20575e-01, 7.20575e-01}, + {"Mg", 2.49793e-04, 2.49794e-04}, + {"Al", 1.66468e-08, 1.66468e-08}, + {"Si", 4.01058e-06, 4.01099e-06}, + {"S", 0.00000e+00, 0.00000e+00}, + {"Fe", 4.15804e-06, 4.15804e-06}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 2.33171e-24, + /* size_moments = */ {4.02891e-08, 1.67016e-15, 7.11339e-23}, + /* opacity_coef_table = */ { + {1.05240e-01, 1.77320e-08, 3.18492e-15, 5.89732e-22}, + {1.32588e-01, 2.23399e-08, 4.01256e-15, 7.42980e-22}, + {1.67016e-01, 2.81408e-08, 5.05449e-15, 9.35908e-22}, + {2.10360e-01, 3.54438e-08, 6.36620e-15, 1.17879e-21}, + {2.71887e-01, 4.58106e-08, 8.22824e-15, 1.52357e-21}, + {3.55694e-01, 5.99313e-08, 1.07645e-14, 1.99320e-21}, + {4.84932e-01, 8.17069e-08, 1.46757e-14, 2.71741e-21}, + {6.99767e-01, 1.17905e-07, 2.11774e-14, 3.92128e-21}, + {1.05860e+00, 1.78364e-07, 3.20367e-14, 5.93204e-21}, + {1.62902e+00, 2.74475e-07, 4.92997e-14, 9.12851e-21}, + {2.54260e+00, 4.28406e-07, 7.69478e-14, 1.42479e-20}, + {3.96488e+00, 6.68047e-07, 1.19991e-13, 2.22179e-20}, + {6.10630e+00, 1.02886e-06, 1.84797e-13, 3.42178e-20}, + {9.28766e+00, 1.56489e-06, 2.81076e-13, 5.20451e-20}, + {1.39265e+01, 2.34649e-06, 4.21463e-13, 7.80396e-20}, + {2.05382e+01, 3.46051e-06, 6.21558e-13, 1.15090e-19}, + {3.00649e+01, 5.06568e-06, 9.09868e-13, 1.68475e-19}, + {4.55102e+01, 7.66807e-06, 1.37729e-12, 2.55025e-19}, + {7.47839e+01, 1.26004e-05, 2.26322e-12, 4.19065e-19}, + {1.29621e+02, 2.18400e-05, 3.92277e-12, 7.26354e-19}, + {2.14820e+02, 3.61953e-05, 6.50119e-12, 1.20378e-18}, + {3.20002e+02, 5.39175e-05, 9.68435e-12, 1.79319e-18}, + {4.29768e+02, 7.24122e-05, 1.30063e-11, 2.40829e-18}, + {5.30829e+02, 8.94401e-05, 1.60647e-11, 2.97460e-18}, + {5.99696e+02, 1.01044e-04, 1.81489e-11, 3.36051e-18}, + {6.06539e+02, 1.02197e-04, 1.83560e-11, 3.39886e-18}, + {5.43264e+02, 9.15353e-05, 1.64410e-11, 3.04428e-18}, + {4.33547e+02, 7.30489e-05, 1.31206e-11, 2.42946e-18}, + {3.13324e+02, 5.27923e-05, 9.48225e-12, 1.75577e-18}, + {2.09008e+02, 3.52161e-05, 6.32532e-12, 1.17122e-18}, + {1.31150e+02, 2.20976e-05, 3.96905e-12, 7.34924e-19}, + {7.90692e+01, 1.33225e-05, 2.39291e-12, 4.43080e-19}, + {4.73403e+01, 7.97645e-06, 1.43269e-12, 2.65282e-19}, + {2.96433e+01, 4.99469e-06, 8.97122e-13, 1.66115e-19}, + {2.04754e+01, 3.45001e-06, 6.19680e-13, 1.14743e-19}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.62486e-10, + /* size_moments = */ {1.68491e-07, 3.02634e-14, 5.60369e-21}, + /* opacity_coef_table = */ { + {2.19890e-02, 2.92460e-09, 4.05846e-16, 5.77498e-23}, + {3.90612e-02, 5.19526e-09, 7.20944e-16, 1.02587e-22}, + {6.05539e-02, 8.05385e-09, 1.11763e-15, 1.59033e-22}, + {8.76116e-02, 1.16526e-08, 1.61703e-15, 2.30095e-22}, + {1.43288e-01, 1.90577e-08, 2.64462e-15, 3.76317e-22}, + {2.19266e-01, 2.91631e-08, 4.04694e-15, 5.75860e-22}, + {3.36256e-01, 4.47230e-08, 6.20619e-15, 8.83109e-22}, + {5.14336e-01, 6.84082e-08, 9.49297e-15, 1.35080e-21}, + {7.97216e-01, 1.06032e-07, 1.47140e-14, 2.09373e-21}, + {1.25414e+00, 1.66804e-07, 2.31474e-14, 3.29375e-21}, + {2.03450e+00, 2.70594e-07, 3.75503e-14, 5.34322e-21}, + {3.34648e+00, 4.45091e-07, 6.17651e-14, 8.78886e-21}, + {5.45893e+00, 7.26054e-07, 1.00754e-13, 1.43368e-20}, + {8.82117e+00, 1.17324e-06, 1.62810e-13, 2.31671e-20}, + {1.41825e+01, 1.88631e-06, 2.61763e-13, 3.72475e-20}, + {2.28419e+01, 3.03804e-06, 4.21588e-13, 5.99898e-20}, + {3.71178e+01, 4.93677e-06, 6.85074e-13, 9.74826e-20}, + {6.14273e+01, 8.17002e-06, 1.13375e-12, 1.61327e-19}, + {1.03847e+02, 1.38119e-05, 1.91667e-12, 2.72733e-19}, + {1.75507e+02, 2.33429e-05, 3.23928e-12, 4.60933e-19}, + {2.82060e+02, 3.75148e-05, 5.20591e-12, 7.40775e-19}, + {4.14519e+02, 5.51322e-05, 7.65067e-12, 1.08865e-18}, + {5.59962e+02, 7.44767e-05, 1.03351e-11, 1.47063e-18}, + {7.11026e+02, 9.45685e-05, 1.31232e-11, 1.86737e-18}, + {8.40809e+02, 1.11830e-04, 1.55186e-11, 2.20822e-18}, + {8.95315e+02, 1.19080e-04, 1.65246e-11, 2.35137e-18}, + {8.40416e+02, 1.11778e-04, 1.55114e-11, 2.20719e-18}, + {6.96694e+02, 9.26624e-05, 1.28587e-11, 1.82973e-18}, + {5.18204e+02, 6.89226e-05, 9.56436e-12, 1.36096e-18}, + {3.52865e+02, 4.69321e-05, 6.51275e-12, 9.26731e-19}, + {2.24211e+02, 2.98208e-05, 4.13822e-12, 5.88848e-19}, + {1.35138e+02, 1.79738e-05, 2.49421e-12, 3.54913e-19}, + {7.83122e+01, 1.04158e-05, 1.44539e-12, 2.05672e-19}, + {4.41556e+01, 5.87282e-06, 8.14969e-13, 1.15966e-19}, + {2.45896e+01, 3.27050e-06, 4.53847e-13, 6.45802e-20}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 1.21446e-09, + /* size_moments = */ {1.33003e-07, 1.84568e-14, 2.62630e-21}, + /* opacity_coef_table = */ { + {1.47700e-02, 8.71144e-10, 5.19508e-17, 3.12839e-24}, + {2.47694e-02, 1.46092e-09, 8.71220e-17, 5.24635e-24}, + {3.73580e-02, 2.20340e-09, 1.31400e-16, 7.91270e-24}, + {5.32060e-02, 3.13813e-09, 1.87143e-16, 1.12694e-23}, + {8.50036e-02, 5.01357e-09, 2.98985e-16, 1.80044e-23}, + {1.29213e-01, 7.62106e-09, 4.54483e-16, 2.73683e-23}, + {2.00170e-01, 1.18061e-08, 7.04061e-16, 4.23974e-23}, + {3.15560e-01, 1.86119e-08, 1.10993e-15, 6.68379e-23}, + {5.01384e-01, 2.95719e-08, 1.76353e-15, 1.06197e-22}, + {7.88907e-01, 4.65303e-08, 2.77484e-15, 1.67096e-22}, + {1.24250e+00, 7.32834e-08, 4.37027e-15, 2.63171e-22}, + {1.95225e+00, 1.15145e-07, 6.86667e-15, 4.13500e-22}, + {3.04002e+00, 1.79302e-07, 1.06927e-14, 6.43899e-22}, + {4.68918e+00, 2.76571e-07, 1.64933e-14, 9.93203e-22}, + {7.12599e+00, 4.20295e-07, 2.50644e-14, 1.50934e-21}, + {1.05834e+01, 6.24215e-07, 3.72252e-14, 2.24164e-21}, + {1.52356e+01, 8.98605e-07, 5.35885e-14, 3.22701e-21}, + {2.13345e+01, 1.25832e-06, 7.50404e-14, 4.51881e-21}, + {2.98061e+01, 1.75798e-06, 1.04837e-13, 6.31314e-21}, + {4.27642e+01, 2.52226e-06, 1.50415e-13, 9.05777e-21}, + {6.30370e+01, 3.71796e-06, 2.21721e-13, 1.33517e-20}, + {9.29361e+01, 5.48143e-06, 3.26886e-13, 1.96845e-20}, + {1.32987e+02, 7.84365e-06, 4.67758e-13, 2.81676e-20}, + {1.82150e+02, 1.07433e-05, 6.40681e-13, 3.85808e-20}, + {2.40388e+02, 1.41782e-05, 8.45520e-13, 5.09158e-20}, + {3.12065e+02, 1.84058e-05, 1.09763e-12, 6.60977e-20}, + {4.08414e+02, 2.40885e-05, 1.43652e-12, 8.65051e-20}, + {5.49591e+02, 3.24152e-05, 1.93309e-12, 1.16407e-19}, + {7.67451e+02, 4.52647e-05, 2.69937e-12, 1.62552e-19}, + {1.10725e+03, 6.53066e-05, 3.89457e-12, 2.34525e-19}, + {1.62060e+03, 9.55840e-05, 5.70017e-12, 3.43255e-19}, + {2.33999e+03, 1.38014e-04, 8.23049e-12, 4.95627e-19}, + {3.24369e+03, 1.91315e-04, 1.14091e-11, 6.87037e-19}, + {4.25718e+03, 2.51091e-04, 1.49739e-11, 9.01702e-19}, + {5.34014e+03, 3.14965e-04, 1.87830e-11, 1.13108e-18}, + } + }, + { + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 2.41799e-13, + /* size_moments = */ {5.89806e-08, 3.51732e-15, 2.11807e-22}, + /* opacity_coef_table = */ { + {3.27960e-01, 2.23600e-07, 2.14215e-13, 2.51135e-19}, + {4.38752e-01, 2.99136e-07, 2.86582e-13, 3.35973e-19}, + {5.78230e-01, 3.94231e-07, 3.77685e-13, 4.42778e-19}, + {7.53823e-01, 5.13949e-07, 4.92378e-13, 5.77238e-19}, + {1.04013e+00, 7.09149e-07, 6.79388e-13, 7.96479e-19}, + {1.41735e+00, 9.66336e-07, 9.25781e-13, 1.08534e-18}, + {1.95292e+00, 1.33148e-06, 1.27560e-12, 1.49545e-18}, + {2.71530e+00, 1.85127e-06, 1.77357e-12, 2.07925e-18}, + {3.79675e+00, 2.58859e-06, 2.47995e-12, 2.90737e-18}, + {5.29742e+00, 3.61173e-06, 3.46016e-12, 4.05652e-18}, + {7.37832e+00, 5.03048e-06, 4.81937e-12, 5.65000e-18}, + {1.02167e+01, 6.96570e-06, 6.67339e-12, 7.82359e-18}, + {1.40420e+01, 9.57377e-06, 9.17203e-12, 1.07529e-17}, + {1.92020e+01, 1.30918e-05, 1.25425e-11, 1.47044e-17}, + {2.61614e+01, 1.78368e-05, 1.70885e-11, 2.00340e-17}, + {3.55303e+01, 2.42246e-05, 2.32084e-11, 2.72089e-17}, + {4.81604e+01, 3.28360e-05, 3.14588e-11, 3.68819e-17}, + {6.53156e+01, 4.45330e-05, 4.26657e-11, 5.00213e-17}, + {8.87641e+01, 6.05213e-05, 5.79846e-11, 6.79824e-17}, + {1.20700e+02, 8.22973e-05, 7.88495e-11, 9.24471e-17}, + {1.63611e+02, 1.11558e-04, 1.06888e-10, 1.25326e-16}, + {2.20556e+02, 1.50393e-04, 1.44104e-10, 1.68969e-16}, + {2.96069e+02, 2.01894e-04, 1.93464e-10, 2.26864e-16}, + {3.96959e+02, 2.70713e-04, 2.59434e-10, 3.04254e-16}, + {5.31398e+02, 3.62437e-04, 3.47381e-10, 4.07456e-16}, + {7.06744e+02, 4.82105e-04, 4.62166e-10, 5.42204e-16}, + {9.30503e+02, 6.34887e-04, 6.08797e-10, 7.14450e-16}, + {1.21574e+03, 8.29802e-04, 7.96038e-10, 9.34622e-16}, + {1.58603e+03, 1.08311e-03, 1.03970e-09, 1.22157e-15}, + {2.07753e+03, 1.41988e-03, 1.36429e-09, 1.60466e-15}, + {2.74067e+03, 1.87531e-03, 1.80443e-09, 2.12568e-15}, + {3.64502e+03, 2.49832e-03, 2.40876e-09, 2.84400e-15}, + {4.89065e+03, 3.35972e-03, 3.24810e-09, 3.84654e-15}, + {6.62881e+03, 4.56615e-03, 4.42856e-09, 5.26292e-15}, + {9.09708e+03, 6.28233e-03, 6.11057e-09, 7.28448e-15}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.09849e-04, + /* size_moments = */ {6.81790e-07, 6.53175e-13, 7.65748e-19}, + /* opacity_coef_table = */ { + {7.60360e-02, 7.46380e-09, 7.39712e-16, 7.36277e-23}, + {9.07207e-02, 8.90526e-09, 8.82572e-16, 8.78473e-23}, + {1.09208e-01, 1.07200e-08, 1.06242e-15, 1.05749e-22}, + {1.32481e-01, 1.30045e-08, 1.28884e-15, 1.28285e-22}, + {1.58907e-01, 1.55986e-08, 1.54592e-15, 1.53874e-22}, + {1.91565e-01, 1.88042e-08, 1.86363e-15, 1.85497e-22}, + {2.30490e-01, 2.26252e-08, 2.24231e-15, 2.23190e-22}, + {2.76795e-01, 2.71706e-08, 2.69279e-15, 2.68028e-22}, + {3.33074e-01, 3.26950e-08, 3.24029e-15, 3.22524e-22}, + {4.05325e-01, 3.97872e-08, 3.94318e-15, 3.92487e-22}, + {5.08160e-01, 4.98817e-08, 4.94361e-15, 4.92065e-22}, + {6.72472e-01, 6.60108e-08, 6.54211e-15, 6.51173e-22}, + {9.48549e-01, 9.31109e-08, 9.22792e-15, 9.18506e-22}, + {1.41787e+00, 1.39180e-07, 1.37937e-14, 1.37297e-21}, + {2.19502e+00, 2.15466e-07, 2.13541e-14, 2.12549e-21}, + {3.46719e+00, 3.40344e-07, 3.37304e-14, 3.35738e-21}, + {5.76852e+00, 5.66246e-07, 5.61188e-14, 5.58582e-21}, + {1.17194e+01, 1.15039e-06, 1.14012e-13, 1.13482e-20}, + {3.16449e+01, 3.10631e-06, 3.07856e-13, 3.06426e-20}, + {8.68296e+01, 8.52331e-06, 8.44717e-13, 8.40795e-20}, + {1.92300e+02, 1.88764e-05, 1.87078e-12, 1.86209e-19}, + {3.36231e+02, 3.30049e-05, 3.27100e-12, 3.25581e-19}, + {5.05825e+02, 4.96525e-05, 4.92089e-12, 4.89804e-19}, + {7.20624e+02, 7.07374e-05, 7.01055e-12, 6.97800e-19}, + {9.77376e+02, 9.59406e-05, 9.50836e-12, 9.46420e-19}, + {1.18646e+03, 1.16464e-04, 1.15424e-11, 1.14888e-18}, + {1.23845e+03, 1.21568e-04, 1.20482e-11, 1.19922e-18}, + {1.11188e+03, 1.09144e-04, 1.08169e-11, 1.07667e-18}, + {8.76396e+02, 8.60282e-05, 8.52597e-12, 8.48638e-19}, + {6.22207e+02, 6.10766e-05, 6.05311e-12, 6.02500e-19}, + {4.07290e+02, 3.99801e-05, 3.96230e-12, 3.94390e-19}, + {2.50573e+02, 2.45966e-05, 2.43769e-12, 2.42636e-19}, + {1.47073e+02, 1.44369e-05, 1.43080e-12, 1.42415e-19}, + {8.33122e+01, 8.17804e-06, 8.10499e-13, 8.06735e-20}, + {4.59586e+01, 4.51135e-06, 4.47106e-13, 4.45029e-20}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 3.41863e-11, + /* size_moments = */ {9.81613e-08, 9.72845e-15, 9.68327e-22}, + /* opacity_coef_table = */ { + {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07300e-26}, + {1.81240e-03, 7.30662e-11, 3.02982e-18, 1.29062e-25}, + {2.84365e-03, 1.14641e-10, 4.75377e-18, 2.02498e-25}, + {4.14191e-03, 1.66980e-10, 6.92410e-18, 2.94948e-25}, + {7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11486e-25}, + {1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07270e-25}, + {1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24}, + {2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84776e-24}, + {3.45425e-02, 1.39257e-09, 5.77453e-17, 2.45980e-24}, + {4.22006e-02, 1.70130e-09, 7.05475e-17, 3.00514e-24}, + {4.71420e-02, 1.90051e-09, 7.88080e-17, 3.35701e-24}, + {4.91934e-02, 1.98321e-09, 8.22374e-17, 3.50310e-24}, + {5.05162e-02, 2.03654e-09, 8.44487e-17, 3.59729e-24}, + {5.78201e-02, 2.33100e-09, 9.66588e-17, 4.11741e-24}, + {8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29671e-24}, + {1.78786e-01, 7.20770e-09, 2.98880e-16, 1.27315e-23}, + {4.36404e-01, 1.75935e-08, 7.29543e-16, 3.10766e-23}, + {1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22}, + {8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05873e-22}, + {3.92751e+01, 1.58336e-06, 6.56568e-14, 2.79681e-21}, + {1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20}, + {3.83709e+02, 1.54691e-05, 6.41452e-13, 2.73242e-20}, + {7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48615e-20}, + {1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28885e-20}, + {1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79620e-20}, + {1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47600e-20}, + {1.09978e+03, 4.43372e-05, 1.83852e-12, 7.83160e-20}, + {8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73701e-20}, + {5.38690e+02, 2.17171e-05, 9.00536e-13, 3.83605e-20}, + {3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39509e-20}, + {1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20}, + {1.13787e+02, 4.58729e-06, 1.90220e-13, 8.10286e-21}, + {6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48920e-21}, + {3.41529e+01, 1.37686e-06, 5.70940e-14, 2.43205e-21}, + {1.81893e+01, 7.33294e-07, 3.04073e-14, 1.29527e-21}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 2.53950e-17, + /* size_moments = */ {4.03146e-08, 1.67172e-15, 7.12107e-23}, + /* opacity_coef_table = */ { + {1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28}, + {2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27}, + {3.40288e-05, 1.37326e-12, 5.70184e-20, 2.43208e-27}, + {4.92305e-05, 1.98674e-12, 8.24901e-20, 3.51856e-27}, + {8.08507e-05, 3.26278e-12, 1.35471e-19, 5.77841e-27}, + {1.25019e-04, 5.04514e-12, 2.09472e-19, 8.93477e-27}, + {1.96584e-04, 7.93293e-12, 3.29363e-19, 1.40481e-26}, + {3.14489e-04, 1.26902e-11, 5.26848e-19, 2.24703e-26}, + {5.06846e-04, 2.04508e-11, 8.48987e-19, 3.62076e-26}, + {8.07280e-04, 3.25711e-11, 1.35207e-18, 5.76597e-26}, + {1.28667e-03, 5.19094e-11, 2.15469e-18, 9.18830e-26}, + {2.05240e-03, 8.27959e-11, 3.43651e-18, 1.46534e-25}, + {3.27023e-03, 1.31912e-10, 5.47463e-18, 2.33420e-25}, + {5.23895e-03, 2.11300e-10, 8.76840e-18, 3.73817e-25}, + {8.45019e-03, 3.40772e-10, 1.41393e-17, 6.02717e-25}, + {1.37157e-02, 5.53037e-10, 2.29434e-17, 9.77885e-25}, + {2.24099e-02, 9.03468e-10, 3.74764e-17, 1.59710e-24}, + {3.70041e-02, 1.49164e-09, 6.18661e-17, 2.63618e-24}, + {6.21584e-02, 2.50530e-09, 1.03896e-16, 4.42660e-24}, + {1.07033e-01, 4.31351e-09, 1.78864e-16, 7.62000e-24}, + {1.90089e-01, 7.66007e-09, 3.17606e-16, 1.35297e-23}, + {3.49470e-01, 1.40818e-08, 5.83831e-16, 2.48691e-23}, + {6.64947e-01, 2.67926e-08, 1.11077e-15, 4.73128e-23}, + {1.30413e+00, 5.25455e-08, 2.17837e-15, 9.27841e-23}, + {2.61640e+00, 1.05417e-07, 4.37015e-15, 1.86136e-22}, + {5.31790e+00, 2.14259e-07, 8.88223e-15, 3.78313e-22}, + {1.08366e+01, 4.36604e-07, 1.80995e-14, 7.70889e-22}, + {2.19132e+01, 8.82874e-07, 3.65995e-14, 1.55883e-21}, + {4.35354e+01, 1.75402e-06, 7.27125e-14, 3.09693e-21}, + {8.42362e+01, 3.39383e-06, 1.40690e-13, 5.99219e-21}, + {1.57704e+02, 6.35380e-06, 2.63395e-13, 1.12183e-20}, + {2.84822e+02, 1.14753e-05, 4.75704e-13, 2.02608e-20}, + {4.96653e+02, 2.00098e-05, 8.29500e-13, 3.53294e-20}, + {8.39966e+02, 3.38417e-05, 1.40289e-12, 5.97510e-20}, + {1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20}, + } + }, +}; + +} // namespace fsn50 + +namespace fsn80 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 2.43883e-01, 2.52563e-01}, + {"O", 7.46061e-01, 7.46061e-01}, + {"Mg", 1.36917e-03, 1.36917e-03}, + {"Al", 1.55602e-08, 1.55602e-08}, + {"Si", 3.63906e-06, 3.63906e-06}, + {"S", 0.00000e+00, 0.00000e+00}, + {"Fe", 2.43915e-06, 2.43915e-06}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 3.87590e-26, + /* size_moments = */ {4.02891e-08, 1.67016e-15, 7.11339e-23}, + /* opacity_coef_table = */ { + {1.05240e-01, 6.19546e-09, 3.68996e-16, 2.22004e-23}, + {1.32588e-01, 7.80541e-09, 4.64884e-16, 2.79694e-23}, + {1.67016e-01, 9.83223e-09, 5.85599e-16, 3.52321e-23}, + {2.10360e-01, 1.23838e-08, 7.37570e-16, 4.43753e-23}, + {2.71887e-01, 1.60059e-08, 9.53300e-16, 5.73545e-23}, + {3.55694e-01, 2.09396e-08, 1.24715e-15, 7.50336e-23}, + {4.84932e-01, 2.85479e-08, 1.70029e-15, 1.02296e-22}, + {6.99767e-01, 4.11952e-08, 2.45355e-15, 1.47616e-22}, + {1.05860e+00, 6.23193e-08, 3.71169e-15, 2.23311e-22}, + {1.62902e+00, 9.59000e-08, 5.71172e-15, 3.43641e-22}, + {2.54260e+00, 1.49682e-07, 8.91495e-15, 5.36361e-22}, + {3.96488e+00, 2.33412e-07, 1.39018e-14, 8.36390e-22}, + {6.10630e+00, 3.59476e-07, 2.14101e-14, 1.28812e-21}, + {9.28766e+00, 5.46763e-07, 3.25647e-14, 1.95923e-21}, + {1.39265e+01, 8.19849e-07, 4.88295e-14, 2.93779e-21}, + {2.05382e+01, 1.20908e-06, 7.20119e-14, 4.33254e-21}, + {3.00649e+01, 1.76992e-06, 1.05415e-13, 6.34219e-21}, + {4.55102e+01, 2.67918e-06, 1.59569e-13, 9.60036e-21}, + {7.47839e+01, 4.40251e-06, 2.62210e-13, 1.57756e-20}, + {1.29621e+02, 7.63075e-06, 4.54481e-13, 2.73435e-20}, + {2.14820e+02, 1.26464e-05, 7.53210e-13, 4.53162e-20}, + {3.20002e+02, 1.88384e-05, 1.12200e-12, 6.75043e-20}, + {4.29768e+02, 2.53004e-05, 1.50687e-12, 9.06596e-20}, + {5.30827e+02, 3.12497e-05, 1.86120e-12, 1.11978e-19}, + {5.99694e+02, 3.53039e-05, 2.10267e-12, 1.26505e-19}, + {6.06537e+02, 3.57067e-05, 2.12666e-12, 1.27949e-19}, + {5.43262e+02, 3.19817e-05, 1.90480e-12, 1.14601e-19}, + {4.33545e+02, 2.55227e-05, 1.52011e-12, 9.14563e-20}, + {3.13324e+02, 1.84453e-05, 1.09859e-12, 6.60956e-20}, + {2.09006e+02, 1.23041e-05, 7.32824e-13, 4.40898e-20}, + {1.31150e+02, 7.72078e-06, 4.59843e-13, 2.76661e-20}, + {7.90683e+01, 4.65474e-06, 2.77232e-13, 1.66794e-20}, + {4.73389e+01, 2.78683e-06, 1.65981e-13, 9.98614e-21}, + {2.96409e+01, 1.74496e-06, 1.03928e-13, 6.25275e-21}, + {2.04709e+01, 1.20512e-06, 7.17759e-14, 4.31834e-21}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.36180e-13, + /* size_moments = */ {5.88698e-08, 3.50624e-15, 2.10950e-22}, + /* opacity_coef_table = */ { + {2.19890e-02, 1.29231e-09, 7.68620e-17, 4.61833e-24}, + {3.90612e-02, 2.29567e-09, 1.36538e-16, 8.20401e-24}, + {6.05539e-02, 3.55881e-09, 2.11665e-16, 1.27181e-23}, + {8.76116e-02, 5.14902e-09, 3.06244e-16, 1.84010e-23}, + {1.43288e-01, 8.42115e-09, 5.00858e-16, 3.00946e-23}, + {2.19266e-01, 1.28865e-08, 7.66440e-16, 4.60523e-23}, + {3.36256e-01, 1.97621e-08, 1.17537e-15, 7.06235e-23}, + {5.14336e-01, 3.02280e-08, 1.79785e-15, 1.08026e-22}, + {7.97216e-01, 4.68532e-08, 2.78665e-15, 1.67439e-22}, + {1.25414e+00, 7.37070e-08, 4.38381e-15, 2.63406e-22}, + {2.03450e+00, 1.19569e-07, 7.11154e-15, 4.27305e-22}, + {3.34648e+00, 1.96676e-07, 1.16975e-14, 7.02858e-22}, + {5.45893e+00, 3.20827e-07, 1.90816e-14, 1.14654e-21}, + {8.82117e+00, 5.18428e-07, 3.08342e-14, 1.85270e-21}, + {1.41825e+01, 8.33519e-07, 4.95746e-14, 2.97874e-21}, + {2.28419e+01, 1.34244e-06, 7.98433e-14, 4.79747e-21}, + {3.71178e+01, 2.18145e-06, 1.29744e-13, 7.79582e-21}, + {6.14272e+01, 3.61014e-06, 2.14717e-13, 1.29015e-20}, + {1.03847e+02, 6.10317e-06, 3.62993e-13, 2.18108e-20}, + {1.75507e+02, 1.03147e-05, 6.13479e-13, 3.68615e-20}, + {2.82060e+02, 1.65769e-05, 9.85934e-13, 5.92409e-20}, + {4.14519e+02, 2.43617e-05, 1.44894e-12, 8.70611e-20}, + {5.59961e+02, 3.29094e-05, 1.95733e-12, 1.17608e-19}, + {7.11024e+02, 4.17876e-05, 2.48537e-12, 1.49336e-19}, + {8.40806e+02, 4.94150e-05, 2.93902e-12, 1.76594e-19}, + {8.95312e+02, 5.26183e-05, 3.12954e-12, 1.88042e-19}, + {8.40415e+02, 4.93920e-05, 2.93765e-12, 1.76512e-19}, + {6.96693e+02, 4.09453e-05, 2.43527e-12, 1.46326e-19}, + {5.18202e+02, 3.04552e-05, 1.81136e-12, 1.08838e-19}, + {3.52864e+02, 2.07382e-05, 1.23343e-12, 7.41118e-20}, + {2.24210e+02, 1.31770e-05, 7.83720e-13, 4.70907e-20}, + {1.35138e+02, 7.94218e-06, 4.72371e-13, 2.83829e-20}, + {7.83119e+01, 4.60247e-06, 2.73737e-13, 1.64478e-20}, + {4.41553e+01, 2.59505e-06, 1.54344e-13, 9.27391e-21}, + {2.45888e+01, 1.44511e-06, 8.59497e-14, 5.16438e-21}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.48190e-12, + /* size_moments = */ {5.87709e-08, 3.49547e-15, 2.10029e-22}, + /* opacity_coef_table = */ { + {1.47700e-02, 5.95736e-10, 2.47198e-17, 1.05395e-24}, + {2.47694e-02, 9.99055e-10, 4.14553e-17, 1.76749e-24}, + {3.73580e-02, 1.50680e-09, 6.25240e-17, 2.66578e-24}, + {5.32060e-02, 2.14602e-09, 8.90481e-17, 3.79666e-24}, + {8.50036e-02, 3.42855e-09, 1.42266e-16, 6.06566e-24}, + {1.29213e-01, 5.21170e-09, 2.16257e-16, 9.22034e-24}, + {2.00170e-01, 8.07368e-09, 3.35013e-16, 1.42836e-23}, + {3.15560e-01, 1.27279e-08, 5.28136e-16, 2.25176e-23}, + {5.01384e-01, 2.02229e-08, 8.39139e-16, 3.57776e-23}, + {7.88907e-01, 3.18199e-08, 1.32035e-15, 5.62946e-23}, + {1.24250e+00, 5.01152e-08, 2.07951e-15, 8.86619e-23}, + {1.95225e+00, 7.87422e-08, 3.26737e-15, 1.39308e-22}, + {3.04002e+00, 1.22617e-07, 5.08792e-15, 2.16929e-22}, + {4.68918e+00, 1.89134e-07, 7.84803e-15, 3.34609e-22}, + {7.12599e+00, 2.87421e-07, 1.19264e-14, 5.08494e-22}, + {1.05834e+01, 4.26872e-07, 1.77129e-14, 7.55206e-22}, + {1.52356e+01, 6.14515e-07, 2.54990e-14, 1.08718e-21}, + {2.13345e+01, 8.60511e-07, 3.57065e-14, 1.52238e-21}, + {2.98061e+01, 1.20220e-06, 4.98848e-14, 2.12689e-21}, + {4.27642e+01, 1.72486e-06, 7.15721e-14, 3.05155e-21}, + {6.30370e+01, 2.54254e-06, 1.05502e-13, 4.49817e-21}, + {9.29361e+01, 3.74850e-06, 1.55542e-13, 6.63170e-21}, + {1.32987e+02, 5.36392e-06, 2.22573e-13, 9.48964e-21}, + {1.82150e+02, 7.34689e-06, 3.04855e-13, 1.29978e-20}, + {2.40388e+02, 9.69583e-06, 4.02324e-13, 1.71535e-20}, + {3.12065e+02, 1.25869e-05, 5.22286e-13, 2.22682e-20}, + {4.08414e+02, 1.64730e-05, 6.83540e-13, 2.91435e-20}, + {5.49591e+02, 2.21673e-05, 9.19821e-13, 3.92175e-20}, + {7.67451e+02, 3.09545e-05, 1.28444e-12, 5.47635e-20}, + {1.10725e+03, 4.46602e-05, 1.85315e-12, 7.90111e-20}, + {1.62060e+03, 6.53655e-05, 2.71231e-12, 1.15642e-19}, + {2.33999e+03, 9.43815e-05, 3.91631e-12, 1.66976e-19}, + {3.24367e+03, 1.30831e-04, 5.42876e-12, 2.31461e-19}, + {4.25716e+03, 1.71709e-04, 7.12499e-12, 3.03781e-19}, + {5.34010e+03, 2.15389e-04, 8.93744e-12, 3.81058e-19}, + } + }, + { + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 3.01120e-15, + /* size_moments = */ {4.03342e-08, 1.67365e-15, 7.13577e-23}, + /* opacity_coef_table = */ { + {3.27960e-01, 1.38598e-06, 7.55735e-12, 4.81450e-17}, + {4.38752e-01, 1.85420e-06, 1.01104e-11, 6.44096e-17}, + {5.78230e-01, 2.44365e-06, 1.33245e-11, 8.48855e-17}, + {7.53823e-01, 3.18572e-06, 1.73708e-11, 1.10663e-16}, + {1.04016e+00, 4.39581e-06, 2.39692e-11, 1.52700e-16}, + {1.41740e+00, 5.99012e-06, 3.26627e-11, 2.08084e-16}, + {1.95298e+00, 8.25351e-06, 4.50044e-11, 2.86710e-16}, + {2.71536e+00, 1.14754e-05, 6.25729e-11, 3.98636e-16}, + {3.79688e+00, 1.60461e-05, 8.74963e-11, 5.57421e-16}, + {5.29770e+00, 2.23889e-05, 1.22083e-10, 7.77774e-16}, + {7.37879e+00, 3.11841e-05, 1.70043e-10, 1.08333e-15}, + {1.02177e+01, 4.31826e-05, 2.35472e-10, 1.50021e-15}, + {1.40437e+01, 5.93525e-05, 3.23651e-10, 2.06204e-15}, + {1.92054e+01, 8.11692e-05, 4.42628e-10, 2.82017e-15}, + {2.61678e+01, 1.10598e-04, 6.03124e-10, 3.84293e-15}, + {3.55420e+01, 1.50223e-04, 8.19247e-10, 5.22035e-15}, + {4.81826e+01, 2.03661e-04, 1.11074e-09, 7.07845e-15}, + {6.53571e+01, 2.76274e-04, 1.50689e-09, 9.60430e-15}, + {8.88432e+01, 3.75591e-04, 2.04885e-09, 1.30610e-14}, + {1.20848e+02, 5.10965e-04, 2.78778e-09, 1.77762e-14}, + {1.63896e+02, 6.93122e-04, 3.78255e-09, 2.41285e-14}, + {2.21094e+02, 9.35280e-04, 5.10587e-09, 3.25877e-14}, + {2.97091e+02, 1.25728e-03, 6.86710e-09, 4.38623e-14}, + {3.98900e+02, 1.68904e-03, 9.23101e-09, 5.90159e-14}, + {5.35045e+02, 2.26701e-03, 1.23979e-08, 7.93362e-14}, + {7.13531e+02, 3.02568e-03, 1.65576e-08, 1.06036e-13}, + {9.43152e+02, 4.00348e-03, 2.19225e-08, 1.40472e-13}, + {1.23958e+03, 5.26932e-03, 2.88749e-08, 1.85093e-13}, + {1.63174e+03, 6.95105e-03, 3.81274e-08, 2.44493e-13}, + {2.16646e+03, 9.25803e-03, 5.08543e-08, 3.26274e-13}, + {2.91544e+03, 1.25164e-02, 6.89019e-08, 4.42468e-13}, + {3.98965e+03, 1.72412e-02, 9.52155e-08, 6.12399e-13}, + {5.56191e+03, 2.42454e-02, 1.34481e-07, 8.66957e-13}, + {7.88390e+03, 3.47095e-02, 1.93494e-07, 1.25089e-12}, + {1.12585e+04, 4.99889e-02, 2.79860e-07, 1.81329e-12}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 8.68025e-03, + /* size_moments = */ {4.22607e-06, 2.30435e-11, 1.46801e-16}, + /* opacity_coef_table = */ { + {7.60360e-02, 3.06759e-09, 1.27330e-16, 5.43132e-24}, + {9.07207e-02, 3.66003e-09, 1.51922e-16, 6.48026e-24}, + {1.09208e-01, 4.40586e-09, 1.82880e-16, 7.80079e-24}, + {1.32481e-01, 5.34481e-09, 2.21854e-16, 9.46325e-24}, + {1.58907e-01, 6.41094e-09, 2.66108e-16, 1.13509e-23}, + {1.91565e-01, 7.72847e-09, 3.20796e-16, 1.36836e-23}, + {2.30490e-01, 9.29887e-09, 3.85981e-16, 1.64641e-23}, + {2.76795e-01, 1.11670e-08, 4.63523e-16, 1.97717e-23}, + {3.33074e-01, 1.34375e-08, 5.57768e-16, 2.37917e-23}, + {4.05325e-01, 1.63524e-08, 6.78759e-16, 2.89527e-23}, + {5.08160e-01, 2.05012e-08, 8.50969e-16, 3.62983e-23}, + {6.72472e-01, 2.71301e-08, 1.12613e-15, 4.80353e-23}, + {9.48549e-01, 3.82682e-08, 1.58845e-15, 6.77557e-23}, + {1.41787e+00, 5.72025e-08, 2.37438e-15, 1.01280e-22}, + {2.19502e+00, 8.85555e-08, 3.67579e-15, 1.56792e-22}, + {3.46719e+00, 1.39880e-07, 5.80619e-15, 2.47665e-22}, + {5.76852e+00, 2.32725e-07, 9.66001e-15, 4.12050e-22}, + {1.17194e+01, 4.72806e-07, 1.96254e-14, 8.37126e-22}, + {3.16449e+01, 1.27668e-06, 5.29928e-14, 2.26042e-21}, + {8.68296e+01, 3.50304e-06, 1.45406e-13, 6.20231e-21}, + {1.92300e+02, 7.75813e-06, 3.22027e-13, 1.37362e-20}, + {3.36231e+02, 1.35649e-05, 5.63055e-13, 2.40173e-20}, + {5.05825e+02, 2.04070e-05, 8.47058e-13, 3.61315e-20}, + {7.20624e+02, 2.90728e-05, 1.20676e-12, 5.14748e-20}, + {9.77376e+02, 3.94312e-05, 1.63672e-12, 6.98148e-20}, + {1.18646e+03, 4.78662e-05, 1.98685e-12, 8.47495e-20}, + {1.23845e+03, 4.99638e-05, 2.07391e-12, 8.84633e-20}, + {1.11188e+03, 4.48576e-05, 1.86197e-12, 7.94227e-20}, + {8.76396e+02, 3.53572e-05, 1.46762e-12, 6.26017e-20}, + {6.22207e+02, 2.51022e-05, 1.04195e-12, 4.44448e-20}, + {4.07290e+02, 1.64317e-05, 6.82051e-13, 2.90931e-20}, + {2.50573e+02, 1.01091e-05, 4.19611e-13, 1.78986e-20}, + {1.47073e+02, 5.93352e-06, 2.46290e-13, 1.05056e-20}, + {8.33122e+01, 3.36114e-06, 1.39515e-13, 5.95106e-21}, + {4.59585e+01, 1.85415e-06, 7.69625e-14, 3.28286e-21}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 3.70132e-14, + /* size_moments = */ {4.03439e-08, 1.67461e-15, 7.14309e-23}, + /* opacity_coef_table = */ { + {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07300e-26}, + {1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25}, + {2.84365e-03, 1.14641e-10, 4.75377e-18, 2.02498e-25}, + {4.14191e-03, 1.66980e-10, 6.92409e-18, 2.94948e-25}, + {7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11485e-25}, + {1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07269e-25}, + {1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24}, + {2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84775e-24}, + {3.45425e-02, 1.39257e-09, 5.77452e-17, 2.45980e-24}, + {4.22006e-02, 1.70130e-09, 7.05474e-17, 3.00513e-24}, + {4.71420e-02, 1.90051e-09, 7.88080e-17, 3.35701e-24}, + {4.91934e-02, 1.98321e-09, 8.22373e-17, 3.50309e-24}, + {5.05162e-02, 2.03654e-09, 8.44486e-17, 3.59729e-24}, + {5.78201e-02, 2.33100e-09, 9.66587e-17, 4.11741e-24}, + {8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29671e-24}, + {1.78786e-01, 7.20770e-09, 2.98879e-16, 1.27315e-23}, + {4.36404e-01, 1.75935e-08, 7.29543e-16, 3.10766e-23}, + {1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22}, + {8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05872e-22}, + {3.92751e+01, 1.58336e-06, 6.56567e-14, 2.79680e-21}, + {1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20}, + {3.83709e+02, 1.54691e-05, 6.41451e-13, 2.73241e-20}, + {7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48615e-20}, + {1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28884e-20}, + {1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79619e-20}, + {1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47599e-20}, + {1.09978e+03, 4.43371e-05, 1.83852e-12, 7.83159e-20}, + {8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73700e-20}, + {5.38690e+02, 2.17171e-05, 9.00536e-13, 3.83605e-20}, + {3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39508e-20}, + {1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20}, + {1.13787e+02, 4.58729e-06, 1.90220e-13, 8.10285e-21}, + {6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48920e-21}, + {3.41529e+01, 1.37686e-06, 5.70939e-14, 2.43205e-21}, + {1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21}, + } + }, + { + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 3.77811e-18, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, + /* opacity_coef_table = */ { + {1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28}, + {2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27}, + {3.40288e-05, 1.37326e-12, 5.70184e-20, 2.43208e-27}, + {4.92305e-05, 1.98674e-12, 8.24901e-20, 3.51856e-27}, + {8.08507e-05, 3.26278e-12, 1.35471e-19, 5.77841e-27}, + {1.25019e-04, 5.04514e-12, 2.09472e-19, 8.93477e-27}, + {1.96584e-04, 7.93293e-12, 3.29363e-19, 1.40481e-26}, + {3.14489e-04, 1.26902e-11, 5.26848e-19, 2.24703e-26}, + {5.06846e-04, 2.04508e-11, 8.48987e-19, 3.62076e-26}, + {8.07280e-04, 3.25711e-11, 1.35207e-18, 5.76597e-26}, + {1.28667e-03, 5.19094e-11, 2.15469e-18, 9.18830e-26}, + {2.05240e-03, 8.27959e-11, 3.43651e-18, 1.46534e-25}, + {3.27023e-03, 1.31912e-10, 5.47463e-18, 2.33420e-25}, + {5.23895e-03, 2.11300e-10, 8.76840e-18, 3.73817e-25}, + {8.45019e-03, 3.40772e-10, 1.41393e-17, 6.02717e-25}, + {1.37157e-02, 5.53037e-10, 2.29434e-17, 9.77885e-25}, + {2.24099e-02, 9.03468e-10, 3.74764e-17, 1.59710e-24}, + {3.70041e-02, 1.49164e-09, 6.18661e-17, 2.63618e-24}, + {6.21584e-02, 2.50530e-09, 1.03896e-16, 4.42660e-24}, + {1.07033e-01, 4.31351e-09, 1.78864e-16, 7.62000e-24}, + {1.90089e-01, 7.66007e-09, 3.17606e-16, 1.35297e-23}, + {3.49470e-01, 1.40818e-08, 5.83831e-16, 2.48691e-23}, + {6.64947e-01, 2.67926e-08, 1.11077e-15, 4.73128e-23}, + {1.30413e+00, 5.25455e-08, 2.17837e-15, 9.27841e-23}, + {2.61640e+00, 1.05417e-07, 4.37015e-15, 1.86136e-22}, + {5.31790e+00, 2.14259e-07, 8.88223e-15, 3.78313e-22}, + {1.08366e+01, 4.36604e-07, 1.80995e-14, 7.70889e-22}, + {2.19132e+01, 8.82874e-07, 3.65995e-14, 1.55883e-21}, + {4.35354e+01, 1.75402e-06, 7.27125e-14, 3.09693e-21}, + {8.42362e+01, 3.39383e-06, 1.40690e-13, 5.99219e-21}, + {1.57704e+02, 6.35380e-06, 2.63395e-13, 1.12183e-20}, + {2.84822e+02, 1.14753e-05, 4.75704e-13, 2.02608e-20}, + {4.96653e+02, 2.00098e-05, 8.29500e-13, 3.53294e-20}, + {8.39966e+02, 3.38417e-05, 1.40289e-12, 5.97510e-20}, + {1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20}, + } + }, +}; + +} // namespace fsn80 + +namespace pisn170 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 5.29528e-02, 5.29975e-02}, + {"O", 5.60799e-01, 5.60864e-01}, + {"Mg", 3.58366e-02, 3.58367e-02}, + {"Al", 3.27680e-04, 3.27680e-04}, + {"Si", 1.39585e-01, 1.52750e-01}, + {"S", 8.06035e-02, 8.06035e-02}, + {"Fe", 5.29394e-02, 5.29729e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "SiM_dust", + /* nonprimoridal_yield_frac = */ 1.31079e-02, + /* size_moments = */ {2.72050e-06, 2.87427e-11, 7.09270e-16}, + /* opacity_coef_table = */ { + {1.89038e-02, 2.14190e-07, 2.52372e-12, 3.12761e-17}, + {3.29962e-02, 3.72180e-07, 4.35946e-12, 5.36210e-17}, + {5.06585e-02, 5.69928e-07, 6.65321e-12, 8.14803e-17}, + {7.28477e-02, 8.18206e-07, 9.53077e-12, 1.16395e-16}, + {1.17388e-01, 1.31311e-06, 1.52141e-11, 1.84531e-16}, + {1.77851e-01, 1.98324e-06, 2.28841e-11, 2.76089e-16}, + {2.70459e-01, 3.00576e-06, 3.45287e-11, 4.14188e-16}, + {4.11194e-01, 4.55413e-06, 5.20790e-11, 6.21046e-16}, + {6.23355e-01, 6.88052e-06, 7.83314e-11, 9.28691e-16}, + {9.33206e-01, 1.02680e-05, 1.16407e-10, 1.37259e-15}, + {1.38665e+00, 1.52105e-05, 1.71743e-10, 2.01438e-15}, + {2.02921e+00, 2.21948e-05, 2.49647e-10, 2.91351e-15}, + {2.90114e+00, 3.16481e-05, 3.54739e-10, 4.12109e-15}, + {4.04178e+00, 4.39869e-05, 4.91497e-10, 5.68634e-15}, + {5.48102e+00, 5.95254e-05, 6.63275e-10, 7.64576e-15}, + {7.23953e+00, 7.84801e-05, 8.72371e-10, 1.00241e-14}, + {9.32332e+00, 1.00911e-04, 1.11939e-09, 1.28274e-14}, + {1.17250e+01, 1.26738e-04, 1.40342e-09, 1.60451e-14}, + {1.44493e+01, 1.56015e-04, 1.72511e-09, 1.96853e-14}, + {1.75655e+01, 1.89497e-04, 2.09290e-09, 2.38454e-14}, + {2.12689e+01, 2.29295e-04, 2.53020e-09, 2.87941e-14}, + {2.59441e+01, 2.79574e-04, 3.08321e-09, 3.50603e-14}, + {3.22597e+01, 3.47571e-04, 3.83222e-09, 4.35643e-14}, + {4.13113e+01, 4.45148e-04, 4.90883e-09, 5.58148e-14}, + {5.48617e+01, 5.91330e-04, 6.52336e-09, 7.42101e-14}, + {7.57474e+01, 8.16590e-04, 9.01042e-09, 1.02534e-13}, + {1.08611e+02, 1.17059e-03, 1.29124e-08, 1.46875e-13}, + {1.61171e+02, 1.73570e-03, 1.91260e-08, 2.17252e-13}, + {2.46323e+02, 2.64930e-03, 2.91428e-08, 3.30280e-13}, + {3.85260e+02, 4.13661e-03, 4.54013e-08, 5.13015e-13}, + {6.12075e+02, 6.55899e-03, 7.17997e-08, 8.08495e-13}, + {9.79548e+02, 1.04742e-02, 1.14330e-07, 1.28253e-12}, + {1.56260e+03, 1.66712e-02, 1.81431e-07, 2.02722e-12}, + {2.44258e+03, 2.60024e-02, 2.82158e-07, 3.14054e-12}, + {3.65611e+03, 3.88442e-02, 4.20404e-07, 4.66303e-12}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 3.34688e-05, + /* size_moments = */ {1.08069e-05, 1.19634e-10, 1.36724e-15}, + /* opacity_coef_table = */ { + {1.05240e-01, 1.88391e-06, 3.41670e-11, 6.27487e-16}, + {1.32588e-01, 2.37346e-06, 4.30456e-11, 7.90546e-16}, + {1.67016e-01, 2.98977e-06, 5.42231e-11, 9.95825e-16}, + {2.10360e-01, 3.76566e-06, 6.82948e-11, 1.25426e-15}, + {2.71891e-01, 4.86713e-06, 8.82715e-11, 1.62113e-15}, + {3.55703e-01, 6.36747e-06, 1.15482e-10, 2.12086e-15}, + {4.84952e-01, 8.68116e-06, 1.57444e-10, 2.89150e-15}, + {6.99815e-01, 1.25274e-05, 2.27201e-10, 4.17262e-15}, + {1.05872e+00, 1.89523e-05, 3.43724e-10, 6.31261e-15}, + {1.62931e+00, 2.91665e-05, 5.28972e-10, 9.71478e-15}, + {2.54332e+00, 4.55285e-05, 8.25720e-10, 1.51647e-14}, + {3.96674e+00, 7.10095e-05, 1.28786e-09, 2.36521e-14}, + {6.11063e+00, 1.09388e-04, 1.98392e-09, 3.64359e-14}, + {9.29771e+00, 1.66443e-04, 3.01871e-09, 5.54408e-14}, + {1.39496e+01, 2.49721e-04, 4.52916e-09, 8.31823e-14}, + {2.05907e+01, 3.68616e-04, 6.68568e-09, 1.22791e-13}, + {3.01907e+01, 5.40495e-04, 9.80342e-09, 1.80058e-13}, + {4.58362e+01, 8.20646e-04, 1.48857e-08, 2.73420e-13}, + {7.56329e+01, 1.35424e-03, 2.45668e-08, 4.51281e-13}, + {1.31563e+02, 2.35588e-03, 4.27405e-08, 7.85179e-13}, + {2.18570e+02, 3.91412e-03, 7.10137e-08, 1.30465e-12}, + {3.26293e+02, 5.84347e-03, 1.06022e-07, 1.94790e-12}, + {4.39310e+02, 7.86786e-03, 1.42760e-07, 2.62299e-12}, + {5.43909e+02, 9.74168e-03, 1.76768e-07, 3.24798e-12}, + {6.15422e+02, 1.10228e-02, 2.00021e-07, 3.67534e-12}, + {6.22866e+02, 1.11563e-02, 2.02446e-07, 3.71993e-12}, + {5.58030e+02, 9.99504e-03, 1.81374e-07, 3.33274e-12}, + {4.45434e+02, 7.97833e-03, 1.44778e-07, 2.66031e-12}, + {3.22068e+02, 5.76874e-03, 1.04683e-07, 1.92357e-12}, + {2.15071e+02, 3.85233e-03, 6.99082e-08, 1.28461e-12}, + {1.35309e+02, 2.42376e-03, 4.39862e-08, 8.08311e-13}, + {8.22952e+01, 1.47437e-03, 2.67608e-08, 4.91842e-13}, + {5.06858e+01, 9.08497e-04, 1.64974e-08, 3.03339e-13}, + {3.39204e+01, 6.08602e-04, 1.10623e-08, 2.03592e-13}, + {2.60778e+01, 4.68473e-04, 8.52552e-09, 1.57083e-13}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.84952e-13, + /* size_moments = */ {1.79010e-05, 3.24658e-10, 5.96244e-15}, + /* opacity_coef_table = */ { + {2.19890e-02, 5.52339e-07, 1.38741e-11, 3.48502e-16}, + {3.90618e-02, 9.81187e-07, 2.46463e-11, 6.19087e-16}, + {6.05551e-02, 1.52108e-06, 3.82077e-11, 9.59734e-16}, + {8.76136e-02, 2.20075e-06, 5.52805e-11, 1.38858e-15}, + {1.43295e-01, 3.59940e-06, 9.04128e-11, 2.27107e-15}, + {2.19281e-01, 5.50809e-06, 1.38357e-10, 3.47537e-15}, + {3.36283e-01, 8.44705e-06, 2.12180e-10, 5.32973e-15}, + {5.14405e-01, 1.29213e-05, 3.24567e-10, 8.15276e-15}, + {7.97396e-01, 2.00297e-05, 5.03123e-10, 1.26379e-14}, + {1.25461e+00, 3.15143e-05, 7.91604e-10, 1.98842e-14}, + {2.03570e+00, 5.11345e-05, 1.28444e-09, 3.22637e-14}, + {3.34964e+00, 8.41390e-05, 2.11348e-09, 5.30881e-14}, + {5.46697e+00, 1.37324e-04, 3.44942e-09, 8.66456e-14}, + {8.84149e+00, 2.22088e-04, 5.57860e-09, 1.40128e-13}, + {1.42340e+01, 3.57543e-04, 8.98107e-09, 2.25594e-13}, + {2.29730e+01, 5.77056e-04, 1.44950e-08, 3.64097e-13}, + {3.74525e+01, 9.40765e-04, 2.36310e-08, 5.93583e-13}, + {6.22721e+01, 1.56420e-03, 3.92910e-08, 9.86946e-13}, + {1.05860e+02, 2.65909e-03, 6.67934e-08, 1.67777e-12}, + {1.79797e+02, 4.51630e-03, 1.13444e-07, 2.84959e-12}, + {2.89938e+02, 7.28291e-03, 1.82938e-07, 4.59521e-12}, + {4.27133e+02, 1.07291e-02, 2.69503e-07, 6.76961e-12}, + {5.77898e+02, 1.45162e-02, 3.64629e-07, 9.15907e-12}, + {7.33244e+02, 1.84183e-02, 4.62646e-07, 1.16211e-11}, + {8.63989e+02, 2.17024e-02, 5.45140e-07, 1.36933e-11}, + {9.15488e+02, 2.29960e-02, 5.77634e-07, 1.45095e-11}, + {8.55336e+02, 2.14851e-02, 5.39680e-07, 1.35562e-11}, + {7.06445e+02, 1.77451e-02, 4.45737e-07, 1.11964e-11}, + {5.24103e+02, 1.31649e-02, 3.30686e-07, 8.30647e-12}, + {3.56328e+02, 8.95056e-03, 2.24828e-07, 5.64742e-12}, + {2.26296e+02, 5.68431e-03, 1.42783e-07, 3.58656e-12}, + {1.36494e+02, 3.42857e-03, 8.61218e-08, 2.16328e-12}, + {7.93347e+01, 1.99280e-03, 5.00568e-08, 1.25737e-12}, + {4.50672e+01, 1.13204e-03, 2.84355e-08, 7.14267e-13}, + {2.56082e+01, 6.43249e-04, 1.61577e-08, 4.05863e-13}, + } + }, + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 7.72302e-25, + /* size_moments = */ {2.51189e-05, 6.30957e-10, 1.58489e-14}, + /* opacity_coef_table = */ { + {3.27960e-01, 2.72950e-07, 4.37442e-13, 1.43560e-18}, + {4.38752e-01, 3.65158e-07, 5.85222e-13, 1.92064e-18}, + {5.78230e-01, 4.81242e-07, 7.71265e-13, 2.53127e-18}, + {7.53823e-01, 6.27382e-07, 1.00548e-12, 3.30001e-18}, + {1.04013e+00, 8.65671e-07, 1.38740e-12, 4.55369e-18}, + {1.41735e+00, 1.17963e-06, 1.89059e-12, 6.20550e-18}, + {1.95292e+00, 1.62537e-06, 2.60499e-12, 8.55074e-18}, + {2.71531e+00, 2.25988e-06, 3.62196e-12, 1.18896e-17}, + {3.79676e+00, 3.15995e-06, 5.06464e-12, 1.66270e-17}, + {5.29743e+00, 4.40895e-06, 7.06667e-12, 2.32024e-17}, + {7.37835e+00, 6.14088e-06, 9.84291e-12, 3.23229e-17}, + {1.02168e+01, 8.50337e-06, 1.36303e-11, 4.47703e-17}, + {1.40421e+01, 1.16873e-05, 1.87349e-11, 6.15552e-17}, + {1.92022e+01, 1.59823e-05, 2.56223e-11, 8.42199e-17}, + {2.61618e+01, 2.17754e-05, 3.49137e-11, 1.14828e-16}, + {3.55310e+01, 2.95745e-05, 4.74267e-11, 1.56111e-16}, + {4.81618e+01, 4.00896e-05, 6.43047e-11, 2.11918e-16}, + {6.53182e+01, 5.43738e-05, 8.72469e-11, 2.88010e-16}, + {8.87691e+01, 7.39018e-05, 1.18639e-10, 3.92576e-16}, + {1.20709e+02, 1.00504e-04, 1.61458e-10, 5.36074e-16}, + {1.63629e+02, 1.36264e-04, 2.19128e-10, 7.31160e-16}, + {2.20590e+02, 1.83746e-04, 2.95924e-10, 9.94659e-16}, + {2.96134e+02, 2.46760e-04, 3.98255e-10, 1.35250e-15}, + {3.97082e+02, 3.31036e-04, 5.35697e-10, 1.84221e-15}, + {5.31629e+02, 4.43468e-04, 7.19648e-10, 2.50526e-15}, + {7.07172e+02, 5.90324e-04, 9.60341e-10, 3.37390e-15}, + {9.31294e+02, 7.78129e-04, 1.26840e-09, 4.47614e-15}, + {1.21722e+03, 1.01834e-03, 1.66280e-09, 5.86569e-15}, + {1.58885e+03, 1.33177e-03, 2.17875e-09, 7.65284e-15}, + {2.08299e+03, 1.75095e-03, 2.87268e-09, 1.00241e-14}, + {2.75132e+03, 2.32265e-03, 3.82862e-09, 1.32680e-14}, + {3.66587e+03, 3.11403e-03, 5.17218e-09, 1.78307e-14}, + {4.93093e+03, 4.22440e-03, 7.09398e-09, 2.43990e-14}, + {6.70346e+03, 5.80132e-03, 9.87242e-09, 3.39492e-14}, + {9.22475e+03, 8.05642e-03, 1.38679e-08, 4.76003e-14}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 4.47758e-05, + /* size_moments = */ {8.32266e-07, 1.33383e-12, 4.37739e-18}, + /* opacity_coef_table = */ { + {7.60055e-02, 1.61556e-06, 3.49407e-11, 7.72118e-16}, + {9.06897e-02, 1.92769e-06, 4.16913e-11, 9.21295e-16}, + {1.09176e-01, 2.32063e-06, 5.01898e-11, 1.10910e-15}, + {1.32449e-01, 2.81532e-06, 6.08888e-11, 1.34553e-15}, + {1.58880e-01, 3.37714e-06, 7.30398e-11, 1.61404e-15}, + {1.91543e-01, 4.07143e-06, 8.80558e-11, 1.94587e-15}, + {2.30474e-01, 4.89894e-06, 1.05953e-10, 2.34138e-15}, + {2.76789e-01, 5.88341e-06, 1.27245e-10, 2.81190e-15}, + {3.33087e-01, 7.08010e-06, 1.53127e-10, 3.38385e-15}, + {4.05372e-01, 8.61660e-06, 1.86359e-10, 4.11822e-15}, + {5.08264e-01, 1.08037e-05, 2.33661e-10, 5.16354e-15}, + {6.72714e-01, 1.42993e-05, 3.09265e-10, 6.83430e-15}, + {9.49132e-01, 2.01750e-05, 4.36348e-10, 9.64271e-15}, + {1.41935e+00, 3.01704e-05, 6.52536e-10, 1.44204e-14}, + {2.19866e+00, 4.67362e-05, 1.01084e-09, 2.23390e-14}, + {3.47731e+00, 7.39180e-05, 1.59880e-09, 3.53339e-14}, + {5.80454e+00, 1.23397e-04, 2.66922e-09, 5.89965e-14}, + {1.18802e+01, 2.52595e-04, 5.46495e-09, 1.20817e-13}, + {3.22814e+01, 6.86446e-04, 1.48537e-08, 3.28442e-13}, + {8.86792e+01, 1.88575e-03, 4.08062e-08, 9.02327e-13}, + {1.96255e+02, 4.17327e-03, 9.03045e-08, 1.99681e-12}, + {3.42549e+02, 7.28388e-03, 1.57607e-07, 3.48479e-12}, + {5.11736e+02, 1.08798e-02, 2.35370e-07, 5.20299e-12}, + {7.16479e+02, 1.52272e-02, 3.29269e-07, 7.27459e-12}, + {9.48899e+02, 2.01568e-02, 4.35598e-07, 9.61645e-12}, + {1.12707e+03, 2.39309e-02, 5.16871e-07, 1.14029e-11}, + {1.15762e+03, 2.45716e-02, 5.30490e-07, 1.16974e-11}, + {1.02786e+03, 2.18125e-02, 4.70793e-07, 1.03775e-11}, + {8.04358e+02, 1.70671e-02, 3.68303e-07, 8.11658e-12}, + {5.68400e+02, 1.20593e-02, 2.60207e-07, 5.73357e-12}, + {3.70952e+02, 7.86976e-03, 1.69795e-07, 3.74103e-12}, + {2.27785e+02, 4.83229e-03, 1.04255e-07, 2.29687e-12}, + {1.33544e+02, 2.83297e-03, 6.11184e-08, 1.34647e-12}, + {7.56194e+01, 1.60416e-03, 3.46077e-08, 7.62416e-13}, + {4.17402e+01, 8.85464e-04, 1.91029e-08, 4.20847e-13}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.23405e-04, + /* size_moments = */ {2.12560e-05, 4.59721e-10, 1.01590e-14}, + /* opacity_coef_table = */ { + {2.25358e-04, 3.62400e-09, 5.98548e-14, 1.01451e-18}, + {4.04933e-04, 6.51178e-09, 1.07551e-13, 1.82293e-18}, + {6.31005e-04, 1.01473e-08, 1.67596e-13, 2.84068e-18}, + {9.15612e-04, 1.47241e-08, 2.43188e-13, 4.12194e-18}, + {1.52196e-03, 2.44750e-08, 4.04238e-13, 6.85169e-18}, + {2.37413e-03, 3.81788e-08, 6.30577e-13, 1.06881e-17}, + {3.77230e-03, 6.06633e-08, 1.00194e-12, 1.69826e-17}, + {6.14410e-03, 9.88050e-08, 1.63191e-12, 2.76605e-17}, + {1.01925e-02, 1.63910e-07, 2.70723e-12, 4.58870e-17}, + {1.68946e-02, 2.71691e-07, 4.48743e-12, 7.60616e-17}, + {2.96294e-02, 4.76492e-07, 7.87018e-12, 1.33401e-16}, + {6.11307e-02, 9.83118e-07, 1.62386e-11, 2.75255e-16}, + {1.43660e-01, 2.31047e-06, 3.81646e-11, 6.46939e-16}, + {3.28203e-01, 5.27865e-06, 8.71964e-11, 1.47815e-15}, + {6.41613e-01, 1.03199e-05, 1.70479e-10, 2.89009e-15}, + {1.05901e+00, 1.70371e-05, 2.81505e-10, 4.77324e-15}, + {1.60722e+00, 2.58913e-05, 4.28363e-10, 7.27252e-15}, + {3.19739e+00, 5.16560e-05, 8.57040e-10, 1.45895e-14}, + {1.40905e+01, 2.27322e-04, 3.76636e-09, 6.40310e-14}, + {7.15093e+01, 1.15025e-03, 1.90029e-08, 3.22170e-13}, + {2.48952e+02, 3.99764e-03, 6.59323e-08, 1.11600e-12}, + {5.77048e+02, 9.25757e-03, 1.52545e-07, 2.57979e-12}, + {9.46693e+02, 1.51796e-02, 2.49995e-07, 4.22569e-12}, + {1.17600e+03, 1.88501e-02, 3.10343e-07, 5.24410e-12}, + {1.17447e+03, 1.88215e-02, 3.09806e-07, 5.23395e-12}, + {9.91612e+02, 1.58888e-02, 2.61497e-07, 4.41720e-12}, + {7.37095e+02, 1.18095e-02, 1.94341e-07, 3.28252e-12}, + {4.97965e+02, 7.97772e-03, 1.31276e-07, 2.21717e-12}, + {3.13212e+02, 5.01764e-03, 8.25631e-08, 1.39438e-12}, + {1.86742e+02, 2.99150e-03, 4.92223e-08, 8.31277e-13}, + {1.06960e+02, 1.71340e-03, 2.81918e-08, 4.76098e-13}, + {5.94287e+01, 9.51978e-04, 1.56633e-08, 2.64516e-13}, + {3.22675e+01, 5.16881e-04, 8.50437e-09, 1.43617e-13}, + {1.72142e+01, 2.75746e-04, 4.53688e-09, 7.66156e-14}, + {9.06015e+00, 1.45130e-04, 2.38782e-09, 4.03237e-14}, + } + }, + { + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.41247e-07, + /* size_moments = */ {1.60812e-05, 2.65603e-10, 4.50188e-15}, + /* opacity_coef_table = */ { + {1.54566e-01, 4.18815e-07, 4.38802e-12, 1.07634e-16}, + {1.94597e-01, 5.27516e-07, 5.53200e-12, 1.35785e-16}, + {2.44992e-01, 6.64362e-07, 6.97216e-12, 1.71223e-16}, + {3.08437e-01, 8.36640e-07, 8.78521e-12, 2.15837e-16}, + {3.88320e-01, 1.05373e-06, 1.10736e-11, 2.72217e-16}, + {4.88890e-01, 1.32707e-06, 1.39559e-11, 3.43241e-16}, + {6.15507e-01, 1.67134e-06, 1.75891e-11, 4.32825e-16}, + {7.74906e-01, 2.10492e-06, 2.21686e-11, 5.45804e-16}, + {9.75270e-01, 2.65013e-06, 2.79315e-11, 6.88059e-16}, + {1.22485e+00, 3.32948e-06, 3.51169e-11, 8.65513e-16}, + {1.52110e+00, 4.13615e-06, 4.36560e-11, 1.07652e-15}, + {1.83679e+00, 4.99624e-06, 5.27698e-11, 1.30190e-15}, + {2.15666e+00, 5.86838e-06, 6.20278e-11, 1.53115e-15}, + {2.55518e+00, 6.95661e-06, 7.36137e-11, 1.81866e-15}, + {3.22834e+00, 8.79676e-06, 9.32496e-11, 2.30667e-15}, + {4.33225e+00, 1.18177e-05, 1.25559e-10, 3.11092e-15}, + {5.81697e+00, 1.58892e-05, 1.69288e-10, 4.20258e-15}, + {7.48671e+00, 2.04890e-05, 2.19146e-10, 5.45508e-15}, + {9.22042e+00, 2.53165e-05, 2.72602e-10, 6.81745e-15}, + {1.12094e+01, 3.09883e-05, 3.38326e-10, 8.54226e-15}, + {1.40327e+01, 3.92793e-05, 4.39589e-10, 1.12871e-14}, + {1.79556e+01, 5.11182e-05, 5.91090e-10, 1.55105e-14}, + {2.19076e+01, 6.38759e-05, 7.72200e-10, 2.08556e-14}, + {2.40396e+01, 7.32505e-05, 9.56570e-10, 2.71081e-14}, + {2.35050e+01, 7.74606e-05, 1.14341e-09, 3.48207e-14}, + {2.10698e+01, 7.75334e-05, 1.32500e-09, 4.37333e-14}, + {1.81145e+01, 7.52350e-05, 1.46962e-09, 5.20115e-14}, + {1.55283e+01, 7.16932e-05, 1.54535e-09, 5.74821e-14}, + {1.35973e+01, 6.77513e-05, 1.55041e-09, 5.93660e-14}, + {1.28568e+01, 6.72854e-05, 1.57294e-09, 6.05730e-14}, + {1.62414e+01, 9.03391e-05, 2.02876e-09, 7.45675e-14}, + {3.62078e+01, 2.25165e-04, 4.46960e-09, 1.44123e-13}, + {1.13353e+02, 7.52538e-04, 1.29670e-08, 3.61005e-13}, + {3.52139e+02, 2.31091e-03, 3.53205e-08, 8.74277e-13}, + {9.61671e+02, 5.84143e-03, 8.01724e-08, 1.81153e-12}, + } + }, +}; + +} // namespace pisn170 + +namespace pisn200 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 3.64677e-02, 3.65050e-02}, + {"O", 4.88307e-01, 4.88552e-01}, + {"Mg", 2.69665e-02, 2.69665e-02}, + {"Al", 1.36872e-04, 1.36872e-04}, + {"Si", 1.87051e-01, 1.87324e-01}, + {"S", 1.15582e-01, 1.15582e-01}, + {"Fe", 6.75026e-02, 6.79294e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "SiM_dust", + /* nonprimoridal_yield_frac = */ 5.90622e-05, + /* size_moments = */ {8.86269e-07, 1.71166e-12, 5.46663e-18}, + /* opacity_coef_table = */ { + {9.09085e-04, 3.41941e-09, 1.80920e-14, 1.27369e-19}, + {1.61039e-03, 6.04845e-09, 3.18823e-14, 2.22622e-19}, + {2.49320e-03, 9.35673e-09, 4.92187e-14, 3.42113e-19}, + {3.60452e-03, 1.35207e-08, 7.10297e-14, 4.92299e-19}, + {5.89215e-03, 2.20677e-08, 1.15535e-13, 7.95087e-19}, + {9.02912e-03, 3.37737e-08, 1.76355e-13, 1.20713e-18}, + {1.39130e-02, 5.19580e-08, 2.70494e-13, 1.84076e-18}, + {2.14719e-02, 8.00206e-08, 4.15192e-13, 2.80850e-18}, + {3.30912e-02, 1.23012e-07, 6.35936e-13, 4.27570e-18}, + {5.03917e-02, 1.86799e-07, 9.62098e-13, 6.43127e-18}, + {7.63291e-02, 2.81960e-07, 1.44615e-12, 9.61004e-18}, + {1.14179e-01, 4.19929e-07, 2.14346e-12, 1.41576e-17}, + {1.67303e-01, 6.12055e-07, 3.10728e-12, 2.03974e-17}, + {2.39689e-01, 8.71248e-07, 4.39580e-12, 2.86715e-17}, + {3.35470e-01, 1.21013e-06, 6.06256e-12, 3.92787e-17}, + {4.59119e-01, 1.64148e-06, 8.15789e-12, 5.24812e-17}, + {6.15407e-01, 2.17768e-06, 1.07246e-11, 6.84719e-17}, + {8.10332e-01, 2.83301e-06, 1.38055e-11, 8.74075e-17}, + {1.05438e+00, 3.63322e-06, 1.74835e-11, 1.09639e-16}, + {1.37021e+00, 4.63773e-06, 2.19726e-11, 1.36212e-16}, + {1.80496e+00, 5.97282e-06, 2.77433e-11, 1.69529e-16}, + {2.45118e+00, 7.88356e-06, 3.57016e-11, 2.14206e-16}, + {3.48432e+00, 1.08228e-05, 4.74799e-11, 2.78412e-16}, + {5.23381e+00, 1.56143e-05, 6.59474e-11, 3.76121e-16}, + {8.31585e+00, 2.37506e-05, 9.61230e-11, 5.31044e-16}, + {1.38802e+01, 3.79407e-05, 1.46823e-10, 7.83600e-16}, + {2.40529e+01, 6.30826e-05, 2.33568e-10, 1.20322e-15}, + {4.26908e+01, 1.07918e-04, 3.83527e-10, 1.90929e-15}, + {7.65687e+01, 1.87651e-04, 6.43418e-10, 3.10502e-15}, + {1.37077e+02, 3.27739e-04, 1.09108e-09, 5.12746e-15}, + {2.42517e+02, 5.69117e-04, 1.85185e-09, 8.51948e-15}, + {4.21112e+02, 9.75067e-04, 3.11997e-09, 1.41236e-14}, + {7.14738e+02, 1.63904e-03, 5.18038e-09, 2.31656e-14}, + {1.18235e+03, 2.68818e-03, 8.40281e-09, 3.71602e-14}, + {1.90342e+03, 4.27908e-03, 1.31829e-08, 5.74720e-14}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 4.26809e-04, + /* size_moments = */ {2.02272e-06, 5.41308e-12, 2.06248e-17}, + /* opacity_coef_table = */ { + {1.05240e-01, 1.49640e-06, 2.15567e-11, 3.14463e-16}, + {1.32588e-01, 1.88525e-06, 2.71584e-11, 3.96179e-16}, + {1.67016e-01, 2.37479e-06, 3.42106e-11, 4.99054e-16}, + {2.10360e-01, 2.99108e-06, 4.30887e-11, 6.28566e-16}, + {2.71889e-01, 3.86597e-06, 5.56922e-11, 8.12421e-16}, + {3.55700e-01, 5.05766e-06, 7.28594e-11, 1.06285e-15}, + {4.84944e-01, 6.89538e-06, 9.93331e-11, 1.44904e-15}, + {6.99796e-01, 9.95035e-06, 1.43342e-10, 2.09104e-15}, + {1.05867e+00, 1.50532e-05, 2.16853e-10, 3.16340e-15}, + {1.62919e+00, 2.31655e-05, 3.33717e-10, 4.86818e-15}, + {2.54303e+00, 3.61594e-05, 5.20906e-10, 7.59887e-15}, + {3.96603e+00, 5.63932e-05, 8.12393e-10, 1.18511e-14}, + {6.10897e+00, 8.68643e-05, 1.25136e-09, 1.82548e-14}, + {9.29384e+00, 1.32151e-04, 1.90378e-09, 2.77724e-14}, + {1.39407e+01, 1.98229e-04, 2.85574e-09, 4.16600e-14}, + {2.05705e+01, 2.92507e-04, 4.21400e-09, 6.14759e-14}, + {3.01423e+01, 4.28630e-04, 6.17529e-09, 9.00909e-14}, + {4.57104e+01, 6.50055e-04, 9.36595e-09, 1.36648e-13}, + {7.53064e+01, 1.07104e-03, 1.54328e-08, 2.25181e-13}, + {1.30815e+02, 1.86065e-03, 2.68126e-08, 3.91253e-13}, + {2.17127e+02, 3.08849e-03, 4.45083e-08, 6.49502e-13}, + {3.23880e+02, 4.60717e-03, 6.63972e-08, 9.68963e-13}, + {4.35662e+02, 6.19759e-03, 8.93224e-08, 1.30358e-12}, + {5.38932e+02, 7.66706e-03, 1.10506e-07, 1.61282e-12}, + {6.09467e+02, 8.67078e-03, 1.24977e-07, 1.82406e-12}, + {6.16707e+02, 8.77390e-03, 1.26464e-07, 1.84580e-12}, + {5.52479e+02, 7.86016e-03, 1.13294e-07, 1.65358e-12}, + {4.40975e+02, 6.27379e-03, 9.04293e-08, 1.31986e-12}, + {3.18791e+02, 4.53552e-03, 6.53747e-08, 9.54183e-13}, + {2.12803e+02, 3.02766e-03, 4.36414e-08, 6.36986e-13}, + {1.33761e+02, 1.90318e-03, 2.74344e-08, 4.00448e-13}, + {8.11305e+01, 1.15453e-03, 1.66451e-08, 2.42996e-13}, + {4.95598e+01, 7.05594e-04, 1.01773e-08, 1.48640e-13}, + {3.25906e+01, 4.64465e-04, 6.70585e-09, 9.80294e-14}, + {2.45153e+01, 3.49814e-04, 5.05664e-09, 7.40047e-14}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 4.08246e-15, + /* size_moments = */ {1.42189e-05, 2.04834e-10, 2.98805e-15}, + /* opacity_coef_table = */ { + {3.27960e-01, 2.44690e-07, 3.05689e-13, 6.54462e-19}, + {4.38752e-01, 3.27351e-07, 4.08957e-13, 8.75569e-19}, + {5.78230e-01, 4.31415e-07, 5.38965e-13, 1.15393e-18}, + {7.53823e-01, 5.62424e-07, 7.02635e-13, 1.50436e-18}, + {1.04013e+00, 7.76039e-07, 9.69511e-13, 2.07581e-18}, + {1.41735e+00, 1.05749e-06, 1.32113e-12, 2.82873e-18}, + {1.95292e+00, 1.45707e-06, 1.82034e-12, 3.89771e-18}, + {2.71531e+00, 2.02589e-06, 2.53098e-12, 5.41951e-18}, + {3.79675e+00, 2.83276e-06, 3.53905e-12, 7.57851e-18}, + {5.29742e+00, 3.95242e-06, 4.93793e-12, 1.05749e-17}, + {7.37833e+00, 5.50501e-06, 6.87773e-12, 1.47304e-17}, + {1.02168e+01, 7.62282e-06, 9.52385e-12, 2.04006e-17}, + {1.40421e+01, 1.04770e-05, 1.30901e-11, 2.80446e-17}, + {1.92021e+01, 1.43270e-05, 1.79012e-11, 3.83618e-17}, + {2.61616e+01, 1.95199e-05, 2.43907e-11, 5.22874e-17}, + {3.55307e+01, 2.65108e-05, 3.31285e-11, 7.10543e-17}, + {4.81611e+01, 3.59357e-05, 4.49107e-11, 9.63939e-17}, + {6.53170e+01, 4.87382e-05, 6.09196e-11, 1.30888e-16}, + {8.87668e+01, 6.62390e-05, 8.28118e-11, 1.78181e-16}, + {1.20705e+02, 9.00772e-05, 1.12647e-10, 2.42873e-16}, + {1.63621e+02, 1.22115e-04, 1.52778e-10, 3.30388e-16}, + {2.20575e+02, 1.64642e-04, 2.06114e-10, 4.47715e-16}, + {2.96104e+02, 2.21060e-04, 2.76991e-10, 6.05473e-16}, + {3.97026e+02, 2.96479e-04, 3.71917e-10, 8.19263e-16}, + {5.31526e+02, 3.97049e-04, 4.98696e-10, 1.10695e-15}, + {7.06983e+02, 5.28345e-04, 6.64405e-10, 1.48343e-15}, + {9.30949e+02, 6.96139e-04, 8.76417e-10, 1.96294e-15}, + {1.21659e+03, 9.10536e-04, 1.14776e-09, 2.57160e-15}, + {1.58765e+03, 1.18982e-03, 1.50225e-09, 3.36001e-15}, + {2.08069e+03, 1.56242e-03, 1.97748e-09, 4.41103e-15}, + {2.74685e+03, 2.06876e-03, 2.62823e-09, 5.84923e-15}, + {3.65712e+03, 2.76611e-03, 3.53431e-09, 7.86205e-15}, + {4.91402e+03, 3.73838e-03, 4.81486e-09, 1.07337e-14}, + {6.67206e+03, 5.11081e-03, 6.64539e-09, 1.48739e-14}, + {9.17096e+03, 7.06881e-03, 9.26820e-09, 2.07940e-14}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 3.72287e-05, + /* size_moments = */ {7.46096e-07, 9.32091e-13, 1.99556e-18}, + /* opacity_coef_table = */ { + {7.60136e-02, 1.31860e-06, 2.34539e-11, 4.30529e-16}, + {9.06981e-02, 1.57333e-06, 2.79848e-11, 5.13702e-16}, + {1.09185e-01, 1.89402e-06, 3.36890e-11, 6.18411e-16}, + {1.32458e-01, 2.29774e-06, 4.08700e-11, 7.50232e-16}, + {1.58888e-01, 2.75623e-06, 4.90252e-11, 8.99935e-16}, + {1.91549e-01, 3.32281e-06, 5.91032e-11, 1.08494e-15}, + {2.30478e-01, 3.99813e-06, 7.11152e-11, 1.30544e-15}, + {2.76790e-01, 4.80151e-06, 8.54053e-11, 1.56776e-15}, + {3.33085e-01, 5.77806e-06, 1.02776e-10, 1.88663e-15}, + {4.05362e-01, 7.03188e-06, 1.25078e-10, 2.29603e-15}, + {5.08238e-01, 8.81651e-06, 1.56822e-10, 2.87877e-15}, + {6.72650e-01, 1.16686e-05, 2.07555e-10, 3.81010e-15}, + {9.48976e-01, 1.64623e-05, 2.92824e-10, 5.37545e-15}, + {1.41897e+00, 2.46158e-05, 4.37862e-10, 8.03808e-15}, + {2.19768e+00, 3.81252e-05, 6.78181e-10, 1.24501e-14}, + {3.47459e+00, 6.02792e-05, 1.07231e-09, 1.96868e-14}, + {5.79486e+00, 1.00542e-04, 1.78877e-09, 3.28453e-14}, + {1.18370e+01, 2.05418e-04, 3.65563e-09, 6.71473e-14}, + {3.21108e+01, 5.57348e-04, 9.92083e-09, 1.82279e-13}, + {8.81851e+01, 1.53068e-03, 2.72473e-08, 5.00649e-13}, + {1.95201e+02, 3.38815e-03, 6.03099e-08, 1.10811e-12}, + {3.40883e+02, 5.91645e-03, 1.05307e-07, 1.93471e-12}, + {5.10268e+02, 8.85442e-03, 1.57557e-07, 2.89365e-12}, + {7.17917e+02, 1.24511e-02, 2.21410e-07, 4.06297e-12}, + {9.57120e+02, 1.65879e-02, 2.94709e-07, 5.40198e-12}, + {1.14369e+03, 1.98088e-02, 3.51649e-07, 6.43917e-12}, + {1.17995e+03, 2.04271e-02, 3.62410e-07, 6.63127e-12}, + {1.05086e+03, 1.81866e-02, 3.22531e-07, 5.89860e-12}, + {8.23986e+02, 1.42573e-02, 2.52780e-07, 4.62145e-12}, + {5.83014e+02, 1.00864e-02, 1.78801e-07, 3.26825e-12}, + {3.80801e+02, 6.58750e-03, 1.16763e-07, 2.13399e-12}, + {2.33954e+02, 4.04697e-03, 7.17275e-08, 1.31079e-12}, + {1.37203e+02, 2.37328e-03, 4.20617e-08, 7.68622e-13}, + {7.77017e+01, 1.34403e-03, 2.38199e-08, 4.35268e-13}, + {4.28856e+01, 7.41814e-04, 1.31471e-08, 2.40245e-13}, + } + }, + { + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 4.59330e-04, + /* size_moments = */ {1.73471e-05, 3.08556e-10, 5.66409e-15}, + /* opacity_coef_table = */ { + {2.25374e-04, 2.84663e-09, 3.59861e-14, 4.55424e-19}, + {4.04950e-04, 5.11481e-09, 6.46597e-14, 8.18303e-19}, + {6.31024e-04, 7.97028e-09, 1.00758e-13, 1.27514e-18}, + {9.15633e-04, 1.15651e-08, 1.46202e-13, 1.85026e-18}, + {1.52197e-03, 1.92235e-08, 2.43017e-13, 3.07552e-18}, + {2.37410e-03, 2.99866e-08, 3.79080e-13, 4.79746e-18}, + {3.77219e-03, 4.76455e-08, 6.02318e-13, 7.62266e-18}, + {6.14378e-03, 7.76004e-08, 9.80998e-13, 1.24151e-17}, + {1.01916e-02, 1.28728e-07, 1.62733e-12, 2.05948e-17}, + {1.68921e-02, 2.13360e-07, 2.69722e-12, 3.41348e-17}, + {2.96213e-02, 3.74139e-07, 4.72974e-12, 5.98574e-17}, + {6.10970e-02, 7.71701e-07, 9.75560e-12, 1.23463e-16}, + {1.43533e-01, 1.81293e-06, 2.29185e-11, 2.90047e-16}, + {3.27806e-01, 4.14044e-06, 5.23423e-11, 6.62424e-16}, + {6.40565e-01, 8.09084e-06, 1.02282e-10, 1.29445e-15}, + {1.05534e+00, 1.33298e-05, 1.68513e-10, 2.13267e-15}, + {1.58348e+00, 2.00015e-05, 2.52868e-10, 3.20044e-15}, + {3.07310e+00, 3.88206e-05, 4.90841e-10, 6.21320e-15}, + {1.37089e+01, 1.73169e-04, 2.18940e-09, 2.77122e-14}, + {7.13521e+01, 9.01235e-04, 1.13932e-08, 1.44189e-13}, + {2.52035e+02, 3.18325e-03, 4.02394e-08, 5.09217e-13}, + {5.88759e+02, 7.43595e-03, 9.39947e-08, 1.18943e-12}, + {9.70270e+02, 1.22542e-02, 1.54897e-07, 1.96005e-12}, + {1.20866e+03, 1.52648e-02, 1.92951e-07, 2.44153e-12}, + {1.20927e+03, 1.52725e-02, 1.93046e-07, 2.44272e-12}, + {1.02223e+03, 1.29102e-02, 1.63185e-07, 2.06485e-12}, + {7.60460e+02, 9.60416e-03, 1.21396e-07, 1.53608e-12}, + {5.14029e+02, 6.49187e-03, 8.20570e-08, 1.03830e-12}, + {3.23438e+02, 4.08481e-03, 5.16318e-08, 6.53316e-13}, + {1.92889e+02, 2.43607e-03, 3.07917e-08, 3.89618e-13}, + {1.10502e+02, 1.39557e-03, 1.76399e-08, 2.23204e-13}, + {6.14046e+01, 7.75500e-04, 9.80225e-09, 1.24031e-13}, + {3.33434e+01, 4.21106e-04, 5.32274e-09, 6.73503e-14}, + {1.77894e+01, 2.24668e-04, 2.83978e-09, 3.59327e-14}, + {9.36317e+00, 1.18251e-04, 1.49468e-09, 1.89126e-14}, + } + }, + { + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 5.38389e-09, + /* size_moments = */ {1.26307e-05, 1.59673e-10, 2.02075e-15}, + /* opacity_coef_table = */ { + {1.54645e-01, 1.37048e-07, 2.64662e-13, 8.45209e-19}, + {1.94685e-01, 1.72534e-07, 3.33193e-13, 1.06408e-18}, + {2.45092e-01, 2.17207e-07, 4.19469e-13, 1.33961e-18}, + {3.08551e-01, 2.73447e-07, 5.28084e-13, 1.68649e-18}, + {3.88446e-01, 3.44254e-07, 6.64830e-13, 2.12322e-18}, + {4.89028e-01, 4.33396e-07, 8.36986e-13, 2.67303e-18}, + {6.15654e-01, 5.45619e-07, 1.05372e-12, 3.36522e-18}, + {7.75056e-01, 6.86892e-07, 1.32656e-12, 4.23661e-18}, + {9.75414e-01, 8.64464e-07, 1.66951e-12, 5.33191e-18}, + {1.22498e+00, 1.08564e-06, 2.09668e-12, 6.69620e-18}, + {1.52119e+00, 1.34817e-06, 2.60370e-12, 8.31550e-18}, + {1.83682e+00, 1.62792e-06, 3.14401e-12, 1.00412e-17}, + {2.15660e+00, 1.91133e-06, 3.69138e-12, 1.17894e-17}, + {2.55494e+00, 2.26439e-06, 4.37331e-12, 1.39675e-17}, + {3.22768e+00, 2.86067e-06, 5.52501e-12, 1.76460e-17}, + {4.33077e+00, 3.83839e-06, 7.41349e-12, 2.36779e-17}, + {5.81399e+00, 5.15308e-06, 9.95292e-12, 3.17892e-17}, + {7.48107e+00, 6.63084e-06, 1.28076e-11, 4.09082e-17}, + {9.20965e+00, 8.16336e-06, 1.57686e-11, 5.03682e-17}, + {1.11868e+01, 9.91669e-06, 1.91573e-11, 6.11981e-17}, + {1.39824e+01, 1.23969e-05, 2.39531e-11, 7.65315e-17}, + {1.78531e+01, 1.58317e-05, 3.05972e-11, 9.77803e-17}, + {2.17179e+01, 1.92624e-05, 3.72355e-11, 1.19020e-16}, + {2.37018e+01, 2.10255e-05, 4.06526e-11, 1.29977e-16}, + {2.29438e+01, 2.03578e-05, 3.93739e-11, 1.25940e-16}, + {2.02577e+01, 1.79829e-05, 3.48015e-11, 1.11389e-16}, + {1.70972e+01, 1.51927e-05, 2.94374e-11, 9.43240e-17}, + {1.43876e+01, 1.28090e-05, 2.48736e-11, 7.98414e-17}, + {1.23927e+01, 1.10758e-05, 2.16034e-11, 6.95714e-17}, + {1.14807e+01, 1.03984e-05, 2.05890e-11, 6.70125e-17}, + {1.34941e+01, 1.30878e-05, 2.78918e-11, 9.54730e-17}, + {2.46530e+01, 2.87907e-05, 7.29927e-11, 2.79411e-16}, + {6.22628e+01, 8.83029e-05, 2.60128e-10, 1.09021e-15}, + {1.73608e+02, 2.73721e-04, 8.65552e-10, 3.78030e-15}, + {4.81453e+02, 7.67244e-04, 2.43830e-09, 1.06714e-14}, + } + }, +}; + +} // namespace pisn200 + +namespace y19 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 0.00000e+00, 2.50000e-01}, + {"O", 1.73867e-01, 2.93867e-01}, + {"Mg", 0.00000e+00, 6.00000e-02}, + {"Al", 2.85361e-03, 2.85361e-03}, + {"Si", 0.00000e+00, 7.00000e-02}, + {"S", 1.58191e-02, 1.58191e-02}, + {"Fe", 6.64078e-02, 6.64078e-02}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { + { + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.50000e-01, + /* size_moments = */ {1.00000e-05, 1.00000e-10, 1.00000e-15}, + /* opacity_coef_table = */ { + {6.76020e-02, 6.76020e-07, 6.76020e-12, 6.76020e-17}, + {1.20181e-01, 1.20181e-06, 1.20181e-11, 1.20181e-16}, + {1.86375e-01, 1.86375e-06, 1.86375e-11, 1.86375e-16}, + {2.69708e-01, 2.69708e-06, 2.69708e-11, 2.69708e-16}, + {4.44368e-01, 4.44368e-06, 4.44368e-11, 4.44368e-16}, + {6.87406e-01, 6.87406e-06, 6.87406e-11, 6.87406e-16}, + {1.07797e+00, 1.07797e-05, 1.07797e-10, 1.07797e-15}, + {1.71241e+00, 1.71241e-05, 1.71241e-10, 1.71241e-15}, + {2.74163e+00, 2.74163e-05, 2.74163e-10, 2.74163e-15}, + {4.35812e+00, 4.35812e-05, 4.35812e-10, 4.35812e-15}, + {6.98720e+00, 6.98720e-05, 6.98720e-10, 6.98720e-15}, + {1.13206e+01, 1.13206e-04, 1.13206e-09, 1.13206e-14}, + {1.85159e+01, 1.85159e-04, 1.85159e-09, 1.85159e-14}, + {3.09414e+01, 3.09414e-04, 3.09414e-09, 3.09414e-14}, + {5.34575e+01, 5.34575e-04, 5.34575e-09, 5.34575e-14}, + {9.60912e+01, 9.60912e-04, 9.60912e-09, 9.60912e-14}, + {1.76000e+02, 1.76000e-03, 1.76000e-08, 1.76000e-13}, + {3.10598e+02, 3.10598e-03, 3.10598e-08, 3.10598e-13}, + {4.95502e+02, 4.95502e-03, 4.95502e-08, 4.95502e-13}, + {6.87389e+02, 6.87389e-03, 6.87389e-08, 6.87389e-13}, + {8.21760e+02, 8.21760e-03, 8.21760e-08, 8.21760e-13}, + {8.55209e+02, 8.55209e-03, 8.55209e-08, 8.55209e-13}, + {7.90315e+02, 7.90315e-03, 7.90315e-08, 7.90315e-13}, + {6.63814e+02, 6.63814e-03, 6.63814e-08, 6.63814e-13}, + {5.19410e+02, 5.19410e-03, 5.19410e-08, 5.19410e-13}, + {3.88956e+02, 3.88956e-03, 3.88956e-08, 3.88956e-13}, + {2.88141e+02, 2.88141e-03, 2.88141e-08, 2.88141e-13}, + {2.20698e+02, 2.20698e-03, 2.20698e-08, 2.20698e-13}, + {1.84716e+02, 1.84716e-03, 1.84716e-08, 1.84716e-13}, + {1.78316e+02, 1.78316e-03, 1.78316e-08, 1.78316e-13}, + {2.05010e+02, 2.05010e-03, 2.05010e-08, 2.05010e-13}, + {2.82760e+02, 2.82760e-03, 2.82760e-08, 2.82760e-13}, + {4.70437e+02, 4.70437e-03, 4.70437e-08, 4.70437e-13}, + {9.49808e+02, 9.49808e-03, 9.49808e-08, 9.49808e-13}, + {2.18634e+03, 2.18634e-02, 2.18634e-07, 2.18634e-12}, + } + }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 2.50000e-01, + /* size_moments = */ {1.00000e-05, 1.00000e-10, 1.00000e-15}, + /* opacity_coef_table = */ { + {2.19890e-02, 2.19890e-07, 2.19890e-12, 2.19890e-17}, + {3.90612e-02, 3.90612e-07, 3.90612e-12, 3.90612e-17}, + {6.05539e-02, 6.05539e-07, 6.05539e-12, 6.05539e-17}, + {8.76116e-02, 8.76116e-07, 8.76116e-12, 8.76116e-17}, + {1.43288e-01, 1.43288e-06, 1.43288e-11, 1.43288e-16}, + {2.19266e-01, 2.19266e-06, 2.19266e-11, 2.19266e-16}, + {3.36256e-01, 3.36256e-06, 3.36256e-11, 3.36256e-16}, + {5.14336e-01, 5.14336e-06, 5.14336e-11, 5.14336e-16}, + {7.97216e-01, 7.97216e-06, 7.97216e-11, 7.97216e-16}, + {1.25414e+00, 1.25414e-05, 1.25414e-10, 1.25414e-15}, + {2.03450e+00, 2.03450e-05, 2.03450e-10, 2.03450e-15}, + {3.34654e+00, 3.34654e-05, 3.34654e-10, 3.34654e-15}, + {5.45913e+00, 5.45913e-05, 5.45913e-10, 5.45913e-15}, + {8.82166e+00, 8.82166e-05, 8.82166e-10, 8.82166e-15}, + {1.41836e+01, 1.41836e-04, 1.41836e-09, 1.41836e-14}, + {2.28449e+01, 2.28449e-04, 2.28449e-09, 2.28449e-14}, + {3.71258e+01, 3.71258e-04, 3.71258e-09, 3.71258e-14}, + {6.14485e+01, 6.14485e-04, 6.14485e-09, 6.14485e-14}, + {1.03898e+02, 1.03898e-03, 1.03898e-08, 1.03898e-13}, + {1.75627e+02, 1.75627e-03, 1.75627e-08, 1.75627e-13}, + {2.82290e+02, 2.82290e-03, 2.82290e-08, 2.82290e-13}, + {4.14908e+02, 4.14908e-03, 4.14908e-08, 4.14908e-13}, + {5.60606e+02, 5.60606e-03, 5.60606e-08, 5.60606e-13}, + {7.12020e+02, 7.12020e-03, 7.12020e-08, 7.12020e-13}, + {8.42130e+02, 8.42130e-03, 8.42130e-08, 8.42130e-13}, + {8.96812e+02, 8.96812e-03, 8.96812e-08, 8.96812e-13}, + {8.41845e+02, 8.41845e-03, 8.41845e-08, 8.41845e-13}, + {6.97883e+02, 6.97883e-03, 6.97883e-08, 6.97883e-13}, + {5.19082e+02, 5.19082e-03, 5.19082e-08, 5.19082e-13}, + {3.53464e+02, 3.53464e-03, 3.53464e-08, 3.53464e-13}, + {2.24610e+02, 2.24610e-03, 2.24610e-08, 2.24610e-13}, + {1.35389e+02, 1.35389e-03, 1.35389e-08, 1.35389e-13}, + {7.84898e+01, 7.84898e-04, 7.84898e-09, 7.84898e-14}, + {4.43113e+01, 4.43113e-04, 4.43113e-09, 4.43113e-14}, + {2.49396e+01, 2.49396e-04, 2.49396e-09, 2.49396e-14}, + } + }, +}; + +} // namespace y19 + +// clang-format on +} // namespace grackle::impl::inj_model_input + +#define STRINGIFY_HELPER(s) #s + +// called inside of input_inject_model_iterate +#define PROCESS_INJ_MODEL(NAME, OP, OP_DATA) \ + { \ + grackle::impl::inj_model_input::InjectionPathwayInputData input = { \ + /* metal_nuclide_yields = */ \ + (grackle::impl::inj_model_input::NAME::metal_props), \ + \ + /* n_metal_nuclide_yields = */ \ + static_cast( \ + sizeof(grackle::impl::inj_model_input::NAME::metal_props) / \ + sizeof(grackle::impl::inj_model_input::MetalNuclideYieldProps)), \ + \ + /* initial_grain_props = */ \ + (grackle::impl::inj_model_input::NAME ::grain_props), \ + \ + /* n_injected_grain_species = */ \ + static_cast( \ + sizeof(grackle::impl::inj_model_input::NAME::grain_props) / \ + sizeof(grackle::impl::inj_model_input::GrainSpeciesYieldProps)), \ + }; \ + \ + int tmp = OP(STRINGIFY_HELPER(NAME), &input, OP_DATA); \ + if (tmp != GR_SUCCESS) { \ + return tmp; \ + } \ + } + +int grackle::impl::inj_model_input::input_inject_model_iterate(inj_iterate_t op, + void* op_data) { + PROCESS_INJ_MODEL(local_ISM, op, op_data); + PROCESS_INJ_MODEL(ccsn13, op, op_data); + PROCESS_INJ_MODEL(ccsn20, op, op_data); + PROCESS_INJ_MODEL(ccsn25, op, op_data); + PROCESS_INJ_MODEL(ccsn30, op, op_data); + PROCESS_INJ_MODEL(fsn13, op, op_data); + PROCESS_INJ_MODEL(fsn15, op, op_data); + PROCESS_INJ_MODEL(fsn50, op, op_data); + PROCESS_INJ_MODEL(fsn80, op, op_data); + PROCESS_INJ_MODEL(pisn170, op, op_data); + PROCESS_INJ_MODEL(pisn200, op, op_data); + PROCESS_INJ_MODEL(y19, op, op_data); + return GR_SUCCESS; +} diff --git a/src/clib/inject_model/raw_data.hpp b/src/clib/inject_model/raw_data.hpp index aad12e52c..c1e2ddc03 100644 --- a/src/clib/inject_model/raw_data.hpp +++ b/src/clib/inject_model/raw_data.hpp @@ -102,7 +102,8 @@ struct GrainSpeciesYieldProps { extern "C" { /// protoype for callback function used with input_inject_model_iterate -typedef int (*inj_iterate_t)(const char* name, InjectionPathwayInputData* input, +typedef int (*inj_iterate_t)(const char* name, + const InjectionPathwayInputData* input, void* op_data); } From 22c981d89a8a344f7421a97360f2e836c8ac11a0 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 21:42:09 -0500 Subject: [PATCH 028/111] confirm new src for total nuclide yields is correct --- src/clib/initialize_dust_yields.cpp | 65 +++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 153934cbc..889f67e53 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -63,7 +63,7 @@ int lookup_pathway_idx(const char* name) { /// the context object for setup_yield_table_callback struct SetupCallbackCtx{ chemistry_data_storage *my_rates; - int setup_counter; + int counter; }; /// a callback function that sets up the appropriate parts of @@ -90,6 +90,10 @@ extern "C" int setup_yield_table_callback( return GrPrintAndReturnErr( "`%s` is an unexpected injection pathway name", name); } + + int counter_val = static_cast(ctx)->counter; + + GR_INTERNAL_REQUIRE(counter_val == pathway_idx, "sanity-checking"); //printf("encounterd: `%s`, pathway_idx: %d\n", name, pathway_idx); //fflush(stdout); @@ -99,6 +103,47 @@ extern "C" int setup_yield_table_callback( grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; + GR_INTERNAL_REQUIRE(input->n_metal_nuclide_yields == 7, "sanity-checking"); + + auto copy_data = [pathway_idx](const grackle::impl::yields::MetalTables& tab, + double* ptr) + { + ptr[0] = tab.C[pathway_idx]; + ptr[1] = tab.O[pathway_idx]; + ptr[2] = tab.Mg[pathway_idx]; + ptr[3] = tab.Al[pathway_idx]; + ptr[4] = tab.Si[pathway_idx]; + ptr[5] = tab.S[pathway_idx]; + ptr[6] = tab.Fe[pathway_idx]; + }; + + auto clear_tab = [pathway_idx](const grackle::impl::yields::MetalTables& tab) + { + tab.C[pathway_idx] = NAN; + tab.O[pathway_idx] = NAN; + tab.Mg[pathway_idx] = NAN; + tab.Al[pathway_idx] = NAN; + tab.Si[pathway_idx] = NAN; + tab.S[pathway_idx] = NAN; + tab.Fe[pathway_idx] = NAN; + }; + + double original[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + double updated[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + + copy_data(inject_pathway_props->total_metal_nuclide_yields, original); + + printf("\n"); + for (int i = 0; i < 7; i++) { + printf("%g, ", original[i]); + } + printf("\n"); + fflush(stdout); + + clear_tab(inject_pathway_props->total_metal_nuclide_yields); + + + // record each metal nuclide yield // -> there is less value to using string keys in this case, but it makes // some sense to be semi-consistent with the handling of the dust species @@ -137,10 +182,19 @@ extern "C" int setup_yield_table_callback( "`%s` not a known metal nuclide", yield_info.name); } - //total_yield[pathway_idx] = yield_info.total_yield; + total_yield[pathway_idx] = yield_info.total_yield; //gas_yield[pathway_idx] = yield_info.gas_yield; } + copy_data(inject_pathway_props->total_metal_nuclide_yields, updated); + for (int i =0; i <7; i++){ + if (original[i] != updated[i]) { + printf("nuclide %d has changed!\n", i); + fflush(stdout); + return GR_FAIL; + } + } + // record each grain species yield for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; yield_idx++) { @@ -235,6 +289,8 @@ extern "C" int setup_yield_table_callback( */ } + (static_cast(ctx)->counter)++; + return GR_SUCCESS; } @@ -440,9 +496,10 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int ret = grackle::impl::inj_model_input::input_inject_model_iterate( &setup_yield_table_callback, static_cast(&ctx)); if (ret != GR_SUCCESS) { - GRIMPL_ERROR("THERE WAS AN ERROR"); + return GR_FAIL; } - //return GR_FAIL; + + GR_INTERNAL_REQUIRE(ctx.counter == 12, "sanity-checking"); return GR_SUCCESS; } From 29b602878f2c606797dfee7b89897f852d4cd377 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 21:45:57 -0500 Subject: [PATCH 029/111] confirm new src for gas nuclide yields is correct --- src/clib/initialize_dust_yields.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 889f67e53..48d04332b 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -131,7 +131,7 @@ extern "C" int setup_yield_table_callback( double original[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double updated[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - copy_data(inject_pathway_props->total_metal_nuclide_yields, original); + copy_data(inject_pathway_props->gas_metal_nuclide_yields, original); printf("\n"); for (int i = 0; i < 7; i++) { @@ -141,6 +141,7 @@ extern "C" int setup_yield_table_callback( fflush(stdout); clear_tab(inject_pathway_props->total_metal_nuclide_yields); + clear_tab(inject_pathway_props->gas_metal_nuclide_yields); @@ -183,10 +184,10 @@ extern "C" int setup_yield_table_callback( } total_yield[pathway_idx] = yield_info.total_yield; - //gas_yield[pathway_idx] = yield_info.gas_yield; + gas_yield[pathway_idx] = yield_info.gas_yield; } - copy_data(inject_pathway_props->total_metal_nuclide_yields, updated); + copy_data(inject_pathway_props->gas_metal_nuclide_yields, updated); for (int i =0; i <7; i++){ if (original[i] != updated[i]) { printf("nuclide %d has changed!\n", i); From 5b1f50bd5af492b9793b98b28caf4b26db279faf Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 5 Dec 2025 21:50:30 -0500 Subject: [PATCH 030/111] finish transition to newer datasource for metal nuclide yields --- src/clib/initialize_dust_yields.cpp | 243 ---------------------------- 1 file changed, 243 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 48d04332b..36abee786 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -103,48 +103,6 @@ extern "C" int setup_yield_table_callback( grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - GR_INTERNAL_REQUIRE(input->n_metal_nuclide_yields == 7, "sanity-checking"); - - auto copy_data = [pathway_idx](const grackle::impl::yields::MetalTables& tab, - double* ptr) - { - ptr[0] = tab.C[pathway_idx]; - ptr[1] = tab.O[pathway_idx]; - ptr[2] = tab.Mg[pathway_idx]; - ptr[3] = tab.Al[pathway_idx]; - ptr[4] = tab.Si[pathway_idx]; - ptr[5] = tab.S[pathway_idx]; - ptr[6] = tab.Fe[pathway_idx]; - }; - - auto clear_tab = [pathway_idx](const grackle::impl::yields::MetalTables& tab) - { - tab.C[pathway_idx] = NAN; - tab.O[pathway_idx] = NAN; - tab.Mg[pathway_idx] = NAN; - tab.Al[pathway_idx] = NAN; - tab.Si[pathway_idx] = NAN; - tab.S[pathway_idx] = NAN; - tab.Fe[pathway_idx] = NAN; - }; - - double original[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double updated[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - - copy_data(inject_pathway_props->gas_metal_nuclide_yields, original); - - printf("\n"); - for (int i = 0; i < 7; i++) { - printf("%g, ", original[i]); - } - printf("\n"); - fflush(stdout); - - clear_tab(inject_pathway_props->total_metal_nuclide_yields); - clear_tab(inject_pathway_props->gas_metal_nuclide_yields); - - - // record each metal nuclide yield // -> there is less value to using string keys in this case, but it makes // some sense to be semi-consistent with the handling of the dust species @@ -187,15 +145,6 @@ extern "C" int setup_yield_table_callback( gas_yield[pathway_idx] = yield_info.gas_yield; } - copy_data(inject_pathway_props->gas_metal_nuclide_yields, updated); - for (int i =0; i <7; i++){ - if (original[i] != updated[i]) { - printf("nuclide %d has changed!\n", i); - fflush(stdout); - return GR_FAIL; - } - } - // record each grain species yield for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; yield_idx++) { @@ -577,22 +526,6 @@ int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 1.79042e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 5.11524e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.46246e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 3.07922e-03; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 3.76121e-02; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 2.21374e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 6.77017e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 5.01317e-02; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 2.78491e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 3.07922e-03; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 3.50813e-03; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.66568e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.35403e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust][iSN] = 1.36165e-01; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 3.84003e-02; @@ -917,22 +850,6 @@ int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.65314e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 3.00982e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.06651e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.47296e-04; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 6.38319e-02; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 3.40910e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 9.62448e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 2.16731e-01; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 2.99231e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 3.03586e-02; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.47296e-04; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 4.59041e-02; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 3.40903e-02; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 7.22586e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 1.65746e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 2.39849e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 8.69522e-04; @@ -1299,22 +1216,6 @@ int calc_rates_dust_C20(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 1.00183e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 6.06515e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 2.75968e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.87118e-04; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.00051e-01; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 6.02208e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 3.07560e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 8.74563e-02; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 6.04383e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.63753e-02; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.87118e-04; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 6.44592e-02; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 6.02018e-02; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 2.69505e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 3.44388e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.77223e-03; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.90086e-03; @@ -1723,22 +1624,6 @@ int calc_rates_dust_C25(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 1.75488e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 5.69674e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.12340e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.98415e-04; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 8.33205e-02; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 4.73930e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 1.98197e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 1.34092e-01; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 5.53726e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.48100e-02; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.98415e-04; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 3.47760e-02; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 4.72556e-02; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.46955e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 3.83373e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 4.88366e-03; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.68068e-02; @@ -2147,22 +2032,6 @@ int calc_rates_dust_C30(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 4.99965e-02; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 7.32832e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.87430e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 8.61678e-04; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 7.18810e-02; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 3.70455e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 1.45822e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 4.93773e-02; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 7.29130e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 3.76731e-02; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 8.61678e-04; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 4.01269e-02; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 3.68812e-02; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 1.23641e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 2.91389e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.93065e-03; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 7.73041e-04; @@ -2571,22 +2440,6 @@ int calc_rates_dust_F13(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 6.69235e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 3.30556e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 1.86824e-04; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.97017e-07; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.30184e-05; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 8.90341e-06; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 4.93693e-01; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 3.30556e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 1.86824e-04; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.97017e-07; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.30184e-05; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 8.90341e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 6.31648e-26; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.06081e-16; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 3.19262e-15; @@ -2911,22 +2764,6 @@ int calc_rates_dust_F15(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 6.46299e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 3.53548e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 1.29204e-04; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.22729e-07; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.32242e-05; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 9.66658e-06; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 4.57071e-01; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 3.53548e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 1.29204e-04; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.22729e-07; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.32242e-05; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 9.66658e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.53361e-25; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.56864e-15; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.13810e-14; @@ -3251,22 +3088,6 @@ int calc_rates_dust_F50(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.79167e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 7.20575e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 2.49794e-04; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.66468e-08; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 4.01099e-06; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 4.15804e-06; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 2.79057e-01; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 7.20575e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.49793e-04; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.66468e-08; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 4.01058e-06; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 4.15804e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 2.33171e-24; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.62486e-10; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 1.21446e-09; @@ -3591,22 +3412,6 @@ int calc_rates_dust_F80(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.52563e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 7.46061e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 1.36917e-03; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.55602e-08; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 3.63906e-06; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 2.43915e-06; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 2.43883e-01; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 7.46061e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 1.36917e-03; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.55602e-08; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 3.63906e-06; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 2.43915e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.87590e-26; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.36180e-13; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.48190e-12; @@ -3931,22 +3736,6 @@ int calc_rates_dust_P170(int iSN, chemistry_data *my_chemistry, chemistry_data_s grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 5.29975e-02; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 5.60864e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 3.58367e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 3.27680e-04; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.52750e-01; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 8.06035e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 5.29729e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 5.29528e-02; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 5.60799e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 3.58366e-02; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 3.27680e-04; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.39585e-01; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 8.06035e-02; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 5.29394e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 1.31079e-02; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.34688e-05; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.84952e-13; @@ -4271,22 +4060,6 @@ int calc_rates_dust_P200(int iSN, chemistry_data *my_chemistry, chemistry_data_s grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 3.65050e-02; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 4.88552e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 2.69665e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 1.36872e-04; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 1.87324e-01; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 1.15582e-01; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 6.79294e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 3.64677e-02; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 4.88307e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 2.69665e-02; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 1.36872e-04; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 1.87051e-01; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 1.15582e-01; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 6.75026e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 5.90622e-05; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 4.26809e-04; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 4.08246e-15; @@ -4569,22 +4342,6 @@ int calc_rates_dust_Y19(int iSN, chemistry_data *my_chemistry, chemistry_data_st grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 2.50000e-01; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 2.93867e-01; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 6.00000e-02; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 2.85361e-03; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 7.00000e-02; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 1.58191e-02; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 6.64078e-02; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 1.73867e-01; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 2.85361e-03; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 0.00000e+00; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 1.58191e-02; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 6.64078e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust][iSN] = 2.50000e-01; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 2.50000e-01; From 29f04c23b6d2bd1972e764580d16bbc76a1f9ab0 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 10:24:18 -0500 Subject: [PATCH 031/111] pull out zeroing logic (inject-rates) 1 of 2 The goal is two-fold: 1. reduce the length of grackle::impl::initialize_dust_yields 2. make some anticipated spot checks a LOT easier --- src/clib/initialize_dust_yields.cpp | 93 +++++++++++++++++++---------- 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 36abee786..ccd3dc117 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -244,6 +244,62 @@ extern "C" int setup_yield_table_callback( return GR_SUCCESS; } +/// a helper function override the values of all metal injection properties +void override_metal_inject_props( + grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + double value, int n_pathways) +{ + for(int iSN = 0; iSN < n_pathways; iSN++) { + inject_pathway_props->total_metal_nuclide_yields.C [iSN] = value; + inject_pathway_props->total_metal_nuclide_yields.O [iSN] = value; + inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = value; + inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = value; + inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = value; + inject_pathway_props->total_metal_nuclide_yields.S [iSN] = value; + inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = value; + + inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = value; + inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = value; + inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = value; + inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = value; + inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = value; + inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = value; + inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = value; + } +} + +/// a helper function to override the values of all dust inject properties +/// +/// @note +/// to start, this only handles the grain yields +void override_dust_inject_props(chemistry_data_storage *my_rates, + double value, int n_pathways) { + + GRIMPL_REQUIRE(my_rates != nullptr && my_rates->opaque_storage != nullptr, + "sanity check -- should never ever fail!"); + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + if (inject_pathway_props != nullptr) { + for(int iSN = 0; iSN < n_pathways; iSN++) { + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust] [iSN] = value; + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust] [iSN] = value; + } + } + +} + } // anonymous namespace int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, @@ -287,38 +343,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = inject_pathway_props->gas_metal_nuclide_yields.S; my_rates->SN0_fFe = inject_pathway_props->gas_metal_nuclide_yields.Fe; - for(int iSN = 0; iSN < NSN; iSN++) { - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = 0.0; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = 0.0; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = 0.0; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = 0.0; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = 0.0; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = 0.0; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = 0.0; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = 0.0; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = 0.0; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = 0.0; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = 0.0; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = 0.0; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = 0.0; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = 0.0; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust] [iSN] = 0.0; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust] [iSN] = 0.0; - } - my_rates->SN0_r0SiM = (double*)malloc(NSN * 3 * sizeof(double)); my_rates->SN0_r0FeM = (double*)malloc(NSN * 3 * sizeof(double)); my_rates->SN0_r0Mg2SiO4 = (double*)malloc(NSN * 3 * sizeof(double)); @@ -428,6 +452,11 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, } } + // zero-out all metal injection yield fractions and dust grain properties + override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); + override_dust_inject_props(my_rates, 0.0, n_pathways); + + // initialize all of the properties calc_yield_rate_fn* fn_list[] = { &calc_rates_dust_loc, &calc_rates_dust_C13, &calc_rates_dust_C20, &calc_rates_dust_C25, &calc_rates_dust_C30, &calc_rates_dust_F13, From 0b95a9cb841e7f1611a7ecce1dc9c548708b183f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 10:43:35 -0500 Subject: [PATCH 032/111] pull out zeroing logic (inject-rates) 2 of 2 --- src/clib/initialize_dust_yields.cpp | 83 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index ccd3dc117..dc9734e71 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -281,6 +281,7 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, = my_rates->opaque_storage->inject_pathway_props; if (inject_pathway_props != nullptr) { + // handle the grain yields for(int iSN = 0; iSN < n_pathways; iSN++) { inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = value; inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = value; @@ -298,6 +299,44 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, } } + if (true) { // NOLINT(readability-simplify-boolean-expr) + + // handle the size moments + int moment_table_len = n_pathways * 3; // there are 3 size moments + for(int i = 0; i < moment_table_len; i++) { + my_rates->SN0_r0SiM [i] = value; + my_rates->SN0_r0FeM [i] = value; + my_rates->SN0_r0Mg2SiO4 [i] = value; + my_rates->SN0_r0MgSiO3 [i] = value; + my_rates->SN0_r0Fe3O4 [i] = value; + my_rates->SN0_r0AC [i] = value; + my_rates->SN0_r0SiO2D [i] = value; + my_rates->SN0_r0MgO [i] = value; + my_rates->SN0_r0FeS [i] = value; + my_rates->SN0_r0Al2O3 [i] = value; + my_rates->SN0_r0reforg [i] = value; + my_rates->SN0_r0volorg [i] = value; + my_rates->SN0_r0H2Oice [i] = value; + } + + // handle the opacity coefficient table + int opac_table_len = n_pathways * my_rates->gr_Size; + for(int i = 0; i < opac_table_len; i++) { + my_rates->SN0_kpSiM [i] = value; + my_rates->SN0_kpFeM [i] = value; + my_rates->SN0_kpMg2SiO4 [i] = value; + my_rates->SN0_kpMgSiO3 [i] = value; + my_rates->SN0_kpFe3O4 [i] = value; + my_rates->SN0_kpAC [i] = value; + my_rates->SN0_kpSiO2D [i] = value; + my_rates->SN0_kpMgO [i] = value; + my_rates->SN0_kpFeS [i] = value; + my_rates->SN0_kpAl2O3 [i] = value; + my_rates->SN0_kpreforg [i] = value; + my_rates->SN0_kpvolorg [i] = value; + my_rates->SN0_kpH2Oice [i] = value; + } + } } } // anonymous namespace @@ -357,26 +396,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_r0volorg = (double*)malloc(NSN * 3 * sizeof(double)); my_rates->SN0_r0H2Oice = (double*)malloc(NSN * 3 * sizeof(double)); - int itab = 0; - for(int iSN = 0; iSN < NSN; iSN++) { - for(int imom = 0; imom < 3; imom++) { - my_rates->SN0_r0SiM [itab] = 0.0; - my_rates->SN0_r0FeM [itab] = 0.0; - my_rates->SN0_r0Mg2SiO4 [itab] = 0.0; - my_rates->SN0_r0MgSiO3 [itab] = 0.0; - my_rates->SN0_r0Fe3O4 [itab] = 0.0; - my_rates->SN0_r0AC [itab] = 0.0; - my_rates->SN0_r0SiO2D [itab] = 0.0; - my_rates->SN0_r0MgO [itab] = 0.0; - my_rates->SN0_r0FeS [itab] = 0.0; - my_rates->SN0_r0Al2O3 [itab] = 0.0; - my_rates->SN0_r0reforg [itab] = 0.0; - my_rates->SN0_r0volorg [itab] = 0.0; - my_rates->SN0_r0H2Oice [itab] = 0.0; - itab++; - } - } - // write out the opacity related quantities // todo: consider renaming Nmom -> Ncoef @@ -427,30 +446,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_kpvolorg = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); my_rates->SN0_kpH2Oice = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - itab = 0; - for(int iSN = 0; iSN < NSN; iSN++) { - // TODO: I'm pretty sure we want to flip the order of inner loops - // - while it doesn't actually effect the result this is extremely - // confusing if the grain-temperature axis isn't the fast axis. - for(int imom = 0; imom < Nmom; imom++) { - for(int iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab] = 0.0; - my_rates->SN0_kpFeM [itab] = 0.0; - my_rates->SN0_kpMg2SiO4 [itab] = 0.0; - my_rates->SN0_kpMgSiO3 [itab] = 0.0; - my_rates->SN0_kpFe3O4 [itab] = 0.0; - my_rates->SN0_kpAC [itab] = 0.0; - my_rates->SN0_kpSiO2D [itab] = 0.0; - my_rates->SN0_kpMgO [itab] = 0.0; - my_rates->SN0_kpFeS [itab] = 0.0; - my_rates->SN0_kpAl2O3 [itab] = 0.0; - my_rates->SN0_kpreforg [itab] = 0.0; - my_rates->SN0_kpvolorg [itab] = 0.0; - my_rates->SN0_kpH2Oice [itab] = 0.0; - itab++; - } - } - } // zero-out all metal injection yield fractions and dust grain properties override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); From ff118a58e739b8901def4d797488256b233b93b0 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 12:23:27 -0500 Subject: [PATCH 033/111] add temporary machinery in preparation for transition in grain data source --- src/clib/initialize_dust_yields.cpp | 149 ++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index dc9734e71..2956549e7 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include "grackle_macros.h" #include "grackle_chemistry_data.h" #include "initialize_dust_yields.hpp" // forward declarations @@ -339,6 +341,145 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, } } +struct SummaryGrainYieldProp{ + std::string name; + std::vector yield_frac; + std::vector size_moments; + std::vector opacity_coef_table; + + bool operator==(const SummaryGrainYieldProp& other) const { + return ( + (name == other.name) && + (yield_frac == other.yield_frac) && + (size_moments == other.size_moments) && + (opacity_coef_table == other.opacity_coef_table) + ); + } + + + bool operator!=(const SummaryGrainYieldProp& other) const { + return ( + (name != other.name) || + (yield_frac != other.yield_frac) || + (size_moments != other.size_moments) || + (opacity_coef_table != other.opacity_coef_table) + ); + } +}; + +std::vector +get_summary(chemistry_data_storage *my_rates, int n_pathways) { + + GRIMPL_REQUIRE(my_rates != nullptr && my_rates->opaque_storage != nullptr, + "sanity check -- should never ever fail!"); + grackle::impl::GrainMetalInjectPathways* inject_pathway_props + = my_rates->opaque_storage->inject_pathway_props; + + GRIMPL_REQUIRE(inject_pathway_props != nullptr, + "sanity check -- should never ever fail!"); + auto helper_fn = [=](const char* name) { + + int grain_species_idx = -1; + const double* cur_size_mom_table = nullptr; + const double* cur_opac_coef_table = nullptr; + if (std::strcmp("MgSiO3_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; + cur_size_mom_table = my_rates->SN0_r0MgSiO3; + cur_opac_coef_table = my_rates->SN0_kpMgSiO3; + } else if (std::strcmp("AC_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::AC_dust; + cur_size_mom_table = my_rates->SN0_r0AC; + cur_opac_coef_table = my_rates->SN0_kpAC; + } else if (std::strcmp("SiM_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::SiM_dust; + cur_size_mom_table = my_rates->SN0_r0SiM; + cur_opac_coef_table = my_rates->SN0_kpSiM; + } else if (std::strcmp("FeM_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::FeM_dust; + cur_size_mom_table = my_rates->SN0_r0FeM; + cur_opac_coef_table = my_rates->SN0_kpFeM; + } else if (std::strcmp("Mg2SiO4_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; + cur_size_mom_table = my_rates->SN0_r0Mg2SiO4; + cur_opac_coef_table = my_rates->SN0_kpMg2SiO4; + } else if (std::strcmp("Fe3O4_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; + cur_size_mom_table = my_rates->SN0_r0Fe3O4; + cur_opac_coef_table = my_rates->SN0_kpFe3O4; + } else if (std::strcmp("SiO2_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::SiO2_dust; + cur_size_mom_table = my_rates->SN0_r0SiO2D; + cur_opac_coef_table = my_rates->SN0_kpSiO2D; + } else if (std::strcmp("MgO_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::MgO_dust; + cur_size_mom_table = my_rates->SN0_r0MgO; + cur_opac_coef_table = my_rates->SN0_kpMgO; + } else if (std::strcmp("FeS_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::FeS_dust; + cur_size_mom_table = my_rates->SN0_r0FeS; + cur_opac_coef_table = my_rates->SN0_kpFeS; + } else if (std::strcmp("Al2O3_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; + cur_size_mom_table = my_rates->SN0_r0Al2O3; + cur_opac_coef_table = my_rates->SN0_kpAl2O3; + } else if (std::strcmp("ref_org_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::ref_org_dust; + cur_size_mom_table = my_rates->SN0_r0reforg; + cur_opac_coef_table = my_rates->SN0_kpreforg; + } else if (std::strcmp("vol_org_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::vol_org_dust; + cur_size_mom_table = my_rates->SN0_r0volorg; + cur_opac_coef_table = my_rates->SN0_kpvolorg; + } else if (std::strcmp("H2O_ice_dust", name) == 0) { + grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; + cur_size_mom_table = my_rates->SN0_r0H2Oice; + cur_opac_coef_table = my_rates->SN0_kpH2Oice; + } else { + GRIMPL_ERROR("THERE'S A PROBLEM"); + } + + const double* cur_yields = + inject_pathway_props->grain_yields.data[grain_species_idx]; + + std::vector yields(cur_yields, cur_yields + n_pathways); + std::vector size_mom_table + (cur_size_mom_table, cur_size_mom_table + (n_pathways*3)); + std::vector opac_coef_table + (cur_opac_coef_table, + cur_opac_coef_table + (n_pathways*my_rates->gr_Size)); + return SummaryGrainYieldProp{std::string(name), + yields, + size_mom_table, + opac_coef_table}; + }; + + std::vector names = { + "MgSiO3_dust", + "AC_dust", + "SiM_dust", + "FeM_dust", + "Mg2SiO4_dust", + "Fe3O4_dust", + "SiO2_dust", + "MgO_dust", + "FeS_dust", + "Al2O3_dust", + "ref_org_dust", + "vol_org_dust", + "H2O_ice_dust", + }; + + + std::vector out; + for (auto name : names){ + out.push_back(helper_fn(name.c_str())); + } + std::printf("%s\n", out[2].name.c_str()); + return out; + +} + + } // anonymous namespace int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, @@ -451,6 +592,9 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); override_dust_inject_props(my_rates, 0.0, n_pathways); + + std::vector raw = get_summary(my_rates, n_pathways); + // initialize all of the properties calc_yield_rate_fn* fn_list[] = { &calc_rates_dust_loc, &calc_rates_dust_C13, &calc_rates_dust_C20, @@ -465,6 +609,11 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int rv = fn_list[i](i, my_chemistry, my_rates); if (rv != SUCCESS) { return rv; } } + + std::vector original_set = get_summary(my_rates, + n_pathways); + // if (raw != original_set) { return GrPrintAndReturnErr("expected to fail!"); } + SetupCallbackCtx ctx = {my_rates, 0}; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( From 0b74a6ba13858c7e1e80f59cb36d9f40e80134f1 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 15:36:17 -0500 Subject: [PATCH 034/111] fixed a major error in the reformated tables of injection model data (essentially data was randomly swapped between dust species within a given injection pathway) --- src/clib/inject_model/raw_data.cpp | 1422 ++++++++++++++-------------- 1 file changed, 711 insertions(+), 711 deletions(-) diff --git a/src/clib/inject_model/raw_data.cpp b/src/clib/inject_model/raw_data.cpp index 2d5a7b72d..f63ec1dae 100644 --- a/src/clib/inject_model/raw_data.cpp +++ b/src/clib/inject_model/raw_data.cpp @@ -43,6 +43,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "FeM_dust", /* nonprimoridal_yield_frac = */ 1.35403e-02, /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, + /* opacity_coef_table = */ { + {3.03937e-04, 1.23816e-09, 4.62094e-14, 3.72497e-18}, + {5.33931e-04, 1.94666e-09, 6.42306e-14, 4.92267e-18}, + {8.23085e-04, 2.82715e-09, 8.64655e-14, 6.40508e-18}, + {1.18689e-03, 3.92926e-09, 1.14201e-13, 8.25547e-18}, + {1.93090e-03, 5.86828e-09, 1.50433e-13, 1.02764e-17}, + {2.95251e-03, 8.43657e-09, 1.95467e-13, 1.27089e-17}, + {4.55033e-03, 1.22013e-08, 2.52591e-13, 1.54880e-17}, + {7.04895e-03, 1.77533e-08, 3.26595e-13, 1.87358e-17}, + {1.09337e-02, 2.59554e-08, 4.24054e-13, 2.26060e-17}, + {1.67787e-02, 3.77909e-08, 5.51941e-13, 2.72576e-17}, + {2.56790e-02, 5.50228e-08, 7.20688e-13, 3.28090e-17}, + {3.89780e-02, 7.95600e-08, 9.39516e-13, 3.93285e-17}, + {5.82741e-02, 1.13372e-07, 1.21633e-12, 4.68721e-17}, + {8.58228e-02, 1.58873e-07, 1.55917e-12, 5.54857e-17}, + {1.24511e-01, 2.18724e-07, 1.97549e-12, 6.52470e-17}, + {1.78164e-01, 2.96038e-07, 2.47229e-12, 7.62244e-17}, + {2.51965e-01, 3.94501e-07, 3.05495e-12, 8.84292e-17}, + {3.53706e-01, 5.19228e-07, 3.72904e-12, 1.01872e-16}, + {4.96690e-01, 6.79268e-07, 4.51008e-12, 1.16807e-16}, + {7.06391e-01, 8.93298e-07, 5.44240e-12, 1.34078e-16}, + {1.03345e+00, 1.19958e-06, 6.62440e-12, 1.55520e-16}, + {1.58058e+00, 1.67481e-06, 8.24715e-12, 1.84604e-16}, + {2.55750e+00, 2.47088e-06, 1.06606e-11, 2.27517e-16}, + {4.39505e+00, 3.88891e-06, 1.44836e-11, 2.94492e-16}, + {7.97338e+00, 6.52370e-06, 2.07697e-11, 4.00081e-16}, + {1.50676e+01, 1.15419e-05, 3.12837e-11, 5.61771e-16}, + {2.91750e+01, 2.11959e-05, 4.90431e-11, 7.99872e-16}, + {5.69546e+01, 3.97177e-05, 7.93362e-11, 1.14279e-15}, + {1.10473e+02, 7.47151e-05, 1.31340e-10, 1.63629e-15}, + {2.10337e+02, 1.39130e-04, 2.20345e-10, 2.35251e-15}, + {3.89661e+02, 2.53753e-04, 3.70677e-10, 3.39830e-15}, + {6.99152e+02, 4.50456e-04, 6.19407e-10, 4.92457e-15}, + {1.21457e+03, 7.76739e-04, 1.02057e-09, 7.13090e-15}, + {2.05022e+03, 1.30302e-03, 1.64745e-09, 1.02322e-14}, + {3.38793e+03, 2.13731e-03, 2.59306e-09, 1.43690e-14}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.36165e-01, + /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, /* opacity_coef_table = */ { {2.45237e-01, 1.46287e-07, 1.48927e-13, 1.14540e-18}, {3.08964e-01, 1.84301e-07, 1.87627e-13, 1.44311e-18}, @@ -82,8 +124,8 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 1.36165e-01, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 3.84003e-02, /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, /* opacity_coef_table = */ { {5.12401e-02, 3.05654e-08, 3.11170e-14, 2.39327e-19}, @@ -124,8 +166,8 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 3.84003e-02, + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 3.04389e-02, /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, /* opacity_coef_table = */ { {1.20726e-01, 7.20182e-08, 7.35280e-14, 5.95267e-19}, @@ -166,8 +208,8 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeS_dust", - /* nonprimoridal_yield_frac = */ 3.04389e-02, + /* name = */ "ref_org_dust", + /* nonprimoridal_yield_frac = */ 1.86114e-01, /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, /* opacity_coef_table = */ { {4.68555e-02, 2.79499e-08, 2.84543e-14, 2.18837e-19}, @@ -208,8 +250,8 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "ref_org_dust", - /* nonprimoridal_yield_frac = */ 1.86114e-01, + /* name = */ "vol_org_dust", + /* nonprimoridal_yield_frac = */ 3.81956e-02, /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, /* opacity_coef_table = */ { {7.02832e-02, 4.19249e-08, 4.26814e-14, 3.28255e-19}, @@ -250,8 +292,8 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "vol_org_dust", - /* nonprimoridal_yield_frac = */ 3.81956e-02, + /* name = */ "H2O_ice_dust", + /* nonprimoridal_yield_frac = */ 6.33011e-02, /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, /* opacity_coef_table = */ { {6.30862e-02, 3.76318e-08, 3.83108e-14, 2.94648e-19}, @@ -291,48 +333,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.96048e+03, 1.16958e-03, 1.17438e-09, 7.69912e-15}, } }, - { - /* name = */ "H2O_ice_dust", - /* nonprimoridal_yield_frac = */ 6.33011e-02, - /* size_moments = */ {8.33039e-07, 1.16161e-12, 8.21384e-18}, - /* opacity_coef_table = */ { - {3.03937e-04, 1.23816e-09, 4.62094e-14, 3.72497e-18}, - {5.33931e-04, 1.94666e-09, 6.42306e-14, 4.92267e-18}, - {8.23085e-04, 2.82715e-09, 8.64655e-14, 6.40508e-18}, - {1.18689e-03, 3.92926e-09, 1.14201e-13, 8.25547e-18}, - {1.93090e-03, 5.86828e-09, 1.50433e-13, 1.02764e-17}, - {2.95251e-03, 8.43657e-09, 1.95467e-13, 1.27089e-17}, - {4.55033e-03, 1.22013e-08, 2.52591e-13, 1.54880e-17}, - {7.04895e-03, 1.77533e-08, 3.26595e-13, 1.87358e-17}, - {1.09337e-02, 2.59554e-08, 4.24054e-13, 2.26060e-17}, - {1.67787e-02, 3.77909e-08, 5.51941e-13, 2.72576e-17}, - {2.56790e-02, 5.50228e-08, 7.20688e-13, 3.28090e-17}, - {3.89780e-02, 7.95600e-08, 9.39516e-13, 3.93285e-17}, - {5.82741e-02, 1.13372e-07, 1.21633e-12, 4.68721e-17}, - {8.58228e-02, 1.58873e-07, 1.55917e-12, 5.54857e-17}, - {1.24511e-01, 2.18724e-07, 1.97549e-12, 6.52470e-17}, - {1.78164e-01, 2.96038e-07, 2.47229e-12, 7.62244e-17}, - {2.51965e-01, 3.94501e-07, 3.05495e-12, 8.84292e-17}, - {3.53706e-01, 5.19228e-07, 3.72904e-12, 1.01872e-16}, - {4.96690e-01, 6.79268e-07, 4.51008e-12, 1.16807e-16}, - {7.06391e-01, 8.93298e-07, 5.44240e-12, 1.34078e-16}, - {1.03345e+00, 1.19958e-06, 6.62440e-12, 1.55520e-16}, - {1.58058e+00, 1.67481e-06, 8.24715e-12, 1.84604e-16}, - {2.55750e+00, 2.47088e-06, 1.06606e-11, 2.27517e-16}, - {4.39505e+00, 3.88891e-06, 1.44836e-11, 2.94492e-16}, - {7.97338e+00, 6.52370e-06, 2.07697e-11, 4.00081e-16}, - {1.50676e+01, 1.15419e-05, 3.12837e-11, 5.61771e-16}, - {2.91750e+01, 2.11959e-05, 4.90431e-11, 7.99872e-16}, - {5.69546e+01, 3.97177e-05, 7.93362e-11, 1.14279e-15}, - {1.10473e+02, 7.47151e-05, 1.31340e-10, 1.63629e-15}, - {2.10337e+02, 1.39130e-04, 2.20345e-10, 2.35251e-15}, - {3.89661e+02, 2.53753e-04, 3.70677e-10, 3.39830e-15}, - {6.99152e+02, 4.50456e-04, 6.19407e-10, 4.92457e-15}, - {1.21457e+03, 7.76739e-04, 1.02057e-09, 7.13090e-15}, - {2.05022e+03, 1.30302e-03, 1.64745e-09, 1.02322e-14}, - {3.38793e+03, 2.13731e-03, 2.59306e-09, 1.43690e-14}, - } - }, }; } // namespace local_ISM @@ -354,6 +354,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "SiM_dust", /* nonprimoridal_yield_frac = */ 1.65746e-02, /* size_moments = */ {1.68557e-06, 9.75226e-12, 1.74046e-16}, + /* opacity_coef_table = */ { + {1.54619e-01, 2.60128e-07, 1.49475e-12, 2.65148e-17}, + {1.94656e-01, 3.27554e-07, 1.88361e-12, 3.34351e-17}, + {2.45059e-01, 4.12439e-07, 2.37316e-12, 4.21472e-17}, + {3.08513e-01, 5.19301e-07, 2.98947e-12, 5.31150e-17}, + {3.88404e-01, 6.53894e-07, 3.76675e-12, 6.69643e-17}, + {4.88982e-01, 8.23350e-07, 4.74559e-12, 8.44087e-17}, + {6.15605e-01, 1.03673e-06, 5.97899e-12, 1.06403e-16}, + {7.75006e-01, 1.30539e-06, 7.53301e-12, 1.34131e-16}, + {9.75366e-01, 1.64315e-06, 9.48791e-12, 1.69031e-16}, + {1.22493e+00, 2.06392e-06, 1.19246e-11, 2.12553e-16}, + {1.52116e+00, 2.56344e-06, 1.48192e-11, 2.64285e-16}, + {1.83681e+00, 3.09586e-06, 1.79072e-11, 3.19511e-16}, + {2.15662e+00, 3.63549e-06, 2.10413e-11, 3.75635e-16}, + {2.55502e+00, 4.30820e-06, 2.49580e-11, 4.45921e-16}, + {3.22790e+00, 5.44497e-06, 3.15890e-11, 5.65115e-16}, + {4.33126e+00, 7.30995e-06, 4.24882e-11, 7.61352e-16}, + {5.81498e+00, 9.82030e-06, 5.72103e-11, 1.02723e-15}, + {7.48294e+00, 1.26484e-05, 7.39233e-11, 1.33106e-15}, + {9.21324e+00, 1.55973e-05, 9.16644e-11, 1.65851e-15}, + {1.11943e+01, 1.90119e-05, 1.13021e-10, 2.06536e-15}, + {1.39990e+01, 2.39150e-05, 1.45136e-10, 2.69938e-15}, + {1.78867e+01, 3.08010e-05, 1.92146e-10, 3.65687e-15}, + {2.17798e+01, 3.79266e-05, 2.45744e-10, 4.82338e-15}, + {2.38104e+01, 4.23268e-05, 2.93339e-10, 6.06677e-15}, + {2.31200e+01, 4.26489e-05, 3.30423e-10, 7.40538e-15}, + {2.05061e+01, 3.98990e-05, 3.56330e-10, 8.76054e-15}, + {1.74011e+01, 3.59849e-05, 3.69684e-10, 9.86673e-15}, + {1.47227e+01, 3.22080e-05, 3.69774e-10, 1.04731e-14}, + {1.27456e+01, 2.91368e-05, 3.59951e-10, 1.05598e-14}, + {1.18944e+01, 2.82426e-05, 3.62521e-10, 1.07315e-14}, + {1.43878e+01, 3.74123e-05, 4.87177e-10, 1.37994e-14}, + {2.85377e+01, 9.23385e-05, 1.20077e-09, 3.00478e-14}, + {7.93256e+01, 3.11569e-04, 3.91124e-09, 8.56317e-14}, + {2.33021e+02, 9.78251e-04, 1.15601e-08, 2.28453e-13}, + {6.42052e+02, 2.55294e-03, 2.77058e-08, 5.06000e-13}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 2.39849e-02, + /* size_moments = */ {4.62542e-06, 3.82292e-11, 4.68445e-16}, /* opacity_coef_table = */ { {5.88921e-03, 6.87770e-08, 1.06227e-12, 2.02349e-17}, {1.01153e-02, 1.15444e-07, 1.74157e-12, 3.24501e-17}, @@ -393,9 +435,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 2.39849e-02, - /* size_moments = */ {4.62542e-06, 3.82292e-11, 4.68445e-16}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 8.69522e-04, + /* size_moments = */ {1.82163e-06, 5.83823e-12, 3.61356e-17}, /* opacity_coef_table = */ { {1.05240e-01, 1.91709e-07, 6.14415e-13, 3.80291e-18}, {1.32588e-01, 2.41526e-07, 7.74078e-13, 4.79114e-18}, @@ -435,9 +477,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 8.69522e-04, - /* size_moments = */ {1.82163e-06, 5.83823e-12, 3.61356e-17}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.87802e-06, + /* size_moments = */ {7.26303e-07, 7.49856e-13, 1.57511e-18}, /* opacity_coef_table = */ { {2.19890e-02, 1.59707e-08, 1.64886e-14, 3.46350e-20}, {3.90612e-02, 2.83703e-08, 2.92903e-14, 6.15261e-20}, @@ -477,9 +519,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 2.87802e-06, - /* size_moments = */ {7.26303e-07, 7.49856e-13, 1.57511e-18}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 4.85826e-02, + /* size_moments = */ {4.82296e-06, 3.91353e-11, 5.15140e-16}, /* opacity_coef_table = */ { {3.27960e-01, 1.58173e-06, 1.28346e-11, 1.68940e-16}, {4.38754e-01, 2.11613e-06, 1.71717e-11, 2.26045e-16}, @@ -519,9 +561,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 4.85826e-02, - /* size_moments = */ {4.82296e-06, 3.91353e-11, 5.15140e-16}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 2.52534e-03, + /* size_moments = */ {1.33530e-06, 5.91862e-12, 5.31739e-17}, /* opacity_coef_table = */ { {7.60358e-02, 1.01529e-07, 4.49989e-13, 4.04236e-18}, {9.07205e-02, 1.21137e-07, 5.36902e-13, 4.82320e-18}, @@ -561,9 +603,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 2.52534e-03, - /* size_moments = */ {1.33530e-06, 5.91862e-12, 5.31739e-17}, + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.28672e-05, + /* size_moments = */ {1.59029e-06, 7.21459e-12, 4.84120e-17}, /* opacity_coef_table = */ { {2.25390e-04, 3.58434e-10, 1.62608e-15, 1.09114e-20}, {4.04968e-04, 6.44015e-10, 2.92166e-15, 1.96051e-20}, @@ -603,9 +645,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgO_dust", - /* nonprimoridal_yield_frac = */ 1.28672e-05, - /* size_moments = */ {1.59029e-06, 7.21459e-12, 4.84120e-17}, + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 2.09730e-06, + /* size_moments = */ {6.16010e-07, 4.56500e-13, 4.16699e-19}, /* opacity_coef_table = */ { {5.18081e-02, 3.19144e-08, 2.36505e-14, 2.15886e-20}, {9.98885e-02, 6.15325e-08, 4.55993e-14, 4.16239e-20}, @@ -644,48 +686,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {9.83739e+02, 6.31245e-04, 5.01948e-10, 5.05703e-16}, } }, - { - /* name = */ "FeS_dust", - /* nonprimoridal_yield_frac = */ 2.09730e-06, - /* size_moments = */ {6.16010e-07, 4.56500e-13, 4.16699e-19}, - /* opacity_coef_table = */ { - {1.54619e-01, 2.60128e-07, 1.49475e-12, 2.65148e-17}, - {1.94656e-01, 3.27554e-07, 1.88361e-12, 3.34351e-17}, - {2.45059e-01, 4.12439e-07, 2.37316e-12, 4.21472e-17}, - {3.08513e-01, 5.19301e-07, 2.98947e-12, 5.31150e-17}, - {3.88404e-01, 6.53894e-07, 3.76675e-12, 6.69643e-17}, - {4.88982e-01, 8.23350e-07, 4.74559e-12, 8.44087e-17}, - {6.15605e-01, 1.03673e-06, 5.97899e-12, 1.06403e-16}, - {7.75006e-01, 1.30539e-06, 7.53301e-12, 1.34131e-16}, - {9.75366e-01, 1.64315e-06, 9.48791e-12, 1.69031e-16}, - {1.22493e+00, 2.06392e-06, 1.19246e-11, 2.12553e-16}, - {1.52116e+00, 2.56344e-06, 1.48192e-11, 2.64285e-16}, - {1.83681e+00, 3.09586e-06, 1.79072e-11, 3.19511e-16}, - {2.15662e+00, 3.63549e-06, 2.10413e-11, 3.75635e-16}, - {2.55502e+00, 4.30820e-06, 2.49580e-11, 4.45921e-16}, - {3.22790e+00, 5.44497e-06, 3.15890e-11, 5.65115e-16}, - {4.33126e+00, 7.30995e-06, 4.24882e-11, 7.61352e-16}, - {5.81498e+00, 9.82030e-06, 5.72103e-11, 1.02723e-15}, - {7.48294e+00, 1.26484e-05, 7.39233e-11, 1.33106e-15}, - {9.21324e+00, 1.55973e-05, 9.16644e-11, 1.65851e-15}, - {1.11943e+01, 1.90119e-05, 1.13021e-10, 2.06536e-15}, - {1.39990e+01, 2.39150e-05, 1.45136e-10, 2.69938e-15}, - {1.78867e+01, 3.08010e-05, 1.92146e-10, 3.65687e-15}, - {2.17798e+01, 3.79266e-05, 2.45744e-10, 4.82338e-15}, - {2.38104e+01, 4.23268e-05, 2.93339e-10, 6.06677e-15}, - {2.31200e+01, 4.26489e-05, 3.30423e-10, 7.40538e-15}, - {2.05061e+01, 3.98990e-05, 3.56330e-10, 8.76054e-15}, - {1.74011e+01, 3.59849e-05, 3.69684e-10, 9.86673e-15}, - {1.47227e+01, 3.22080e-05, 3.69774e-10, 1.04731e-14}, - {1.27456e+01, 2.91368e-05, 3.59951e-10, 1.05598e-14}, - {1.18944e+01, 2.82426e-05, 3.62521e-10, 1.07315e-14}, - {1.43878e+01, 3.74123e-05, 4.87177e-10, 1.37994e-14}, - {2.85377e+01, 9.23385e-05, 1.20077e-09, 3.00478e-14}, - {7.93256e+01, 3.11569e-04, 3.91124e-09, 8.56317e-14}, - {2.33021e+02, 9.78251e-04, 1.15601e-08, 2.28453e-13}, - {6.42052e+02, 2.55294e-03, 2.77058e-08, 5.06000e-13}, - } - }, }; } // namespace ccsn13 @@ -708,47 +708,89 @@ static const GrainSpeciesYieldProps grain_props[] = { /* nonprimoridal_yield_frac = */ 3.44388e-02, /* size_moments = */ {1.24861e-05, 2.86508e-10, 1.01028e-14}, /* opacity_coef_table = */ { - {1.10506e-02, 1.69983e-07, 3.50089e-12, 9.16404e-17}, - {1.85837e-02, 2.76971e-07, 5.53036e-12, 1.40642e-16}, - {2.79449e-02, 4.08949e-07, 8.01809e-12, 2.00458e-16}, - {3.96605e-02, 5.73574e-07, 1.11125e-11, 2.74730e-16}, - {6.19392e-02, 8.69904e-07, 1.63567e-11, 3.93140e-16}, - {9.16817e-02, 1.25867e-06, 2.31128e-11, 5.43193e-16}, - {1.36080e-01, 1.82251e-06, 3.26005e-11, 7.47226e-16}, - {2.02056e-01, 2.63811e-06, 4.59129e-11, 1.02492e-15}, - {2.99593e-01, 3.81390e-06, 6.45602e-11, 1.40281e-15}, - {4.39758e-01, 5.46636e-06, 9.01024e-11, 1.90718e-15}, - {6.41903e-01, 7.79581e-06, 1.25163e-10, 2.58082e-15}, - {9.24985e-01, 1.09870e-05, 1.71974e-10, 3.45658e-15}, - {1.30585e+00, 1.51941e-05, 2.32250e-10, 4.55695e-15}, - {1.80164e+00, 2.05666e-05, 3.07564e-10, 5.90101e-15}, - {2.42648e+00, 2.72192e-05, 3.99035e-10, 7.50126e-15}, - {3.19207e+00, 3.52384e-05, 5.07449e-10, 9.36601e-15}, - {4.10565e+00, 4.46618e-05, 6.32978e-10, 1.14947e-14}, - {5.17172e+00, 5.54917e-05, 7.75385e-10, 1.38820e-14}, - {6.40478e+00, 6.78244e-05, 9.35760e-10, 1.65481e-14}, - {7.85614e+00, 8.21045e-05, 1.11980e-09, 1.95943e-14}, - {9.64785e+00, 9.94326e-05, 1.34166e-09, 2.32660e-14}, - {1.20159e+01, 1.21941e-04, 1.62875e-09, 2.80374e-14}, - {1.53778e+01, 1.53371e-04, 2.02922e-09, 3.47445e-14}, - {2.04423e+01, 1.99938e-04, 2.62238e-09, 4.47607e-14}, - {2.83887e+01, 2.71546e-04, 3.53030e-09, 6.01372e-14}, - {4.11773e+01, 3.83718e-04, 4.93303e-09, 8.37180e-14}, - {6.21107e+01, 5.61284e-04, 7.10254e-09, 1.19520e-13}, - {9.68132e+01, 8.45164e-04, 1.04719e-08, 1.73689e-13}, - {1.54804e+02, 1.30324e-03, 1.57446e-08, 2.55980e-13}, - {2.51780e+02, 2.04562e-03, 2.40381e-08, 3.81486e-13}, - {4.12838e+02, 3.24595e-03, 3.70714e-08, 5.72650e-13}, - {6.76592e+02, 5.16747e-03, 5.73792e-08, 8.61246e-13}, - {1.09863e+03, 8.17937e-03, 8.83910e-08, 1.28821e-12}, - {1.74646e+03, 1.26954e-02, 1.33666e-07, 1.89228e-12}, - {2.67882e+03, 1.89754e-02, 1.94753e-07, 2.68226e-12}, + {1.53894e-01, 1.90916e-06, 4.34900e-11, 1.52207e-15}, + {1.93844e-01, 2.40648e-06, 5.48634e-11, 1.92178e-15}, + {2.44138e-01, 3.03256e-06, 6.91797e-11, 2.42474e-15}, + {3.07454e-01, 3.82073e-06, 8.72020e-11, 3.05783e-15}, + {3.87243e-01, 4.81526e-06, 1.09978e-10, 3.85936e-15}, + {4.87709e-01, 6.06778e-06, 1.38669e-10, 4.86916e-15}, + {6.14251e-01, 7.64642e-06, 1.74856e-10, 6.14383e-15}, + {7.73625e-01, 9.63590e-06, 2.20495e-10, 7.75268e-15}, + {9.74036e-01, 1.21392e-05, 2.77959e-10, 9.78002e-15}, + {1.22376e+00, 1.52600e-05, 3.49642e-10, 1.23105e-14}, + {1.52029e+00, 1.89682e-05, 4.34881e-10, 1.53223e-14}, + {1.83650e+00, 2.29254e-05, 5.25941e-10, 1.85447e-14}, + {2.15714e+00, 2.69443e-05, 6.18616e-10, 2.18354e-14}, + {2.55729e+00, 3.19712e-05, 7.34846e-10, 2.59753e-14}, + {3.23398e+00, 4.04866e-05, 9.32032e-10, 3.30022e-14}, + {4.34499e+00, 5.44911e-05, 1.25683e-09, 4.45846e-14}, + {5.84259e+00, 7.34292e-05, 1.69748e-09, 6.03345e-14}, + {7.53509e+00, 9.49825e-05, 2.20255e-09, 7.84868e-14}, + {9.31292e+00, 1.17996e-04, 2.75076e-09, 9.84428e-14}, + {1.14053e+01, 1.46050e-04, 3.44207e-09, 1.24265e-13}, + {1.44699e+01, 1.88865e-04, 4.53802e-09, 1.66375e-13}, + {1.88525e+01, 2.52409e-04, 6.22006e-09, 2.32633e-13}, + {2.35897e+01, 3.27106e-04, 8.33967e-09, 3.20293e-13}, + {2.71065e+01, 3.99935e-04, 1.08043e-08, 4.33797e-13}, + {2.87408e+01, 4.69399e-04, 1.38602e-08, 5.94648e-13}, + {2.88428e+01, 5.34587e-04, 1.74785e-08, 8.07129e-13}, + {2.80514e+01, 5.86377e-04, 2.09655e-08, 1.03092e-12}, + {2.67893e+01, 6.13530e-04, 2.33810e-08, 1.20137e-12}, + {2.53851e+01, 6.14601e-04, 2.43011e-08, 1.28034e-12}, + {2.53848e+01, 6.23633e-04, 2.48207e-08, 1.31287e-12}, + {3.52560e+01, 8.08661e-04, 3.01974e-08, 1.52398e-12}, + {9.64731e+01, 1.84326e-03, 5.73265e-08, 2.51143e-12}, + {3.56496e+02, 5.70937e-03, 1.44867e-07, 5.33930e-12}, + {1.16716e+03, 1.65654e-02, 3.60906e-07, 1.15456e-11}, + {3.02792e+03, 3.93985e-02, 7.71226e-07, 2.22345e-11}, } }, { /* name = */ "FeM_dust", /* nonprimoridal_yield_frac = */ 3.77223e-03, /* size_moments = */ {6.67024e-06, 7.50596e-11, 1.22752e-15}, + /* opacity_coef_table = */ { + {1.10506e-02, 1.69983e-07, 3.50089e-12, 9.16404e-17}, + {1.85837e-02, 2.76971e-07, 5.53036e-12, 1.40642e-16}, + {2.79449e-02, 4.08949e-07, 8.01809e-12, 2.00458e-16}, + {3.96605e-02, 5.73574e-07, 1.11125e-11, 2.74730e-16}, + {6.19392e-02, 8.69904e-07, 1.63567e-11, 3.93140e-16}, + {9.16817e-02, 1.25867e-06, 2.31128e-11, 5.43193e-16}, + {1.36080e-01, 1.82251e-06, 3.26005e-11, 7.47226e-16}, + {2.02056e-01, 2.63811e-06, 4.59129e-11, 1.02492e-15}, + {2.99593e-01, 3.81390e-06, 6.45602e-11, 1.40281e-15}, + {4.39758e-01, 5.46636e-06, 9.01024e-11, 1.90718e-15}, + {6.41903e-01, 7.79581e-06, 1.25163e-10, 2.58082e-15}, + {9.24985e-01, 1.09870e-05, 1.71974e-10, 3.45658e-15}, + {1.30585e+00, 1.51941e-05, 2.32250e-10, 4.55695e-15}, + {1.80164e+00, 2.05666e-05, 3.07564e-10, 5.90101e-15}, + {2.42648e+00, 2.72192e-05, 3.99035e-10, 7.50126e-15}, + {3.19207e+00, 3.52384e-05, 5.07449e-10, 9.36601e-15}, + {4.10565e+00, 4.46618e-05, 6.32978e-10, 1.14947e-14}, + {5.17172e+00, 5.54917e-05, 7.75385e-10, 1.38820e-14}, + {6.40478e+00, 6.78244e-05, 9.35760e-10, 1.65481e-14}, + {7.85614e+00, 8.21045e-05, 1.11980e-09, 1.95943e-14}, + {9.64785e+00, 9.94326e-05, 1.34166e-09, 2.32660e-14}, + {1.20159e+01, 1.21941e-04, 1.62875e-09, 2.80374e-14}, + {1.53778e+01, 1.53371e-04, 2.02922e-09, 3.47445e-14}, + {2.04423e+01, 1.99938e-04, 2.62238e-09, 4.47607e-14}, + {2.83887e+01, 2.71546e-04, 3.53030e-09, 6.01372e-14}, + {4.11773e+01, 3.83718e-04, 4.93303e-09, 8.37180e-14}, + {6.21107e+01, 5.61284e-04, 7.10254e-09, 1.19520e-13}, + {9.68132e+01, 8.45164e-04, 1.04719e-08, 1.73689e-13}, + {1.54804e+02, 1.30324e-03, 1.57446e-08, 2.55980e-13}, + {2.51780e+02, 2.04562e-03, 2.40381e-08, 3.81486e-13}, + {4.12838e+02, 3.24595e-03, 3.70714e-08, 5.72650e-13}, + {6.76592e+02, 5.16747e-03, 5.73792e-08, 8.61246e-13}, + {1.09863e+03, 8.17937e-03, 8.83910e-08, 1.28821e-12}, + {1.74646e+03, 1.26954e-02, 1.33666e-07, 1.89228e-12}, + {2.67882e+03, 1.89754e-02, 1.94753e-07, 2.68226e-12}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.90086e-03, + /* size_moments = */ {1.41253e-06, 4.77566e-12, 3.08016e-17}, /* opacity_coef_table = */ { {1.05240e-01, 1.48654e-07, 5.02591e-13, 3.24156e-18}, {1.32588e-01, 1.87284e-07, 6.33194e-13, 4.08391e-18}, @@ -788,9 +830,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 1.90086e-03, - /* size_moments = */ {1.41253e-06, 4.77566e-12, 3.08016e-17}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.57266e-06, + /* size_moments = */ {1.01138e-06, 1.31688e-12, 2.89696e-18}, /* opacity_coef_table = */ { {2.19890e-02, 2.22393e-08, 2.89570e-14, 6.37012e-20}, {3.90612e-02, 3.95059e-08, 5.14391e-14, 1.13159e-19}, @@ -830,9 +872,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 2.57266e-06, - /* size_moments = */ {1.01138e-06, 1.31688e-12, 2.89696e-18}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.27270e-02, + /* size_moments = */ {7.95099e-07, 2.51133e-12, 4.21640e-17}, /* opacity_coef_table = */ { {3.27960e-01, 2.60760e-07, 8.23594e-13, 1.38274e-17}, {4.38752e-01, 3.48855e-07, 1.10197e-12, 1.85031e-17}, @@ -872,9 +914,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 1.27270e-02, - /* size_moments = */ {7.95099e-07, 2.51133e-12, 4.21640e-17}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.65484e-03, + /* size_moments = */ {1.40285e-06, 3.98828e-12, 1.93974e-17}, /* opacity_coef_table = */ { {7.60358e-02, 1.06666e-07, 3.03247e-13, 1.47482e-18}, {9.07206e-02, 1.27267e-07, 3.61815e-13, 1.75967e-18}, @@ -914,9 +956,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 1.65484e-03, - /* size_moments = */ {1.40285e-06, 3.98828e-12, 1.93974e-17}, + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 9.48713e-04, + /* size_moments = */ {1.29303e-06, 1.06240e-11, 1.57687e-16}, /* opacity_coef_table = */ { {2.25389e-04, 2.91423e-10, 2.39426e-15, 3.55346e-20}, {4.04967e-04, 5.23622e-10, 4.30206e-15, 6.38511e-20}, @@ -956,9 +998,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgO_dust", - /* nonprimoridal_yield_frac = */ 9.48713e-04, - /* size_moments = */ {1.29303e-06, 1.06240e-11, 1.57687e-16}, + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 5.23050e-05, + /* size_moments = */ {1.68897e-06, 3.16618e-12, 6.72598e-18}, /* opacity_coef_table = */ { {5.18099e-02, 8.75057e-08, 1.64042e-13, 3.48481e-19}, {9.98914e-02, 1.68714e-07, 3.16278e-13, 6.71882e-19}, @@ -998,9 +1040,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeS_dust", - /* nonprimoridal_yield_frac = */ 5.23050e-05, - /* size_moments = */ {1.68897e-06, 3.16618e-12, 6.72598e-18}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 1.31693e-29, + /* size_moments = */ {9.21063e-08, 9.03508e-15, 9.36936e-22}, /* opacity_coef_table = */ { {9.93250e-04, 9.14846e-11, 8.97410e-18, 9.30612e-25}, {1.81240e-03, 1.66933e-10, 1.63752e-17, 1.69810e-24}, @@ -1039,48 +1081,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 1.67535e-06, 1.64342e-13, 1.70422e-20}, } }, - { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 1.31693e-29, - /* size_moments = */ {9.21063e-08, 9.03508e-15, 9.36936e-22}, - /* opacity_coef_table = */ { - {1.53894e-01, 1.90916e-06, 4.34900e-11, 1.52207e-15}, - {1.93844e-01, 2.40648e-06, 5.48634e-11, 1.92178e-15}, - {2.44138e-01, 3.03256e-06, 6.91797e-11, 2.42474e-15}, - {3.07454e-01, 3.82073e-06, 8.72020e-11, 3.05783e-15}, - {3.87243e-01, 4.81526e-06, 1.09978e-10, 3.85936e-15}, - {4.87709e-01, 6.06778e-06, 1.38669e-10, 4.86916e-15}, - {6.14251e-01, 7.64642e-06, 1.74856e-10, 6.14383e-15}, - {7.73625e-01, 9.63590e-06, 2.20495e-10, 7.75268e-15}, - {9.74036e-01, 1.21392e-05, 2.77959e-10, 9.78002e-15}, - {1.22376e+00, 1.52600e-05, 3.49642e-10, 1.23105e-14}, - {1.52029e+00, 1.89682e-05, 4.34881e-10, 1.53223e-14}, - {1.83650e+00, 2.29254e-05, 5.25941e-10, 1.85447e-14}, - {2.15714e+00, 2.69443e-05, 6.18616e-10, 2.18354e-14}, - {2.55729e+00, 3.19712e-05, 7.34846e-10, 2.59753e-14}, - {3.23398e+00, 4.04866e-05, 9.32032e-10, 3.30022e-14}, - {4.34499e+00, 5.44911e-05, 1.25683e-09, 4.45846e-14}, - {5.84259e+00, 7.34292e-05, 1.69748e-09, 6.03345e-14}, - {7.53509e+00, 9.49825e-05, 2.20255e-09, 7.84868e-14}, - {9.31292e+00, 1.17996e-04, 2.75076e-09, 9.84428e-14}, - {1.14053e+01, 1.46050e-04, 3.44207e-09, 1.24265e-13}, - {1.44699e+01, 1.88865e-04, 4.53802e-09, 1.66375e-13}, - {1.88525e+01, 2.52409e-04, 6.22006e-09, 2.32633e-13}, - {2.35897e+01, 3.27106e-04, 8.33967e-09, 3.20293e-13}, - {2.71065e+01, 3.99935e-04, 1.08043e-08, 4.33797e-13}, - {2.87408e+01, 4.69399e-04, 1.38602e-08, 5.94648e-13}, - {2.88428e+01, 5.34587e-04, 1.74785e-08, 8.07129e-13}, - {2.80514e+01, 5.86377e-04, 2.09655e-08, 1.03092e-12}, - {2.67893e+01, 6.13530e-04, 2.33810e-08, 1.20137e-12}, - {2.53851e+01, 6.14601e-04, 2.43011e-08, 1.28034e-12}, - {2.53848e+01, 6.23633e-04, 2.48207e-08, 1.31287e-12}, - {3.52560e+01, 8.08661e-04, 3.01974e-08, 1.52398e-12}, - {9.64731e+01, 1.84326e-03, 5.73265e-08, 2.51143e-12}, - {3.56496e+02, 5.70937e-03, 1.44867e-07, 5.33930e-12}, - {1.16716e+03, 1.65654e-02, 3.60906e-07, 1.15456e-11}, - {3.02792e+03, 3.93985e-02, 7.71226e-07, 2.22345e-11}, - } - }, }; } // namespace ccsn20 @@ -1102,6 +1102,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "SiM_dust", /* nonprimoridal_yield_frac = */ 3.83373e-02, /* size_moments = */ {1.72153e-05, 6.33208e-10, 4.04318e-14}, + /* opacity_coef_table = */ { + {1.53307e-01, 2.58151e-06, 8.97185e-11, 5.13410e-15}, + {1.93187e-01, 3.26103e-06, 1.14053e-10, 6.60852e-15}, + {2.43381e-01, 4.11484e-06, 1.44443e-10, 8.42753e-15}, + {3.06566e-01, 5.18903e-06, 1.82603e-10, 1.07022e-14}, + {3.86268e-01, 6.55217e-06, 2.31853e-10, 1.37374e-14}, + {4.86630e-01, 8.26891e-06, 2.93869e-10, 1.75576e-14}, + {6.13093e-01, 1.04376e-05, 3.72751e-10, 2.24815e-14}, + {7.72441e-01, 1.31779e-05, 4.73205e-10, 2.88483e-14}, + {9.72908e-01, 1.66348e-05, 6.00927e-10, 3.70670e-14}, + {1.22279e+00, 2.09532e-05, 7.61455e-10, 4.75186e-14}, + {1.51967e+00, 2.61010e-05, 9.54694e-10, 6.03376e-14}, + {1.83660e+00, 3.16418e-05, 1.16836e-09, 7.52509e-14}, + {2.15883e+00, 3.73832e-05, 1.40366e-09, 9.34936e-14}, + {2.56188e+00, 4.46730e-05, 1.71564e-09, 1.19386e-13}, + {3.24331e+00, 5.69556e-05, 2.23297e-09, 1.61351e-13}, + {4.36192e+00, 7.70449e-05, 3.06366e-09, 2.26659e-13}, + {5.87089e+00, 1.04185e-04, 4.17746e-09, 3.12654e-13}, + {7.58000e+00, 1.35161e-04, 5.44737e-09, 4.09330e-13}, + {9.38530e+00, 1.68565e-04, 6.82760e-09, 5.12932e-13}, + {1.15371e+01, 2.10285e-04, 8.59830e-09, 6.44799e-13}, + {1.47388e+01, 2.75860e-04, 1.14755e-08, 8.58985e-13}, + {1.93877e+01, 3.75887e-04, 1.59953e-08, 1.19600e-12}, + {2.46008e+01, 5.00971e-04, 2.20360e-08, 1.65571e-12}, + {2.90408e+01, 6.45456e-04, 3.01610e-08, 2.31085e-12}, + {3.23701e+01, 8.27330e-04, 4.23216e-08, 3.35508e-12}, + {3.49305e+01, 1.05238e-03, 5.92405e-08, 4.87268e-12}, + {3.68020e+01, 1.28200e-03, 7.79075e-08, 6.59988e-12}, + {3.76194e+01, 1.45174e-03, 9.27975e-08, 8.01634e-12}, + {3.72617e+01, 1.52446e-03, 1.00177e-07, 8.74632e-12}, + {3.76576e+01, 1.55784e-03, 1.02687e-07, 8.96074e-12}, + {4.91245e+01, 1.84545e-03, 1.14505e-07, 9.64022e-12}, + {1.17100e+02, 3.32870e-03, 1.70057e-07, 1.27411e-11}, + {3.93519e+02, 8.31574e-03, 3.27938e-07, 2.07522e-11}, + {1.23314e+03, 2.12665e-02, 6.72506e-07, 3.61691e-11}, + {3.12736e+03, 4.71942e-02, 1.26825e-06, 5.97225e-11}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 4.88366e-03, + /* size_moments = */ {1.96666e-05, 5.88305e-10, 2.42323e-14}, /* opacity_coef_table = */ { {7.05387e-02, 2.70513e-06, 1.33741e-10, 7.96280e-15}, {1.06564e-01, 3.93018e-06, 1.88633e-10, 1.09924e-14}, @@ -1141,9 +1183,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 4.88366e-03, - /* size_moments = */ {1.96666e-05, 5.88305e-10, 2.42323e-14}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.68068e-02, + /* size_moments = */ {2.33213e-06, 2.48648e-11, 4.29427e-16}, /* opacity_coef_table = */ { {1.05240e-01, 2.45433e-07, 2.61677e-12, 4.51929e-17}, {1.32588e-01, 3.09211e-07, 3.29676e-12, 5.69367e-17}, @@ -1183,9 +1225,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 1.68068e-02, - /* size_moments = */ {2.33213e-06, 2.48648e-11, 4.29427e-16}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.49736e-05, + /* size_moments = */ {1.55439e-06, 4.30058e-12, 1.92568e-17}, /* opacity_coef_table = */ { {2.19890e-02, 3.41795e-08, 9.45655e-14, 4.23439e-19}, {3.90612e-02, 6.07164e-08, 1.67986e-13, 7.52197e-19}, @@ -1225,9 +1267,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 2.49736e-05, - /* size_moments = */ {1.55439e-06, 4.30058e-12, 1.92568e-17}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 4.13961e-02, + /* size_moments = */ {7.93494e-07, 3.53402e-12, 1.04050e-16}, /* opacity_coef_table = */ { {3.27960e-01, 2.60233e-07, 1.15896e-12, 3.41207e-17}, {4.38752e-01, 3.48153e-07, 1.55085e-12, 4.56711e-17}, @@ -1267,9 +1309,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 4.13961e-02, - /* size_moments = */ {7.93494e-07, 3.53402e-12, 1.04050e-16}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.46546e-02, + /* size_moments = */ {2.56804e-06, 4.82971e-11, 2.53766e-15}, /* opacity_coef_table = */ { {7.60344e-02, 1.95196e-07, 3.66716e-12, 1.92423e-16}, {9.07191e-02, 2.32906e-07, 4.37632e-12, 2.29682e-16}, @@ -1309,9 +1351,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 1.46546e-02, - /* size_moments = */ {2.56804e-06, 4.82971e-11, 2.53766e-15}, + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.09289e-03, + /* size_moments = */ {3.58420e-06, 3.09713e-11, 4.03929e-16}, /* opacity_coef_table = */ { {2.25388e-04, 8.07807e-10, 6.97998e-15, 9.10286e-20}, {4.04965e-04, 1.45145e-09, 1.25417e-14, 1.63564e-19}, @@ -1351,9 +1393,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgO_dust", - /* nonprimoridal_yield_frac = */ 1.09289e-03, - /* size_moments = */ {3.58420e-06, 3.09713e-11, 4.03929e-16}, + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 3.77935e-04, + /* size_moments = */ {9.61035e-07, 2.46507e-12, 1.42549e-17}, /* opacity_coef_table = */ { {5.18089e-02, 4.97944e-08, 1.27767e-13, 7.39409e-19}, {9.98898e-02, 9.60047e-08, 2.46329e-13, 1.42543e-18}, @@ -1393,9 +1435,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeS_dust", - /* nonprimoridal_yield_frac = */ 3.77935e-04, - /* size_moments = */ {9.61035e-07, 2.46507e-12, 1.42549e-17}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 1.65550e-31, + /* size_moments = */ {1.99526e-08, 3.98107e-16, 7.94328e-24}, /* opacity_coef_table = */ { {9.93250e-04, 1.98179e-11, 3.95420e-19, 7.88967e-27}, {1.81240e-03, 3.61621e-11, 7.21529e-19, 1.43964e-26}, @@ -1434,48 +1476,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 3.62924e-07, 7.24128e-15, 1.44483e-22}, } }, - { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 1.65550e-31, - /* size_moments = */ {1.99526e-08, 3.98107e-16, 7.94328e-24}, - /* opacity_coef_table = */ { - {1.53307e-01, 2.58151e-06, 8.97185e-11, 5.13410e-15}, - {1.93187e-01, 3.26103e-06, 1.14053e-10, 6.60852e-15}, - {2.43381e-01, 4.11484e-06, 1.44443e-10, 8.42753e-15}, - {3.06566e-01, 5.18903e-06, 1.82603e-10, 1.07022e-14}, - {3.86268e-01, 6.55217e-06, 2.31853e-10, 1.37374e-14}, - {4.86630e-01, 8.26891e-06, 2.93869e-10, 1.75576e-14}, - {6.13093e-01, 1.04376e-05, 3.72751e-10, 2.24815e-14}, - {7.72441e-01, 1.31779e-05, 4.73205e-10, 2.88483e-14}, - {9.72908e-01, 1.66348e-05, 6.00927e-10, 3.70670e-14}, - {1.22279e+00, 2.09532e-05, 7.61455e-10, 4.75186e-14}, - {1.51967e+00, 2.61010e-05, 9.54694e-10, 6.03376e-14}, - {1.83660e+00, 3.16418e-05, 1.16836e-09, 7.52509e-14}, - {2.15883e+00, 3.73832e-05, 1.40366e-09, 9.34936e-14}, - {2.56188e+00, 4.46730e-05, 1.71564e-09, 1.19386e-13}, - {3.24331e+00, 5.69556e-05, 2.23297e-09, 1.61351e-13}, - {4.36192e+00, 7.70449e-05, 3.06366e-09, 2.26659e-13}, - {5.87089e+00, 1.04185e-04, 4.17746e-09, 3.12654e-13}, - {7.58000e+00, 1.35161e-04, 5.44737e-09, 4.09330e-13}, - {9.38530e+00, 1.68565e-04, 6.82760e-09, 5.12932e-13}, - {1.15371e+01, 2.10285e-04, 8.59830e-09, 6.44799e-13}, - {1.47388e+01, 2.75860e-04, 1.14755e-08, 8.58985e-13}, - {1.93877e+01, 3.75887e-04, 1.59953e-08, 1.19600e-12}, - {2.46008e+01, 5.00971e-04, 2.20360e-08, 1.65571e-12}, - {2.90408e+01, 6.45456e-04, 3.01610e-08, 2.31085e-12}, - {3.23701e+01, 8.27330e-04, 4.23216e-08, 3.35508e-12}, - {3.49305e+01, 1.05238e-03, 5.92405e-08, 4.87268e-12}, - {3.68020e+01, 1.28200e-03, 7.79075e-08, 6.59988e-12}, - {3.76194e+01, 1.45174e-03, 9.27975e-08, 8.01634e-12}, - {3.72617e+01, 1.52446e-03, 1.00177e-07, 8.74632e-12}, - {3.76576e+01, 1.55784e-03, 1.02687e-07, 8.96074e-12}, - {4.91245e+01, 1.84545e-03, 1.14505e-07, 9.64022e-12}, - {1.17100e+02, 3.32870e-03, 1.70057e-07, 1.27411e-11}, - {3.93519e+02, 8.31574e-03, 3.27938e-07, 2.07522e-11}, - {1.23314e+03, 2.12665e-02, 6.72506e-07, 3.61691e-11}, - {3.12736e+03, 4.71942e-02, 1.26825e-06, 5.97225e-11}, - } - }, }; } // namespace ccsn25 @@ -1497,6 +1497,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "SiM_dust", /* nonprimoridal_yield_frac = */ 2.91389e-02, /* size_moments = */ {2.56305e-05, 1.02092e-09, 5.78476e-14}, + /* opacity_coef_table = */ { + {1.52613e-01, 3.87036e-06, 1.51475e-10, 8.34686e-15}, + {1.92410e-01, 4.88554e-06, 1.91604e-10, 1.05937e-14}, + {2.42503e-01, 6.16264e-06, 2.42001e-10, 1.34057e-14}, + {3.05564e-01, 7.77004e-06, 3.05397e-10, 1.69392e-14}, + {3.85174e-01, 9.80462e-06, 3.86046e-10, 2.14732e-14}, + {4.85438e-01, 1.23675e-05, 4.87634e-10, 2.71828e-14}, + {6.11833e-01, 1.56019e-05, 6.16102e-10, 3.44270e-14}, + {7.71157e-01, 1.96838e-05, 7.78585e-10, 4.36231e-14}, + {9.71669e-01, 2.48269e-05, 9.83743e-10, 5.52763e-14}, + {1.22169e+00, 3.12457e-05, 1.24021e-09, 6.98829e-14}, + {1.51883e+00, 3.88844e-05, 1.54619e-09, 8.73862e-14}, + {1.83610e+00, 4.70620e-05, 1.87584e-09, 1.06471e-13}, + {2.15867e+00, 5.54249e-05, 2.21779e-09, 1.26800e-13}, + {2.56252e+00, 6.59468e-05, 2.65228e-09, 1.53070e-13}, + {3.24657e+00, 8.37697e-05, 3.38561e-09, 1.97020e-13}, + {4.37158e+00, 1.13090e-04, 4.58835e-09, 2.68525e-13}, + {5.89356e+00, 1.52861e-04, 6.22099e-09, 3.65325e-13}, + {7.62770e+00, 1.98484e-04, 8.10272e-09, 4.76950e-13}, + {9.48448e+00, 2.48132e-04, 1.01763e-08, 6.00571e-13}, + {1.17614e+01, 3.11117e-04, 1.28785e-08, 7.63878e-13}, + {1.52604e+01, 4.11692e-04, 1.73236e-08, 1.03683e-12}, + {2.04857e+01, 5.67120e-04, 2.43755e-08, 1.47603e-12}, + {2.67121e+01, 7.65926e-04, 3.38756e-08, 2.08532e-12}, + {3.30214e+01, 1.00600e-03, 4.67023e-08, 2.95970e-12}, + {3.94796e+01, 1.32148e-03, 6.59032e-08, 4.35947e-12}, + {4.60630e+01, 1.71870e-03, 9.26057e-08, 6.41018e-12}, + {5.17888e+01, 2.12529e-03, 1.22060e-07, 8.76593e-12}, + {5.52863e+01, 2.42692e-03, 1.45553e-07, 1.07154e-11}, + {5.60930e+01, 2.55895e-03, 1.57221e-07, 1.17347e-11}, + {5.70683e+01, 2.61927e-03, 1.61476e-07, 1.20713e-11}, + {7.25749e+01, 3.09971e-03, 1.82166e-07, 1.32162e-11}, + {1.59194e+02, 5.49929e-03, 2.77545e-07, 1.82852e-11}, + {4.83739e+02, 1.31658e-02, 5.43977e-07, 3.13196e-11}, + {1.39550e+03, 3.19882e-02, 1.11499e-06, 5.65773e-11}, + {3.29912e+03, 6.76125e-02, 2.08154e-06, 9.54501e-11}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 1.93065e-03, + /* size_moments = */ {2.05800e-05, 5.92424e-10, 2.26690e-14}, /* opacity_coef_table = */ { {7.21495e-02, 2.58300e-06, 1.19134e-10, 6.77090e-15}, {1.09797e-01, 3.79107e-06, 1.69411e-10, 9.39020e-15}, @@ -1536,9 +1578,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 1.93065e-03, - /* size_moments = */ {2.05800e-05, 5.92424e-10, 2.26690e-14}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 7.73041e-04, + /* size_moments = */ {4.70227e-07, 6.29420e-13, 1.71079e-18}, /* opacity_coef_table = */ { {1.05240e-01, 4.94867e-08, 6.62401e-14, 1.80043e-19}, {1.32588e-01, 6.23464e-08, 8.34533e-14, 2.26830e-19}, @@ -1578,9 +1620,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 7.73041e-04, - /* size_moments = */ {4.70227e-07, 6.29420e-13, 1.71079e-18}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 4.17376e-06, + /* size_moments = */ {1.02156e-06, 1.31765e-12, 2.63083e-18}, /* opacity_coef_table = */ { {2.19890e-02, 2.24631e-08, 2.89738e-14, 5.78493e-20}, {3.90612e-02, 3.99034e-08, 5.14691e-14, 1.02764e-19}, @@ -1620,9 +1662,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 4.17376e-06, - /* size_moments = */ {1.02156e-06, 1.31765e-12, 2.63083e-18}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 6.19235e-04, + /* size_moments = */ {1.17005e-06, 2.37154e-12, 7.59875e-18}, /* opacity_coef_table = */ { {3.27960e-01, 3.83729e-07, 7.77768e-13, 2.49208e-18}, {4.38752e-01, 5.13360e-07, 1.04052e-12, 3.33400e-18}, @@ -1662,9 +1704,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 6.19235e-04, - /* size_moments = */ {1.17005e-06, 2.37154e-12, 7.59875e-18}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 5.27016e-03, + /* size_moments = */ {1.62875e-06, 1.12314e-11, 1.91031e-16}, /* opacity_coef_table = */ { {7.60354e-02, 1.23833e-07, 8.53754e-13, 1.45191e-17}, {9.07201e-02, 1.47751e-07, 1.01868e-12, 1.73242e-17}, @@ -1704,9 +1746,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 5.27016e-03, - /* size_moments = */ {1.62875e-06, 1.12314e-11, 1.91031e-16}, + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.33978e-03, + /* size_moments = */ {2.32229e-06, 1.39783e-11, 1.49800e-16}, /* opacity_coef_table = */ { {2.25389e-04, 5.23412e-10, 3.15038e-15, 3.37599e-20}, {4.04967e-04, 9.40443e-10, 5.66055e-15, 6.06603e-20}, @@ -1746,9 +1788,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgO_dust", - /* nonprimoridal_yield_frac = */ 1.33978e-03, - /* size_moments = */ {2.32229e-06, 1.39783e-11, 1.49800e-16}, + /* name = */ "FeS_dust", + /* nonprimoridal_yield_frac = */ 4.51744e-04, + /* size_moments = */ {1.69769e-06, 6.40794e-12, 4.40126e-17}, /* opacity_coef_table = */ { {5.18102e-02, 8.79700e-08, 3.32172e-13, 2.28308e-18}, {9.98920e-02, 1.69607e-07, 6.40403e-13, 4.40131e-18}, @@ -1788,9 +1830,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeS_dust", - /* nonprimoridal_yield_frac = */ 4.51744e-04, - /* size_moments = */ {1.69769e-06, 6.40794e-12, 4.40126e-17}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 5.79251e-12, + /* size_moments = */ {7.63588e-08, 8.88224e-15, 1.42247e-21}, /* opacity_coef_table = */ { {9.93250e-04, 7.58434e-11, 8.82228e-18, 1.41287e-24}, {1.81240e-03, 1.38393e-10, 1.60982e-17, 2.57809e-24}, @@ -1829,48 +1871,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 1.38891e-06, 1.61561e-13, 2.58738e-20}, } }, - { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 5.79251e-12, - /* size_moments = */ {7.63588e-08, 8.88224e-15, 1.42247e-21}, - /* opacity_coef_table = */ { - {1.52613e-01, 3.87036e-06, 1.51475e-10, 8.34686e-15}, - {1.92410e-01, 4.88554e-06, 1.91604e-10, 1.05937e-14}, - {2.42503e-01, 6.16264e-06, 2.42001e-10, 1.34057e-14}, - {3.05564e-01, 7.77004e-06, 3.05397e-10, 1.69392e-14}, - {3.85174e-01, 9.80462e-06, 3.86046e-10, 2.14732e-14}, - {4.85438e-01, 1.23675e-05, 4.87634e-10, 2.71828e-14}, - {6.11833e-01, 1.56019e-05, 6.16102e-10, 3.44270e-14}, - {7.71157e-01, 1.96838e-05, 7.78585e-10, 4.36231e-14}, - {9.71669e-01, 2.48269e-05, 9.83743e-10, 5.52763e-14}, - {1.22169e+00, 3.12457e-05, 1.24021e-09, 6.98829e-14}, - {1.51883e+00, 3.88844e-05, 1.54619e-09, 8.73862e-14}, - {1.83610e+00, 4.70620e-05, 1.87584e-09, 1.06471e-13}, - {2.15867e+00, 5.54249e-05, 2.21779e-09, 1.26800e-13}, - {2.56252e+00, 6.59468e-05, 2.65228e-09, 1.53070e-13}, - {3.24657e+00, 8.37697e-05, 3.38561e-09, 1.97020e-13}, - {4.37158e+00, 1.13090e-04, 4.58835e-09, 2.68525e-13}, - {5.89356e+00, 1.52861e-04, 6.22099e-09, 3.65325e-13}, - {7.62770e+00, 1.98484e-04, 8.10272e-09, 4.76950e-13}, - {9.48448e+00, 2.48132e-04, 1.01763e-08, 6.00571e-13}, - {1.17614e+01, 3.11117e-04, 1.28785e-08, 7.63878e-13}, - {1.52604e+01, 4.11692e-04, 1.73236e-08, 1.03683e-12}, - {2.04857e+01, 5.67120e-04, 2.43755e-08, 1.47603e-12}, - {2.67121e+01, 7.65926e-04, 3.38756e-08, 2.08532e-12}, - {3.30214e+01, 1.00600e-03, 4.67023e-08, 2.95970e-12}, - {3.94796e+01, 1.32148e-03, 6.59032e-08, 4.35947e-12}, - {4.60630e+01, 1.71870e-03, 9.26057e-08, 6.41018e-12}, - {5.17888e+01, 2.12529e-03, 1.22060e-07, 8.76593e-12}, - {5.52863e+01, 2.42692e-03, 1.45553e-07, 1.07154e-11}, - {5.60930e+01, 2.55895e-03, 1.57221e-07, 1.17347e-11}, - {5.70683e+01, 2.61927e-03, 1.61476e-07, 1.20713e-11}, - {7.25749e+01, 3.09971e-03, 1.82166e-07, 1.32162e-11}, - {1.59194e+02, 5.49929e-03, 2.77545e-07, 1.82852e-11}, - {4.83739e+02, 1.31658e-02, 5.43977e-07, 3.13196e-11}, - {1.39550e+03, 3.19882e-02, 1.11499e-06, 5.65773e-11}, - {3.29912e+03, 6.76125e-02, 2.08154e-06, 9.54501e-11}, - } - }, }; } // namespace ccsn30 @@ -1892,6 +1892,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "FeM_dust", /* nonprimoridal_yield_frac = */ 6.31648e-26, /* size_moments = */ {4.02937e-08, 1.67044e-15, 7.11477e-23}, + /* opacity_coef_table = */ { + {1.23621e-05, 4.98941e-13, 2.07173e-20, 8.83710e-28}, + {2.19539e-05, 8.86065e-13, 3.67916e-20, 1.56937e-27}, + {3.40291e-05, 1.37342e-12, 5.70280e-20, 2.43256e-27}, + {4.92310e-05, 1.98698e-12, 8.25041e-20, 3.51925e-27}, + {8.08514e-05, 3.26317e-12, 1.35494e-19, 5.77953e-27}, + {1.25020e-04, 5.04574e-12, 2.09508e-19, 8.93651e-27}, + {1.96586e-04, 7.93387e-12, 3.29418e-19, 1.40509e-26}, + {3.14491e-04, 1.26917e-11, 5.26937e-19, 2.24747e-26}, + {5.06850e-04, 2.04532e-11, 8.49130e-19, 3.62146e-26}, + {8.07286e-04, 3.25749e-11, 1.35229e-18, 5.76710e-26}, + {1.28668e-03, 5.19155e-11, 2.15506e-18, 9.19009e-26}, + {2.05241e-03, 8.28056e-11, 3.43709e-18, 1.46562e-25}, + {3.27026e-03, 1.31928e-10, 5.47555e-18, 2.33466e-25}, + {5.23898e-03, 2.11325e-10, 8.76988e-18, 3.73889e-25}, + {8.45023e-03, 3.40811e-10, 1.41417e-17, 6.02834e-25}, + {1.37158e-02, 5.53101e-10, 2.29473e-17, 9.78076e-25}, + {2.24100e-02, 9.03572e-10, 3.74827e-17, 1.59741e-24}, + {3.70042e-02, 1.49181e-09, 6.18765e-17, 2.63669e-24}, + {6.21585e-02, 2.50559e-09, 1.03913e-16, 4.42746e-24}, + {1.07033e-01, 4.31400e-09, 1.78894e-16, 7.62148e-24}, + {1.90089e-01, 7.66095e-09, 3.17659e-16, 1.35323e-23}, + {3.49470e-01, 1.40834e-08, 5.83928e-16, 2.48739e-23}, + {6.64947e-01, 2.67957e-08, 1.11096e-15, 4.73220e-23}, + {1.30413e+00, 5.25515e-08, 2.17873e-15, 9.28021e-23}, + {2.61640e+00, 1.05429e-07, 4.37088e-15, 1.86172e-22}, + {5.31791e+00, 2.14284e-07, 8.88372e-15, 3.78386e-22}, + {1.08366e+01, 4.36654e-07, 1.81025e-14, 7.71039e-22}, + {2.19132e+01, 8.82975e-07, 3.66056e-14, 1.55913e-21}, + {4.35354e+01, 1.75422e-06, 7.27247e-14, 3.09753e-21}, + {8.42362e+01, 3.39422e-06, 1.40714e-13, 5.99335e-21}, + {1.57704e+02, 6.35452e-06, 2.63439e-13, 1.12205e-20}, + {2.84822e+02, 1.14766e-05, 4.75784e-13, 2.02648e-20}, + {4.96653e+02, 2.00121e-05, 8.29639e-13, 3.53363e-20}, + {8.39966e+02, 3.38455e-05, 1.40313e-12, 5.97626e-20}, + {1.38932e+03, 5.59813e-05, 2.32081e-12, 9.88487e-20}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.06081e-16, + /* size_moments = */ {4.03307e-08, 1.67330e-15, 7.13316e-23}, /* opacity_coef_table = */ { {1.05240e-01, 4.24440e-09, 1.76098e-16, 7.50693e-24}, {1.32588e-01, 5.34735e-09, 2.21859e-16, 9.45769e-24}, @@ -1931,9 +1973,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 2.06081e-16, - /* size_moments = */ {4.03307e-08, 1.67330e-15, 7.13316e-23}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 3.19262e-15, + /* size_moments = */ {4.03157e-08, 1.67182e-15, 7.12190e-23}, /* opacity_coef_table = */ { {2.19890e-02, 8.86503e-10, 3.67618e-17, 1.56604e-24}, {3.90612e-02, 1.57478e-09, 6.53036e-17, 2.78190e-24}, @@ -1973,9 +2015,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 3.19262e-15, - /* size_moments = */ {4.03157e-08, 1.67182e-15, 7.12190e-23}, + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 4.37192e-15, + /* size_moments = */ {4.03312e-08, 1.67336e-15, 7.13357e-23}, /* opacity_coef_table = */ { {1.47700e-02, 5.95693e-10, 2.47155e-17, 1.05363e-24}, {2.47694e-02, 9.98982e-10, 4.14481e-17, 1.76695e-24}, @@ -2015,9 +2057,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Fe3O4_dust", - /* nonprimoridal_yield_frac = */ 4.37192e-15, - /* size_moments = */ {4.03312e-08, 1.67336e-15, 7.13357e-23}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.75542e-01, + /* size_moments = */ {6.60867e-06, 5.49310e-11, 5.25955e-16}, /* opacity_coef_table = */ { {3.27960e-01, 2.16737e-06, 1.80151e-11, 1.72491e-16}, {4.38754e-01, 2.89959e-06, 2.41015e-11, 2.30770e-16}, @@ -2057,9 +2099,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 1.75542e-01, - /* size_moments = */ {6.60867e-06, 5.49310e-11, 5.25955e-16}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.92019e-16, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12105e-23}, /* opacity_coef_table = */ { {7.60360e-02, 3.06536e-09, 1.27110e-16, 5.41456e-24}, {9.07207e-02, 3.65737e-09, 1.51659e-16, 6.46027e-24}, @@ -2099,9 +2141,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 1.92019e-16, - /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12105e-23}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 6.23283e-17, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, /* opacity_coef_table = */ { {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07299e-26}, {1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25}, @@ -2140,69 +2182,69 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21}, } }, +}; + +} // namespace fsn13 + +namespace fsn15 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 4.57071e-01, 6.46299e-01}, + {"O", 3.53548e-01, 3.53548e-01}, + {"Mg", 1.29204e-04, 1.29204e-04}, + {"Al", 2.22729e-07, 2.22729e-07}, + {"Si", 1.32242e-05, 1.32242e-05}, + {"S", 0.00000e+00, 0.00000e+00}, + {"Fe", 9.66658e-06, 9.66658e-06}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 6.23283e-17, - /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 1.53361e-25, + /* size_moments = */ {4.02634e-08, 1.66860e-15, 7.10566e-23}, /* opacity_coef_table = */ { - {1.23621e-05, 4.98941e-13, 2.07173e-20, 8.83710e-28}, - {2.19539e-05, 8.86065e-13, 3.67916e-20, 1.56937e-27}, - {3.40291e-05, 1.37342e-12, 5.70280e-20, 2.43256e-27}, - {4.92310e-05, 1.98698e-12, 8.25041e-20, 3.51925e-27}, - {8.08514e-05, 3.26317e-12, 1.35494e-19, 5.77953e-27}, - {1.25020e-04, 5.04574e-12, 2.09508e-19, 8.93651e-27}, - {1.96586e-04, 7.93387e-12, 3.29418e-19, 1.40509e-26}, - {3.14491e-04, 1.26917e-11, 5.26937e-19, 2.24747e-26}, - {5.06850e-04, 2.04532e-11, 8.49130e-19, 3.62146e-26}, - {8.07286e-04, 3.25749e-11, 1.35229e-18, 5.76710e-26}, - {1.28668e-03, 5.19155e-11, 2.15506e-18, 9.19009e-26}, - {2.05241e-03, 8.28056e-11, 3.43709e-18, 1.46562e-25}, - {3.27026e-03, 1.31928e-10, 5.47555e-18, 2.33466e-25}, - {5.23898e-03, 2.11325e-10, 8.76988e-18, 3.73889e-25}, - {8.45023e-03, 3.40811e-10, 1.41417e-17, 6.02834e-25}, - {1.37158e-02, 5.53101e-10, 2.29473e-17, 9.78076e-25}, - {2.24100e-02, 9.03572e-10, 3.74827e-17, 1.59741e-24}, - {3.70042e-02, 1.49181e-09, 6.18765e-17, 2.63669e-24}, - {6.21585e-02, 2.50559e-09, 1.03913e-16, 4.42746e-24}, - {1.07033e-01, 4.31400e-09, 1.78894e-16, 7.62148e-24}, - {1.90089e-01, 7.66095e-09, 3.17659e-16, 1.35323e-23}, - {3.49470e-01, 1.40834e-08, 5.83928e-16, 2.48739e-23}, - {6.64947e-01, 2.67957e-08, 1.11096e-15, 4.73220e-23}, - {1.30413e+00, 5.25515e-08, 2.17873e-15, 9.28021e-23}, - {2.61640e+00, 1.05429e-07, 4.37088e-15, 1.86172e-22}, - {5.31791e+00, 2.14284e-07, 8.88372e-15, 3.78386e-22}, - {1.08366e+01, 4.36654e-07, 1.81025e-14, 7.71039e-22}, - {2.19132e+01, 8.82975e-07, 3.66056e-14, 1.55913e-21}, - {4.35354e+01, 1.75422e-06, 7.27247e-14, 3.09753e-21}, - {8.42362e+01, 3.39422e-06, 1.40714e-13, 5.99335e-21}, - {1.57704e+02, 6.35452e-06, 2.63439e-13, 1.12205e-20}, - {2.84822e+02, 1.14766e-05, 4.75784e-13, 2.02648e-20}, - {4.96653e+02, 2.00121e-05, 8.29639e-13, 3.53363e-20}, - {8.39966e+02, 3.38455e-05, 1.40313e-12, 5.97626e-20}, - {1.38932e+03, 5.59813e-05, 2.32081e-12, 9.88487e-20}, + {1.23614e-05, 4.98551e-13, 2.06942e-20, 8.82572e-28}, + {2.19525e-05, 8.85374e-13, 3.67505e-20, 1.56735e-27}, + {3.40270e-05, 1.37235e-12, 5.69643e-20, 2.42942e-27}, + {4.92280e-05, 1.98543e-12, 8.24119e-20, 3.51472e-27}, + {8.08465e-05, 3.26062e-12, 1.35343e-19, 5.77209e-27}, + {1.25012e-04, 5.04181e-12, 2.09274e-19, 8.92500e-27}, + {1.96574e-04, 7.92769e-12, 3.29050e-19, 1.40328e-26}, + {3.14473e-04, 1.26818e-11, 5.26348e-19, 2.24457e-26}, + {5.06822e-04, 2.04373e-11, 8.48182e-19, 3.61680e-26}, + {8.07243e-04, 3.25496e-11, 1.35079e-18, 5.75968e-26}, + {1.28661e-03, 5.18753e-11, 2.15265e-18, 9.17827e-26}, + {2.05232e-03, 8.27416e-11, 3.43325e-18, 1.46374e-25}, + {3.27011e-03, 1.31826e-10, 5.46945e-18, 2.33165e-25}, + {5.23877e-03, 2.11162e-10, 8.76012e-18, 3.73409e-25}, + {8.44994e-03, 3.40550e-10, 1.41259e-17, 6.02059e-25}, + {1.37154e-02, 5.52677e-10, 2.29218e-17, 9.76820e-25}, + {2.24094e-02, 9.02883e-10, 3.74411e-17, 1.59536e-24}, + {3.70035e-02, 1.49068e-09, 6.18079e-17, 2.63331e-24}, + {6.21576e-02, 2.50369e-09, 1.03798e-16, 4.42178e-24}, + {1.07032e-01, 4.31074e-09, 1.78696e-16, 7.61171e-24}, + {1.90087e-01, 7.65516e-09, 3.17308e-16, 1.35149e-23}, + {3.49468e-01, 1.40728e-08, 5.83283e-16, 2.48420e-23}, + {6.64945e-01, 2.67755e-08, 1.10973e-15, 4.72613e-23}, + {1.30413e+00, 5.25119e-08, 2.17633e-15, 9.26832e-23}, + {2.61639e+00, 1.05349e-07, 4.36605e-15, 1.85933e-22}, + {5.31790e+00, 2.14123e-07, 8.87391e-15, 3.77901e-22}, + {1.08366e+01, 4.36326e-07, 1.80825e-14, 7.70051e-22}, + {2.19131e+01, 8.82310e-07, 3.65652e-14, 1.55714e-21}, + {4.35353e+01, 1.75290e-06, 7.26444e-14, 3.09356e-21}, + {8.42362e+01, 3.39166e-06, 1.40558e-13, 5.98567e-21}, + {1.57704e+02, 6.34974e-06, 2.63148e-13, 1.12061e-20}, + {2.84822e+02, 1.14680e-05, 4.75258e-13, 2.02388e-20}, + {4.96653e+02, 1.99971e-05, 8.28723e-13, 3.52910e-20}, + {8.39966e+02, 3.38201e-05, 1.40158e-12, 5.96860e-20}, + {1.38932e+03, 5.59392e-05, 2.31824e-12, 9.87221e-20}, } }, -}; - -} // namespace fsn13 - -namespace fsn15 { -static const MetalNuclideYieldProps metal_props[] = { - // {name, gas_yield, total_yield} - {"C", 4.57071e-01, 6.46299e-01}, - {"O", 3.53548e-01, 3.53548e-01}, - {"Mg", 1.29204e-04, 1.29204e-04}, - {"Al", 2.22729e-07, 2.22729e-07}, - {"Si", 1.32242e-05, 1.32242e-05}, - {"S", 0.00000e+00, 0.00000e+00}, - {"Fe", 9.66658e-06, 9.66658e-06}, -}; - -static const GrainSpeciesYieldProps grain_props[] = { { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 1.53361e-25, - /* size_moments = */ {4.02634e-08, 1.66860e-15, 7.10566e-23}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 1.56864e-15, + /* size_moments = */ {4.03318e-08, 1.67341e-15, 7.13397e-23}, /* opacity_coef_table = */ { {1.05240e-01, 4.24452e-09, 1.76110e-16, 7.50779e-24}, {1.32588e-01, 5.34750e-09, 2.21874e-16, 9.45877e-24}, @@ -2242,9 +2284,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 1.56864e-15, - /* size_moments = */ {4.03318e-08, 1.67341e-15, 7.13397e-23}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.13810e-14, + /* size_moments = */ {4.03159e-08, 1.67184e-15, 7.12201e-23}, /* opacity_coef_table = */ { {2.19890e-02, 8.86506e-10, 3.67621e-17, 1.56606e-24}, {3.90612e-02, 1.57479e-09, 6.53041e-17, 2.78195e-24}, @@ -2284,9 +2326,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 2.13810e-14, - /* size_moments = */ {4.03159e-08, 1.67184e-15, 7.12201e-23}, + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 1.22287e-14, + /* size_moments = */ {4.03301e-08, 1.67324e-15, 7.13269e-23}, /* opacity_coef_table = */ { {1.47700e-02, 5.95675e-10, 2.47138e-17, 1.05350e-24}, {2.47694e-02, 9.98953e-10, 4.14453e-17, 1.76673e-24}, @@ -2326,9 +2368,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Fe3O4_dust", - /* nonprimoridal_yield_frac = */ 1.22287e-14, - /* size_moments = */ {4.03301e-08, 1.67324e-15, 7.13269e-23}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.89229e-01, + /* size_moments = */ {1.14540e-05, 1.60512e-10, 2.55303e-15}, /* opacity_coef_table = */ { {3.27956e-01, 3.75639e-06, 5.26403e-11, 8.37270e-16}, {4.38770e-01, 5.02579e-06, 7.04309e-11, 1.12026e-15}, @@ -2368,9 +2410,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 1.89229e-01, - /* size_moments = */ {1.14540e-05, 1.60512e-10, 2.55303e-15}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.47463e-15, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12105e-23}, /* opacity_coef_table = */ { {7.60360e-02, 3.06536e-09, 1.27110e-16, 5.41456e-24}, {9.07207e-02, 3.65737e-09, 1.51659e-16, 6.46027e-24}, @@ -2410,9 +2452,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 1.47463e-15, - /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12105e-23}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 2.15191e-16, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, /* opacity_coef_table = */ { {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07299e-26}, {1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25}, @@ -2451,48 +2493,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21}, } }, - { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 2.15191e-16, - /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, - /* opacity_coef_table = */ { - {1.23614e-05, 4.98551e-13, 2.06942e-20, 8.82572e-28}, - {2.19525e-05, 8.85374e-13, 3.67505e-20, 1.56735e-27}, - {3.40270e-05, 1.37235e-12, 5.69643e-20, 2.42942e-27}, - {4.92280e-05, 1.98543e-12, 8.24119e-20, 3.51472e-27}, - {8.08465e-05, 3.26062e-12, 1.35343e-19, 5.77209e-27}, - {1.25012e-04, 5.04181e-12, 2.09274e-19, 8.92500e-27}, - {1.96574e-04, 7.92769e-12, 3.29050e-19, 1.40328e-26}, - {3.14473e-04, 1.26818e-11, 5.26348e-19, 2.24457e-26}, - {5.06822e-04, 2.04373e-11, 8.48182e-19, 3.61680e-26}, - {8.07243e-04, 3.25496e-11, 1.35079e-18, 5.75968e-26}, - {1.28661e-03, 5.18753e-11, 2.15265e-18, 9.17827e-26}, - {2.05232e-03, 8.27416e-11, 3.43325e-18, 1.46374e-25}, - {3.27011e-03, 1.31826e-10, 5.46945e-18, 2.33165e-25}, - {5.23877e-03, 2.11162e-10, 8.76012e-18, 3.73409e-25}, - {8.44994e-03, 3.40550e-10, 1.41259e-17, 6.02059e-25}, - {1.37154e-02, 5.52677e-10, 2.29218e-17, 9.76820e-25}, - {2.24094e-02, 9.02883e-10, 3.74411e-17, 1.59536e-24}, - {3.70035e-02, 1.49068e-09, 6.18079e-17, 2.63331e-24}, - {6.21576e-02, 2.50369e-09, 1.03798e-16, 4.42178e-24}, - {1.07032e-01, 4.31074e-09, 1.78696e-16, 7.61171e-24}, - {1.90087e-01, 7.65516e-09, 3.17308e-16, 1.35149e-23}, - {3.49468e-01, 1.40728e-08, 5.83283e-16, 2.48420e-23}, - {6.64945e-01, 2.67755e-08, 1.10973e-15, 4.72613e-23}, - {1.30413e+00, 5.25119e-08, 2.17633e-15, 9.26832e-23}, - {2.61639e+00, 1.05349e-07, 4.36605e-15, 1.85933e-22}, - {5.31790e+00, 2.14123e-07, 8.87391e-15, 3.77901e-22}, - {1.08366e+01, 4.36326e-07, 1.80825e-14, 7.70051e-22}, - {2.19131e+01, 8.82310e-07, 3.65652e-14, 1.55714e-21}, - {4.35353e+01, 1.75290e-06, 7.26444e-14, 3.09356e-21}, - {8.42362e+01, 3.39166e-06, 1.40558e-13, 5.98567e-21}, - {1.57704e+02, 6.34974e-06, 2.63148e-13, 1.12061e-20}, - {2.84822e+02, 1.14680e-05, 4.75258e-13, 2.02388e-20}, - {4.96653e+02, 1.99971e-05, 8.28723e-13, 3.52910e-20}, - {8.39966e+02, 3.38201e-05, 1.40158e-12, 5.96860e-20}, - {1.38932e+03, 5.59392e-05, 2.31824e-12, 9.87221e-20}, - } - }, }; } // namespace fsn15 @@ -2514,6 +2514,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "FeM_dust", /* nonprimoridal_yield_frac = */ 2.33171e-24, /* size_moments = */ {4.02891e-08, 1.67016e-15, 7.11339e-23}, + /* opacity_coef_table = */ { + {1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28}, + {2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27}, + {3.40288e-05, 1.37326e-12, 5.70184e-20, 2.43208e-27}, + {4.92305e-05, 1.98674e-12, 8.24901e-20, 3.51856e-27}, + {8.08507e-05, 3.26278e-12, 1.35471e-19, 5.77841e-27}, + {1.25019e-04, 5.04514e-12, 2.09472e-19, 8.93477e-27}, + {1.96584e-04, 7.93293e-12, 3.29363e-19, 1.40481e-26}, + {3.14489e-04, 1.26902e-11, 5.26848e-19, 2.24703e-26}, + {5.06846e-04, 2.04508e-11, 8.48987e-19, 3.62076e-26}, + {8.07280e-04, 3.25711e-11, 1.35207e-18, 5.76597e-26}, + {1.28667e-03, 5.19094e-11, 2.15469e-18, 9.18830e-26}, + {2.05240e-03, 8.27959e-11, 3.43651e-18, 1.46534e-25}, + {3.27023e-03, 1.31912e-10, 5.47463e-18, 2.33420e-25}, + {5.23895e-03, 2.11300e-10, 8.76840e-18, 3.73817e-25}, + {8.45019e-03, 3.40772e-10, 1.41393e-17, 6.02717e-25}, + {1.37157e-02, 5.53037e-10, 2.29434e-17, 9.77885e-25}, + {2.24099e-02, 9.03468e-10, 3.74764e-17, 1.59710e-24}, + {3.70041e-02, 1.49164e-09, 6.18661e-17, 2.63618e-24}, + {6.21584e-02, 2.50530e-09, 1.03896e-16, 4.42660e-24}, + {1.07033e-01, 4.31351e-09, 1.78864e-16, 7.62000e-24}, + {1.90089e-01, 7.66007e-09, 3.17606e-16, 1.35297e-23}, + {3.49470e-01, 1.40818e-08, 5.83831e-16, 2.48691e-23}, + {6.64947e-01, 2.67926e-08, 1.11077e-15, 4.73128e-23}, + {1.30413e+00, 5.25455e-08, 2.17837e-15, 9.27841e-23}, + {2.61640e+00, 1.05417e-07, 4.37015e-15, 1.86136e-22}, + {5.31790e+00, 2.14259e-07, 8.88223e-15, 3.78313e-22}, + {1.08366e+01, 4.36604e-07, 1.80995e-14, 7.70889e-22}, + {2.19132e+01, 8.82874e-07, 3.65995e-14, 1.55883e-21}, + {4.35354e+01, 1.75402e-06, 7.27125e-14, 3.09693e-21}, + {8.42362e+01, 3.39383e-06, 1.40690e-13, 5.99219e-21}, + {1.57704e+02, 6.35380e-06, 2.63395e-13, 1.12183e-20}, + {2.84822e+02, 1.14753e-05, 4.75704e-13, 2.02608e-20}, + {4.96653e+02, 2.00098e-05, 8.29500e-13, 3.53294e-20}, + {8.39966e+02, 3.38417e-05, 1.40289e-12, 5.97510e-20}, + {1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20}, + } + }, + { + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.62486e-10, + /* size_moments = */ {1.68491e-07, 3.02634e-14, 5.60369e-21}, /* opacity_coef_table = */ { {1.05240e-01, 1.77320e-08, 3.18492e-15, 5.89732e-22}, {1.32588e-01, 2.23399e-08, 4.01256e-15, 7.42980e-22}, @@ -2553,9 +2595,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 2.62486e-10, - /* size_moments = */ {1.68491e-07, 3.02634e-14, 5.60369e-21}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 1.21446e-09, + /* size_moments = */ {1.33003e-07, 1.84568e-14, 2.62630e-21}, /* opacity_coef_table = */ { {2.19890e-02, 2.92460e-09, 4.05846e-16, 5.77498e-23}, {3.90612e-02, 5.19526e-09, 7.20944e-16, 1.02587e-22}, @@ -2595,9 +2637,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 1.21446e-09, - /* size_moments = */ {1.33003e-07, 1.84568e-14, 2.62630e-21}, + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 2.41799e-13, + /* size_moments = */ {5.89806e-08, 3.51732e-15, 2.11807e-22}, /* opacity_coef_table = */ { {1.47700e-02, 8.71144e-10, 5.19508e-17, 3.12839e-24}, {2.47694e-02, 1.46092e-09, 8.71220e-17, 5.24635e-24}, @@ -2637,9 +2679,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Fe3O4_dust", - /* nonprimoridal_yield_frac = */ 2.41799e-13, - /* size_moments = */ {5.89806e-08, 3.51732e-15, 2.11807e-22}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 1.09849e-04, + /* size_moments = */ {6.81790e-07, 6.53175e-13, 7.65748e-19}, /* opacity_coef_table = */ { {3.27960e-01, 2.23600e-07, 2.14215e-13, 2.51135e-19}, {4.38752e-01, 2.99136e-07, 2.86582e-13, 3.35973e-19}, @@ -2679,9 +2721,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 1.09849e-04, - /* size_moments = */ {6.81790e-07, 6.53175e-13, 7.65748e-19}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 3.41863e-11, + /* size_moments = */ {9.81613e-08, 9.72845e-15, 9.68327e-22}, /* opacity_coef_table = */ { {7.60360e-02, 7.46380e-09, 7.39712e-16, 7.36277e-23}, {9.07207e-02, 8.90526e-09, 8.82572e-16, 8.78473e-23}, @@ -2721,9 +2763,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 3.41863e-11, - /* size_moments = */ {9.81613e-08, 9.72845e-15, 9.68327e-22}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 2.53950e-17, + /* size_moments = */ {4.03146e-08, 1.67172e-15, 7.12107e-23}, /* opacity_coef_table = */ { {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07300e-26}, {1.81240e-03, 7.30662e-11, 3.02982e-18, 1.29062e-25}, @@ -2762,10 +2804,27 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 7.33294e-07, 3.04073e-14, 1.29527e-21}, } }, +}; + +} // namespace fsn50 + +namespace fsn80 { +static const MetalNuclideYieldProps metal_props[] = { + // {name, gas_yield, total_yield} + {"C", 2.43883e-01, 2.52563e-01}, + {"O", 7.46061e-01, 7.46061e-01}, + {"Mg", 1.36917e-03, 1.36917e-03}, + {"Al", 1.55602e-08, 1.55602e-08}, + {"Si", 3.63906e-06, 3.63906e-06}, + {"S", 0.00000e+00, 0.00000e+00}, + {"Fe", 2.43915e-06, 2.43915e-06}, +}; + +static const GrainSpeciesYieldProps grain_props[] = { { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 2.53950e-17, - /* size_moments = */ {4.03146e-08, 1.67172e-15, 7.12107e-23}, + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 3.87590e-26, + /* size_moments = */ {4.02891e-08, 1.67016e-15, 7.11339e-23}, /* opacity_coef_table = */ { {1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28}, {2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27}, @@ -2804,27 +2863,10 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20}, } }, -}; - -} // namespace fsn50 - -namespace fsn80 { -static const MetalNuclideYieldProps metal_props[] = { - // {name, gas_yield, total_yield} - {"C", 2.43883e-01, 2.52563e-01}, - {"O", 7.46061e-01, 7.46061e-01}, - {"Mg", 1.36917e-03, 1.36917e-03}, - {"Al", 1.55602e-08, 1.55602e-08}, - {"Si", 3.63906e-06, 3.63906e-06}, - {"S", 0.00000e+00, 0.00000e+00}, - {"Fe", 2.43915e-06, 2.43915e-06}, -}; - -static const GrainSpeciesYieldProps grain_props[] = { { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 3.87590e-26, - /* size_moments = */ {4.02891e-08, 1.67016e-15, 7.11339e-23}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.36180e-13, + /* size_moments = */ {5.88698e-08, 3.50624e-15, 2.10950e-22}, /* opacity_coef_table = */ { {1.05240e-01, 6.19546e-09, 3.68996e-16, 2.22004e-23}, {1.32588e-01, 7.80541e-09, 4.64884e-16, 2.79694e-23}, @@ -2864,9 +2906,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 2.36180e-13, - /* size_moments = */ {5.88698e-08, 3.50624e-15, 2.10950e-22}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 2.48190e-12, + /* size_moments = */ {5.87709e-08, 3.49547e-15, 2.10029e-22}, /* opacity_coef_table = */ { {2.19890e-02, 1.29231e-09, 7.68620e-17, 4.61833e-24}, {3.90612e-02, 2.29567e-09, 1.36538e-16, 8.20401e-24}, @@ -2906,9 +2948,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 2.48190e-12, - /* size_moments = */ {5.87709e-08, 3.49547e-15, 2.10029e-22}, + /* name = */ "Fe3O4_dust", + /* nonprimoridal_yield_frac = */ 3.01120e-15, + /* size_moments = */ {4.03342e-08, 1.67365e-15, 7.13577e-23}, /* opacity_coef_table = */ { {1.47700e-02, 5.95736e-10, 2.47198e-17, 1.05395e-24}, {2.47694e-02, 9.99055e-10, 4.14553e-17, 1.76749e-24}, @@ -2948,9 +2990,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Fe3O4_dust", - /* nonprimoridal_yield_frac = */ 3.01120e-15, - /* size_moments = */ {4.03342e-08, 1.67365e-15, 7.13577e-23}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 8.68025e-03, + /* size_moments = */ {4.22607e-06, 2.30435e-11, 1.46801e-16}, /* opacity_coef_table = */ { {3.27960e-01, 1.38598e-06, 7.55735e-12, 4.81450e-17}, {4.38752e-01, 1.85420e-06, 1.01104e-11, 6.44096e-17}, @@ -2990,9 +3032,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 8.68025e-03, - /* size_moments = */ {4.22607e-06, 2.30435e-11, 1.46801e-16}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 3.70132e-14, + /* size_moments = */ {4.03439e-08, 1.67461e-15, 7.14309e-23}, /* opacity_coef_table = */ { {7.60360e-02, 3.06759e-09, 1.27330e-16, 5.43132e-24}, {9.07207e-02, 3.66003e-09, 1.51922e-16, 6.48026e-24}, @@ -3032,9 +3074,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 3.70132e-14, - /* size_moments = */ {4.03439e-08, 1.67461e-15, 7.14309e-23}, + /* name = */ "Al2O3_dust", + /* nonprimoridal_yield_frac = */ 3.77811e-18, + /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, /* opacity_coef_table = */ { {9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07300e-26}, {1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25}, @@ -3073,48 +3115,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21}, } }, - { - /* name = */ "Al2O3_dust", - /* nonprimoridal_yield_frac = */ 3.77811e-18, - /* size_moments = */ {4.03146e-08, 1.67171e-15, 7.12106e-23}, - /* opacity_coef_table = */ { - {1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28}, - {2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27}, - {3.40288e-05, 1.37326e-12, 5.70184e-20, 2.43208e-27}, - {4.92305e-05, 1.98674e-12, 8.24901e-20, 3.51856e-27}, - {8.08507e-05, 3.26278e-12, 1.35471e-19, 5.77841e-27}, - {1.25019e-04, 5.04514e-12, 2.09472e-19, 8.93477e-27}, - {1.96584e-04, 7.93293e-12, 3.29363e-19, 1.40481e-26}, - {3.14489e-04, 1.26902e-11, 5.26848e-19, 2.24703e-26}, - {5.06846e-04, 2.04508e-11, 8.48987e-19, 3.62076e-26}, - {8.07280e-04, 3.25711e-11, 1.35207e-18, 5.76597e-26}, - {1.28667e-03, 5.19094e-11, 2.15469e-18, 9.18830e-26}, - {2.05240e-03, 8.27959e-11, 3.43651e-18, 1.46534e-25}, - {3.27023e-03, 1.31912e-10, 5.47463e-18, 2.33420e-25}, - {5.23895e-03, 2.11300e-10, 8.76840e-18, 3.73817e-25}, - {8.45019e-03, 3.40772e-10, 1.41393e-17, 6.02717e-25}, - {1.37157e-02, 5.53037e-10, 2.29434e-17, 9.77885e-25}, - {2.24099e-02, 9.03468e-10, 3.74764e-17, 1.59710e-24}, - {3.70041e-02, 1.49164e-09, 6.18661e-17, 2.63618e-24}, - {6.21584e-02, 2.50530e-09, 1.03896e-16, 4.42660e-24}, - {1.07033e-01, 4.31351e-09, 1.78864e-16, 7.62000e-24}, - {1.90089e-01, 7.66007e-09, 3.17606e-16, 1.35297e-23}, - {3.49470e-01, 1.40818e-08, 5.83831e-16, 2.48691e-23}, - {6.64947e-01, 2.67926e-08, 1.11077e-15, 4.73128e-23}, - {1.30413e+00, 5.25455e-08, 2.17837e-15, 9.27841e-23}, - {2.61640e+00, 1.05417e-07, 4.37015e-15, 1.86136e-22}, - {5.31790e+00, 2.14259e-07, 8.88223e-15, 3.78313e-22}, - {1.08366e+01, 4.36604e-07, 1.80995e-14, 7.70889e-22}, - {2.19132e+01, 8.82874e-07, 3.65995e-14, 1.55883e-21}, - {4.35354e+01, 1.75402e-06, 7.27125e-14, 3.09693e-21}, - {8.42362e+01, 3.39383e-06, 1.40690e-13, 5.99219e-21}, - {1.57704e+02, 6.35380e-06, 2.63395e-13, 1.12183e-20}, - {2.84822e+02, 1.14753e-05, 4.75704e-13, 2.02608e-20}, - {4.96653e+02, 2.00098e-05, 8.29500e-13, 3.53294e-20}, - {8.39966e+02, 3.38417e-05, 1.40289e-12, 5.97510e-20}, - {1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20}, - } - }, }; } // namespace fsn80 @@ -3136,6 +3136,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "SiM_dust", /* nonprimoridal_yield_frac = */ 1.31079e-02, /* size_moments = */ {2.72050e-06, 2.87427e-11, 7.09270e-16}, + /* opacity_coef_table = */ { + {1.54566e-01, 4.18815e-07, 4.38802e-12, 1.07634e-16}, + {1.94597e-01, 5.27516e-07, 5.53200e-12, 1.35785e-16}, + {2.44992e-01, 6.64362e-07, 6.97216e-12, 1.71223e-16}, + {3.08437e-01, 8.36640e-07, 8.78521e-12, 2.15837e-16}, + {3.88320e-01, 1.05373e-06, 1.10736e-11, 2.72217e-16}, + {4.88890e-01, 1.32707e-06, 1.39559e-11, 3.43241e-16}, + {6.15507e-01, 1.67134e-06, 1.75891e-11, 4.32825e-16}, + {7.74906e-01, 2.10492e-06, 2.21686e-11, 5.45804e-16}, + {9.75270e-01, 2.65013e-06, 2.79315e-11, 6.88059e-16}, + {1.22485e+00, 3.32948e-06, 3.51169e-11, 8.65513e-16}, + {1.52110e+00, 4.13615e-06, 4.36560e-11, 1.07652e-15}, + {1.83679e+00, 4.99624e-06, 5.27698e-11, 1.30190e-15}, + {2.15666e+00, 5.86838e-06, 6.20278e-11, 1.53115e-15}, + {2.55518e+00, 6.95661e-06, 7.36137e-11, 1.81866e-15}, + {3.22834e+00, 8.79676e-06, 9.32496e-11, 2.30667e-15}, + {4.33225e+00, 1.18177e-05, 1.25559e-10, 3.11092e-15}, + {5.81697e+00, 1.58892e-05, 1.69288e-10, 4.20258e-15}, + {7.48671e+00, 2.04890e-05, 2.19146e-10, 5.45508e-15}, + {9.22042e+00, 2.53165e-05, 2.72602e-10, 6.81745e-15}, + {1.12094e+01, 3.09883e-05, 3.38326e-10, 8.54226e-15}, + {1.40327e+01, 3.92793e-05, 4.39589e-10, 1.12871e-14}, + {1.79556e+01, 5.11182e-05, 5.91090e-10, 1.55105e-14}, + {2.19076e+01, 6.38759e-05, 7.72200e-10, 2.08556e-14}, + {2.40396e+01, 7.32505e-05, 9.56570e-10, 2.71081e-14}, + {2.35050e+01, 7.74606e-05, 1.14341e-09, 3.48207e-14}, + {2.10698e+01, 7.75334e-05, 1.32500e-09, 4.37333e-14}, + {1.81145e+01, 7.52350e-05, 1.46962e-09, 5.20115e-14}, + {1.55283e+01, 7.16932e-05, 1.54535e-09, 5.74821e-14}, + {1.35973e+01, 6.77513e-05, 1.55041e-09, 5.93660e-14}, + {1.28568e+01, 6.72854e-05, 1.57294e-09, 6.05730e-14}, + {1.62414e+01, 9.03391e-05, 2.02876e-09, 7.45675e-14}, + {3.62078e+01, 2.25165e-04, 4.46960e-09, 1.44123e-13}, + {1.13353e+02, 7.52538e-04, 1.29670e-08, 3.61005e-13}, + {3.52139e+02, 2.31091e-03, 3.53205e-08, 8.74277e-13}, + {9.61671e+02, 5.84143e-03, 8.01724e-08, 1.81153e-12}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 3.34688e-05, + /* size_moments = */ {1.08069e-05, 1.19634e-10, 1.36724e-15}, /* opacity_coef_table = */ { {1.89038e-02, 2.14190e-07, 2.52372e-12, 3.12761e-17}, {3.29962e-02, 3.72180e-07, 4.35946e-12, 5.36210e-17}, @@ -3175,9 +3217,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 3.34688e-05, - /* size_moments = */ {1.08069e-05, 1.19634e-10, 1.36724e-15}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 2.84952e-13, + /* size_moments = */ {1.79010e-05, 3.24658e-10, 5.96244e-15}, /* opacity_coef_table = */ { {1.05240e-01, 1.88391e-06, 3.41670e-11, 6.27487e-16}, {1.32588e-01, 2.37346e-06, 4.30456e-11, 7.90546e-16}, @@ -3217,9 +3259,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 2.84952e-13, - /* size_moments = */ {1.79010e-05, 3.24658e-10, 5.96244e-15}, + /* name = */ "MgSiO3_dust", + /* nonprimoridal_yield_frac = */ 7.72302e-25, + /* size_moments = */ {2.51189e-05, 6.30957e-10, 1.58489e-14}, /* opacity_coef_table = */ { {2.19890e-02, 5.52339e-07, 1.38741e-11, 3.48502e-16}, {3.90618e-02, 9.81187e-07, 2.46463e-11, 6.19087e-16}, @@ -3259,9 +3301,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "MgSiO3_dust", - /* nonprimoridal_yield_frac = */ 7.72302e-25, - /* size_moments = */ {2.51189e-05, 6.30957e-10, 1.58489e-14}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 4.47758e-05, + /* size_moments = */ {8.32266e-07, 1.33383e-12, 4.37739e-18}, /* opacity_coef_table = */ { {3.27960e-01, 2.72950e-07, 4.37442e-13, 1.43560e-18}, {4.38752e-01, 3.65158e-07, 5.85222e-13, 1.92064e-18}, @@ -3301,9 +3343,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 4.47758e-05, - /* size_moments = */ {8.32266e-07, 1.33383e-12, 4.37739e-18}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 1.23405e-04, + /* size_moments = */ {2.12560e-05, 4.59721e-10, 1.01590e-14}, /* opacity_coef_table = */ { {7.60055e-02, 1.61556e-06, 3.49407e-11, 7.72118e-16}, {9.06897e-02, 1.92769e-06, 4.16913e-11, 9.21295e-16}, @@ -3343,9 +3385,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 1.23405e-04, - /* size_moments = */ {2.12560e-05, 4.59721e-10, 1.01590e-14}, + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 1.41247e-07, + /* size_moments = */ {1.60812e-05, 2.65603e-10, 4.50188e-15}, /* opacity_coef_table = */ { {2.25358e-04, 3.62400e-09, 5.98548e-14, 1.01451e-18}, {4.04933e-04, 6.51178e-09, 1.07551e-13, 1.82293e-18}, @@ -3384,48 +3426,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {9.06015e+00, 1.45130e-04, 2.38782e-09, 4.03237e-14}, } }, - { - /* name = */ "MgO_dust", - /* nonprimoridal_yield_frac = */ 1.41247e-07, - /* size_moments = */ {1.60812e-05, 2.65603e-10, 4.50188e-15}, - /* opacity_coef_table = */ { - {1.54566e-01, 4.18815e-07, 4.38802e-12, 1.07634e-16}, - {1.94597e-01, 5.27516e-07, 5.53200e-12, 1.35785e-16}, - {2.44992e-01, 6.64362e-07, 6.97216e-12, 1.71223e-16}, - {3.08437e-01, 8.36640e-07, 8.78521e-12, 2.15837e-16}, - {3.88320e-01, 1.05373e-06, 1.10736e-11, 2.72217e-16}, - {4.88890e-01, 1.32707e-06, 1.39559e-11, 3.43241e-16}, - {6.15507e-01, 1.67134e-06, 1.75891e-11, 4.32825e-16}, - {7.74906e-01, 2.10492e-06, 2.21686e-11, 5.45804e-16}, - {9.75270e-01, 2.65013e-06, 2.79315e-11, 6.88059e-16}, - {1.22485e+00, 3.32948e-06, 3.51169e-11, 8.65513e-16}, - {1.52110e+00, 4.13615e-06, 4.36560e-11, 1.07652e-15}, - {1.83679e+00, 4.99624e-06, 5.27698e-11, 1.30190e-15}, - {2.15666e+00, 5.86838e-06, 6.20278e-11, 1.53115e-15}, - {2.55518e+00, 6.95661e-06, 7.36137e-11, 1.81866e-15}, - {3.22834e+00, 8.79676e-06, 9.32496e-11, 2.30667e-15}, - {4.33225e+00, 1.18177e-05, 1.25559e-10, 3.11092e-15}, - {5.81697e+00, 1.58892e-05, 1.69288e-10, 4.20258e-15}, - {7.48671e+00, 2.04890e-05, 2.19146e-10, 5.45508e-15}, - {9.22042e+00, 2.53165e-05, 2.72602e-10, 6.81745e-15}, - {1.12094e+01, 3.09883e-05, 3.38326e-10, 8.54226e-15}, - {1.40327e+01, 3.92793e-05, 4.39589e-10, 1.12871e-14}, - {1.79556e+01, 5.11182e-05, 5.91090e-10, 1.55105e-14}, - {2.19076e+01, 6.38759e-05, 7.72200e-10, 2.08556e-14}, - {2.40396e+01, 7.32505e-05, 9.56570e-10, 2.71081e-14}, - {2.35050e+01, 7.74606e-05, 1.14341e-09, 3.48207e-14}, - {2.10698e+01, 7.75334e-05, 1.32500e-09, 4.37333e-14}, - {1.81145e+01, 7.52350e-05, 1.46962e-09, 5.20115e-14}, - {1.55283e+01, 7.16932e-05, 1.54535e-09, 5.74821e-14}, - {1.35973e+01, 6.77513e-05, 1.55041e-09, 5.93660e-14}, - {1.28568e+01, 6.72854e-05, 1.57294e-09, 6.05730e-14}, - {1.62414e+01, 9.03391e-05, 2.02876e-09, 7.45675e-14}, - {3.62078e+01, 2.25165e-04, 4.46960e-09, 1.44123e-13}, - {1.13353e+02, 7.52538e-04, 1.29670e-08, 3.61005e-13}, - {3.52139e+02, 2.31091e-03, 3.53205e-08, 8.74277e-13}, - {9.61671e+02, 5.84143e-03, 8.01724e-08, 1.81153e-12}, - } - }, }; } // namespace pisn170 @@ -3447,6 +3447,48 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "SiM_dust", /* nonprimoridal_yield_frac = */ 5.90622e-05, /* size_moments = */ {8.86269e-07, 1.71166e-12, 5.46663e-18}, + /* opacity_coef_table = */ { + {1.54645e-01, 1.37048e-07, 2.64662e-13, 8.45209e-19}, + {1.94685e-01, 1.72534e-07, 3.33193e-13, 1.06408e-18}, + {2.45092e-01, 2.17207e-07, 4.19469e-13, 1.33961e-18}, + {3.08551e-01, 2.73447e-07, 5.28084e-13, 1.68649e-18}, + {3.88446e-01, 3.44254e-07, 6.64830e-13, 2.12322e-18}, + {4.89028e-01, 4.33396e-07, 8.36986e-13, 2.67303e-18}, + {6.15654e-01, 5.45619e-07, 1.05372e-12, 3.36522e-18}, + {7.75056e-01, 6.86892e-07, 1.32656e-12, 4.23661e-18}, + {9.75414e-01, 8.64464e-07, 1.66951e-12, 5.33191e-18}, + {1.22498e+00, 1.08564e-06, 2.09668e-12, 6.69620e-18}, + {1.52119e+00, 1.34817e-06, 2.60370e-12, 8.31550e-18}, + {1.83682e+00, 1.62792e-06, 3.14401e-12, 1.00412e-17}, + {2.15660e+00, 1.91133e-06, 3.69138e-12, 1.17894e-17}, + {2.55494e+00, 2.26439e-06, 4.37331e-12, 1.39675e-17}, + {3.22768e+00, 2.86067e-06, 5.52501e-12, 1.76460e-17}, + {4.33077e+00, 3.83839e-06, 7.41349e-12, 2.36779e-17}, + {5.81399e+00, 5.15308e-06, 9.95292e-12, 3.17892e-17}, + {7.48107e+00, 6.63084e-06, 1.28076e-11, 4.09082e-17}, + {9.20965e+00, 8.16336e-06, 1.57686e-11, 5.03682e-17}, + {1.11868e+01, 9.91669e-06, 1.91573e-11, 6.11981e-17}, + {1.39824e+01, 1.23969e-05, 2.39531e-11, 7.65315e-17}, + {1.78531e+01, 1.58317e-05, 3.05972e-11, 9.77803e-17}, + {2.17179e+01, 1.92624e-05, 3.72355e-11, 1.19020e-16}, + {2.37018e+01, 2.10255e-05, 4.06526e-11, 1.29977e-16}, + {2.29438e+01, 2.03578e-05, 3.93739e-11, 1.25940e-16}, + {2.02577e+01, 1.79829e-05, 3.48015e-11, 1.11389e-16}, + {1.70972e+01, 1.51927e-05, 2.94374e-11, 9.43240e-17}, + {1.43876e+01, 1.28090e-05, 2.48736e-11, 7.98414e-17}, + {1.23927e+01, 1.10758e-05, 2.16034e-11, 6.95714e-17}, + {1.14807e+01, 1.03984e-05, 2.05890e-11, 6.70125e-17}, + {1.34941e+01, 1.30878e-05, 2.78918e-11, 9.54730e-17}, + {2.46530e+01, 2.87907e-05, 7.29927e-11, 2.79411e-16}, + {6.22628e+01, 8.83029e-05, 2.60128e-10, 1.09021e-15}, + {1.73608e+02, 2.73721e-04, 8.65552e-10, 3.78030e-15}, + {4.81453e+02, 7.67244e-04, 2.43830e-09, 1.06714e-14}, + } + }, + { + /* name = */ "FeM_dust", + /* nonprimoridal_yield_frac = */ 4.26809e-04, + /* size_moments = */ {2.02272e-06, 5.41308e-12, 2.06248e-17}, /* opacity_coef_table = */ { {9.09085e-04, 3.41941e-09, 1.80920e-14, 1.27369e-19}, {1.61039e-03, 6.04845e-09, 3.18823e-14, 2.22622e-19}, @@ -3486,9 +3528,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "FeM_dust", - /* nonprimoridal_yield_frac = */ 4.26809e-04, - /* size_moments = */ {2.02272e-06, 5.41308e-12, 2.06248e-17}, + /* name = */ "Mg2SiO4_dust", + /* nonprimoridal_yield_frac = */ 4.08246e-15, + /* size_moments = */ {1.42189e-05, 2.04834e-10, 2.98805e-15}, /* opacity_coef_table = */ { {1.05240e-01, 1.49640e-06, 2.15567e-11, 3.14463e-16}, {1.32588e-01, 1.88525e-06, 2.71584e-11, 3.96179e-16}, @@ -3528,9 +3570,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "Mg2SiO4_dust", - /* nonprimoridal_yield_frac = */ 4.08246e-15, - /* size_moments = */ {1.42189e-05, 2.04834e-10, 2.98805e-15}, + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 3.72287e-05, + /* size_moments = */ {7.46096e-07, 9.32091e-13, 1.99556e-18}, /* opacity_coef_table = */ { {3.27960e-01, 2.44690e-07, 3.05689e-13, 6.54462e-19}, {4.38752e-01, 3.27351e-07, 4.08957e-13, 8.75569e-19}, @@ -3570,9 +3612,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 3.72287e-05, - /* size_moments = */ {7.46096e-07, 9.32091e-13, 1.99556e-18}, + /* name = */ "SiO2_dust", + /* nonprimoridal_yield_frac = */ 4.59330e-04, + /* size_moments = */ {1.73471e-05, 3.08556e-10, 5.66409e-15}, /* opacity_coef_table = */ { {7.60136e-02, 1.31860e-06, 2.34539e-11, 4.30529e-16}, {9.06981e-02, 1.57333e-06, 2.79848e-11, 5.13702e-16}, @@ -3612,9 +3654,9 @@ static const GrainSpeciesYieldProps grain_props[] = { } }, { - /* name = */ "SiO2_dust", - /* nonprimoridal_yield_frac = */ 4.59330e-04, - /* size_moments = */ {1.73471e-05, 3.08556e-10, 5.66409e-15}, + /* name = */ "MgO_dust", + /* nonprimoridal_yield_frac = */ 5.38389e-09, + /* size_moments = */ {1.26307e-05, 1.59673e-10, 2.02075e-15}, /* opacity_coef_table = */ { {2.25374e-04, 2.84663e-09, 3.59861e-14, 4.55424e-19}, {4.04950e-04, 5.11481e-09, 6.46597e-14, 8.18303e-19}, @@ -3653,48 +3695,6 @@ static const GrainSpeciesYieldProps grain_props[] = { {9.36317e+00, 1.18251e-04, 1.49468e-09, 1.89126e-14}, } }, - { - /* name = */ "MgO_dust", - /* nonprimoridal_yield_frac = */ 5.38389e-09, - /* size_moments = */ {1.26307e-05, 1.59673e-10, 2.02075e-15}, - /* opacity_coef_table = */ { - {1.54645e-01, 1.37048e-07, 2.64662e-13, 8.45209e-19}, - {1.94685e-01, 1.72534e-07, 3.33193e-13, 1.06408e-18}, - {2.45092e-01, 2.17207e-07, 4.19469e-13, 1.33961e-18}, - {3.08551e-01, 2.73447e-07, 5.28084e-13, 1.68649e-18}, - {3.88446e-01, 3.44254e-07, 6.64830e-13, 2.12322e-18}, - {4.89028e-01, 4.33396e-07, 8.36986e-13, 2.67303e-18}, - {6.15654e-01, 5.45619e-07, 1.05372e-12, 3.36522e-18}, - {7.75056e-01, 6.86892e-07, 1.32656e-12, 4.23661e-18}, - {9.75414e-01, 8.64464e-07, 1.66951e-12, 5.33191e-18}, - {1.22498e+00, 1.08564e-06, 2.09668e-12, 6.69620e-18}, - {1.52119e+00, 1.34817e-06, 2.60370e-12, 8.31550e-18}, - {1.83682e+00, 1.62792e-06, 3.14401e-12, 1.00412e-17}, - {2.15660e+00, 1.91133e-06, 3.69138e-12, 1.17894e-17}, - {2.55494e+00, 2.26439e-06, 4.37331e-12, 1.39675e-17}, - {3.22768e+00, 2.86067e-06, 5.52501e-12, 1.76460e-17}, - {4.33077e+00, 3.83839e-06, 7.41349e-12, 2.36779e-17}, - {5.81399e+00, 5.15308e-06, 9.95292e-12, 3.17892e-17}, - {7.48107e+00, 6.63084e-06, 1.28076e-11, 4.09082e-17}, - {9.20965e+00, 8.16336e-06, 1.57686e-11, 5.03682e-17}, - {1.11868e+01, 9.91669e-06, 1.91573e-11, 6.11981e-17}, - {1.39824e+01, 1.23969e-05, 2.39531e-11, 7.65315e-17}, - {1.78531e+01, 1.58317e-05, 3.05972e-11, 9.77803e-17}, - {2.17179e+01, 1.92624e-05, 3.72355e-11, 1.19020e-16}, - {2.37018e+01, 2.10255e-05, 4.06526e-11, 1.29977e-16}, - {2.29438e+01, 2.03578e-05, 3.93739e-11, 1.25940e-16}, - {2.02577e+01, 1.79829e-05, 3.48015e-11, 1.11389e-16}, - {1.70972e+01, 1.51927e-05, 2.94374e-11, 9.43240e-17}, - {1.43876e+01, 1.28090e-05, 2.48736e-11, 7.98414e-17}, - {1.23927e+01, 1.10758e-05, 2.16034e-11, 6.95714e-17}, - {1.14807e+01, 1.03984e-05, 2.05890e-11, 6.70125e-17}, - {1.34941e+01, 1.30878e-05, 2.78918e-11, 9.54730e-17}, - {2.46530e+01, 2.87907e-05, 7.29927e-11, 2.79411e-16}, - {6.22628e+01, 8.83029e-05, 2.60128e-10, 1.09021e-15}, - {1.73608e+02, 2.73721e-04, 8.65552e-10, 3.78030e-15}, - {4.81453e+02, 7.67244e-04, 2.43830e-09, 1.06714e-14}, - } - }, }; } // namespace pisn200 @@ -3716,48 +3716,6 @@ static const GrainSpeciesYieldProps grain_props[] = { /* name = */ "MgSiO3_dust", /* nonprimoridal_yield_frac = */ 2.50000e-01, /* size_moments = */ {1.00000e-05, 1.00000e-10, 1.00000e-15}, - /* opacity_coef_table = */ { - {6.76020e-02, 6.76020e-07, 6.76020e-12, 6.76020e-17}, - {1.20181e-01, 1.20181e-06, 1.20181e-11, 1.20181e-16}, - {1.86375e-01, 1.86375e-06, 1.86375e-11, 1.86375e-16}, - {2.69708e-01, 2.69708e-06, 2.69708e-11, 2.69708e-16}, - {4.44368e-01, 4.44368e-06, 4.44368e-11, 4.44368e-16}, - {6.87406e-01, 6.87406e-06, 6.87406e-11, 6.87406e-16}, - {1.07797e+00, 1.07797e-05, 1.07797e-10, 1.07797e-15}, - {1.71241e+00, 1.71241e-05, 1.71241e-10, 1.71241e-15}, - {2.74163e+00, 2.74163e-05, 2.74163e-10, 2.74163e-15}, - {4.35812e+00, 4.35812e-05, 4.35812e-10, 4.35812e-15}, - {6.98720e+00, 6.98720e-05, 6.98720e-10, 6.98720e-15}, - {1.13206e+01, 1.13206e-04, 1.13206e-09, 1.13206e-14}, - {1.85159e+01, 1.85159e-04, 1.85159e-09, 1.85159e-14}, - {3.09414e+01, 3.09414e-04, 3.09414e-09, 3.09414e-14}, - {5.34575e+01, 5.34575e-04, 5.34575e-09, 5.34575e-14}, - {9.60912e+01, 9.60912e-04, 9.60912e-09, 9.60912e-14}, - {1.76000e+02, 1.76000e-03, 1.76000e-08, 1.76000e-13}, - {3.10598e+02, 3.10598e-03, 3.10598e-08, 3.10598e-13}, - {4.95502e+02, 4.95502e-03, 4.95502e-08, 4.95502e-13}, - {6.87389e+02, 6.87389e-03, 6.87389e-08, 6.87389e-13}, - {8.21760e+02, 8.21760e-03, 8.21760e-08, 8.21760e-13}, - {8.55209e+02, 8.55209e-03, 8.55209e-08, 8.55209e-13}, - {7.90315e+02, 7.90315e-03, 7.90315e-08, 7.90315e-13}, - {6.63814e+02, 6.63814e-03, 6.63814e-08, 6.63814e-13}, - {5.19410e+02, 5.19410e-03, 5.19410e-08, 5.19410e-13}, - {3.88956e+02, 3.88956e-03, 3.88956e-08, 3.88956e-13}, - {2.88141e+02, 2.88141e-03, 2.88141e-08, 2.88141e-13}, - {2.20698e+02, 2.20698e-03, 2.20698e-08, 2.20698e-13}, - {1.84716e+02, 1.84716e-03, 1.84716e-08, 1.84716e-13}, - {1.78316e+02, 1.78316e-03, 1.78316e-08, 1.78316e-13}, - {2.05010e+02, 2.05010e-03, 2.05010e-08, 2.05010e-13}, - {2.82760e+02, 2.82760e-03, 2.82760e-08, 2.82760e-13}, - {4.70437e+02, 4.70437e-03, 4.70437e-08, 4.70437e-13}, - {9.49808e+02, 9.49808e-03, 9.49808e-08, 9.49808e-13}, - {2.18634e+03, 2.18634e-02, 2.18634e-07, 2.18634e-12}, - } - }, - { - /* name = */ "AC_dust", - /* nonprimoridal_yield_frac = */ 2.50000e-01, - /* size_moments = */ {1.00000e-05, 1.00000e-10, 1.00000e-15}, /* opacity_coef_table = */ { {2.19890e-02, 2.19890e-07, 2.19890e-12, 2.19890e-17}, {3.90612e-02, 3.90612e-07, 3.90612e-12, 3.90612e-17}, @@ -3796,6 +3754,48 @@ static const GrainSpeciesYieldProps grain_props[] = { {2.49396e+01, 2.49396e-04, 2.49396e-09, 2.49396e-14}, } }, + { + /* name = */ "AC_dust", + /* nonprimoridal_yield_frac = */ 2.50000e-01, + /* size_moments = */ {1.00000e-05, 1.00000e-10, 1.00000e-15}, + /* opacity_coef_table = */ { + {6.76020e-02, 6.76020e-07, 6.76020e-12, 6.76020e-17}, + {1.20181e-01, 1.20181e-06, 1.20181e-11, 1.20181e-16}, + {1.86375e-01, 1.86375e-06, 1.86375e-11, 1.86375e-16}, + {2.69708e-01, 2.69708e-06, 2.69708e-11, 2.69708e-16}, + {4.44368e-01, 4.44368e-06, 4.44368e-11, 4.44368e-16}, + {6.87406e-01, 6.87406e-06, 6.87406e-11, 6.87406e-16}, + {1.07797e+00, 1.07797e-05, 1.07797e-10, 1.07797e-15}, + {1.71241e+00, 1.71241e-05, 1.71241e-10, 1.71241e-15}, + {2.74163e+00, 2.74163e-05, 2.74163e-10, 2.74163e-15}, + {4.35812e+00, 4.35812e-05, 4.35812e-10, 4.35812e-15}, + {6.98720e+00, 6.98720e-05, 6.98720e-10, 6.98720e-15}, + {1.13206e+01, 1.13206e-04, 1.13206e-09, 1.13206e-14}, + {1.85159e+01, 1.85159e-04, 1.85159e-09, 1.85159e-14}, + {3.09414e+01, 3.09414e-04, 3.09414e-09, 3.09414e-14}, + {5.34575e+01, 5.34575e-04, 5.34575e-09, 5.34575e-14}, + {9.60912e+01, 9.60912e-04, 9.60912e-09, 9.60912e-14}, + {1.76000e+02, 1.76000e-03, 1.76000e-08, 1.76000e-13}, + {3.10598e+02, 3.10598e-03, 3.10598e-08, 3.10598e-13}, + {4.95502e+02, 4.95502e-03, 4.95502e-08, 4.95502e-13}, + {6.87389e+02, 6.87389e-03, 6.87389e-08, 6.87389e-13}, + {8.21760e+02, 8.21760e-03, 8.21760e-08, 8.21760e-13}, + {8.55209e+02, 8.55209e-03, 8.55209e-08, 8.55209e-13}, + {7.90315e+02, 7.90315e-03, 7.90315e-08, 7.90315e-13}, + {6.63814e+02, 6.63814e-03, 6.63814e-08, 6.63814e-13}, + {5.19410e+02, 5.19410e-03, 5.19410e-08, 5.19410e-13}, + {3.88956e+02, 3.88956e-03, 3.88956e-08, 3.88956e-13}, + {2.88141e+02, 2.88141e-03, 2.88141e-08, 2.88141e-13}, + {2.20698e+02, 2.20698e-03, 2.20698e-08, 2.20698e-13}, + {1.84716e+02, 1.84716e-03, 1.84716e-08, 1.84716e-13}, + {1.78316e+02, 1.78316e-03, 1.78316e-08, 1.78316e-13}, + {2.05010e+02, 2.05010e-03, 2.05010e-08, 2.05010e-13}, + {2.82760e+02, 2.82760e-03, 2.82760e-08, 2.82760e-13}, + {4.70437e+02, 4.70437e-03, 4.70437e-08, 4.70437e-13}, + {9.49808e+02, 9.49808e-03, 9.49808e-08, 9.49808e-13}, + {2.18634e+03, 2.18634e-02, 2.18634e-07, 2.18634e-12}, + } + }, }; } // namespace y19 From 53e79fd6bf7cd4d754b2f8ff1136bab5be43488b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 15:36:52 -0500 Subject: [PATCH 035/111] A little more work on the machinery between the new and the old injection model format A bunch of this mess was in place to check for equivalence. Indeed, it succesfully uncovered a major error that is now fixed (in a prior commit) --- src/clib/initialize_dust_yields.cpp | 61 ++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 2956549e7..c469af56b 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -215,7 +215,6 @@ extern "C" int setup_yield_table_callback( "`%s` not a known grain species", yield_info.name); } - /* // copy the nonprimordial yield fraction inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] = yield_info.nonprimoridal_yield_frac; @@ -228,8 +227,8 @@ extern "C" int setup_yield_table_callback( // copy over the opacity coefficients table { - int n_Td = N_Tdust_Opacity_Table; - int n_coef = N_Opacity_Coef; + int n_Td = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; + int n_coef = grackle::impl::inj_model_input::N_Opacity_Coef; for (int i_Td = 0; i_Td < n_Td; i_Td++) { for (int i_coef = 0; i_coef < n_coef; i_coef++) { @@ -238,7 +237,6 @@ extern "C" int setup_yield_table_callback( } } } - */ } (static_cast(ctx)->counter)++; @@ -612,8 +610,13 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, std::vector original_set = get_summary(my_rates, n_pathways); - // if (raw != original_set) { return GrPrintAndReturnErr("expected to fail!"); } + printf("\nn grains: %d\n", (int)original_set.size()); + for (int i = 0; i < original_set.size(); i++){ + printf("->\"%s\"\n", original_set[i].name.c_str()); + } + //if (raw != original_set) { return GrPrintAndReturnErr("expected to fail!"); } + //override_dust_inject_props(my_rates, 0.0, n_pathways); SetupCallbackCtx ctx = {my_rates, 0}; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( @@ -622,6 +625,54 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, return GR_FAIL; } + std::vector newer_set = get_summary(my_rates, + n_pathways); + if (newer_set.size() != original_set.size()) { + return GrPrintAndReturnErr("Shouldn't be an issue!"); + } + + for (int i =0; i < original_set.size(); i++) { + if (newer_set[i].name != original_set[i].name) { + return GrPrintAndReturnErr("Shouldn't be an issue!"); + } + + if (newer_set[i].yield_frac != original_set[i].yield_frac) { + return GrPrintAndReturnErr("issue with yield_frac"); + } + + if (newer_set[i].size_moments != original_set[i].size_moments) { + return GrPrintAndReturnErr("issue with size_moments"); + } + + for (int iSN = 0; iSN < n_pathways; iSN++) { + for (int j = 0; j < my_rates->gr_Size; j++) { + int idx = iSN * my_rates->gr_Size + j; + if (newer_set[i].opacity_coef_table[idx] != + original_set[i].opacity_coef_table[idx]) { + return GrPrintAndReturnErr( + "issue with opacity_coef_table for: %s iSN = %d, j =%d.\n" + "Traditional: %g. New:%g\n, trad - new: %g", + newer_set[i].name.c_str(), + iSN, j, original_set[i].opacity_coef_table[idx], + newer_set[i].opacity_coef_table[idx], + original_set[i].opacity_coef_table[idx] - + newer_set[i].opacity_coef_table[idx] + ); + } + + } + } + + if (newer_set[i].opacity_coef_table != original_set[i].opacity_coef_table) { + return GrPrintAndReturnErr("issue with opacity_coef_table"); + } + } + + + if (newer_set != original_set) { + return GrPrintAndReturnErr("there seems to be an issue!"); + } + GR_INTERNAL_REQUIRE(ctx.counter == 12, "sanity-checking"); return GR_SUCCESS; From 9871e851a88a401c96d28ae863b05eef83e08c69 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 15:40:13 -0500 Subject: [PATCH 036/111] another check of correctness --- src/clib/initialize_dust_yields.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index c469af56b..071ceb6da 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -616,7 +616,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, } //if (raw != original_set) { return GrPrintAndReturnErr("expected to fail!"); } - //override_dust_inject_props(my_rates, 0.0, n_pathways); + override_dust_inject_props(my_rates, 0.0, n_pathways); SetupCallbackCtx ctx = {my_rates, 0}; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( From 6eb164e287a213e283b2bcc20f6abe01149eba80 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sat, 6 Dec 2025 15:49:05 -0500 Subject: [PATCH 037/111] remove the older injection model data organization --- src/clib/initialize_dust_yields.cpp | 4177 --------------------------- 1 file changed, 4177 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 071ceb6da..9643b8391 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -15,8 +15,6 @@ #include #include #include -#include -#include #include "grackle_macros.h" #include "grackle_chemistry_data.h" #include "initialize_dust_yields.hpp" // forward declarations @@ -25,27 +23,6 @@ #include "opaque_storage.hpp" #include "status_reporting.h" // GrPrintAndReturnErr -namespace { // stuff inside an anonymous namespace is local to this file - -// forward declare some functions -int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_C20(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_C25(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_C30(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_F13(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_F15(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_F50(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_F80(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_P170(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_P200(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); -int calc_rates_dust_Y19(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates); - -} // anonymous namespace - -typedef int calc_yield_rate_fn(int, chemistry_data*, chemistry_data_storage*); - - namespace { // stuff inside an anonymous namespace is local to this file int lookup_pathway_idx(const char* name) { @@ -93,12 +70,6 @@ extern "C" int setup_yield_table_callback( "`%s` is an unexpected injection pathway name", name); } - int counter_val = static_cast(ctx)->counter; - - GR_INTERNAL_REQUIRE(counter_val == pathway_idx, "sanity-checking"); - //printf("encounterd: `%s`, pathway_idx: %d\n", name, pathway_idx); - //fflush(stdout); - chemistry_data_storage *my_rates = static_cast(ctx)->my_rates; @@ -339,145 +310,6 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, } } -struct SummaryGrainYieldProp{ - std::string name; - std::vector yield_frac; - std::vector size_moments; - std::vector opacity_coef_table; - - bool operator==(const SummaryGrainYieldProp& other) const { - return ( - (name == other.name) && - (yield_frac == other.yield_frac) && - (size_moments == other.size_moments) && - (opacity_coef_table == other.opacity_coef_table) - ); - } - - - bool operator!=(const SummaryGrainYieldProp& other) const { - return ( - (name != other.name) || - (yield_frac != other.yield_frac) || - (size_moments != other.size_moments) || - (opacity_coef_table != other.opacity_coef_table) - ); - } -}; - -std::vector -get_summary(chemistry_data_storage *my_rates, int n_pathways) { - - GRIMPL_REQUIRE(my_rates != nullptr && my_rates->opaque_storage != nullptr, - "sanity check -- should never ever fail!"); - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - GRIMPL_REQUIRE(inject_pathway_props != nullptr, - "sanity check -- should never ever fail!"); - auto helper_fn = [=](const char* name) { - - int grain_species_idx = -1; - const double* cur_size_mom_table = nullptr; - const double* cur_opac_coef_table = nullptr; - if (std::strcmp("MgSiO3_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; - cur_size_mom_table = my_rates->SN0_r0MgSiO3; - cur_opac_coef_table = my_rates->SN0_kpMgSiO3; - } else if (std::strcmp("AC_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::AC_dust; - cur_size_mom_table = my_rates->SN0_r0AC; - cur_opac_coef_table = my_rates->SN0_kpAC; - } else if (std::strcmp("SiM_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::SiM_dust; - cur_size_mom_table = my_rates->SN0_r0SiM; - cur_opac_coef_table = my_rates->SN0_kpSiM; - } else if (std::strcmp("FeM_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::FeM_dust; - cur_size_mom_table = my_rates->SN0_r0FeM; - cur_opac_coef_table = my_rates->SN0_kpFeM; - } else if (std::strcmp("Mg2SiO4_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; - cur_size_mom_table = my_rates->SN0_r0Mg2SiO4; - cur_opac_coef_table = my_rates->SN0_kpMg2SiO4; - } else if (std::strcmp("Fe3O4_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; - cur_size_mom_table = my_rates->SN0_r0Fe3O4; - cur_opac_coef_table = my_rates->SN0_kpFe3O4; - } else if (std::strcmp("SiO2_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::SiO2_dust; - cur_size_mom_table = my_rates->SN0_r0SiO2D; - cur_opac_coef_table = my_rates->SN0_kpSiO2D; - } else if (std::strcmp("MgO_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::MgO_dust; - cur_size_mom_table = my_rates->SN0_r0MgO; - cur_opac_coef_table = my_rates->SN0_kpMgO; - } else if (std::strcmp("FeS_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::FeS_dust; - cur_size_mom_table = my_rates->SN0_r0FeS; - cur_opac_coef_table = my_rates->SN0_kpFeS; - } else if (std::strcmp("Al2O3_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; - cur_size_mom_table = my_rates->SN0_r0Al2O3; - cur_opac_coef_table = my_rates->SN0_kpAl2O3; - } else if (std::strcmp("ref_org_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::ref_org_dust; - cur_size_mom_table = my_rates->SN0_r0reforg; - cur_opac_coef_table = my_rates->SN0_kpreforg; - } else if (std::strcmp("vol_org_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::vol_org_dust; - cur_size_mom_table = my_rates->SN0_r0volorg; - cur_opac_coef_table = my_rates->SN0_kpvolorg; - } else if (std::strcmp("H2O_ice_dust", name) == 0) { - grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; - cur_size_mom_table = my_rates->SN0_r0H2Oice; - cur_opac_coef_table = my_rates->SN0_kpH2Oice; - } else { - GRIMPL_ERROR("THERE'S A PROBLEM"); - } - - const double* cur_yields = - inject_pathway_props->grain_yields.data[grain_species_idx]; - - std::vector yields(cur_yields, cur_yields + n_pathways); - std::vector size_mom_table - (cur_size_mom_table, cur_size_mom_table + (n_pathways*3)); - std::vector opac_coef_table - (cur_opac_coef_table, - cur_opac_coef_table + (n_pathways*my_rates->gr_Size)); - return SummaryGrainYieldProp{std::string(name), - yields, - size_mom_table, - opac_coef_table}; - }; - - std::vector names = { - "MgSiO3_dust", - "AC_dust", - "SiM_dust", - "FeM_dust", - "Mg2SiO4_dust", - "Fe3O4_dust", - "SiO2_dust", - "MgO_dust", - "FeS_dust", - "Al2O3_dust", - "ref_org_dust", - "vol_org_dust", - "H2O_ice_dust", - }; - - - std::vector out; - for (auto name : names){ - out.push_back(helper_fn(name.c_str())); - } - std::printf("%s\n", out[2].name.c_str()); - return out; - -} - - } // anonymous namespace int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, @@ -590,33 +422,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); override_dust_inject_props(my_rates, 0.0, n_pathways); - - std::vector raw = get_summary(my_rates, n_pathways); - - // initialize all of the properties - calc_yield_rate_fn* fn_list[] = { - &calc_rates_dust_loc, &calc_rates_dust_C13, &calc_rates_dust_C20, - &calc_rates_dust_C25, &calc_rates_dust_C30, &calc_rates_dust_F13, - &calc_rates_dust_F15, &calc_rates_dust_F50, &calc_rates_dust_F80, - &calc_rates_dust_P170, &calc_rates_dust_P200, &calc_rates_dust_Y19 - }; - - int n_funcs = (int)(sizeof(fn_list) / sizeof(calc_yield_rate_fn*)); - - for (int i = 0; i < n_funcs; i++) { - int rv = fn_list[i](i, my_chemistry, my_rates); - if (rv != SUCCESS) { return rv; } - } - - std::vector original_set = get_summary(my_rates, - n_pathways); - printf("\nn grains: %d\n", (int)original_set.size()); - for (int i = 0; i < original_set.size(); i++){ - printf("->\"%s\"\n", original_set[i].name.c_str()); - } - //if (raw != original_set) { return GrPrintAndReturnErr("expected to fail!"); } - - override_dust_inject_props(my_rates, 0.0, n_pathways); SetupCallbackCtx ctx = {my_rates, 0}; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( @@ -625,54 +430,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, return GR_FAIL; } - std::vector newer_set = get_summary(my_rates, - n_pathways); - if (newer_set.size() != original_set.size()) { - return GrPrintAndReturnErr("Shouldn't be an issue!"); - } - - for (int i =0; i < original_set.size(); i++) { - if (newer_set[i].name != original_set[i].name) { - return GrPrintAndReturnErr("Shouldn't be an issue!"); - } - - if (newer_set[i].yield_frac != original_set[i].yield_frac) { - return GrPrintAndReturnErr("issue with yield_frac"); - } - - if (newer_set[i].size_moments != original_set[i].size_moments) { - return GrPrintAndReturnErr("issue with size_moments"); - } - - for (int iSN = 0; iSN < n_pathways; iSN++) { - for (int j = 0; j < my_rates->gr_Size; j++) { - int idx = iSN * my_rates->gr_Size + j; - if (newer_set[i].opacity_coef_table[idx] != - original_set[i].opacity_coef_table[idx]) { - return GrPrintAndReturnErr( - "issue with opacity_coef_table for: %s iSN = %d, j =%d.\n" - "Traditional: %g. New:%g\n, trad - new: %g", - newer_set[i].name.c_str(), - iSN, j, original_set[i].opacity_coef_table[idx], - newer_set[i].opacity_coef_table[idx], - original_set[i].opacity_coef_table[idx] - - newer_set[i].opacity_coef_table[idx] - ); - } - - } - } - - if (newer_set[i].opacity_coef_table != original_set[i].opacity_coef_table) { - return GrPrintAndReturnErr("issue with opacity_coef_table"); - } - } - - - if (newer_set != original_set) { - return GrPrintAndReturnErr("there seems to be an issue!"); - } - GR_INTERNAL_REQUIRE(ctx.counter == 12, "sanity-checking"); return GR_SUCCESS; @@ -738,3937 +495,3 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, return SUCCESS; } - -namespace { // stuff inside an anonymous namespace is local to this file - -int calc_rates_dust_loc(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.35403e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust][iSN] = 1.36165e-01; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 3.84003e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 3.04389e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust][iSN] = 1.86114e-01; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust][iSN] = 3.81956e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust][iSN] = 6.33011e-02; - - itab0 = 3 * iSN; - my_rates->SN0_r0FeM [itab0 + 0] = 8.33039e-07; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 8.33039e-07; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 8.33039e-07; - my_rates->SN0_r0FeS [itab0 + 0] = 8.33039e-07; - my_rates->SN0_r0reforg [itab0 + 0] = 8.33039e-07; - my_rates->SN0_r0volorg [itab0 + 0] = 8.33039e-07; - my_rates->SN0_r0H2Oice [itab0 + 0] = 8.33039e-07; - - my_rates->SN0_r0FeM [itab0 + 1] = 1.16161e-12; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 1.16161e-12; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.16161e-12; - my_rates->SN0_r0FeS [itab0 + 1] = 1.16161e-12; - my_rates->SN0_r0reforg [itab0 + 1] = 1.16161e-12; - my_rates->SN0_r0volorg [itab0 + 1] = 1.16161e-12; - my_rates->SN0_r0H2Oice [itab0 + 1] = 1.16161e-12; - - my_rates->SN0_r0FeM [itab0 + 2] = 8.21384e-18; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 8.21384e-18; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 8.21384e-18; - my_rates->SN0_r0FeS [itab0 + 2] = 8.21384e-18; - my_rates->SN0_r0reforg [itab0 + 2] = 8.21384e-18; - my_rates->SN0_r0volorg [itab0 + 2] = 8.21384e-18; - my_rates->SN0_r0H2Oice [itab0 + 2] = 8.21384e-18; - - NTd = 35; - Nmom = 4; - - double loc_kpFeM[] = - { 3.03937e-04, 1.23816e-09, 4.62094e-14, 3.72497e-18, - 5.33931e-04, 1.94666e-09, 6.42306e-14, 4.92267e-18, - 8.23085e-04, 2.82715e-09, 8.64655e-14, 6.40508e-18, - 1.18689e-03, 3.92926e-09, 1.14201e-13, 8.25547e-18, - 1.93090e-03, 5.86828e-09, 1.50433e-13, 1.02764e-17, - 2.95251e-03, 8.43657e-09, 1.95467e-13, 1.27089e-17, - 4.55033e-03, 1.22013e-08, 2.52591e-13, 1.54880e-17, - 7.04895e-03, 1.77533e-08, 3.26595e-13, 1.87358e-17, - 1.09337e-02, 2.59554e-08, 4.24054e-13, 2.26060e-17, - 1.67787e-02, 3.77909e-08, 5.51941e-13, 2.72576e-17, - 2.56790e-02, 5.50228e-08, 7.20688e-13, 3.28090e-17, - 3.89780e-02, 7.95600e-08, 9.39516e-13, 3.93285e-17, - 5.82741e-02, 1.13372e-07, 1.21633e-12, 4.68721e-17, - 8.58228e-02, 1.58873e-07, 1.55917e-12, 5.54857e-17, - 1.24511e-01, 2.18724e-07, 1.97549e-12, 6.52470e-17, - 1.78164e-01, 2.96038e-07, 2.47229e-12, 7.62244e-17, - 2.51965e-01, 3.94501e-07, 3.05495e-12, 8.84292e-17, - 3.53706e-01, 5.19228e-07, 3.72904e-12, 1.01872e-16, - 4.96690e-01, 6.79268e-07, 4.51008e-12, 1.16807e-16, - 7.06391e-01, 8.93298e-07, 5.44240e-12, 1.34078e-16, - 1.03345e+00, 1.19958e-06, 6.62440e-12, 1.55520e-16, - 1.58058e+00, 1.67481e-06, 8.24715e-12, 1.84604e-16, - 2.55750e+00, 2.47088e-06, 1.06606e-11, 2.27517e-16, - 4.39505e+00, 3.88891e-06, 1.44836e-11, 2.94492e-16, - 7.97338e+00, 6.52370e-06, 2.07697e-11, 4.00081e-16, - 1.50676e+01, 1.15419e-05, 3.12837e-11, 5.61771e-16, - 2.91750e+01, 2.11959e-05, 4.90431e-11, 7.99872e-16, - 5.69546e+01, 3.97177e-05, 7.93362e-11, 1.14279e-15, - 1.10473e+02, 7.47151e-05, 1.31340e-10, 1.63629e-15, - 2.10337e+02, 1.39130e-04, 2.20345e-10, 2.35251e-15, - 3.89661e+02, 2.53753e-04, 3.70677e-10, 3.39830e-15, - 6.99152e+02, 4.50456e-04, 6.19407e-10, 4.92457e-15, - 1.21457e+03, 7.76739e-04, 1.02057e-09, 7.13090e-15, - 2.05022e+03, 1.30302e-03, 1.64745e-09, 1.02322e-14, - 3.38793e+03, 2.13731e-03, 2.59306e-09, 1.43690e-14 }; - - double loc_kpMg2SiO4[] = - { 2.45237e-01, 1.46287e-07, 1.48927e-13, 1.14540e-18, - 3.08964e-01, 1.84301e-07, 1.87627e-13, 1.44311e-18, - 3.89192e-01, 2.32158e-07, 2.36348e-13, 1.81790e-18, - 4.90193e-01, 2.92406e-07, 2.97684e-13, 2.28974e-18, - 6.33568e-01, 3.77932e-07, 3.84757e-13, 2.95995e-18, - 8.28859e-01, 4.94426e-07, 5.03359e-13, 3.87306e-18, - 1.13002e+00, 6.74071e-07, 6.86261e-13, 5.28188e-18, - 1.63064e+00, 9.72699e-07, 9.90315e-13, 7.62608e-18, - 2.46680e+00, 1.47148e-06, 1.49820e-12, 1.15475e-17, - 3.79604e+00, 2.26439e-06, 2.30565e-12, 1.77932e-17, - 5.92492e+00, 3.53430e-06, 3.59906e-12, 2.78297e-17, - 9.23920e+00, 5.51134e-06, 5.61323e-12, 4.35401e-17, - 1.42293e+01, 8.48802e-06, 8.64701e-12, 6.73899e-17, - 2.16427e+01, 1.29103e-05, 1.31570e-11, 1.03293e-16, - 3.24523e+01, 1.93586e-05, 1.97391e-11, 1.56579e-16, - 4.78595e+01, 2.85497e-05, 2.91302e-11, 2.33879e-16, - 7.00593e+01, 4.17932e-05, 4.26757e-11, 3.46486e-16, - 1.06051e+02, 6.32653e-05, 6.46560e-11, 5.28640e-16, - 1.74267e+02, 1.03964e-04, 1.06329e-10, 8.68729e-16, - 3.02053e+02, 1.80203e-04, 1.84359e-10, 1.49313e-15, - 5.00593e+02, 2.98655e-04, 3.05537e-10, 2.44653e-15, - 7.45698e+02, 4.44894e-04, 4.55158e-10, 3.61190e-15, - 1.00149e+03, 5.97517e-04, 6.11446e-10, 4.82507e-15, - 1.23701e+03, 7.38051e-04, 7.55475e-10, 5.93849e-15, - 1.39749e+03, 8.33819e-04, 8.53626e-10, 6.68589e-15, - 1.41344e+03, 8.43342e-04, 8.63374e-10, 6.74095e-15, - 1.26599e+03, 7.55370e-04, 7.73283e-10, 6.02512e-15, - 1.01032e+03, 6.02819e-04, 6.17127e-10, 4.80541e-15, - 7.30148e+02, 4.35656e-04, 4.46054e-10, 3.47626e-15, - 4.87070e+02, 2.90623e-04, 2.97653e-10, 2.32554e-15, - 3.05625e+02, 1.82365e-04, 1.86919e-10, 1.46881e-15, - 1.84266e+02, 1.09966e-04, 1.12993e-10, 9.02608e-16, - 1.10340e+02, 6.58826e-05, 6.82482e-11, 5.72358e-16, - 6.91207e+01, 4.13300e-05, 4.36913e-11, 4.08010e-16, - 4.77899e+01, 2.86629e-05, 3.13943e-11, 3.40524e-16 }; - - double loc_kpMgSiO3[] = - { 5.12401e-02, 3.05654e-08, 3.11170e-14, 2.39327e-19, - 9.10229e-02, 5.42964e-08, 5.52765e-14, 4.25193e-19, - 1.41106e-01, 8.41719e-08, 8.56916e-14, 6.59185e-19, - 2.04158e-01, 1.21783e-07, 1.23982e-13, 9.53762e-19, - 3.33897e-01, 1.99174e-07, 2.02773e-13, 1.56024e-18, - 5.10947e-01, 3.04787e-07, 3.10298e-13, 2.38807e-18, - 7.83563e-01, 4.67406e-07, 4.75863e-13, 3.66337e-18, - 1.19854e+00, 7.14943e-07, 7.27902e-13, 5.60698e-18, - 1.85772e+00, 1.10816e-06, 1.12831e-12, 8.70099e-18, - 2.92247e+00, 1.74330e-06, 1.77515e-12, 1.37124e-17, - 4.74091e+00, 2.82803e-06, 2.88010e-12, 2.23096e-17, - 7.79816e+00, 4.65174e-06, 4.73847e-12, 3.68720e-17, - 1.27207e+01, 7.58818e-06, 7.73243e-12, 6.06033e-17, - 2.05556e+01, 1.22619e-05, 1.25020e-11, 9.90816e-17, - 3.30490e+01, 1.97147e-05, 2.01153e-11, 1.61650e-16, - 5.32277e+01, 3.17524e-05, 3.24225e-11, 2.63830e-16, - 8.64944e+01, 5.15982e-05, 5.27236e-11, 4.32162e-16, - 1.43144e+02, 8.53944e-05, 8.73076e-11, 7.16006e-16, - 2.41992e+02, 1.44367e-04, 1.47663e-10, 1.20379e-15, - 4.08980e+02, 2.43996e-04, 2.49602e-10, 2.01287e-15, - 6.57282e+02, 3.92138e-04, 4.01100e-10, 3.19447e-15, - 9.65951e+02, 5.76298e-04, 5.89371e-10, 4.64306e-15, - 1.30489e+03, 7.78527e-04, 7.96032e-10, 6.21292e-15, - 1.65692e+03, 9.88559e-04, 1.01028e-09, 7.80402e-15, - 1.95936e+03, 1.16899e-03, 1.19360e-09, 9.11030e-15, - 2.08639e+03, 1.24475e-03, 1.26965e-09, 9.58003e-15, - 1.95845e+03, 1.16840e-03, 1.19068e-09, 8.90255e-15, - 1.62353e+03, 9.68572e-04, 9.86379e-10, 7.32855e-15, - 1.20759e+03, 7.20421e-04, 7.33336e-10, 5.42763e-15, - 8.22295e+02, 4.90559e-04, 4.99228e-10, 3.68795e-15, - 5.22496e+02, 3.11708e-04, 3.17198e-10, 2.34267e-15, - 3.14915e+02, 1.87872e-04, 1.91211e-10, 1.41447e-15, - 1.82496e+02, 1.08876e-04, 1.10875e-10, 8.23864e-16, - 1.02901e+02, 6.13959e-05, 6.26109e-11, 4.69856e-16, - 5.73186e+01, 3.42174e-05, 3.50508e-11, 2.68356e-16 }; - - double loc_kpFeS[] = - { 1.20726e-01, 7.20182e-08, 7.35280e-14, 5.95267e-19, - 2.32766e-01, 1.38854e-07, 1.41735e-13, 1.14369e-18, - 3.73816e-01, 2.22995e-07, 2.27602e-13, 1.83408e-18, - 5.51388e-01, 3.28923e-07, 3.35702e-13, 2.70320e-18, - 8.55868e-01, 5.10557e-07, 5.21179e-13, 4.21168e-18, - 1.24954e+00, 7.45400e-07, 7.61051e-13, 6.17189e-18, - 1.78078e+00, 1.06231e-06, 1.08497e-12, 8.85200e-18, - 2.44607e+00, 1.45920e-06, 1.49119e-12, 1.23029e-17, - 3.21763e+00, 1.91949e-06, 1.96357e-12, 1.65254e-17, - 4.06334e+00, 2.42404e-06, 2.48333e-12, 2.14914e-17, - 4.90080e+00, 2.92371e-06, 3.00112e-12, 2.69365e-17, - 5.64261e+00, 3.36638e-06, 3.46359e-12, 3.23217e-17, - 6.21740e+00, 3.70948e-06, 3.82669e-12, 3.70749e-17, - 6.56246e+00, 3.91565e-06, 4.05361e-12, 4.08425e-17, - 6.75396e+00, 4.03063e-06, 4.20072e-12, 4.47151e-17, - 7.17709e+00, 4.28498e-06, 4.53461e-12, 5.31551e-17, - 8.60795e+00, 5.14313e-06, 5.58433e-12, 7.44632e-17, - 1.17764e+01, 7.04212e-06, 7.86423e-12, 1.17214e-16, - 1.64787e+01, 9.86444e-06, 1.14471e-11, 1.95038e-16, - 2.14143e+01, 1.28476e-05, 1.62848e-11, 3.61550e-16, - 2.51760e+01, 1.51720e-05, 2.28477e-11, 7.25431e-16, - 2.71833e+01, 1.64950e-05, 3.14267e-11, 1.35273e-15, - 2.77234e+01, 1.69657e-05, 4.09753e-11, 2.14916e-15, - 2.74221e+01, 1.69259e-05, 4.94400e-11, 2.89997e-15, - 2.68227e+01, 1.66816e-05, 5.53227e-11, 3.43309e-15, - 2.62247e+01, 1.64266e-05, 5.86985e-11, 3.72279e-15, - 2.58704e+01, 1.64543e-05, 6.22578e-11, 3.90038e-15, - 2.71342e+01, 1.84130e-05, 7.74409e-11, 4.33089e-15, - 3.69065e+01, 2.84578e-05, 1.28908e-10, 5.42457e-15, - 7.78838e+01, 6.43091e-05, 2.58063e-10, 7.39401e-15, - 1.96086e+02, 1.59699e-04, 5.23332e-10, 1.03910e-14, - 4.47749e+02, 3.52292e-04, 9.69286e-10, 1.44002e-14, - 8.75250e+02, 6.66973e-04, 1.60576e-09, 1.92445e-14, - 1.50099e+03, 1.11385e-03, 2.41814e-09, 2.47015e-14, - 2.33693e+03, 1.69566e-03, 3.38124e-09, 3.05222e-14 }; - - double loc_kpreforg[] = - { 4.68555e-02, 2.79499e-08, 2.84543e-14, 2.18837e-19, - 6.66016e-02, 3.97287e-08, 4.04457e-14, 3.11065e-19, - 9.14604e-02, 5.45574e-08, 5.55420e-14, 4.27173e-19, - 1.22756e-01, 7.32255e-08, 7.45471e-14, 5.73344e-19, - 2.39395e-01, 1.42802e-07, 1.45382e-13, 1.11857e-18, - 4.33638e-01, 2.58671e-07, 2.63349e-13, 2.02683e-18, - 8.54269e-01, 5.09583e-07, 5.18807e-13, 3.99441e-18, - 1.71749e+00, 1.02450e-06, 1.04308e-12, 8.03545e-18, - 3.29447e+00, 1.96520e-06, 2.00091e-12, 1.54275e-17, - 5.86107e+00, 3.49621e-06, 3.55997e-12, 2.74796e-17, - 9.98591e+00, 5.95675e-06, 6.06595e-12, 4.69112e-17, - 1.64428e+01, 9.80839e-06, 9.98976e-12, 7.74960e-17, - 2.63091e+01, 1.56939e-05, 1.59880e-11, 1.24634e-16, - 4.13343e+01, 2.46568e-05, 2.51287e-11, 1.97408e-16, - 6.41346e+01, 3.82579e-05, 3.90120e-11, 3.09791e-16, - 9.87636e+01, 5.89156e-05, 6.01167e-11, 4.83037e-16, - 1.51958e+02, 9.06488e-05, 9.25564e-11, 7.50644e-16, - 2.34417e+02, 1.39841e-04, 1.42858e-10, 1.16365e-15, - 3.57697e+02, 2.13387e-04, 2.18076e-10, 1.77561e-15, - 5.28819e+02, 3.15479e-04, 3.22528e-10, 2.61825e-15, - 7.52235e+02, 4.48774e-04, 4.59023e-10, 3.71332e-15, - 1.02632e+03, 6.12308e-04, 6.26695e-10, 5.05587e-15, - 1.32111e+03, 7.88218e-04, 8.07423e-10, 6.50989e-15, - 1.57574e+03, 9.40185e-04, 9.64291e-10, 7.80218e-15, - 1.73868e+03, 1.03748e-03, 1.06621e-09, 8.71453e-15, - 1.80162e+03, 1.07516e-03, 1.10855e-09, 9.23861e-15, - 1.79360e+03, 1.07058e-03, 1.10965e-09, 9.55041e-15, - 1.76388e+03, 1.05316e-03, 1.10040e-09, 9.92949e-15, - 1.76147e+03, 1.05218e-03, 1.11104e-09, 1.06225e-14, - 1.80062e+03, 1.07614e-03, 1.14939e-09, 1.16303e-14, - 1.85114e+03, 1.10702e-03, 1.19518e-09, 1.26854e-14, - 1.87614e+03, 1.12283e-03, 1.22470e-09, 1.35171e-14, - 1.86911e+03, 1.11985e-03, 1.23456e-09, 1.40796e-14, - 1.85783e+03, 1.11511e-03, 1.24487e-09, 1.45610e-14, - 1.90737e+03, 1.14893e-03, 1.30468e-09, 1.53873e-14 }; - - double loc_kpvolorg[] = - { 7.02832e-02, 4.19249e-08, 4.26814e-14, 3.28255e-19, - 9.99024e-02, 5.95931e-08, 6.06685e-14, 4.66597e-19, - 1.37191e-01, 8.18361e-08, 8.33130e-14, 6.40759e-19, - 1.84134e-01, 1.09838e-07, 1.11821e-13, 8.60016e-19, - 3.59093e-01, 2.14204e-07, 2.18074e-13, 1.67786e-18, - 6.50459e-01, 3.88007e-07, 3.95023e-13, 3.04025e-18, - 1.28140e+00, 7.64376e-07, 7.78212e-13, 5.99162e-18, - 2.57622e+00, 1.53675e-06, 1.56462e-12, 1.20532e-17, - 4.94170e+00, 2.94779e-06, 3.00137e-12, 2.31413e-17, - 8.79162e+00, 5.24433e-06, 5.33996e-12, 4.12194e-17, - 1.49789e+01, 8.93514e-06, 9.09893e-12, 7.03669e-17, - 2.46641e+01, 1.47126e-05, 1.49846e-11, 1.16244e-16, - 3.94637e+01, 2.35409e-05, 2.39820e-11, 1.86951e-16, - 6.20013e+01, 3.69851e-05, 3.76930e-11, 2.96113e-16, - 9.62020e+01, 5.73870e-05, 5.85180e-11, 4.64688e-16, - 1.48145e+02, 8.83735e-05, 9.01751e-11, 7.24557e-16, - 2.27937e+02, 1.35973e-04, 1.38835e-10, 1.12597e-15, - 3.51626e+02, 2.09762e-04, 2.14288e-10, 1.74548e-15, - 5.36545e+02, 3.20081e-04, 3.27114e-10, 2.66341e-15, - 7.93228e+02, 4.73218e-04, 4.83793e-10, 3.92738e-15, - 1.12835e+03, 6.73161e-04, 6.88534e-10, 5.56999e-15, - 1.53947e+03, 9.18463e-04, 9.40042e-10, 7.58380e-15, - 1.98167e+03, 1.18233e-03, 1.21114e-09, 9.76484e-15, - 2.36362e+03, 1.41028e-03, 1.44644e-09, 1.17033e-14, - 2.60802e+03, 1.55622e-03, 1.59931e-09, 1.30718e-14, - 2.70242e+03, 1.61274e-03, 1.66283e-09, 1.38579e-14, - 2.69039e+03, 1.60586e-03, 1.66448e-09, 1.43256e-14, - 2.64583e+03, 1.57974e-03, 1.65060e-09, 1.48942e-14, - 2.64222e+03, 1.57827e-03, 1.66657e-09, 1.59338e-14, - 2.70093e+03, 1.61421e-03, 1.72408e-09, 1.74454e-14, - 2.77670e+03, 1.66053e-03, 1.79277e-09, 1.90281e-14, - 2.81420e+03, 1.68424e-03, 1.83704e-09, 2.02756e-14, - 2.80366e+03, 1.67977e-03, 1.85184e-09, 2.11194e-14, - 2.78675e+03, 1.67267e-03, 1.86731e-09, 2.18416e-14, - 2.86105e+03, 1.72339e-03, 1.95702e-09, 2.30809e-14 }; - - double loc_kpH2Oice[] = - { 6.30862e-02, 3.76318e-08, 3.83108e-14, 2.94648e-19, - 1.09691e-01, 6.54321e-08, 6.66131e-14, 5.12363e-19, - 1.68363e-01, 1.00431e-07, 1.02243e-13, 7.86449e-19, - 2.42226e-01, 1.44491e-07, 1.47099e-13, 1.13150e-18, - 3.92991e-01, 2.34424e-07, 2.38657e-13, 1.83595e-18, - 6.03026e-01, 3.59713e-07, 3.66210e-13, 2.81745e-18, - 9.41509e-01, 5.61623e-07, 5.71771e-13, 4.39959e-18, - 1.54206e+00, 9.19862e-07, 9.36500e-13, 7.20849e-18, - 2.75198e+00, 1.64160e-06, 1.67135e-12, 1.28735e-17, - 5.12965e+00, 3.05991e-06, 3.11550e-12, 2.40170e-17, - 9.67703e+00, 5.77249e-06, 5.87767e-12, 4.53565e-17, - 1.70842e+01, 1.01910e-05, 1.03775e-11, 8.02010e-17, - 2.87858e+01, 1.71712e-05, 1.74882e-11, 1.35552e-16, - 5.22985e+01, 3.11971e-05, 3.17818e-11, 2.47506e-16, - 1.08421e+02, 6.46756e-05, 6.59042e-11, 5.15083e-16, - 2.29694e+02, 1.37018e-04, 1.39634e-10, 1.09171e-15, - 4.35888e+02, 2.60019e-04, 2.64976e-10, 2.06803e-15, - 6.94501e+02, 4.14288e-04, 4.22159e-10, 3.28761e-15, - 9.21763e+02, 5.49857e-04, 5.60297e-10, 4.35726e-15, - 1.06208e+03, 6.33565e-04, 6.45702e-10, 5.02330e-15, - 1.17460e+03, 7.00699e-04, 7.14492e-10, 5.57174e-15, - 1.41297e+03, 8.42922e-04, 8.60130e-10, 6.71698e-15, - 1.86068e+03, 1.11004e-03, 1.13311e-09, 8.82123e-15, - 2.38031e+03, 1.42005e-03, 1.44954e-09, 1.12234e-14, - 2.71131e+03, 1.61753e-03, 1.65107e-09, 1.27373e-14, - 2.72120e+03, 1.62346e-03, 1.65757e-09, 1.27900e-14, - 2.53189e+03, 1.51058e-03, 1.54284e-09, 1.19191e-14, - 2.48249e+03, 1.48118e-03, 1.51103e-09, 1.15227e-14, - 2.89111e+03, 1.72503e-03, 1.75260e-09, 1.28501e-14, - 3.66301e+03, 2.18553e-03, 2.21015e-09, 1.55022e-14, - 4.27842e+03, 2.55260e-03, 2.57302e-09, 1.74959e-14, - 4.29745e+03, 2.56387e-03, 2.57944e-09, 1.72213e-14, - 3.71668e+03, 2.21732e-03, 2.22839e-09, 1.47266e-14, - 2.83563e+03, 1.69168e-03, 1.69914e-09, 1.11685e-14, - 1.96048e+03, 1.16958e-03, 1.17438e-09, 7.69912e-15 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpFeM [itab0] = loc_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = loc_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = loc_kpMgSiO3 [itab]; - my_rates->SN0_kpFeS [itab0] = loc_kpFeS [itab]; - my_rates->SN0_kpreforg [itab0] = loc_kpreforg [itab]; - my_rates->SN0_kpvolorg [itab0] = loc_kpvolorg [itab]; - my_rates->SN0_kpH2Oice [itab0] = loc_kpH2Oice [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_C13(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 1.65746e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 2.39849e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 8.69522e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.87802e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 4.85826e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 2.52534e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.28672e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 2.09730e-06; - - itab0 = 3 * iSN; - my_rates->SN0_r0SiM [itab0 + 0] = 1.68557e-06; - my_rates->SN0_r0FeM [itab0 + 0] = 4.62542e-06; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 1.82163e-06; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 7.26303e-07; - my_rates->SN0_r0AC [itab0 + 0] = 4.82296e-06; - my_rates->SN0_r0SiO2D [itab0 + 0] = 1.33530e-06; - my_rates->SN0_r0MgO [itab0 + 0] = 1.59029e-06; - my_rates->SN0_r0FeS [itab0 + 0] = 6.16010e-07; - - my_rates->SN0_r0SiM [itab0 + 1] = 9.75226e-12; - my_rates->SN0_r0FeM [itab0 + 1] = 3.82292e-11; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 5.83823e-12; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 7.49856e-13; - my_rates->SN0_r0AC [itab0 + 1] = 3.91353e-11; - my_rates->SN0_r0SiO2D [itab0 + 1] = 5.91862e-12; - my_rates->SN0_r0MgO [itab0 + 1] = 7.21459e-12; - my_rates->SN0_r0FeS [itab0 + 1] = 4.56500e-13; - - my_rates->SN0_r0SiM [itab0 + 2] = 1.74046e-16; - my_rates->SN0_r0FeM [itab0 + 2] = 4.68445e-16; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 3.61356e-17; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 1.57511e-18; - my_rates->SN0_r0AC [itab0 + 2] = 5.15140e-16; - my_rates->SN0_r0SiO2D [itab0 + 2] = 5.31739e-17; - my_rates->SN0_r0MgO [itab0 + 2] = 4.84120e-17; - my_rates->SN0_r0FeS [itab0 + 2] = 4.16699e-19; - - NTd = 35; - Nmom = 4; - - double C13_kpSiM[] = - { 1.54619e-01, 2.60128e-07, 1.49475e-12, 2.65148e-17, - 1.94656e-01, 3.27554e-07, 1.88361e-12, 3.34351e-17, - 2.45059e-01, 4.12439e-07, 2.37316e-12, 4.21472e-17, - 3.08513e-01, 5.19301e-07, 2.98947e-12, 5.31150e-17, - 3.88404e-01, 6.53894e-07, 3.76675e-12, 6.69643e-17, - 4.88982e-01, 8.23350e-07, 4.74559e-12, 8.44087e-17, - 6.15605e-01, 1.03673e-06, 5.97899e-12, 1.06403e-16, - 7.75006e-01, 1.30539e-06, 7.53301e-12, 1.34131e-16, - 9.75366e-01, 1.64315e-06, 9.48791e-12, 1.69031e-16, - 1.22493e+00, 2.06392e-06, 1.19246e-11, 2.12553e-16, - 1.52116e+00, 2.56344e-06, 1.48192e-11, 2.64285e-16, - 1.83681e+00, 3.09586e-06, 1.79072e-11, 3.19511e-16, - 2.15662e+00, 3.63549e-06, 2.10413e-11, 3.75635e-16, - 2.55502e+00, 4.30820e-06, 2.49580e-11, 4.45921e-16, - 3.22790e+00, 5.44497e-06, 3.15890e-11, 5.65115e-16, - 4.33126e+00, 7.30995e-06, 4.24882e-11, 7.61352e-16, - 5.81498e+00, 9.82030e-06, 5.72103e-11, 1.02723e-15, - 7.48294e+00, 1.26484e-05, 7.39233e-11, 1.33106e-15, - 9.21324e+00, 1.55973e-05, 9.16644e-11, 1.65851e-15, - 1.11943e+01, 1.90119e-05, 1.13021e-10, 2.06536e-15, - 1.39990e+01, 2.39150e-05, 1.45136e-10, 2.69938e-15, - 1.78867e+01, 3.08010e-05, 1.92146e-10, 3.65687e-15, - 2.17798e+01, 3.79266e-05, 2.45744e-10, 4.82338e-15, - 2.38104e+01, 4.23268e-05, 2.93339e-10, 6.06677e-15, - 2.31200e+01, 4.26489e-05, 3.30423e-10, 7.40538e-15, - 2.05061e+01, 3.98990e-05, 3.56330e-10, 8.76054e-15, - 1.74011e+01, 3.59849e-05, 3.69684e-10, 9.86673e-15, - 1.47227e+01, 3.22080e-05, 3.69774e-10, 1.04731e-14, - 1.27456e+01, 2.91368e-05, 3.59951e-10, 1.05598e-14, - 1.18944e+01, 2.82426e-05, 3.62521e-10, 1.07315e-14, - 1.43878e+01, 3.74123e-05, 4.87177e-10, 1.37994e-14, - 2.85377e+01, 9.23385e-05, 1.20077e-09, 3.00478e-14, - 7.93256e+01, 3.11569e-04, 3.91124e-09, 8.56317e-14, - 2.33021e+02, 9.78251e-04, 1.15601e-08, 2.28453e-13, - 6.42052e+02, 2.55294e-03, 2.77058e-08, 5.06000e-13 }; - - double C13_kpFeM[] = - { 5.88921e-03, 6.87770e-08, 1.06227e-12, 2.02349e-17, - 1.01153e-02, 1.15444e-07, 1.74157e-12, 3.24501e-17, - 1.53919e-02, 1.73359e-07, 2.57952e-12, 4.74426e-17, - 2.20096e-02, 2.45791e-07, 3.62468e-12, 6.61001e-17, - 3.50047e-02, 3.82752e-07, 5.51942e-12, 9.85221e-17, - 5.25286e-02, 5.65069e-07, 8.00632e-12, 1.40508e-16, - 7.91090e-02, 8.36026e-07, 1.16179e-11, 2.00078e-16, - 1.19191e-01, 1.23677e-06, 1.68430e-11, 2.84365e-16, - 1.79251e-01, 1.82633e-06, 2.43704e-11, 4.03226e-16, - 2.66584e-01, 2.66955e-06, 3.49349e-11, 5.66851e-16, - 3.94058e-01, 3.87941e-06, 4.97989e-11, 7.92464e-16, - 5.74681e-01, 5.56462e-06, 7.01108e-11, 1.09474e-15, - 8.20409e-01, 7.81996e-06, 9.68130e-11, 1.48491e-15, - 1.14378e+00, 1.07400e-05, 1.30804e-10, 1.97313e-15, - 1.55566e+00, 1.44006e-05, 1.72756e-10, 2.56649e-15, - 2.06561e+00, 1.88620e-05, 2.23158e-10, 3.26978e-15, - 2.68069e+00, 2.41572e-05, 2.82187e-10, 4.08370e-15, - 3.40683e+00, 3.03006e-05, 3.49792e-10, 5.00618e-15, - 4.25797e+00, 3.73606e-05, 4.26499e-10, 6.04358e-15, - 5.27551e+00, 4.56092e-05, 5.14976e-10, 7.23179e-15, - 6.55438e+00, 5.57066e-05, 6.21908e-10, 8.66078e-15, - 8.27812e+00, 6.89310e-05, 7.60263e-10, 1.05052e-14, - 1.07753e+01, 8.75306e-05, 9.52770e-10, 1.30714e-14, - 1.46156e+01, 1.15279e-04, 1.23703e-09, 1.68635e-14, - 2.07765e+01, 1.58349e-04, 1.67242e-09, 2.26556e-14, - 3.09403e+01, 2.26776e-04, 2.35074e-09, 3.15878e-14, - 4.80249e+01, 3.37152e-04, 3.41710e-09, 4.53799e-14, - 7.70965e+01, 5.17359e-04, 5.10858e-09, 6.67630e-14, - 1.26831e+02, 8.14201e-04, 7.81618e-09, 1.00160e-13, - 2.11638e+02, 1.30438e-03, 1.21704e-08, 1.52564e-13, - 3.54644e+02, 2.11006e-03, 1.91598e-08, 2.34688e-13, - 5.91556e+02, 3.41851e-03, 3.02724e-08, 3.62228e-13, - 9.74370e+02, 5.49677e-03, 4.75739e-08, 5.56235e-13, - 1.56930e+03, 8.65788e-03, 7.33192e-08, 8.38100e-13, - 2.44406e+03, 1.31389e-02, 1.08763e-07, 1.21599e-12 }; - - double C13_kpMg2SiO4[] = - { 1.05240e-01, 1.91709e-07, 6.14415e-13, 3.80291e-18, - 1.32588e-01, 2.41526e-07, 7.74078e-13, 4.79114e-18, - 1.67016e-01, 3.04243e-07, 9.75080e-13, 6.03524e-18, - 2.10360e-01, 3.83198e-07, 1.22813e-12, 7.60148e-18, - 2.71887e-01, 4.95279e-07, 1.58734e-12, 9.82485e-18, - 3.55694e-01, 6.47944e-07, 2.07663e-12, 1.28533e-17, - 4.84932e-01, 8.83369e-07, 2.83116e-12, 1.75235e-17, - 6.99767e-01, 1.27472e-06, 4.08543e-12, 2.52870e-17, - 1.05860e+00, 1.92838e-06, 6.18042e-12, 3.82543e-17, - 1.62902e+00, 2.96748e-06, 9.51075e-12, 5.88683e-17, - 2.54260e+00, 4.63171e-06, 1.48447e-11, 9.18851e-17, - 3.96490e+00, 7.22268e-06, 2.31492e-11, 1.43293e-16, - 6.10635e+00, 1.11237e-05, 3.56530e-11, 2.20699e-16, - 9.28776e+00, 1.69193e-05, 5.42303e-11, 3.35716e-16, - 1.39267e+01, 2.53704e-05, 8.13220e-11, 5.03475e-16, - 2.05388e+01, 3.74163e-05, 1.19943e-10, 7.42685e-16, - 3.00662e+01, 5.47749e-05, 1.75612e-10, 1.08767e-15, - 4.55134e+01, 8.29222e-05, 2.65919e-10, 1.64778e-15, - 7.47928e+01, 1.36281e-04, 4.37190e-10, 2.71088e-15, - 1.29641e+02, 2.36241e-04, 7.58090e-10, 4.70339e-15, - 2.14861e+02, 3.91558e-04, 1.25676e-09, 7.80036e-15, - 3.20074e+02, 5.83333e-04, 1.87266e-09, 1.16272e-14, - 4.29885e+02, 7.83522e-04, 2.51590e-09, 1.56273e-14, - 5.31008e+02, 9.67906e-04, 3.10866e-09, 1.93168e-14, - 5.99926e+02, 1.09359e-03, 3.51289e-09, 2.18342e-14, - 6.06790e+02, 1.10614e-03, 3.55349e-09, 2.20891e-14, - 5.43501e+02, 9.90793e-04, 3.18304e-09, 1.97873e-14, - 4.33743e+02, 7.90717e-04, 2.54035e-09, 1.57927e-14, - 3.13466e+02, 5.71463e-04, 1.83604e-09, 1.14151e-14, - 2.09115e+02, 3.81238e-04, 1.22500e-09, 7.61738e-15, - 1.31224e+02, 2.39260e-04, 7.69004e-10, 4.78403e-15, - 7.91470e+01, 1.44373e-04, 4.64502e-10, 2.89404e-15, - 4.74663e+01, 8.67304e-05, 2.80053e-10, 1.75354e-15, - 2.98668e+01, 5.48299e-05, 1.78713e-10, 1.13252e-15, - 2.08636e+01, 3.86952e-05, 1.28439e-10, 8.30592e-16 }; - - double C13_kpMgSiO3[] = - { 2.19890e-02, 1.59707e-08, 1.64886e-14, 3.46350e-20, - 3.90612e-02, 2.83703e-08, 2.92903e-14, 6.15261e-20, - 6.05539e-02, 4.39805e-08, 4.54068e-14, 9.53799e-20, - 8.76116e-02, 6.36326e-08, 6.56961e-14, 1.37999e-19, - 1.43288e-01, 1.04070e-07, 1.07445e-13, 2.25699e-19, - 2.19266e-01, 1.59254e-07, 1.64418e-13, 3.45380e-19, - 3.36256e-01, 2.44223e-07, 2.52144e-13, 5.29662e-19, - 5.14336e-01, 3.73564e-07, 3.85679e-13, 8.10191e-19, - 7.97216e-01, 5.79021e-07, 5.97800e-13, 1.25585e-18, - 1.25414e+00, 9.10886e-07, 9.40430e-13, 1.97579e-18, - 2.03450e+00, 1.47766e-06, 1.52560e-12, 3.20555e-18, - 3.34648e+00, 2.43056e-06, 2.50942e-12, 5.27367e-18, - 5.45894e+00, 3.96485e-06, 4.09354e-12, 8.60504e-18, - 8.82118e+00, 6.40687e-06, 6.61493e-12, 1.39111e-17, - 1.41825e+01, 1.03009e-05, 1.06356e-11, 2.23816e-17, - 2.28420e+01, 1.65903e-05, 1.71302e-11, 3.60870e-17, - 3.71180e+01, 2.69593e-05, 2.78383e-11, 5.87421e-17, - 6.14285e+01, 4.46166e-05, 4.60756e-11, 9.74574e-17, - 1.03848e+02, 7.54274e-05, 7.79023e-11, 1.65248e-16, - 1.75510e+02, 1.27478e-04, 1.31675e-10, 2.80026e-16, - 2.82066e+02, 2.04875e-04, 2.11635e-10, 4.50867e-16, - 4.14529e+02, 3.01090e-04, 3.11041e-10, 6.63478e-16, - 5.59986e+02, 4.06746e-04, 4.20208e-10, 8.97036e-16, - 7.11059e+02, 5.16484e-04, 5.33582e-10, 1.13854e-15, - 8.40851e+02, 6.10764e-04, 6.30953e-10, 1.34372e-15, - 8.95368e+02, 6.50365e-04, 6.71811e-10, 1.42700e-15, - 8.40461e+02, 6.10482e-04, 6.30563e-10, 1.33611e-15, - 6.96732e+02, 5.06082e-04, 5.22696e-10, 1.10542e-15, - 5.18234e+02, 3.76427e-04, 3.88766e-10, 8.21088e-16, - 3.52885e+02, 2.56323e-04, 2.64719e-10, 5.58648e-16, - 2.24228e+02, 1.62872e-04, 1.68207e-10, 3.54873e-16, - 1.35145e+02, 9.81654e-05, 1.01382e-10, 2.13970e-16, - 7.83182e+01, 5.68892e-05, 5.87587e-11, 1.24192e-16, - 4.41610e+01, 3.20799e-05, 3.31421e-11, 7.03026e-17, - 2.46026e+01, 1.78814e-05, 1.84973e-11, 3.95672e-17 }; - - double C13_kpAC[] = - { 3.27960e-01, 1.58173e-06, 1.28346e-11, 1.68940e-16, - 4.38754e-01, 2.11613e-06, 1.71717e-11, 2.26045e-16, - 5.78236e-01, 2.78890e-06, 2.26319e-11, 2.97935e-16, - 7.53833e-01, 3.63586e-06, 2.95057e-11, 3.88440e-16, - 1.04018e+00, 5.01714e-06, 4.07179e-11, 5.36095e-16, - 1.41744e+00, 6.83702e-06, 5.54910e-11, 7.30661e-16, - 1.95305e+00, 9.42082e-06, 7.64677e-11, 1.00698e-15, - 2.71551e+00, 1.30993e-05, 1.06337e-10, 1.40054e-15, - 3.79716e+00, 1.83183e-05, 1.48729e-10, 1.95931e-15, - 5.29823e+00, 2.55621e-05, 2.07584e-10, 2.73540e-15, - 7.37977e+00, 3.56090e-05, 2.89250e-10, 3.81296e-15, - 1.02196e+01, 4.93202e-05, 4.00773e-10, 5.28580e-15, - 1.40471e+01, 6.78071e-05, 5.51275e-10, 7.27585e-15, - 1.92118e+01, 9.27674e-05, 7.54736e-10, 9.97084e-15, - 2.61798e+01, 1.26469e-04, 1.02994e-09, 1.36251e-14, - 3.55647e+01, 1.71912e-04, 1.40197e-09, 1.85822e-14, - 4.82256e+01, 2.33320e-04, 1.90655e-09, 2.53388e-14, - 6.54391e+01, 3.17003e-04, 2.59771e-09, 3.46585e-14, - 8.90003e+01, 4.31918e-04, 3.55359e-09, 4.76706e-14, - 1.21150e+02, 5.89447e-04, 4.87725e-09, 6.59296e-14, - 1.64482e+02, 8.03274e-04, 6.70152e-09, 9.15912e-14, - 2.22238e+02, 1.09138e-03, 9.21653e-09, 1.27994e-13, - 2.99304e+02, 1.48143e-03, 1.27247e-08, 1.80612e-13, - 4.02975e+02, 2.01378e-03, 1.76517e-08, 2.56967e-13, - 5.41945e+02, 2.73383e-03, 2.44284e-08, 3.63965e-13, - 7.24087e+02, 3.67841e-03, 3.33149e-08, 5.04207e-13, - 9.57733e+02, 4.88178e-03, 4.44353e-08, 6.76055e-13, - 1.25789e+03, 6.40887e-03, 5.80974e-08, 8.78814e-13, - 1.65268e+03, 8.39077e-03, 7.51368e-08, 1.11835e-12, - 2.18798e+03, 1.10499e-02, 9.71231e-08, 1.40975e-12, - 2.93400e+03, 1.47364e-02, 1.26617e-07, 1.77953e-12, - 3.99924e+03, 2.00041e-02, 1.67709e-07, 2.27029e-12, - 5.55224e+03, 2.77223e-02, 2.26777e-07, 2.94699e-12, - 7.83754e+03, 3.91330e-02, 3.12657e-07, 3.89444e-12, - 1.11477e+04, 5.56050e-02, 4.34205e-07, 5.18557e-12 }; - - double C13_kpSiO2D[] = - { 7.60358e-02, 1.01529e-07, 4.49989e-13, 4.04236e-18, - 9.07205e-02, 1.21137e-07, 5.36902e-13, 4.82320e-18, - 1.09207e-01, 1.45823e-07, 6.46320e-13, 5.80621e-18, - 1.32481e-01, 1.76900e-07, 7.84068e-13, 7.04376e-18, - 1.58907e-01, 2.12188e-07, 9.40480e-13, 8.44905e-18, - 1.91565e-01, 2.55795e-07, 1.13377e-12, 1.01857e-17, - 2.30490e-01, 3.07773e-07, 1.36416e-12, 1.22557e-17, - 2.76795e-01, 3.69605e-07, 1.63824e-12, 1.47181e-17, - 3.33074e-01, 4.44757e-07, 1.97136e-12, 1.77112e-17, - 4.05326e-01, 5.41239e-07, 2.39905e-12, 2.15541e-17, - 5.08162e-01, 6.78559e-07, 3.00776e-12, 2.70236e-17, - 6.72474e-01, 8.97974e-07, 3.98043e-12, 3.57640e-17, - 9.48554e-01, 1.26665e-06, 5.61486e-12, 5.04526e-17, - 1.41789e+00, 1.89344e-06, 8.39396e-12, 7.54321e-17, - 2.19504e+00, 2.93130e-06, 1.29962e-11, 1.16808e-16, - 3.46727e+00, 4.63056e-06, 2.05341e-11, 1.84616e-16, - 5.76879e+00, 7.70562e-06, 3.41883e-11, 3.07633e-16, - 1.17206e+01, 1.56620e-05, 6.95719e-11, 6.27184e-16, - 3.16503e+01, 4.23092e-05, 1.88132e-10, 1.69866e-15, - 8.68466e+01, 1.16104e-04, 5.16371e-10, 4.66366e-15, - 1.92342e+02, 2.57132e-04, 1.14345e-09, 1.03252e-14, - 3.36302e+02, 4.49562e-04, 1.99868e-09, 1.80397e-14, - 5.05933e+02, 6.76162e-04, 3.00294e-09, 2.70549e-14, - 7.20757e+02, 9.62603e-04, 4.26374e-09, 3.82441e-14, - 9.77487e+02, 1.30417e-03, 5.75586e-09, 5.13190e-14, - 1.18647e+03, 1.58150e-03, 6.95698e-09, 6.16931e-14, - 1.23844e+03, 1.64960e-03, 7.23901e-09, 6.39380e-14, - 1.11176e+03, 1.48010e-03, 6.48454e-09, 5.71201e-14, - 8.76276e+02, 1.16622e-03, 5.10394e-09, 4.48799e-14, - 6.22103e+02, 8.27770e-04, 3.62020e-09, 3.17970e-14, - 4.07211e+02, 5.41759e-04, 2.36830e-09, 2.07862e-14, - 2.50522e+02, 3.33268e-04, 1.45648e-09, 1.27774e-14, - 1.47042e+02, 1.95598e-04, 8.54671e-10, 7.49580e-15, - 8.32958e+01, 1.10803e-04, 4.84133e-10, 4.24560e-15, - 4.59515e+01, 6.11325e-05, 2.67142e-10, 2.34298e-15 }; - - double C13_kpMgO[] = - { 2.25390e-04, 3.58434e-10, 1.62608e-15, 1.09114e-20, - 4.04968e-04, 6.44015e-10, 2.92166e-15, 1.96051e-20, - 6.31043e-04, 1.00354e-09, 4.55270e-15, 3.05498e-20, - 9.15654e-04, 1.45615e-09, 6.60605e-15, 4.43284e-20, - 1.52197e-03, 2.42038e-09, 1.09804e-14, 7.36816e-20, - 2.37407e-03, 3.77546e-09, 1.71280e-14, 1.14934e-19, - 3.77208e-03, 5.99871e-09, 2.72141e-14, 1.82615e-19, - 6.14347e-03, 9.76990e-09, 4.43228e-14, 2.97421e-19, - 1.01907e-02, 1.62062e-08, 7.35223e-14, 4.93362e-19, - 1.68896e-02, 2.68594e-08, 1.21853e-13, 8.17686e-19, - 2.96122e-02, 4.70930e-08, 2.13650e-13, 1.43371e-18, - 6.10599e-02, 9.71067e-08, 4.40563e-13, 2.95653e-18, - 1.43395e-01, 2.28052e-07, 1.03468e-12, 6.94381e-18, - 3.27370e-01, 5.20656e-07, 2.36231e-12, 1.58544e-17, - 6.39417e-01, 1.01697e-06, 4.61437e-12, 3.09706e-17, - 1.05137e+00, 1.67234e-06, 7.58927e-12, 5.09499e-17, - 1.55802e+00, 2.48015e-06, 1.12675e-11, 7.57604e-17, - 2.94085e+00, 4.69147e-06, 2.13703e-11, 1.44197e-16, - 1.32769e+01, 2.11739e-05, 9.63657e-11, 6.49212e-16, - 7.10101e+01, 1.13066e-04, 5.13371e-10, 3.44675e-15, - 2.54818e+02, 4.05363e-04, 1.83807e-09, 1.23170e-14, - 6.00377e+02, 9.54596e-04, 4.32539e-09, 2.89547e-14, - 9.94365e+02, 1.58056e-03, 7.15868e-09, 4.78926e-14, - 1.24259e+03, 1.97471e-03, 8.94139e-09, 5.97968e-14, - 1.24573e+03, 1.97945e-03, 8.96134e-09, 5.99160e-14, - 1.05442e+03, 1.67534e-03, 7.58381e-09, 5.06979e-14, - 7.85160e+02, 1.24742e-03, 5.64619e-09, 3.77407e-14, - 5.31062e+02, 8.43677e-04, 3.81852e-09, 2.55222e-14, - 3.34296e+02, 5.31069e-04, 2.40355e-09, 1.60640e-14, - 1.99427e+02, 3.16805e-04, 1.43378e-09, 9.58224e-15, - 1.14271e+02, 1.81526e-04, 8.21530e-10, 5.49033e-15, - 6.35097e+01, 1.00887e-04, 4.56573e-10, 3.05124e-15, - 3.44902e+01, 5.47882e-05, 2.47947e-10, 1.65699e-15, - 1.84022e+01, 2.92323e-05, 1.32292e-10, 8.84081e-16, - 9.68612e+00, 1.53865e-05, 6.96321e-11, 4.65335e-16 }; - - double C13_kpFeS[] = - { 5.18081e-02, 3.19144e-08, 2.36505e-14, 2.15886e-20, - 9.98885e-02, 6.15325e-08, 4.55993e-14, 4.16239e-20, - 1.60418e-01, 9.88194e-08, 7.32312e-14, 6.68467e-20, - 2.36621e-01, 1.45761e-07, 1.08018e-13, 9.86004e-20, - 3.67284e-01, 2.26251e-07, 1.67666e-13, 1.53048e-19, - 5.36223e-01, 3.30320e-07, 2.44787e-13, 2.23446e-19, - 7.64198e-01, 4.70755e-07, 3.48859e-13, 3.18445e-19, - 1.04970e+00, 6.46627e-07, 4.79190e-13, 4.37414e-19, - 1.38080e+00, 8.50591e-07, 6.30340e-13, 5.75387e-19, - 1.74373e+00, 1.07416e-06, 7.96018e-13, 7.26623e-19, - 2.10311e+00, 1.29554e-06, 9.60079e-13, 8.76383e-19, - 2.42144e+00, 1.49164e-06, 1.10541e-12, 1.00905e-18, - 2.66810e+00, 1.64360e-06, 1.21802e-12, 1.11185e-18, - 2.81617e+00, 1.73481e-06, 1.28563e-12, 1.17358e-18, - 2.89834e+00, 1.78545e-06, 1.32317e-12, 1.20789e-18, - 3.07987e+00, 1.89732e-06, 1.40614e-12, 1.28370e-18, - 3.69380e+00, 2.27562e-06, 1.68664e-12, 1.53995e-18, - 5.05331e+00, 3.11331e-06, 2.30770e-12, 2.10726e-18, - 7.07089e+00, 4.35648e-06, 3.22940e-12, 2.94918e-18, - 9.18826e+00, 5.66121e-06, 4.19684e-12, 3.83303e-18, - 1.08014e+01, 6.65544e-06, 4.93433e-12, 4.50719e-18, - 1.16611e+01, 7.18584e-06, 5.32843e-12, 4.86833e-18, - 1.18910e+01, 7.32863e-06, 5.43584e-12, 4.96854e-18, - 1.17598e+01, 7.24978e-06, 5.38006e-12, 4.92122e-18, - 1.15004e+01, 7.09317e-06, 5.26837e-12, 4.82521e-18, - 1.12405e+01, 6.93914e-06, 5.16238e-12, 4.73954e-18, - 1.10769e+01, 6.85905e-06, 5.13138e-12, 4.75017e-18, - 1.15509e+01, 7.24181e-06, 5.54113e-12, 5.30090e-18, - 1.54818e+01, 9.90289e-06, 7.85008e-12, 7.89232e-18, - 3.23248e+01, 2.09189e-05, 1.69099e-11, 1.74499e-17, - 8.13876e+01, 5.27406e-05, 4.27128e-11, 4.41701e-17, - 1.86528e+02, 1.20594e-04, 9.72543e-11, 9.99819e-17, - 3.66028e+02, 2.35977e-04, 1.89337e-10, 1.93263e-16, - 6.29868e+02, 4.05043e-04, 3.23450e-10, 3.27929e-16, - 9.83739e+02, 6.31245e-04, 5.01948e-10, 5.05703e-16 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab0] = C13_kpSiM [itab]; - my_rates->SN0_kpFeM [itab0] = C13_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = C13_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = C13_kpMgSiO3 [itab]; - my_rates->SN0_kpAC [itab0] = C13_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = C13_kpSiO2D [itab]; - my_rates->SN0_kpMgO [itab0] = C13_kpMgO [itab]; - my_rates->SN0_kpFeS [itab0] = C13_kpFeS [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_C20(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 3.44388e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.77223e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.90086e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.57266e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.27270e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.65484e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 9.48713e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 5.23050e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 1.31693e-29; - - itab0 = 3 * iSN; - my_rates->SN0_r0SiM [itab0 + 0] = 1.24861e-05; - my_rates->SN0_r0FeM [itab0 + 0] = 6.67024e-06; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 1.41253e-06; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 1.01138e-06; - my_rates->SN0_r0AC [itab0 + 0] = 7.95099e-07; - my_rates->SN0_r0SiO2D [itab0 + 0] = 1.40285e-06; - my_rates->SN0_r0MgO [itab0 + 0] = 1.29303e-06; - my_rates->SN0_r0FeS [itab0 + 0] = 1.68897e-06; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 9.21063e-08; - - my_rates->SN0_r0SiM [itab0 + 1] = 2.86508e-10; - my_rates->SN0_r0FeM [itab0 + 1] = 7.50596e-11; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 4.77566e-12; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.31688e-12; - my_rates->SN0_r0AC [itab0 + 1] = 2.51133e-12; - my_rates->SN0_r0SiO2D [itab0 + 1] = 3.98828e-12; - my_rates->SN0_r0MgO [itab0 + 1] = 1.06240e-11; - my_rates->SN0_r0FeS [itab0 + 1] = 3.16618e-12; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 9.03508e-15; - - my_rates->SN0_r0SiM [itab0 + 2] = 1.01028e-14; - my_rates->SN0_r0FeM [itab0 + 2] = 1.22752e-15; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 3.08016e-17; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 2.89696e-18; - my_rates->SN0_r0AC [itab0 + 2] = 4.21640e-17; - my_rates->SN0_r0SiO2D [itab0 + 2] = 1.93974e-17; - my_rates->SN0_r0MgO [itab0 + 2] = 1.57687e-16; - my_rates->SN0_r0FeS [itab0 + 2] = 6.72598e-18; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 9.36936e-22; - - NTd = 35; - Nmom = 4; - - double C20_kpSiM[] = - { 1.53894e-01, 1.90916e-06, 4.34900e-11, 1.52207e-15, - 1.93844e-01, 2.40648e-06, 5.48634e-11, 1.92178e-15, - 2.44138e-01, 3.03256e-06, 6.91797e-11, 2.42474e-15, - 3.07454e-01, 3.82073e-06, 8.72020e-11, 3.05783e-15, - 3.87243e-01, 4.81526e-06, 1.09978e-10, 3.85936e-15, - 4.87709e-01, 6.06778e-06, 1.38669e-10, 4.86916e-15, - 6.14251e-01, 7.64642e-06, 1.74856e-10, 6.14383e-15, - 7.73625e-01, 9.63590e-06, 2.20495e-10, 7.75268e-15, - 9.74036e-01, 1.21392e-05, 2.77959e-10, 9.78002e-15, - 1.22376e+00, 1.52600e-05, 3.49642e-10, 1.23105e-14, - 1.52029e+00, 1.89682e-05, 4.34881e-10, 1.53223e-14, - 1.83650e+00, 2.29254e-05, 5.25941e-10, 1.85447e-14, - 2.15714e+00, 2.69443e-05, 6.18616e-10, 2.18354e-14, - 2.55729e+00, 3.19712e-05, 7.34846e-10, 2.59753e-14, - 3.23398e+00, 4.04866e-05, 9.32032e-10, 3.30022e-14, - 4.34499e+00, 5.44911e-05, 1.25683e-09, 4.45846e-14, - 5.84259e+00, 7.34292e-05, 1.69748e-09, 6.03345e-14, - 7.53509e+00, 9.49825e-05, 2.20255e-09, 7.84868e-14, - 9.31292e+00, 1.17996e-04, 2.75076e-09, 9.84428e-14, - 1.14053e+01, 1.46050e-04, 3.44207e-09, 1.24265e-13, - 1.44699e+01, 1.88865e-04, 4.53802e-09, 1.66375e-13, - 1.88525e+01, 2.52409e-04, 6.22006e-09, 2.32633e-13, - 2.35897e+01, 3.27106e-04, 8.33967e-09, 3.20293e-13, - 2.71065e+01, 3.99935e-04, 1.08043e-08, 4.33797e-13, - 2.87408e+01, 4.69399e-04, 1.38602e-08, 5.94648e-13, - 2.88428e+01, 5.34587e-04, 1.74785e-08, 8.07129e-13, - 2.80514e+01, 5.86377e-04, 2.09655e-08, 1.03092e-12, - 2.67893e+01, 6.13530e-04, 2.33810e-08, 1.20137e-12, - 2.53851e+01, 6.14601e-04, 2.43011e-08, 1.28034e-12, - 2.53848e+01, 6.23633e-04, 2.48207e-08, 1.31287e-12, - 3.52560e+01, 8.08661e-04, 3.01974e-08, 1.52398e-12, - 9.64731e+01, 1.84326e-03, 5.73265e-08, 2.51143e-12, - 3.56496e+02, 5.70937e-03, 1.44867e-07, 5.33930e-12, - 1.16716e+03, 1.65654e-02, 3.60906e-07, 1.15456e-11, - 3.02792e+03, 3.93985e-02, 7.71226e-07, 2.22345e-11 }; - - double C20_kpFeM[] = - { 1.10506e-02, 1.69983e-07, 3.50089e-12, 9.16404e-17, - 1.85837e-02, 2.76971e-07, 5.53036e-12, 1.40642e-16, - 2.79449e-02, 4.08949e-07, 8.01809e-12, 2.00458e-16, - 3.96605e-02, 5.73574e-07, 1.11125e-11, 2.74730e-16, - 6.19392e-02, 8.69904e-07, 1.63567e-11, 3.93140e-16, - 9.16817e-02, 1.25867e-06, 2.31128e-11, 5.43193e-16, - 1.36080e-01, 1.82251e-06, 3.26005e-11, 7.47226e-16, - 2.02056e-01, 2.63811e-06, 4.59129e-11, 1.02492e-15, - 2.99593e-01, 3.81390e-06, 6.45602e-11, 1.40281e-15, - 4.39758e-01, 5.46636e-06, 9.01024e-11, 1.90718e-15, - 6.41903e-01, 7.79581e-06, 1.25163e-10, 2.58082e-15, - 9.24985e-01, 1.09870e-05, 1.71974e-10, 3.45658e-15, - 1.30585e+00, 1.51941e-05, 2.32250e-10, 4.55695e-15, - 1.80164e+00, 2.05666e-05, 3.07564e-10, 5.90101e-15, - 2.42648e+00, 2.72192e-05, 3.99035e-10, 7.50126e-15, - 3.19207e+00, 3.52384e-05, 5.07449e-10, 9.36601e-15, - 4.10565e+00, 4.46618e-05, 6.32978e-10, 1.14947e-14, - 5.17172e+00, 5.54917e-05, 7.75385e-10, 1.38820e-14, - 6.40478e+00, 6.78244e-05, 9.35760e-10, 1.65481e-14, - 7.85614e+00, 8.21045e-05, 1.11980e-09, 1.95943e-14, - 9.64785e+00, 9.94326e-05, 1.34166e-09, 2.32660e-14, - 1.20159e+01, 1.21941e-04, 1.62875e-09, 2.80374e-14, - 1.53778e+01, 1.53371e-04, 2.02922e-09, 3.47445e-14, - 2.04423e+01, 1.99938e-04, 2.62238e-09, 4.47607e-14, - 2.83887e+01, 2.71546e-04, 3.53030e-09, 6.01372e-14, - 4.11773e+01, 3.83718e-04, 4.93303e-09, 8.37180e-14, - 6.21107e+01, 5.61284e-04, 7.10254e-09, 1.19520e-13, - 9.68132e+01, 8.45164e-04, 1.04719e-08, 1.73689e-13, - 1.54804e+02, 1.30324e-03, 1.57446e-08, 2.55980e-13, - 2.51780e+02, 2.04562e-03, 2.40381e-08, 3.81486e-13, - 4.12838e+02, 3.24595e-03, 3.70714e-08, 5.72650e-13, - 6.76592e+02, 5.16747e-03, 5.73792e-08, 8.61246e-13, - 1.09863e+03, 8.17937e-03, 8.83910e-08, 1.28821e-12, - 1.74646e+03, 1.26954e-02, 1.33666e-07, 1.89228e-12, - 2.67882e+03, 1.89754e-02, 1.94753e-07, 2.68226e-12 }; - - double C20_kpMg2SiO4[] = - { 1.05240e-01, 1.48654e-07, 5.02591e-13, 3.24156e-18, - 1.32588e-01, 1.87284e-07, 6.33194e-13, 4.08391e-18, - 1.67016e-01, 2.35915e-07, 7.97614e-13, 5.14437e-18, - 2.10360e-01, 2.97139e-07, 1.00461e-12, 6.47941e-18, - 2.71887e-01, 3.84048e-07, 1.29844e-12, 8.37459e-18, - 3.55694e-01, 5.02428e-07, 1.69868e-12, 1.09560e-17, - 4.84932e-01, 6.84981e-07, 2.31589e-12, 1.49369e-17, - 6.99767e-01, 9.88442e-07, 3.34188e-12, 2.15544e-17, - 1.05860e+00, 1.49530e-06, 5.05559e-12, 3.26077e-17, - 1.62902e+00, 2.30104e-06, 7.77981e-12, 5.01791e-17, - 2.54260e+00, 3.59152e-06, 1.21430e-11, 7.83229e-17, - 3.96490e+00, 5.60062e-06, 1.89363e-11, 1.22144e-16, - 6.10634e+00, 8.62558e-06, 2.91646e-11, 1.88128e-16, - 9.28774e+00, 1.31196e-05, 4.43615e-11, 2.86175e-16, - 1.39267e+01, 1.96729e-05, 6.65240e-11, 4.29191e-16, - 2.05387e+01, 2.90138e-05, 9.81191e-11, 6.33137e-16, - 3.00660e+01, 4.24748e-05, 1.43665e-10, 9.27312e-16, - 4.55128e+01, 6.43028e-05, 2.17560e-10, 1.40505e-15, - 7.47912e+01, 1.05684e-04, 3.57721e-10, 2.31202e-15, - 1.29637e+02, 1.83206e-04, 6.20346e-10, 4.01209e-15, - 2.14853e+02, 3.03661e-04, 1.02847e-09, 6.65466e-15, - 3.20060e+02, 4.52395e-04, 1.53258e-09, 9.92043e-15, - 4.29862e+02, 6.07661e-04, 2.05913e-09, 1.33350e-14, - 5.30972e+02, 7.50675e-04, 2.54443e-09, 1.64851e-14, - 5.99878e+02, 8.48166e-04, 2.87540e-09, 1.86348e-14, - 6.06737e+02, 8.57905e-04, 2.90867e-09, 1.88528e-14, - 5.43451e+02, 7.68444e-04, 2.60547e-09, 1.68884e-14, - 4.33701e+02, 6.13270e-04, 2.07941e-09, 1.34791e-14, - 3.13436e+02, 4.43222e-04, 1.50292e-09, 9.74306e-15, - 2.09092e+02, 2.95687e-04, 1.00276e-09, 6.50192e-15, - 1.31208e+02, 1.85574e-04, 6.29536e-10, 4.08396e-15, - 7.91293e+01, 1.11988e-04, 3.80343e-10, 2.47142e-15, - 4.74361e+01, 6.72978e-05, 2.29477e-10, 1.49906e-15, - 2.98121e+01, 4.25812e-05, 1.46690e-10, 9.70392e-16, - 2.07674e+01, 3.01013e-05, 1.05718e-10, 7.13724e-16 }; - - double C20_kpMgSiO3[] = - { 2.19890e-02, 2.22393e-08, 2.89570e-14, 6.37012e-20, - 3.90612e-02, 3.95059e-08, 5.14391e-14, 1.13159e-19, - 6.05539e-02, 6.12433e-08, 7.97425e-14, 1.75423e-19, - 8.76116e-02, 8.86090e-08, 1.15374e-13, 2.53808e-19, - 1.43288e-01, 1.44919e-07, 1.88693e-13, 4.15103e-19, - 2.19266e-01, 2.21762e-07, 2.88749e-13, 6.35214e-19, - 3.36256e-01, 3.40084e-07, 4.42810e-13, 9.74136e-19, - 5.14336e-01, 5.20191e-07, 6.77322e-13, 1.49005e-18, - 7.97217e-01, 8.06292e-07, 1.04985e-12, 2.30962e-18, - 1.25414e+00, 1.26842e-06, 1.65157e-12, 3.63350e-18, - 2.03450e+00, 2.05766e-06, 2.67923e-12, 5.89467e-18, - 3.34648e+00, 3.38458e-06, 4.40703e-12, 9.69677e-18, - 5.45894e+00, 5.52111e-06, 7.18906e-12, 1.58199e-17, - 8.82120e+00, 8.92167e-06, 1.16172e-11, 2.55686e-17, - 1.41826e+01, 1.43441e-05, 1.86785e-11, 4.11217e-17, - 2.28421e+01, 2.31025e-05, 3.00847e-11, 6.62628e-17, - 3.71183e+01, 3.75417e-05, 4.88915e-11, 1.07761e-16, - 6.14292e+01, 6.21307e-05, 8.09232e-11, 1.78540e-16, - 1.03850e+02, 1.05037e-04, 1.36825e-10, 3.02237e-16, - 1.75513e+02, 1.77524e-04, 2.31276e-10, 5.11420e-16, - 2.82073e+02, 2.85307e-04, 3.71726e-10, 8.22603e-16, - 4.14541e+02, 4.19298e-04, 5.46336e-10, 1.20964e-15, - 5.60007e+02, 5.66440e-04, 7.38095e-10, 1.63478e-15, - 7.11090e+02, 7.19267e-04, 9.37240e-10, 2.07555e-15, - 8.40892e+02, 8.50566e-04, 1.10826e-09, 2.45241e-15, - 8.95414e+02, 9.05715e-04, 1.18001e-09, 2.60842e-15, - 8.40504e+02, 8.50170e-04, 1.10753e-09, 2.44576e-15, - 6.96768e+02, 7.04778e-04, 9.18057e-10, 2.02574e-15, - 5.18260e+02, 5.24216e-04, 6.82816e-10, 1.50584e-15, - 3.52903e+02, 3.56958e-04, 4.64940e-10, 1.02501e-15, - 2.24241e+02, 2.26818e-04, 2.95430e-10, 6.51237e-16, - 1.35153e+02, 1.36707e-04, 1.78065e-10, 3.92585e-16, - 7.83236e+01, 7.92263e-05, 1.03204e-10, 2.27687e-16, - 4.41657e+01, 4.46783e-05, 5.82153e-11, 1.28647e-16, - 2.46133e+01, 2.49140e-05, 3.25047e-11, 7.21799e-17 }; - - double C20_kpAC[] = - { 3.27960e-01, 2.60760e-07, 8.23594e-13, 1.38274e-17, - 4.38752e-01, 3.48855e-07, 1.10197e-12, 1.85031e-17, - 5.78230e-01, 4.59761e-07, 1.45242e-12, 2.43895e-17, - 7.53824e-01, 5.99382e-07, 1.89361e-12, 3.18000e-17, - 1.04013e+00, 8.27053e-07, 2.61333e-12, 4.38935e-17, - 1.41735e+00, 1.12702e-06, 3.56171e-12, 5.98308e-17, - 1.95293e+00, 1.55292e-06, 4.90855e-12, 8.24705e-17, - 2.71532e+00, 2.15922e-06, 6.82677e-12, 1.14729e-16, - 3.79677e+00, 3.01935e-06, 9.54991e-12, 1.60553e-16, - 5.29747e+00, 4.21303e-06, 1.33318e-11, 2.24238e-16, - 7.37841e+00, 5.86846e-06, 1.85820e-11, 3.12737e-16, - 1.02169e+01, 8.12703e-06, 2.57565e-11, 4.33854e-16, - 1.40423e+01, 1.11717e-05, 3.54480e-11, 5.97791e-16, - 1.92026e+01, 1.52804e-05, 4.85668e-11, 8.20344e-16, - 2.61626e+01, 2.08251e-05, 6.63455e-11, 1.12316e-15, - 3.55324e+01, 2.82955e-05, 9.04435e-11, 1.53595e-15, - 4.81644e+01, 3.83784e-05, 1.23253e-10, 2.10252e-15, - 6.53233e+01, 5.20969e-05, 1.68441e-10, 2.89162e-15, - 8.87789e+01, 7.08925e-05, 2.31406e-10, 4.00785e-15, - 1.20729e+02, 9.65780e-05, 3.19528e-10, 5.60280e-15, - 1.63666e+02, 1.31274e-04, 4.42922e-10, 7.90380e-15, - 2.20664e+02, 1.77696e-04, 6.17150e-10, 1.12922e-14, - 2.96276e+02, 2.39957e-04, 8.67756e-10, 1.64168e-14, - 3.97347e+02, 3.24130e-04, 1.23022e-09, 2.41672e-14, - 5.32072e+02, 4.37186e-04, 1.73755e-09, 3.52998e-14, - 7.07827e+02, 5.84876e-04, 2.40229e-09, 4.99094e-14, - 9.32126e+02, 7.72477e-04, 3.21611e-09, 6.73490e-14, - 1.21808e+03, 1.00957e-03, 4.17439e-09, 8.68091e-14, - 1.58941e+03, 1.31461e-03, 5.30260e-09, 1.07984e-13, - 2.08259e+03, 1.71725e-03, 6.66833e-09, 1.31338e-13, - 2.74876e+03, 2.26047e-03, 8.38813e-09, 1.58137e-13, - 3.65886e+03, 3.00609e-03, 1.06436e-08, 1.90525e-13, - 4.91536e+03, 4.04510e-03, 1.37047e-08, 2.31589e-13, - 6.67260e+03, 5.51150e-03, 1.79301e-08, 2.84849e-13, - 9.16963e+03, 7.59478e-03, 2.36873e-08, 3.52355e-13 }; - - double C20_kpSiO2D[] = - { 7.60358e-02, 1.06666e-07, 3.03247e-13, 1.47482e-18, - 9.07206e-02, 1.27267e-07, 3.61815e-13, 1.75967e-18, - 1.09208e-01, 1.53201e-07, 4.35546e-13, 2.11827e-18, - 1.32481e-01, 1.85851e-07, 5.28369e-13, 2.56972e-18, - 1.58907e-01, 2.22922e-07, 6.33765e-13, 3.08233e-18, - 1.91565e-01, 2.68735e-07, 7.64012e-13, 3.71581e-18, - 2.30490e-01, 3.23342e-07, 9.19258e-13, 4.47087e-18, - 2.76795e-01, 3.88301e-07, 1.10394e-12, 5.36908e-18, - 3.33074e-01, 4.67253e-07, 1.32840e-12, 6.46082e-18, - 4.05326e-01, 5.68613e-07, 1.61658e-12, 7.86245e-18, - 5.08161e-01, 7.12876e-07, 2.02672e-12, 9.85731e-18, - 6.72474e-01, 9.43381e-07, 2.68206e-12, 1.30448e-17, - 9.48552e-01, 1.33068e-06, 3.78319e-12, 1.84008e-17, - 1.41789e+00, 1.98912e-06, 5.65528e-12, 2.75074e-17, - 2.19503e+00, 3.07934e-06, 8.75500e-12, 4.25864e-17, - 3.46724e+00, 4.86415e-06, 1.38300e-11, 6.72794e-17, - 5.76869e+00, 8.09313e-06, 2.30131e-11, 1.11983e-16, - 1.17202e+01, 1.64442e-05, 4.67706e-11, 2.27727e-16, - 3.16486e+01, 4.44090e-05, 1.26336e-10, 6.15454e-16, - 8.68419e+01, 1.21859e-04, 3.46686e-10, 1.68908e-15, - 1.92333e+02, 2.69887e-04, 7.67805e-10, 3.74058e-15, - 3.36287e+02, 4.71894e-04, 1.34247e-09, 6.53939e-15, - 5.05924e+02, 7.09951e-04, 2.01945e-09, 9.83185e-15, - 7.20787e+02, 1.01144e-03, 2.87594e-09, 1.39829e-14, - 9.77602e+02, 1.37169e-03, 3.89813e-09, 1.89179e-14, - 1.18669e+03, 1.66488e-03, 4.72879e-09, 2.29108e-14, - 1.23874e+03, 1.73774e-03, 4.93372e-09, 2.38742e-14, - 1.11204e+03, 1.55988e-03, 4.42750e-09, 2.14067e-14, - 8.76525e+02, 1.22945e-03, 3.48896e-09, 1.68597e-14, - 6.22287e+02, 8.72816e-04, 2.47658e-09, 1.19634e-14, - 4.07334e+02, 5.71310e-04, 1.62094e-09, 7.82836e-15, - 2.50598e+02, 3.51474e-04, 9.97166e-10, 4.81513e-15, - 1.47088e+02, 2.06293e-04, 5.85254e-10, 2.82583e-15, - 8.33219e+01, 1.16862e-04, 3.31541e-10, 1.60077e-15, - 4.59660e+01, 6.44731e-05, 1.82924e-10, 8.83269e-16 }; - - double C20_kpMgO[] = - { 2.25389e-04, 2.91423e-10, 2.39426e-15, 3.55346e-20, - 4.04967e-04, 5.23622e-10, 4.30206e-15, 6.38511e-20, - 6.31042e-04, 8.15942e-10, 6.70384e-15, 9.94996e-20, - 9.15653e-04, 1.18395e-09, 9.72751e-15, 1.44378e-19, - 1.52197e-03, 1.96795e-09, 1.61693e-14, 2.39993e-19, - 2.37407e-03, 3.06977e-09, 2.52225e-14, 3.74371e-19, - 3.77209e-03, 4.87751e-09, 4.00763e-14, 5.94853e-19, - 6.14348e-03, 7.94395e-09, 6.52733e-14, 9.68874e-19, - 1.01907e-02, 1.31776e-08, 1.08281e-13, 1.60732e-18, - 1.68897e-02, 2.18408e-08, 1.79477e-13, 2.66430e-18, - 2.96125e-02, 3.82967e-08, 3.14746e-13, 4.67293e-18, - 6.10610e-02, 7.89818e-08, 6.49304e-13, 9.64262e-18, - 1.43400e-01, 1.85524e-07, 1.52569e-12, 2.26652e-17, - 3.27383e-01, 4.23645e-07, 3.48510e-12, 5.17901e-17, - 6.39452e-01, 8.27698e-07, 6.81196e-12, 1.01271e-16, - 1.05149e+00, 1.36261e-06, 1.12352e-11, 1.67335e-16, - 1.55882e+00, 2.03505e-06, 1.69775e-11, 2.55740e-16, - 2.94474e+00, 3.91135e-06, 3.34978e-11, 5.17225e-16, - 1.32877e+01, 1.75173e-05, 1.48167e-10, 2.26035e-15, - 7.10035e+01, 9.20831e-05, 7.58876e-10, 1.12902e-14, - 2.54672e+02, 3.27285e-04, 2.65806e-09, 3.89823e-14, - 5.99878e+02, 7.67225e-04, 6.18279e-09, 8.99815e-14, - 9.93398e+02, 1.26701e-03, 1.01648e-08, 1.47279e-13, - 1.24125e+03, 1.58042e-03, 1.26439e-08, 1.82695e-13, - 1.24435e+03, 1.58257e-03, 1.26385e-08, 1.82292e-13, - 1.05321e+03, 1.33853e-03, 1.06770e-08, 1.53820e-13, - 7.84243e+02, 9.96171e-04, 7.93973e-09, 1.14294e-13, - 5.30434e+02, 6.73540e-04, 5.36536e-09, 7.71941e-14, - 3.33897e+02, 4.23882e-04, 3.37536e-09, 4.85451e-14, - 1.99187e+02, 2.52825e-04, 2.01271e-09, 2.89397e-14, - 1.14133e+02, 1.44851e-04, 1.15293e-09, 1.65742e-14, - 6.34329e+01, 8.04978e-05, 6.40626e-10, 9.20833e-15, - 3.44484e+01, 4.37133e-05, 3.47851e-10, 4.99954e-15, - 1.83799e+01, 2.33224e-05, 1.85579e-10, 2.66709e-15, - 9.67434e+00, 1.22756e-05, 9.76752e-11, 1.40372e-15 }; - - double C20_kpFeS[] = - { 5.18099e-02, 8.75057e-08, 1.64042e-13, 3.48481e-19, - 9.98914e-02, 1.68714e-07, 3.16278e-13, 6.71882e-19, - 1.60422e-01, 2.70949e-07, 5.07932e-13, 1.07902e-18, - 2.36626e-01, 3.99656e-07, 7.49210e-13, 1.59157e-18, - 3.67294e-01, 6.20351e-07, 1.16293e-12, 2.47046e-18, - 5.36239e-01, 9.05695e-07, 1.69785e-12, 3.60681e-18, - 7.64225e-01, 1.29076e-06, 2.41970e-12, 5.14028e-18, - 1.04974e+00, 1.77298e-06, 3.32371e-12, 7.06072e-18, - 1.38085e+00, 2.33223e-06, 4.37210e-12, 9.28786e-18, - 1.74382e+00, 2.94529e-06, 5.52140e-12, 1.17294e-17, - 2.10325e+00, 3.55236e-06, 6.65945e-12, 1.41471e-17, - 2.42167e+00, 4.09020e-06, 7.66778e-12, 1.62893e-17, - 2.66848e+00, 4.50708e-06, 8.44938e-12, 1.79499e-17, - 2.81672e+00, 4.75754e-06, 8.91905e-12, 1.89480e-17, - 2.89933e+00, 4.89720e-06, 9.18118e-12, 1.95057e-17, - 3.08200e+00, 5.20610e-06, 9.76116e-12, 2.07399e-17, - 3.69875e+00, 6.24871e-06, 1.17179e-11, 2.49020e-17, - 5.06356e+00, 8.55561e-06, 1.60466e-11, 3.41079e-17, - 7.08905e+00, 1.19792e-05, 2.24709e-11, 4.77704e-17, - 9.21663e+00, 1.55761e-05, 2.92218e-11, 6.21311e-17, - 1.08429e+01, 1.83272e-05, 3.43894e-11, 7.31341e-17, - 1.17217e+01, 1.98178e-05, 3.71989e-11, 7.91392e-17, - 1.19809e+01, 2.02656e-05, 3.80618e-11, 8.10292e-17, - 1.18982e+01, 2.01424e-05, 3.78698e-11, 8.07160e-17, - 1.17194e+01, 1.98680e-05, 3.74208e-11, 7.99219e-17, - 1.16101e+01, 1.97358e-05, 3.72971e-11, 7.99631e-17, - 1.19784e+01, 2.05514e-05, 3.92888e-11, 8.53362e-17, - 1.49136e+01, 2.65380e-05, 5.30405e-11, 1.20988e-16, - 2.57980e+01, 4.84122e-05, 1.02966e-10, 2.50769e-16, - 6.12919e+01, 1.18083e-04, 2.58706e-10, 6.49359e-16, - 1.55902e+02, 3.00837e-04, 6.60279e-10, 1.66030e-15, - 3.47036e+02, 6.65409e-04, 1.45009e-09, 3.62025e-15, - 6.57260e+02, 1.25056e-03, 2.70176e-09, 6.68619e-15, - 1.09327e+03, 2.06455e-03, 4.42254e-09, 1.08501e-14, - 1.65394e+03, 3.10062e-03, 6.58692e-09, 1.60229e-14 }; - - double C20_kpAl2O3[] = - { 9.93250e-04, 9.14846e-11, 8.97410e-18, 9.30612e-25, - 1.81240e-03, 1.66933e-10, 1.63752e-17, 1.69810e-24, - 2.84365e-03, 2.61918e-10, 2.56926e-17, 2.66432e-24, - 4.14191e-03, 3.81496e-10, 3.74225e-17, 3.88071e-24, - 7.18271e-03, 6.61573e-10, 6.48964e-17, 6.72974e-24, - 1.13364e-02, 1.04415e-09, 1.02425e-16, 1.06215e-23, - 1.77361e-02, 1.63360e-09, 1.60247e-16, 1.66176e-23, - 2.59477e-02, 2.38995e-09, 2.34440e-16, 2.43114e-23, - 3.45425e-02, 3.18159e-09, 3.12095e-16, 3.23642e-23, - 4.22006e-02, 3.88695e-09, 3.81286e-16, 3.95393e-23, - 4.71420e-02, 4.34208e-09, 4.25932e-16, 4.41691e-23, - 4.91934e-02, 4.53102e-09, 4.44466e-16, 4.60911e-23, - 5.05162e-02, 4.65286e-09, 4.56418e-16, 4.73304e-23, - 5.78201e-02, 5.32560e-09, 5.22410e-16, 5.41738e-23, - 8.84237e-02, 8.14438e-09, 7.98916e-16, 8.28474e-23, - 1.78786e-01, 1.64673e-08, 1.61535e-15, 1.67511e-22, - 4.36404e-01, 4.01956e-08, 3.94295e-15, 4.08884e-22, - 1.63796e+00, 1.50867e-07, 1.47992e-14, 1.53467e-21, - 8.50819e+00, 7.83659e-07, 7.68723e-14, 7.97165e-21, - 3.92751e+01, 3.61749e-06, 3.54854e-13, 3.67984e-20, - 1.41439e+02, 1.30275e-05, 1.27792e-12, 1.32520e-19, - 3.83709e+02, 3.53420e-05, 3.46684e-12, 3.59511e-19, - 7.70411e+02, 7.09598e-05, 6.96073e-12, 7.21827e-19, - 1.16399e+03, 1.07211e-04, 1.05167e-11, 1.09058e-18, - 1.37566e+03, 1.26707e-04, 1.24292e-11, 1.28891e-18, - 1.33070e+03, 1.22566e-04, 1.20230e-11, 1.24678e-18, - 1.09978e+03, 1.01297e-04, 9.93663e-12, 1.03043e-18, - 8.05638e+02, 7.42044e-05, 7.27901e-12, 7.54832e-19, - 5.38690e+02, 4.96167e-05, 4.86711e-12, 5.04718e-19, - 3.36338e+02, 3.09789e-05, 3.03884e-12, 3.15127e-19, - 1.99460e+02, 1.83715e-05, 1.80214e-12, 1.86881e-19, - 1.13787e+02, 1.04805e-05, 1.02808e-12, 1.06611e-19, - 6.30411e+01, 5.80648e-06, 5.69582e-13, 5.90655e-20, - 3.41529e+01, 3.14570e-06, 3.08575e-13, 3.19991e-20, - 1.81893e+01, 1.67535e-06, 1.64342e-13, 1.70422e-20 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab0] = C20_kpSiM [itab]; - my_rates->SN0_kpFeM [itab0] = C20_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = C20_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = C20_kpMgSiO3 [itab]; - my_rates->SN0_kpAC [itab0] = C20_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = C20_kpSiO2D [itab]; - my_rates->SN0_kpMgO [itab0] = C20_kpMgO [itab]; - my_rates->SN0_kpFeS [itab0] = C20_kpFeS [itab]; - my_rates->SN0_kpAl2O3 [itab0] = C20_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_C25(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 3.83373e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 4.88366e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.68068e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.49736e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 4.13961e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.46546e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.09289e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 3.77935e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 1.65550e-31; - - itab0 = 3 * iSN; - my_rates->SN0_r0SiM [itab0 + 0] = 1.72153e-05; - my_rates->SN0_r0FeM [itab0 + 0] = 1.96666e-05; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 2.33213e-06; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 1.55439e-06; - my_rates->SN0_r0AC [itab0 + 0] = 7.93494e-07; - my_rates->SN0_r0SiO2D [itab0 + 0] = 2.56804e-06; - my_rates->SN0_r0MgO [itab0 + 0] = 3.58420e-06; - my_rates->SN0_r0FeS [itab0 + 0] = 9.61035e-07; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 1.99526e-08; - - my_rates->SN0_r0SiM [itab0 + 1] = 6.33208e-10; - my_rates->SN0_r0FeM [itab0 + 1] = 5.88305e-10; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 2.48648e-11; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 4.30058e-12; - my_rates->SN0_r0AC [itab0 + 1] = 3.53402e-12; - my_rates->SN0_r0SiO2D [itab0 + 1] = 4.82971e-11; - my_rates->SN0_r0MgO [itab0 + 1] = 3.09713e-11; - my_rates->SN0_r0FeS [itab0 + 1] = 2.46507e-12; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 3.98107e-16; - - my_rates->SN0_r0SiM [itab0 + 2] = 4.04318e-14; - my_rates->SN0_r0FeM [itab0 + 2] = 2.42323e-14; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 4.29427e-16; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 1.92568e-17; - my_rates->SN0_r0AC [itab0 + 2] = 1.04050e-16; - my_rates->SN0_r0SiO2D [itab0 + 2] = 2.53766e-15; - my_rates->SN0_r0MgO [itab0 + 2] = 4.03929e-16; - my_rates->SN0_r0FeS [itab0 + 2] = 1.42549e-17; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 7.94328e-24; - - NTd = 35; - Nmom = 4; - - double C25_kpSiM[] = - { 1.53307e-01, 2.58151e-06, 8.97185e-11, 5.13410e-15, - 1.93187e-01, 3.26103e-06, 1.14053e-10, 6.60852e-15, - 2.43381e-01, 4.11484e-06, 1.44443e-10, 8.42753e-15, - 3.06566e-01, 5.18903e-06, 1.82603e-10, 1.07022e-14, - 3.86268e-01, 6.55217e-06, 2.31853e-10, 1.37374e-14, - 4.86630e-01, 8.26891e-06, 2.93869e-10, 1.75576e-14, - 6.13093e-01, 1.04376e-05, 3.72751e-10, 2.24815e-14, - 7.72441e-01, 1.31779e-05, 4.73205e-10, 2.88483e-14, - 9.72908e-01, 1.66348e-05, 6.00927e-10, 3.70670e-14, - 1.22279e+00, 2.09532e-05, 7.61455e-10, 4.75186e-14, - 1.51967e+00, 2.61010e-05, 9.54694e-10, 6.03376e-14, - 1.83660e+00, 3.16418e-05, 1.16836e-09, 7.52509e-14, - 2.15883e+00, 3.73832e-05, 1.40366e-09, 9.34936e-14, - 2.56188e+00, 4.46730e-05, 1.71564e-09, 1.19386e-13, - 3.24331e+00, 5.69556e-05, 2.23297e-09, 1.61351e-13, - 4.36192e+00, 7.70449e-05, 3.06366e-09, 2.26659e-13, - 5.87089e+00, 1.04185e-04, 4.17746e-09, 3.12654e-13, - 7.58000e+00, 1.35161e-04, 5.44737e-09, 4.09330e-13, - 9.38530e+00, 1.68565e-04, 6.82760e-09, 5.12932e-13, - 1.15371e+01, 2.10285e-04, 8.59830e-09, 6.44799e-13, - 1.47388e+01, 2.75860e-04, 1.14755e-08, 8.58985e-13, - 1.93877e+01, 3.75887e-04, 1.59953e-08, 1.19600e-12, - 2.46008e+01, 5.00971e-04, 2.20360e-08, 1.65571e-12, - 2.90408e+01, 6.45456e-04, 3.01610e-08, 2.31085e-12, - 3.23701e+01, 8.27330e-04, 4.23216e-08, 3.35508e-12, - 3.49305e+01, 1.05238e-03, 5.92405e-08, 4.87268e-12, - 3.68020e+01, 1.28200e-03, 7.79075e-08, 6.59988e-12, - 3.76194e+01, 1.45174e-03, 9.27975e-08, 8.01634e-12, - 3.72617e+01, 1.52446e-03, 1.00177e-07, 8.74632e-12, - 3.76576e+01, 1.55784e-03, 1.02687e-07, 8.96074e-12, - 4.91245e+01, 1.84545e-03, 1.14505e-07, 9.64022e-12, - 1.17100e+02, 3.32870e-03, 1.70057e-07, 1.27411e-11, - 3.93519e+02, 8.31574e-03, 3.27938e-07, 2.07522e-11, - 1.23314e+03, 2.12665e-02, 6.72506e-07, 3.61691e-11, - 3.12736e+03, 4.71942e-02, 1.26825e-06, 5.97225e-11 }; - - double C25_kpFeM[] = - { 7.05387e-02, 2.70513e-06, 1.33741e-10, 7.96280e-15, - 1.06564e-01, 3.93018e-06, 1.88633e-10, 1.09924e-14, - 1.50619e-01, 5.42584e-06, 2.55756e-10, 1.47090e-14, - 2.05371e-01, 7.28371e-06, 3.39206e-10, 1.93364e-14, - 2.90528e-01, 9.90213e-06, 4.47050e-10, 2.49139e-14, - 3.98319e-01, 1.31460e-05, 5.78557e-10, 3.16454e-14, - 5.44029e-01, 1.73143e-05, 7.40062e-10, 3.96165e-14, - 7.41852e-01, 2.27123e-05, 9.40496e-10, 4.91736e-14, - 1.01111e+00, 2.97427e-05, 1.19128e-09, 6.07485e-14, - 1.37135e+00, 3.87934e-05, 1.50307e-09, 7.47433e-14, - 1.85427e+00, 5.04362e-05, 1.88890e-09, 9.15116e-14, - 2.48538e+00, 6.50566e-05, 2.35529e-09, 1.11141e-13, - 3.28338e+00, 8.28882e-05, 2.90473e-09, 1.33599e-13, - 4.26495e+00, 1.04109e-04, 3.53805e-09, 1.58791e-13, - 5.44209e+00, 1.28847e-04, 4.25649e-09, 1.86722e-13, - 6.82357e+00, 1.57201e-04, 5.06195e-09, 2.17471e-13, - 8.41130e+00, 1.89169e-04, 5.95453e-09, 2.51081e-13, - 1.02033e+01, 2.24714e-04, 6.93482e-09, 2.87663e-13, - 1.22164e+01, 2.64256e-04, 8.01879e-09, 3.27999e-13, - 1.45282e+01, 3.09507e-04, 9.26157e-09, 3.74467e-13, - 1.73262e+01, 3.64447e-04, 1.07851e-08, 4.32120e-13, - 2.09720e+01, 4.36715e-04, 1.28220e-08, 5.10543e-13, - 2.61035e+01, 5.39852e-04, 1.57872e-08, 6.26923e-13, - 3.37725e+01, 6.96147e-04, 2.03646e-08, 8.09666e-13, - 4.55764e+01, 9.38083e-04, 2.75201e-08, 1.09797e-12, - 6.37992e+01, 1.30793e-03, 3.84014e-08, 1.53493e-12, - 9.17796e+01, 1.86084e-03, 5.43135e-08, 2.16276e-12, - 1.34749e+02, 2.67751e-03, 7.69998e-08, 3.03160e-12, - 2.01156e+02, 3.88432e-03, 1.09109e-07, 4.21570e-12, - 3.04328e+02, 5.67395e-03, 1.54550e-07, 5.82179e-12, - 4.64551e+02, 8.32593e-03, 2.18657e-07, 7.98599e-12, - 7.11390e+02, 1.22244e-02, 3.08194e-07, 1.08633e-11, - 1.08442e+03, 1.78487e-02, 4.30797e-07, 1.46043e-11, - 1.62442e+03, 2.56300e-02, 5.92006e-07, 1.92777e-11, - 2.34943e+03, 3.56242e-02, 7.89629e-07, 2.47479e-11 }; - - double C25_kpMg2SiO4[] = - { 1.05240e-01, 2.45433e-07, 2.61677e-12, 4.51929e-17, - 1.32588e-01, 3.09211e-07, 3.29676e-12, 5.69367e-17, - 1.67016e-01, 3.89504e-07, 4.15283e-12, 7.17213e-17, - 2.10360e-01, 4.90585e-07, 5.23055e-12, 9.03341e-17, - 2.71887e-01, 6.34079e-07, 6.76050e-12, 1.16758e-16, - 3.55694e-01, 8.29533e-07, 8.84446e-12, 1.52750e-16, - 4.84933e-01, 1.13094e-06, 1.20582e-11, 2.08253e-16, - 6.99770e-01, 1.63200e-06, 1.74006e-11, 3.00524e-16, - 1.05860e+00, 2.46891e-06, 2.63246e-11, 4.54655e-16, - 1.62903e+00, 3.79938e-06, 4.05116e-11, 6.99697e-16, - 2.54264e+00, 5.93041e-06, 6.32372e-11, 1.09224e-15, - 3.96499e+00, 9.24857e-06, 9.86269e-11, 1.70359e-15, - 6.10655e+00, 1.42452e-05, 1.51927e-10, 2.62446e-15, - 9.28824e+00, 2.16706e-05, 2.31158e-10, 3.99359e-15, - 1.39278e+01, 3.25027e-05, 3.46790e-10, 5.99240e-15, - 2.05413e+01, 4.79530e-05, 5.11839e-10, 8.84697e-15, - 3.00722e+01, 7.02477e-05, 7.50339e-10, 1.29761e-14, - 4.55290e+01, 1.06478e-04, 1.13881e-09, 1.97131e-14, - 7.48333e+01, 1.75301e-04, 1.87829e-09, 3.25565e-14, - 1.29734e+02, 3.04341e-04, 3.26603e-09, 5.66753e-14, - 2.15039e+02, 5.04949e-04, 5.42460e-09, 9.42056e-14, - 3.20373e+02, 7.52945e-04, 8.09632e-09, 1.40698e-13, - 4.30336e+02, 1.01240e-03, 1.08979e-08, 1.89530e-13, - 5.31620e+02, 1.25190e-03, 1.34895e-08, 2.34771e-13, - 6.00659e+02, 1.41538e-03, 1.52608e-08, 2.65718e-13, - 6.07548e+02, 1.43203e-03, 1.54444e-08, 2.68965e-13, - 5.44184e+02, 1.28282e-03, 1.38365e-08, 2.40975e-13, - 4.34292e+02, 1.02387e-03, 1.10444e-08, 1.92359e-13, - 3.13872e+02, 7.40120e-04, 7.98523e-09, 1.39097e-13, - 2.09392e+02, 4.93970e-04, 5.33184e-09, 9.29066e-14, - 1.31415e+02, 3.10355e-04, 3.35361e-09, 5.84810e-14, - 7.92901e+01, 1.87957e-04, 2.03808e-09, 3.56245e-14, - 4.76038e+01, 1.14252e-04, 1.25235e-09, 2.20472e-14, - 3.00283e+01, 7.42825e-05, 8.34278e-10, 1.49154e-14, - 2.10539e+01, 5.48540e-05, 6.37875e-10, 1.16338e-14 }; - - double C25_kpMgSiO3[] = - { 2.19890e-02, 3.41795e-08, 9.45655e-14, 4.23439e-19, - 3.90612e-02, 6.07164e-08, 1.67986e-13, 7.52197e-19, - 6.05539e-02, 9.41245e-08, 2.60417e-13, 1.16608e-18, - 8.76116e-02, 1.36183e-07, 3.76781e-13, 1.68713e-18, - 1.43288e-01, 2.22725e-07, 6.16221e-13, 2.75928e-18, - 2.19266e-01, 3.40825e-07, 9.42974e-13, 4.22240e-18, - 3.36256e-01, 5.22673e-07, 1.44610e-12, 6.47526e-18, - 5.14336e-01, 7.99479e-07, 2.21195e-12, 9.90458e-18, - 7.97217e-01, 1.23919e-06, 3.42851e-12, 1.53521e-17, - 1.25414e+00, 1.94943e-06, 5.39358e-12, 2.41515e-17, - 2.03450e+00, 3.16241e-06, 8.74964e-12, 3.91798e-17, - 3.34649e+00, 5.20178e-06, 1.43922e-11, 6.44481e-17, - 5.45897e+00, 8.48547e-06, 2.34778e-11, 1.05137e-16, - 8.82126e+00, 1.37119e-05, 3.79391e-11, 1.69905e-16, - 1.41827e+01, 2.20461e-05, 6.10001e-11, 2.73202e-16, - 2.28425e+01, 3.55077e-05, 9.82519e-11, 4.40095e-16, - 3.71193e+01, 5.77019e-05, 1.59676e-10, 7.15351e-16, - 6.14319e+01, 9.54994e-05, 2.64297e-10, 1.18434e-15, - 1.03856e+02, 1.61458e-04, 4.46893e-10, 2.00314e-15, - 1.75529e+02, 2.72897e-04, 7.55426e-10, 3.38696e-15, - 2.82103e+02, 4.38604e-04, 1.21423e-09, 5.44494e-15, - 4.14591e+02, 6.44612e-04, 1.78465e-09, 8.00387e-15, - 5.60087e+02, 8.70868e-04, 2.41120e-09, 1.08148e-14, - 7.11212e+02, 1.10590e-03, 3.06203e-09, 1.37338e-14, - 8.41053e+02, 1.30782e-03, 3.62100e-09, 1.62382e-14, - 8.95593e+02, 1.39263e-03, 3.85557e-09, 1.72860e-14, - 8.40674e+02, 1.30722e-03, 3.61884e-09, 1.62210e-14, - 6.96909e+02, 1.08365e-03, 2.99976e-09, 1.34436e-14, - 5.18364e+02, 8.06018e-04, 2.23111e-09, 9.99751e-15, - 3.52974e+02, 5.48846e-04, 1.51920e-09, 6.80696e-15, - 2.24287e+02, 3.48752e-04, 9.65345e-10, 4.32526e-15, - 1.35182e+02, 2.10204e-04, 5.81862e-10, 2.60719e-15, - 7.83444e+01, 1.21833e-04, 3.37284e-10, 1.51159e-15, - 4.41840e+01, 6.87277e-05, 1.90332e-10, 8.53442e-16, - 2.46537e+01, 3.84248e-05, 1.06643e-10, 4.79266e-16 }; - - double C25_kpAC[] = - { 3.27960e-01, 2.60233e-07, 1.15896e-12, 3.41207e-17, - 4.38752e-01, 3.48153e-07, 1.55085e-12, 4.56711e-17, - 5.78230e-01, 4.58837e-07, 2.04421e-12, 6.02121e-17, - 7.53824e-01, 5.98180e-07, 2.66530e-12, 7.85179e-17, - 1.04013e+00, 8.25404e-07, 3.67884e-12, 1.08416e-16, - 1.41735e+00, 1.12479e-06, 5.01451e-12, 1.47828e-16, - 1.95293e+00, 1.54986e-06, 6.91189e-12, 2.03855e-16, - 2.71532e+00, 2.15499e-06, 9.61533e-12, 2.83773e-16, - 3.79678e+00, 3.01350e-06, 1.34554e-11, 3.97470e-16, - 5.29747e+00, 4.20498e-06, 1.87919e-11, 5.55745e-16, - 7.37842e+00, 5.85746e-06, 2.62073e-11, 7.76231e-16, - 1.02169e+01, 8.11222e-06, 3.63532e-11, 1.07888e-15, - 1.40424e+01, 1.11520e-05, 5.00793e-11, 1.48986e-15, - 1.92027e+01, 1.52549e-05, 6.86959e-11, 2.04983e-15, - 2.61627e+01, 2.07929e-05, 9.39920e-11, 2.81528e-15, - 3.55327e+01, 2.82565e-05, 1.28407e-10, 3.86530e-15, - 4.81650e+01, 3.83349e-05, 1.75518e-10, 5.31971e-15, - 6.53244e+01, 5.20561e-05, 2.40904e-10, 7.37173e-15, - 8.87808e+01, 7.08733e-05, 3.33003e-10, 1.03268e-14, - 1.20733e+02, 9.66248e-05, 4.63924e-10, 1.46567e-14, - 1.63674e+02, 1.31491e-04, 6.51645e-10, 2.11366e-14, - 2.20677e+02, 1.78321e-04, 9.26445e-10, 3.11929e-14, - 2.96305e+02, 2.41503e-04, 1.34108e-09, 4.74137e-14, - 3.97405e+02, 3.27522e-04, 1.97072e-09, 7.35006e-14, - 5.32189e+02, 4.43695e-04, 2.88200e-09, 1.12542e-13, - 7.08046e+02, 5.95675e-04, 4.08283e-09, 1.64175e-13, - 9.32526e+02, 7.88039e-04, 5.50980e-09, 2.23600e-13, - 1.21879e+03, 1.02941e-03, 7.08050e-09, 2.84124e-13, - 1.59074e+03, 1.33766e-03, 8.76094e-09, 3.40697e-13, - 2.08510e+03, 1.74270e-03, 1.05986e-08, 3.91613e-13, - 2.75362e+03, 2.28917e-03, 1.27282e-08, 4.38283e-13, - 3.66839e+03, 3.04259e-03, 1.53805e-08, 4.84412e-13, - 4.93379e+03, 4.10065e-03, 1.89004e-08, 5.35144e-13, - 6.70658e+03, 5.60645e-03, 2.37440e-08, 5.95776e-13, - 9.22668e+03, 7.75494e-03, 3.03854e-08, 6.69355e-13 }; - - double C25_kpSiO2D[] = - { 7.60344e-02, 1.95196e-07, 3.66716e-12, 1.92423e-16, - 9.07191e-02, 2.32906e-07, 4.37632e-12, 2.29682e-16, - 1.09206e-01, 2.80380e-07, 5.26909e-12, 2.76586e-16, - 1.32480e-01, 3.40146e-07, 6.39301e-12, 3.35635e-16, - 1.58906e-01, 4.08019e-07, 7.66999e-12, 4.02759e-16, - 1.91564e-01, 4.91897e-07, 9.24810e-12, 4.85715e-16, - 2.30489e-01, 5.91872e-07, 1.11292e-11, 5.84611e-16, - 2.76795e-01, 7.10808e-07, 1.33674e-11, 7.02310e-16, - 3.33075e-01, 8.55378e-07, 1.60886e-11, 8.45443e-16, - 4.05328e-01, 1.04100e-06, 1.95833e-11, 1.02932e-15, - 5.08167e-01, 1.30521e-06, 2.45600e-11, 1.29133e-15, - 6.72485e-01, 1.72749e-06, 3.25210e-11, 1.71095e-15, - 9.48580e-01, 2.43730e-06, 4.59219e-11, 2.41877e-15, - 1.41796e+00, 3.64482e-06, 6.87751e-11, 3.63027e-15, - 2.19521e+00, 5.64613e-06, 1.06783e-10, 5.65494e-15, - 3.46773e+00, 8.92808e-06, 1.69393e-10, 9.00627e-15, - 5.77034e+00, 1.48887e-05, 2.83967e-10, 1.51653e-14, - 1.17273e+01, 3.03917e-05, 5.84644e-10, 3.13500e-14, - 3.16762e+01, 8.23694e-05, 1.59258e-09, 8.53491e-14, - 8.69213e+01, 2.26080e-04, 4.36458e-09, 2.32841e-13, - 1.92500e+02, 5.00291e-04, 9.62913e-09, 5.11437e-13, - 3.36556e+02, 8.73556e-04, 1.67531e-08, 8.86507e-13, - 5.06180e+02, 1.30807e-03, 2.48422e-08, 1.30609e-12, - 7.20631e+02, 1.84289e-03, 3.42245e-08, 1.77586e-12, - 9.76452e+02, 2.46285e-03, 4.43878e-08, 2.26306e-12, - 1.18428e+03, 2.95079e-03, 5.17620e-08, 2.59653e-12, - 1.23545e+03, 3.05120e-03, 5.24657e-08, 2.59989e-12, - 1.10864e+03, 2.72192e-03, 4.61791e-08, 2.26949e-12, - 8.73605e+02, 2.13674e-03, 3.59368e-08, 1.75670e-12, - 6.20107e+02, 1.51303e-03, 2.53058e-08, 1.23288e-12, - 4.05864e+02, 9.88756e-04, 1.64791e-08, 8.01183e-13, - 2.49677e+02, 6.07668e-04, 1.01055e-08, 4.90701e-13, - 1.46540e+02, 3.56444e-04, 5.92003e-09, 2.87265e-13, - 8.30108e+01, 2.01877e-04, 3.35130e-09, 1.62587e-13, - 4.57957e+01, 1.11407e-04, 1.85045e-09, 8.98118e-14 }; - - double C25_kpMgO[] = - { 2.25388e-04, 8.07807e-10, 6.97998e-15, 9.10286e-20, - 4.04965e-04, 1.45145e-09, 1.25417e-14, 1.63564e-19, - 6.31040e-04, 2.26174e-09, 1.95435e-14, 2.54881e-19, - 9.15651e-04, 3.28184e-09, 2.83582e-14, 3.69842e-19, - 1.52197e-03, 5.45504e-09, 4.71373e-14, 6.14765e-19, - 2.37408e-03, 8.50921e-09, 7.35292e-14, 9.58978e-19, - 3.77210e-03, 1.35201e-08, 1.16831e-13, 1.52374e-18, - 6.14351e-03, 2.20201e-08, 1.90284e-13, 2.48178e-18, - 1.01908e-02, 3.65275e-08, 3.15657e-13, 4.11707e-18, - 1.68899e-02, 6.05411e-08, 5.23195e-13, 6.82425e-18, - 2.96134e-02, 1.06156e-07, 9.17483e-13, 1.19682e-17, - 6.10648e-02, 2.18932e-07, 1.89256e-12, 2.46925e-17, - 1.43413e-01, 5.14257e-07, 4.44656e-12, 5.80289e-17, - 3.27427e-01, 1.17431e-06, 1.01561e-11, 1.32572e-16, - 6.39567e-01, 2.29431e-06, 1.98486e-11, 2.59169e-16, - 1.05188e+00, 3.77698e-06, 3.27186e-11, 4.27780e-16, - 1.56137e+00, 5.64036e-06, 4.92651e-11, 6.49403e-16, - 2.95878e+00, 1.08379e-05, 9.64135e-11, 1.29373e-15, - 1.33369e+01, 4.85546e-05, 4.28194e-10, 5.69626e-15, - 7.10715e+01, 2.55311e-04, 2.21076e-09, 2.88829e-14, - 2.54519e+02, 9.07495e-04, 7.77715e-09, 1.00557e-13, - 5.99024e+02, 2.12736e-03, 1.81309e-08, 2.33128e-13, - 9.91502e+02, 3.51313e-03, 2.98462e-08, 3.82528e-13, - 1.23853e+03, 4.38206e-03, 3.71546e-08, 4.75243e-13, - 1.24134e+03, 4.38799e-03, 3.71575e-08, 4.74666e-13, - 1.05053e+03, 3.71132e-03, 3.14012e-08, 4.00789e-13, - 7.82169e+02, 2.76204e-03, 2.33559e-08, 2.97932e-13, - 5.28995e+02, 1.86748e-03, 1.57854e-08, 2.01282e-13, - 3.32978e+02, 1.17527e-03, 9.93166e-09, 1.26606e-13, - 1.98632e+02, 7.00988e-04, 5.92262e-09, 7.54858e-14, - 1.13813e+02, 4.01617e-04, 3.39280e-09, 4.32365e-14, - 6.32536e+01, 2.23189e-04, 1.88528e-09, 2.40230e-14, - 3.43507e+01, 1.21200e-04, 1.02371e-09, 1.30436e-14, - 1.83277e+01, 6.46641e-05, 5.46160e-10, 6.95860e-15, - 9.64683e+00, 3.40355e-05, 2.87461e-10, 3.66245e-15 }; - - double C25_kpFeS[] = - { 5.18089e-02, 4.97944e-08, 1.27767e-13, 7.39409e-19, - 9.98898e-02, 9.60047e-08, 2.46329e-13, 1.42543e-18, - 1.60420e-01, 1.54180e-07, 3.95589e-13, 2.28909e-18, - 2.36623e-01, 2.27418e-07, 5.83496e-13, 3.37637e-18, - 3.67289e-01, 3.53003e-07, 9.05730e-13, 5.24118e-18, - 5.36230e-01, 5.15376e-07, 1.32237e-12, 7.65247e-18, - 7.64209e-01, 7.34494e-07, 1.88465e-12, 1.09071e-17, - 1.04972e+00, 1.00891e-06, 2.58893e-12, 1.49849e-17, - 1.38083e+00, 1.32717e-06, 3.40583e-12, 1.97167e-17, - 1.74377e+00, 1.67607e-06, 4.30174e-12, 2.49099e-17, - 2.10317e+00, 2.02159e-06, 5.18938e-12, 3.00615e-17, - 2.42155e+00, 2.32777e-06, 5.97696e-12, 3.46445e-17, - 2.66826e+00, 2.56519e-06, 6.58920e-12, 3.82277e-17, - 2.81642e+00, 2.70807e-06, 6.96112e-12, 4.04503e-17, - 2.89877e+00, 2.78835e-06, 7.17920e-12, 4.18739e-17, - 3.08081e+00, 2.96627e-06, 7.66777e-12, 4.51307e-17, - 3.69596e+00, 3.56434e-06, 9.27486e-12, 5.54010e-17, - 5.05776e+00, 4.88601e-06, 1.28025e-11, 7.76522e-17, - 7.07898e+00, 6.85096e-06, 1.80991e-11, 1.11855e-16, - 9.20178e+00, 8.93168e-06, 2.39573e-11, 1.53397e-16, - 1.08226e+01, 1.05533e-05, 2.89938e-11, 1.96013e-16, - 1.16924e+01, 1.14675e-05, 3.24020e-11, 2.32497e-16, - 1.19355e+01, 1.17825e-05, 3.42098e-11, 2.58640e-16, - 1.18230e+01, 1.17613e-05, 3.49907e-11, 2.75275e-16, - 1.15929e+01, 1.16487e-05, 3.54453e-11, 2.86649e-16, - 1.13868e+01, 1.16310e-05, 3.63433e-11, 2.99851e-16, - 1.14199e+01, 1.23167e-05, 4.12834e-11, 3.50696e-16, - 1.29371e+01, 1.75436e-05, 7.43145e-11, 6.75730e-16, - 2.05440e+01, 3.98903e-05, 2.16132e-10, 2.04334e-15, - 4.78755e+01, 1.10160e-04, 6.39249e-10, 5.90057e-15, - 1.21252e+02, 2.78758e-04, 1.57840e-09, 1.39121e-14, - 2.69644e+02, 5.88705e-04, 3.18490e-09, 2.68674e-14, - 5.11453e+02, 1.05406e-03, 5.44914e-09, 4.43131e-14, - 8.53209e+02, 1.66585e-03, 8.25940e-09, 6.51454e-14, - 1.29539e+03, 2.40455e-03, 1.14623e-08, 8.80401e-14 }; - - double C25_kpAl2O3[] = - { 9.93250e-04, 1.98179e-11, 3.95420e-19, 7.88967e-27, - 1.81240e-03, 3.61621e-11, 7.21529e-19, 1.43964e-26, - 2.84365e-03, 5.67382e-11, 1.13208e-18, 2.25879e-26, - 4.14191e-03, 8.26420e-11, 1.64892e-18, 3.29004e-26, - 7.18271e-03, 1.43314e-10, 2.85949e-18, 5.70543e-26, - 1.13364e-02, 2.26190e-10, 4.51309e-18, 9.00479e-26, - 1.77361e-02, 3.53881e-10, 7.06085e-18, 1.40883e-25, - 2.59477e-02, 5.17725e-10, 1.03300e-17, 2.06110e-25, - 3.45425e-02, 6.89214e-10, 1.37516e-17, 2.74381e-25, - 4.22006e-02, 8.42014e-10, 1.68004e-17, 3.35212e-25, - 4.71420e-02, 9.40607e-10, 1.87676e-17, 3.74462e-25, - 4.91934e-02, 9.81537e-10, 1.95842e-17, 3.90757e-25, - 5.05162e-02, 1.00793e-09, 2.01109e-17, 4.01264e-25, - 5.78201e-02, 1.15366e-09, 2.30186e-17, 4.59282e-25, - 8.84237e-02, 1.76428e-09, 3.52021e-17, 7.02374e-25, - 1.78786e-01, 3.56725e-09, 7.11761e-17, 1.42015e-24, - 4.36404e-01, 8.70740e-09, 1.73736e-16, 3.46648e-24, - 1.63796e+00, 3.26816e-08, 6.52083e-16, 1.30108e-23, - 8.50817e+00, 1.69760e-07, 3.38716e-15, 6.75828e-23, - 3.92751e+01, 7.83641e-07, 1.56357e-14, 3.11973e-22, - 1.41433e+02, 2.82196e-06, 5.63055e-14, 1.12344e-21, - 3.83709e+02, 7.65599e-06, 1.52757e-13, 3.04791e-21, - 7.70411e+02, 1.53717e-05, 3.06706e-13, 6.11959e-21, - 1.16399e+03, 2.32246e-05, 4.63392e-13, 9.24589e-21, - 1.37566e+03, 2.74481e-05, 5.47662e-13, 1.09273e-20, - 1.33070e+03, 2.65509e-05, 5.29761e-13, 1.05701e-20, - 1.09978e+03, 2.19435e-05, 4.37830e-13, 8.73585e-21, - 8.05638e+02, 1.60746e-05, 3.20730e-13, 6.39941e-21, - 5.38690e+02, 1.07483e-05, 2.14456e-13, 4.27897e-21, - 3.36338e+02, 6.71083e-06, 1.33899e-13, 2.67163e-21, - 1.99460e+02, 3.97975e-06, 7.94065e-14, 1.58437e-21, - 1.13787e+02, 2.27035e-06, 4.52995e-14, 9.03844e-22, - 6.30411e+01, 1.25784e-06, 2.50971e-14, 5.00753e-22, - 3.41529e+01, 6.81441e-07, 1.35965e-14, 2.71286e-22, - 1.81893e+01, 3.62924e-07, 7.24128e-15, 1.44483e-22 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab0] = C25_kpSiM [itab]; - my_rates->SN0_kpFeM [itab0] = C25_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = C25_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = C25_kpMgSiO3 [itab]; - my_rates->SN0_kpAC [itab0] = C25_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = C25_kpSiO2D [itab]; - my_rates->SN0_kpMgO [itab0] = C25_kpMgO [itab]; - my_rates->SN0_kpFeS [itab0] = C25_kpFeS [itab]; - my_rates->SN0_kpAl2O3 [itab0] = C25_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_C30(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 2.91389e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.93065e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 7.73041e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 4.17376e-06; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 6.19235e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 5.27016e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.33978e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = 4.51744e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 5.79251e-12; - - itab0 = 3 * iSN; - my_rates->SN0_r0SiM [itab0 + 0] = 2.56305e-05; - my_rates->SN0_r0FeM [itab0 + 0] = 2.05800e-05; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 4.70227e-07; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 1.02156e-06; - my_rates->SN0_r0AC [itab0 + 0] = 1.17005e-06; - my_rates->SN0_r0SiO2D [itab0 + 0] = 1.62875e-06; - my_rates->SN0_r0MgO [itab0 + 0] = 2.32229e-06; - my_rates->SN0_r0FeS [itab0 + 0] = 1.69769e-06; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 7.63588e-08; - - my_rates->SN0_r0SiM [itab0 + 1] = 1.02092e-09; - my_rates->SN0_r0FeM [itab0 + 1] = 5.92424e-10; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 6.29420e-13; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.31765e-12; - my_rates->SN0_r0AC [itab0 + 1] = 2.37154e-12; - my_rates->SN0_r0SiO2D [itab0 + 1] = 1.12314e-11; - my_rates->SN0_r0MgO [itab0 + 1] = 1.39783e-11; - my_rates->SN0_r0FeS [itab0 + 1] = 6.40794e-12; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 8.88224e-15; - - my_rates->SN0_r0SiM [itab0 + 2] = 5.78476e-14; - my_rates->SN0_r0FeM [itab0 + 2] = 2.26690e-14; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 1.71079e-18; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 2.63083e-18; - my_rates->SN0_r0AC [itab0 + 2] = 7.59875e-18; - my_rates->SN0_r0SiO2D [itab0 + 2] = 1.91031e-16; - my_rates->SN0_r0MgO [itab0 + 2] = 1.49800e-16; - my_rates->SN0_r0FeS [itab0 + 2] = 4.40126e-17; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 1.42247e-21; - - NTd = 35; - Nmom = 4; - - double C30_kpSiM[] = - { 1.52613e-01, 3.87036e-06, 1.51475e-10, 8.34686e-15, - 1.92410e-01, 4.88554e-06, 1.91604e-10, 1.05937e-14, - 2.42503e-01, 6.16264e-06, 2.42001e-10, 1.34057e-14, - 3.05564e-01, 7.77004e-06, 3.05397e-10, 1.69392e-14, - 3.85174e-01, 9.80462e-06, 3.86046e-10, 2.14732e-14, - 4.85438e-01, 1.23675e-05, 4.87634e-10, 2.71828e-14, - 6.11833e-01, 1.56019e-05, 6.16102e-10, 3.44270e-14, - 7.71157e-01, 1.96838e-05, 7.78585e-10, 4.36231e-14, - 9.71669e-01, 2.48269e-05, 9.83743e-10, 5.52763e-14, - 1.22169e+00, 3.12457e-05, 1.24021e-09, 6.98829e-14, - 1.51883e+00, 3.88844e-05, 1.54619e-09, 8.73862e-14, - 1.83610e+00, 4.70620e-05, 1.87584e-09, 1.06471e-13, - 2.15867e+00, 5.54249e-05, 2.21779e-09, 1.26800e-13, - 2.56252e+00, 6.59468e-05, 2.65228e-09, 1.53070e-13, - 3.24657e+00, 8.37697e-05, 3.38561e-09, 1.97020e-13, - 4.37158e+00, 1.13090e-04, 4.58835e-09, 2.68525e-13, - 5.89356e+00, 1.52861e-04, 6.22099e-09, 3.65325e-13, - 7.62770e+00, 1.98484e-04, 8.10272e-09, 4.76950e-13, - 9.48448e+00, 2.48132e-04, 1.01763e-08, 6.00571e-13, - 1.17614e+01, 3.11117e-04, 1.28785e-08, 7.63878e-13, - 1.52604e+01, 4.11692e-04, 1.73236e-08, 1.03683e-12, - 2.04857e+01, 5.67120e-04, 2.43755e-08, 1.47603e-12, - 2.67121e+01, 7.65926e-04, 3.38756e-08, 2.08532e-12, - 3.30214e+01, 1.00600e-03, 4.67023e-08, 2.95970e-12, - 3.94796e+01, 1.32148e-03, 6.59032e-08, 4.35947e-12, - 4.60630e+01, 1.71870e-03, 9.26057e-08, 6.41018e-12, - 5.17888e+01, 2.12529e-03, 1.22060e-07, 8.76593e-12, - 5.52863e+01, 2.42692e-03, 1.45553e-07, 1.07154e-11, - 5.60930e+01, 2.55895e-03, 1.57221e-07, 1.17347e-11, - 5.70683e+01, 2.61927e-03, 1.61476e-07, 1.20713e-11, - 7.25749e+01, 3.09971e-03, 1.82166e-07, 1.32162e-11, - 1.59194e+02, 5.49929e-03, 2.77545e-07, 1.82852e-11, - 4.83739e+02, 1.31658e-02, 5.43977e-07, 3.13196e-11, - 1.39550e+03, 3.19882e-02, 1.11499e-06, 5.65773e-11, - 3.29912e+03, 6.76125e-02, 2.08154e-06, 9.54501e-11 }; - - double C30_kpFeM[] = - { 7.21495e-02, 2.58300e-06, 1.19134e-10, 6.77090e-15, - 1.09797e-01, 3.79107e-06, 1.69411e-10, 9.39020e-15, - 1.55805e-01, 5.26522e-06, 2.30859e-10, 1.26025e-14, - 2.12966e-01, 7.09577e-06, 3.07229e-10, 1.66015e-14, - 3.02975e-01, 9.74053e-06, 4.08459e-10, 2.15040e-14, - 4.17015e-01, 1.30295e-05, 5.32431e-10, 2.74392e-14, - 5.71703e-01, 1.73021e-05, 6.86687e-10, 3.45374e-14, - 7.82114e-01, 2.28860e-05, 8.80449e-10, 4.31318e-14, - 1.06869e+00, 3.02137e-05, 1.12556e-09, 5.36402e-14, - 1.45194e+00, 3.97008e-05, 1.43310e-09, 6.64513e-14, - 1.96519e+00, 5.19736e-05, 1.81745e-09, 8.19495e-14, - 2.63479e+00, 6.74573e-05, 2.28640e-09, 1.00267e-13, - 3.47952e+00, 8.64064e-05, 2.84327e-09, 1.21406e-13, - 4.51582e+00, 1.09014e-04, 3.48958e-09, 1.45307e-13, - 5.75506e+00, 1.35409e-04, 4.22673e-09, 1.71980e-13, - 7.20522e+00, 1.65686e-04, 5.05643e-09, 2.01492e-13, - 8.86719e+00, 1.99826e-04, 5.97834e-09, 2.33868e-13, - 1.07378e+01, 2.37775e-04, 6.99239e-09, 2.69183e-13, - 1.28337e+01, 2.79956e-04, 8.11382e-09, 3.08137e-13, - 1.52347e+01, 3.28163e-04, 9.39756e-09, 3.52929e-13, - 1.81342e+01, 3.86588e-04, 1.09665e-08, 4.08289e-13, - 2.19061e+01, 4.63288e-04, 1.30553e-08, 4.83202e-13, - 2.72090e+01, 5.72531e-04, 1.60822e-08, 5.93756e-13, - 3.51270e+01, 7.37785e-04, 2.07358e-08, 7.66520e-13, - 4.72945e+01, 9.93265e-04, 2.79935e-08, 1.03837e-12, - 6.60183e+01, 1.38363e-03, 3.90367e-08, 1.45073e-12, - 9.46224e+01, 1.96740e-03, 5.52478e-08, 2.04604e-12, - 1.38263e+02, 2.83025e-03, 7.85071e-08, 2.87658e-12, - 2.05210e+02, 4.10585e-03, 1.11674e-07, 4.02015e-12, - 3.08399e+02, 5.99700e-03, 1.58965e-07, 5.58896e-12, - 4.67338e+02, 8.79616e-03, 2.26155e-07, 7.72827e-12, - 7.10129e+02, 1.29022e-02, 3.20597e-07, 1.06077e-11, - 1.07381e+03, 1.88070e-02, 4.50609e-07, 1.43975e-11, - 1.59524e+03, 2.69407e-02, 6.22216e-07, 1.91854e-11, - 2.28747e+03, 3.73289e-02, 8.32996e-07, 2.48404e-11 }; - - double C30_kpMg2SiO4[] = - { 1.05240e-01, 4.94867e-08, 6.62401e-14, 1.80043e-19, - 1.32588e-01, 6.23464e-08, 8.34533e-14, 2.26830e-19, - 1.67016e-01, 7.85357e-08, 1.05123e-13, 2.85730e-19, - 2.10360e-01, 9.89168e-08, 1.32405e-13, 3.59881e-19, - 2.71887e-01, 1.27849e-07, 1.71131e-13, 4.65142e-19, - 3.55694e-01, 1.67257e-07, 2.23881e-13, 6.08518e-19, - 4.84932e-01, 2.28028e-07, 3.05226e-13, 8.29619e-19, - 6.99767e-01, 3.29050e-07, 4.40448e-13, 1.19716e-18, - 1.05860e+00, 4.97781e-07, 6.66304e-13, 1.81105e-18, - 1.62902e+00, 7.66009e-07, 1.02534e-12, 2.78694e-18, - 2.54260e+00, 1.19560e-06, 1.60037e-12, 4.34992e-18, - 3.96488e+00, 1.86440e-06, 2.49561e-12, 6.78334e-18, - 6.10630e+00, 2.87136e-06, 3.84349e-12, 1.04472e-17, - 9.28767e+00, 4.36734e-06, 5.84598e-12, 1.58906e-17, - 1.39265e+01, 6.54868e-06, 8.76595e-12, 2.38284e-17, - 2.05383e+01, 9.65780e-06, 1.29279e-11, 3.51435e-17, - 3.00651e+01, 1.41377e-05, 1.89253e-11, 5.14515e-17, - 4.55105e+01, 2.14011e-05, 2.86497e-11, 7.79011e-17, - 7.47848e+01, 3.51681e-05, 4.70833e-11, 1.28054e-16, - 1.29623e+02, 6.09573e-05, 8.16150e-11, 2.22014e-16, - 2.14824e+02, 1.01026e-04, 1.35269e-10, 3.68020e-16, - 3.20010e+02, 1.50495e-04, 2.01516e-10, 5.48326e-16, - 4.29781e+02, 2.02124e-04, 2.70665e-10, 7.36593e-16, - 5.30850e+02, 2.49665e-04, 3.34350e-10, 9.10050e-16, - 5.99723e+02, 2.82064e-04, 3.77759e-10, 1.02832e-15, - 6.06569e+02, 2.85288e-04, 3.82090e-10, 1.04017e-15, - 5.43292e+02, 2.55531e-04, 3.42243e-10, 9.31723e-16, - 4.33571e+02, 2.03926e-04, 2.73131e-10, 7.43589e-16, - 3.13340e+02, 1.47377e-04, 1.97394e-10, 5.37419e-16, - 2.09022e+02, 9.83146e-05, 1.31685e-10, 3.58547e-16, - 1.31159e+02, 6.16930e-05, 8.26409e-11, 2.25056e-16, - 7.90789e+01, 3.72049e-05, 4.98596e-11, 1.35886e-16, - 4.73566e+01, 2.23007e-05, 2.99370e-11, 8.18168e-17, - 2.96727e+01, 1.40105e-05, 1.88993e-11, 5.20353e-17, - 2.05268e+01, 9.75253e-06, 1.32995e-11, 3.71721e-17 }; - - double C30_kpMgSiO3[] = - { 2.19890e-02, 2.24631e-08, 2.89738e-14, 5.78493e-20, - 3.90612e-02, 3.99034e-08, 5.14691e-14, 1.02764e-19, - 6.05539e-02, 6.18594e-08, 7.97889e-14, 1.59308e-19, - 8.76116e-02, 8.95004e-08, 1.15442e-13, 2.30492e-19, - 1.43288e-01, 1.46377e-07, 1.88803e-13, 3.76970e-19, - 2.19266e-01, 2.23993e-07, 2.88916e-13, 5.76861e-19, - 3.36256e-01, 3.43505e-07, 4.43068e-13, 8.84648e-19, - 5.14336e-01, 5.25424e-07, 6.77716e-13, 1.35317e-18, - 7.97217e-01, 8.14404e-07, 1.05046e-12, 2.09745e-18, - 1.25414e+00, 1.28118e-06, 1.65253e-12, 3.29971e-18, - 2.03450e+00, 2.07836e-06, 2.68078e-12, 5.35315e-18, - 3.34648e+00, 3.41863e-06, 4.40956e-12, 8.80595e-18, - 5.45894e+00, 5.57665e-06, 7.19317e-12, 1.43665e-17, - 8.82120e+00, 9.01141e-06, 1.16237e-11, 2.32195e-17, - 1.41826e+01, 1.44884e-05, 1.86888e-11, 3.73434e-17, - 2.28421e+01, 2.33348e-05, 3.01009e-11, 6.01739e-17, - 3.71183e+01, 3.79191e-05, 4.89167e-11, 9.78570e-17, - 6.14292e+01, 6.27552e-05, 8.09620e-11, 1.62128e-16, - 1.03850e+02, 1.06093e-04, 1.36885e-10, 2.74448e-16, - 1.75514e+02, 1.79307e-04, 2.31368e-10, 4.64387e-16, - 2.82073e+02, 2.88172e-04, 3.71865e-10, 7.46941e-16, - 4.14542e+02, 4.23507e-04, 5.46530e-10, 1.09837e-15, - 5.60007e+02, 5.72126e-04, 7.38347e-10, 1.48437e-15, - 7.11091e+02, 7.26489e-04, 9.37565e-10, 1.88456e-15, - 8.40894e+02, 8.59108e-04, 1.10867e-09, 2.22674e-15, - 8.95416e+02, 9.14814e-04, 1.18049e-09, 2.36840e-15, - 8.40506e+02, 8.58713e-04, 1.10802e-09, 2.22074e-15, - 6.96770e+02, 7.11863e-04, 9.18488e-10, 1.83938e-15, - 5.18262e+02, 5.29487e-04, 6.83149e-10, 1.36732e-15, - 3.52905e+02, 3.60548e-04, 4.65172e-10, 9.30726e-16, - 2.24242e+02, 2.29099e-04, 2.95579e-10, 5.91332e-16, - 1.35153e+02, 1.38081e-04, 1.78153e-10, 3.56469e-16, - 7.83239e+01, 8.00228e-05, 1.03253e-10, 2.06735e-16, - 4.41660e+01, 4.51272e-05, 5.82391e-11, 1.16797e-16, - 2.46140e+01, 2.51643e-05, 3.25109e-11, 6.54871e-17 }; - - double C30_kpAC[] = - { 3.27960e-01, 3.83729e-07, 7.77768e-13, 2.49208e-18, - 4.38752e-01, 5.13360e-07, 1.04052e-12, 3.33400e-18, - 5.78230e-01, 6.76557e-07, 1.37130e-12, 4.39392e-18, - 7.53823e-01, 8.82009e-07, 1.78773e-12, 5.72828e-18, - 1.04013e+00, 1.21701e-06, 2.46677e-12, 7.90427e-18, - 1.41736e+00, 1.65839e-06, 3.36142e-12, 1.07712e-17, - 1.95293e+00, 2.28504e-06, 4.63158e-12, 1.48415e-17, - 2.71531e+00, 3.17707e-06, 6.43967e-12, 2.06359e-17, - 3.79677e+00, 4.44245e-06, 9.00459e-12, 2.88564e-17, - 5.29746e+00, 6.19839e-06, 1.25639e-11, 4.02650e-17, - 7.37839e+00, 8.63325e-06, 1.74996e-11, 5.60866e-17, - 1.02169e+01, 1.19546e-05, 2.42326e-11, 7.76741e-17, - 1.40423e+01, 1.64308e-05, 3.33069e-11, 1.06774e-16, - 1.92025e+01, 2.24692e-05, 4.55495e-11, 1.46048e-16, - 2.61625e+01, 3.06137e-05, 6.20638e-11, 1.99051e-16, - 3.55322e+01, 4.15788e-05, 8.43006e-11, 2.70467e-16, - 4.81640e+01, 5.63626e-05, 1.14288e-10, 3.66871e-16, - 6.53224e+01, 7.64461e-05, 1.55039e-10, 4.98051e-16, - 8.87770e+01, 1.03904e-04, 2.10775e-10, 6.77818e-16, - 1.20724e+02, 1.41310e-04, 2.86753e-10, 9.23530e-16, - 1.63658e+02, 1.91596e-04, 3.88991e-10, 1.25555e-15, - 2.20645e+02, 2.58372e-04, 5.24942e-10, 1.69987e-15, - 2.96236e+02, 3.47007e-04, 7.05751e-10, 2.29590e-15, - 3.97277e+02, 4.65581e-04, 9.48153e-10, 3.10191e-15, - 5.32000e+02, 6.23846e-04, 1.27229e-09, 4.18567e-15, - 7.07873e+02, 8.30738e-04, 1.69662e-09, 5.60591e-15, - 9.32623e+02, 1.09569e-03, 2.24083e-09, 7.42175e-15, - 1.21977e+03, 1.43532e-03, 2.93992e-09, 9.74128e-15, - 1.59377e+03, 1.87988e-03, 3.85840e-09, 1.27719e-14, - 2.09261e+03, 2.47712e-03, 5.09977e-09, 1.68549e-14, - 2.77023e+03, 3.29669e-03, 6.81899e-09, 2.25141e-14, - 3.70299e+03, 4.44048e-03, 9.24971e-09, 3.05579e-14, - 5.00261e+03, 6.06097e-03, 1.27486e-08, 4.22365e-14, - 6.83605e+03, 8.38300e-03, 1.78358e-08, 5.93501e-14, - 9.45120e+03, 1.17154e-02, 2.51744e-08, 8.40301e-14 }; - - double C30_kpSiO2D[] = - { 7.60354e-02, 1.23833e-07, 8.53754e-13, 1.45191e-17, - 9.07201e-02, 1.47751e-07, 1.01868e-12, 1.73242e-17, - 1.09207e-01, 1.77861e-07, 1.22631e-12, 2.08557e-17, - 1.32481e-01, 2.15768e-07, 1.48770e-12, 2.53015e-17, - 1.58907e-01, 2.58811e-07, 1.78454e-12, 3.03507e-17, - 1.91564e-01, 3.12003e-07, 2.15137e-12, 3.65904e-17, - 2.30490e-01, 3.75405e-07, 2.58860e-12, 4.40274e-17, - 2.76795e-01, 4.50827e-07, 3.10875e-12, 5.28751e-17, - 3.33074e-01, 5.42499e-07, 3.74099e-12, 6.36301e-17, - 4.05326e-01, 6.60191e-07, 4.55275e-12, 7.74389e-17, - 5.08163e-01, 8.27703e-07, 5.70817e-12, 9.70950e-17, - 6.72477e-01, 1.09537e-06, 7.55468e-12, 1.28511e-16, - 9.48561e-01, 1.54515e-06, 1.06581e-11, 1.81319e-16, - 1.41791e+00, 2.30989e-06, 1.59363e-11, 2.71154e-16, - 2.19508e+00, 3.57636e-06, 2.46813e-11, 4.20045e-16, - 3.46738e+00, 5.65063e-06, 3.90198e-11, 6.64369e-16, - 5.76921e+00, 9.40776e-06, 6.50678e-11, 1.10919e-15, - 1.17225e+01, 1.91430e-05, 1.32874e-10, 2.27105e-15, - 3.16576e+01, 5.17610e-05, 3.60367e-10, 6.17301e-15, - 8.68678e+01, 1.42065e-04, 9.89621e-10, 1.69586e-14, - 1.92388e+02, 3.14591e-04, 2.19062e-09, 3.75294e-14, - 3.36374e+02, 5.49866e-04, 3.82570e-09, 6.54980e-14, - 5.05999e+02, 8.26100e-04, 5.72796e-09, 9.78085e-14, - 7.20701e+02, 1.17289e-03, 8.06418e-09, 1.36816e-13, - 9.77142e+02, 1.58336e-03, 1.07627e-08, 1.81003e-13, - 1.18576e+03, 1.91391e-03, 1.28756e-08, 2.14810e-13, - 1.23749e+03, 1.99168e-03, 1.32966e-08, 2.20518e-13, - 1.11076e+03, 1.78423e-03, 1.18503e-08, 1.95740e-13, - 8.75424e+02, 1.40444e-03, 9.29642e-09, 1.53150e-13, - 6.21466e+02, 9.96201e-04, 6.57984e-09, 1.08212e-13, - 4.06780e+02, 6.51722e-04, 4.29860e-09, 7.06171e-14, - 2.50252e+02, 4.00808e-04, 2.64130e-09, 4.33611e-14, - 1.46882e+02, 2.35201e-04, 1.54913e-09, 2.54207e-14, - 8.32048e+01, 1.33228e-04, 8.77332e-10, 1.43944e-14, - 4.59015e+01, 7.35091e-05, 4.84195e-10, 7.94538e-15 }; - - double C30_kpMgO[] = - { 2.25389e-04, 5.23412e-10, 3.15038e-15, 3.37599e-20, - 4.04967e-04, 9.40443e-10, 5.66055e-15, 6.06603e-20, - 6.31042e-04, 1.46545e-09, 8.82067e-15, 9.45260e-20, - 9.15653e-04, 2.12641e-09, 1.27990e-14, 1.37160e-19, - 1.52197e-03, 3.53447e-09, 2.12745e-14, 2.27991e-19, - 2.37407e-03, 5.51331e-09, 3.31857e-14, 3.55642e-19, - 3.77209e-03, 8.75995e-09, 5.27284e-14, 5.65083e-19, - 6.14348e-03, 1.42671e-08, 8.58786e-14, 9.20363e-19, - 1.01907e-02, 2.36663e-08, 1.42459e-13, 1.52677e-18, - 1.68897e-02, 3.92242e-08, 2.36116e-13, 2.53063e-18, - 2.96125e-02, 6.87744e-08, 4.14030e-13, 4.43787e-18, - 6.10613e-02, 1.41824e-07, 8.53932e-13, 9.15481e-18, - 1.43400e-01, 3.33097e-07, 2.00598e-12, 2.15106e-17, - 3.27386e-01, 7.60540e-07, 4.58100e-12, 4.91345e-17, - 6.39460e-01, 1.48568e-06, 8.95096e-12, 9.60338e-17, - 1.05151e+00, 2.44421e-06, 1.47414e-11, 1.58361e-16, - 1.55897e+00, 3.63523e-06, 2.20702e-11, 2.39002e-16, - 2.94595e+00, 6.92078e-06, 4.26541e-11, 4.70201e-16, - 1.32939e+01, 3.11374e-05, 1.90589e-10, 2.08296e-15, - 7.10280e+01, 1.65213e-04, 9.96517e-10, 1.06988e-14, - 2.54734e+02, 5.90224e-04, 3.53091e-09, 3.75292e-14, - 5.99997e+02, 1.38734e-03, 8.26333e-09, 8.73603e-14, - 9.93558e+02, 2.29460e-03, 1.36329e-08, 1.43684e-13, - 1.24146e+03, 2.86493e-03, 1.69946e-08, 1.78772e-13, - 1.24450e+03, 2.87058e-03, 1.70110e-08, 1.78725e-13, - 1.05332e+03, 2.42888e-03, 1.43842e-08, 1.51004e-13, - 7.84315e+02, 1.80814e-03, 1.07031e-08, 1.12298e-13, - 5.30478e+02, 1.22276e-03, 7.23576e-09, 7.58903e-14, - 3.33924e+02, 7.69623e-04, 4.55334e-09, 4.77443e-14, - 1.99202e+02, 4.59084e-04, 2.71568e-09, 2.84703e-14, - 1.14141e+02, 2.63040e-04, 1.55583e-09, 1.63087e-14, - 6.34373e+01, 1.46185e-04, 8.64588e-10, 9.06207e-15, - 3.44508e+01, 7.93863e-05, 4.69493e-10, 4.92062e-15, - 1.83812e+01, 4.23560e-05, 2.50488e-10, 2.62517e-15, - 9.67501e+00, 2.22941e-05, 1.31841e-10, 1.38170e-15 }; - - double C30_kpFeS[] = - { 5.18102e-02, 8.79700e-08, 3.32172e-13, 2.28308e-18, - 9.98920e-02, 1.69607e-07, 6.40403e-13, 4.40131e-18, - 1.60423e-01, 2.72381e-07, 1.02844e-12, 7.06800e-18, - 2.36628e-01, 4.01766e-07, 1.51696e-12, 1.04252e-17, - 3.67296e-01, 6.23631e-07, 2.35471e-12, 1.61832e-17, - 5.36243e-01, 9.10491e-07, 3.43791e-12, 2.36285e-17, - 7.64229e-01, 1.29761e-06, 4.89979e-12, 3.36782e-17, - 1.04975e+00, 1.78244e-06, 6.73094e-12, 4.62695e-17, - 1.38087e+00, 2.34473e-06, 8.85504e-12, 6.08809e-17, - 1.74385e+00, 2.96123e-06, 1.11849e-11, 7.69178e-17, - 2.10328e+00, 3.57180e-06, 1.34937e-11, 9.28279e-17, - 2.42172e+00, 4.11304e-06, 1.55431e-11, 1.06984e-16, - 2.66854e+00, 4.53297e-06, 1.71379e-11, 1.18057e-16, - 2.81685e+00, 4.78622e-06, 1.81100e-11, 1.24934e-16, - 2.89955e+00, 4.92990e-06, 1.86888e-11, 1.29362e-16, - 3.08249e+00, 5.24916e-06, 1.99900e-11, 1.39496e-16, - 3.69977e+00, 6.31698e-06, 2.42367e-11, 1.71353e-16, - 5.06558e+00, 8.67290e-06, 3.35347e-11, 2.40280e-16, - 7.09332e+00, 1.21816e-05, 4.75377e-11, 3.46171e-16, - 9.22649e+00, 1.59270e-05, 6.32195e-11, 4.74390e-16, - 1.08624e+01, 1.89007e-05, 7.70051e-11, 6.04198e-16, - 1.17514e+01, 2.06434e-05, 8.66021e-11, 7.12327e-16, - 1.20172e+01, 2.13237e-05, 9.19108e-11, 7.86989e-16, - 1.19350e+01, 2.14078e-05, 9.44200e-11, 8.32977e-16, - 1.17499e+01, 2.13514e-05, 9.60658e-11, 8.64823e-16, - 1.16255e+01, 2.15518e-05, 9.90976e-11, 9.04821e-16, - 1.19573e+01, 2.36139e-05, 1.14559e-10, 1.06630e-15, - 1.51193e+01, 3.80077e-05, 2.17630e-10, 2.11441e-15, - 2.88990e+01, 9.93223e-05, 6.64795e-10, 6.60023e-15, - 7.41785e+01, 2.87865e-04, 1.99265e-09, 1.93332e-14, - 1.88656e+02, 7.26466e-04, 4.90072e-09, 4.57065e-14, - 4.09136e+02, 1.50900e-03, 9.80616e-09, 8.81118e-14, - 7.53739e+02, 2.65184e-03, 1.66314e-08, 1.44869e-13, - 1.22335e+03, 4.11549e-03, 2.50007e-08, 2.12244e-13, - 1.81062e+03, 5.83587e-03, 3.44214e-08, 2.85851e-13 }; - - double C30_kpAl2O3[] = - { 9.93250e-04, 7.58434e-11, 8.82228e-18, 1.41287e-24, - 1.81240e-03, 1.38393e-10, 1.60982e-17, 2.57809e-24, - 2.84365e-03, 2.17138e-10, 2.52580e-17, 4.04502e-24, - 4.14191e-03, 3.16271e-10, 3.67894e-17, 5.89176e-24, - 7.18271e-03, 5.48463e-10, 6.37986e-17, 1.02172e-23, - 1.13364e-02, 8.65631e-10, 1.00692e-16, 1.61257e-23, - 1.77361e-02, 1.35430e-09, 1.57536e-16, 2.52291e-23, - 2.59477e-02, 1.98134e-09, 2.30474e-16, 3.69100e-23, - 3.45425e-02, 2.63763e-09, 3.06815e-16, 4.91359e-23, - 4.22006e-02, 3.22239e-09, 3.74836e-16, 6.00294e-23, - 4.71420e-02, 3.59971e-09, 4.18726e-16, 6.70583e-23, - 4.91934e-02, 3.75635e-09, 4.36947e-16, 6.99764e-23, - 5.05162e-02, 3.85735e-09, 4.48697e-16, 7.18580e-23, - 5.78201e-02, 4.41508e-09, 5.13572e-16, 8.22477e-23, - 8.84237e-02, 6.75193e-09, 7.85401e-16, 1.25781e-22, - 1.78786e-01, 1.36519e-08, 1.58802e-15, 2.54319e-22, - 4.36405e-01, 3.33234e-08, 3.87627e-15, 6.20781e-22, - 1.63797e+00, 1.25074e-07, 1.45490e-14, 2.33003e-21, - 8.50820e+00, 6.49679e-07, 7.55727e-14, 1.21029e-20, - 3.92752e+01, 2.99901e-06, 3.48854e-13, 5.58686e-20, - 1.41437e+02, 1.08001e-05, 1.25630e-12, 2.01195e-19, - 3.83709e+02, 2.92996e-05, 3.40821e-12, 5.45820e-19, - 7.70412e+02, 5.88278e-05, 6.84300e-12, 1.09590e-18, - 1.16399e+03, 8.88808e-05, 1.03388e-11, 1.65574e-18, - 1.37566e+03, 1.05044e-04, 1.22190e-11, 1.95685e-18, - 1.33070e+03, 1.01611e-04, 1.18196e-11, 1.89289e-18, - 1.09978e+03, 8.39785e-05, 9.76864e-12, 1.56444e-18, - 8.05639e+02, 6.15177e-05, 7.15589e-12, 1.14600e-18, - 5.38690e+02, 4.11337e-05, 4.78477e-12, 7.66273e-19, - 3.36338e+02, 2.56824e-05, 2.98743e-12, 4.78432e-19, - 1.99460e+02, 1.52305e-05, 1.77165e-12, 2.83727e-19, - 1.13787e+02, 8.68865e-06, 1.01068e-12, 1.61859e-19, - 6.30411e+01, 4.81374e-06, 5.59946e-13, 8.96744e-20, - 3.41529e+01, 2.60788e-06, 3.03354e-13, 4.85817e-20, - 1.81893e+01, 1.38891e-06, 1.61561e-13, 2.58738e-20 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab0] = C30_kpSiM [itab]; - my_rates->SN0_kpFeM [itab0] = C30_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = C30_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = C30_kpMgSiO3 [itab]; - my_rates->SN0_kpAC [itab0] = C30_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = C30_kpSiO2D [itab]; - my_rates->SN0_kpMgO [itab0] = C30_kpMgO [itab]; - my_rates->SN0_kpFeS [itab0] = C30_kpFeS [itab]; - my_rates->SN0_kpAl2O3 [itab0] = C30_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_F13(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 6.31648e-26; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.06081e-16; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 3.19262e-15; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 4.37192e-15; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.75542e-01; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.92019e-16; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 6.23283e-17; - - itab0 = 3 * iSN; - my_rates->SN0_r0FeM [itab0 + 0] = 4.02937e-08; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 4.03307e-08; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 4.03157e-08; - my_rates->SN0_r0Fe3O4 [itab0 + 0] = 4.03312e-08; - my_rates->SN0_r0AC [itab0 + 0] = 6.60867e-06; - my_rates->SN0_r0SiO2D [itab0 + 0] = 4.03146e-08; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 4.03146e-08; - - my_rates->SN0_r0FeM [itab0 + 1] = 1.67044e-15; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 1.67330e-15; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.67182e-15; - my_rates->SN0_r0Fe3O4 [itab0 + 1] = 1.67336e-15; - my_rates->SN0_r0AC [itab0 + 1] = 5.49310e-11; - my_rates->SN0_r0SiO2D [itab0 + 1] = 1.67171e-15; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 1.67171e-15; - - my_rates->SN0_r0FeM [itab0 + 2] = 7.11477e-23; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 7.13316e-23; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 7.12190e-23; - my_rates->SN0_r0Fe3O4 [itab0 + 2] = 7.13357e-23; - my_rates->SN0_r0AC [itab0 + 2] = 5.25955e-16; - my_rates->SN0_r0SiO2D [itab0 + 2] = 7.12105e-23; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 7.12106e-23; - - NTd = 35; - Nmom = 4; - - double F13_kpFeM[] = - { 1.23621e-05, 4.98941e-13, 2.07173e-20, 8.83710e-28, - 2.19539e-05, 8.86065e-13, 3.67916e-20, 1.56937e-27, - 3.40291e-05, 1.37342e-12, 5.70280e-20, 2.43256e-27, - 4.92310e-05, 1.98698e-12, 8.25041e-20, 3.51925e-27, - 8.08514e-05, 3.26317e-12, 1.35494e-19, 5.77953e-27, - 1.25020e-04, 5.04574e-12, 2.09508e-19, 8.93651e-27, - 1.96586e-04, 7.93387e-12, 3.29418e-19, 1.40509e-26, - 3.14491e-04, 1.26917e-11, 5.26937e-19, 2.24747e-26, - 5.06850e-04, 2.04532e-11, 8.49130e-19, 3.62146e-26, - 8.07286e-04, 3.25749e-11, 1.35229e-18, 5.76710e-26, - 1.28668e-03, 5.19155e-11, 2.15506e-18, 9.19009e-26, - 2.05241e-03, 8.28056e-11, 3.43709e-18, 1.46562e-25, - 3.27026e-03, 1.31928e-10, 5.47555e-18, 2.33466e-25, - 5.23898e-03, 2.11325e-10, 8.76988e-18, 3.73889e-25, - 8.45023e-03, 3.40811e-10, 1.41417e-17, 6.02834e-25, - 1.37158e-02, 5.53101e-10, 2.29473e-17, 9.78076e-25, - 2.24100e-02, 9.03572e-10, 3.74827e-17, 1.59741e-24, - 3.70042e-02, 1.49181e-09, 6.18765e-17, 2.63669e-24, - 6.21585e-02, 2.50559e-09, 1.03913e-16, 4.42746e-24, - 1.07033e-01, 4.31400e-09, 1.78894e-16, 7.62148e-24, - 1.90089e-01, 7.66095e-09, 3.17659e-16, 1.35323e-23, - 3.49470e-01, 1.40834e-08, 5.83928e-16, 2.48739e-23, - 6.64947e-01, 2.67957e-08, 1.11096e-15, 4.73220e-23, - 1.30413e+00, 5.25515e-08, 2.17873e-15, 9.28021e-23, - 2.61640e+00, 1.05429e-07, 4.37088e-15, 1.86172e-22, - 5.31791e+00, 2.14284e-07, 8.88372e-15, 3.78386e-22, - 1.08366e+01, 4.36654e-07, 1.81025e-14, 7.71039e-22, - 2.19132e+01, 8.82975e-07, 3.66056e-14, 1.55913e-21, - 4.35354e+01, 1.75422e-06, 7.27247e-14, 3.09753e-21, - 8.42362e+01, 3.39422e-06, 1.40714e-13, 5.99335e-21, - 1.57704e+02, 6.35452e-06, 2.63439e-13, 1.12205e-20, - 2.84822e+02, 1.14766e-05, 4.75784e-13, 2.02648e-20, - 4.96653e+02, 2.00121e-05, 8.29639e-13, 3.53363e-20, - 8.39966e+02, 3.38455e-05, 1.40313e-12, 5.97626e-20, - 1.38932e+03, 5.59813e-05, 2.32081e-12, 9.88487e-20 }; - - double F13_kpMg2SiO4[] = - { 1.05240e-01, 4.24440e-09, 1.76098e-16, 7.50693e-24, - 1.32588e-01, 5.34735e-09, 2.21859e-16, 9.45769e-24, - 1.67016e-01, 6.73589e-09, 2.79469e-16, 1.19135e-23, - 2.10360e-01, 8.48395e-09, 3.51995e-16, 1.50053e-23, - 2.71887e-01, 1.09654e-08, 4.54949e-16, 1.93941e-23, - 3.55694e-01, 1.43454e-08, 5.95184e-16, 2.53722e-23, - 4.84932e-01, 1.95577e-08, 8.11439e-16, 3.45910e-23, - 6.99767e-01, 2.82221e-08, 1.17092e-15, 4.99155e-23, - 1.05860e+00, 4.26939e-08, 1.77135e-15, 7.55113e-23, - 1.62902e+00, 6.56994e-08, 2.72584e-15, 1.16200e-22, - 2.54260e+00, 1.02545e-07, 4.25454e-15, 1.81368e-22, - 3.96488e+00, 1.59906e-07, 6.63444e-15, 2.82821e-22, - 6.10630e+00, 2.46271e-07, 1.02177e-14, 4.35572e-22, - 9.28766e+00, 3.74578e-07, 1.55411e-14, 6.62503e-22, - 1.39265e+01, 5.61664e-07, 2.33032e-14, 9.93397e-22, - 2.05382e+01, 8.28321e-07, 3.43667e-14, 1.46502e-21, - 3.00649e+01, 1.21254e-06, 5.03077e-14, 2.14458e-21, - 4.55102e+01, 1.83546e-06, 7.61523e-14, 3.24631e-21, - 7.47839e+01, 3.01609e-06, 1.25136e-13, 5.33445e-21, - 1.29621e+02, 5.22769e-06, 2.16895e-13, 9.24605e-21, - 2.14820e+02, 8.66384e-06, 3.59459e-13, 1.53234e-20, - 3.20002e+02, 1.29059e-05, 5.35460e-13, 2.28262e-20, - 4.29768e+02, 1.73329e-05, 7.19133e-13, 3.06560e-20, - 5.30827e+02, 2.14086e-05, 8.88234e-13, 3.78647e-20, - 5.99694e+02, 2.41861e-05, 1.00347e-12, 4.27771e-20, - 6.06537e+02, 2.44620e-05, 1.01492e-12, 4.32652e-20, - 5.43262e+02, 2.19101e-05, 9.09042e-13, 3.87517e-20, - 4.33545e+02, 1.74852e-05, 7.25453e-13, 3.09255e-20, - 3.13324e+02, 1.26366e-05, 5.24285e-13, 2.23499e-20, - 2.09006e+02, 8.42935e-06, 3.49730e-13, 1.49087e-20, - 1.31150e+02, 5.28937e-06, 2.19454e-13, 9.35513e-21, - 7.90681e+01, 3.18887e-06, 1.32305e-13, 5.64006e-21, - 4.73389e+01, 1.90921e-06, 7.92124e-14, 3.37676e-21, - 2.96409e+01, 1.19544e-06, 4.95982e-14, 2.11433e-21, - 2.04708e+01, 8.25601e-07, 3.42539e-14, 1.46021e-21 }; - - double F13_kpMgSiO3[] = - { 2.19890e-02, 8.86503e-10, 3.67618e-17, 1.56604e-24, - 3.90612e-02, 1.57478e-09, 6.53036e-17, 2.78190e-24, - 6.05539e-02, 2.44128e-09, 1.01236e-16, 4.31259e-24, - 8.76116e-02, 3.53213e-09, 1.46471e-16, 6.23961e-24, - 1.43288e-01, 5.77674e-09, 2.39552e-16, 1.02048e-23, - 2.19266e-01, 8.83988e-09, 3.66575e-16, 1.56159e-23, - 3.36256e-01, 1.35564e-08, 5.62160e-16, 2.39478e-23, - 5.14336e-01, 2.07358e-08, 8.59879e-16, 3.66305e-23, - 7.97216e-01, 3.21404e-08, 1.33281e-15, 5.67770e-23, - 1.25414e+00, 5.05616e-08, 2.09670e-15, 8.93186e-23, - 2.03450e+00, 8.20224e-08, 3.40133e-15, 1.44895e-22, - 3.34648e+00, 1.34916e-07, 5.59472e-15, 2.38333e-22, - 5.45893e+00, 2.20081e-07, 9.12638e-15, 3.88780e-22, - 8.82117e+00, 3.55632e-07, 1.47474e-14, 6.28235e-22, - 1.41825e+01, 5.71778e-07, 2.37106e-14, 1.01006e-21, - 2.28419e+01, 9.20889e-07, 3.81877e-14, 1.62678e-21, - 3.71178e+01, 1.49643e-06, 6.20544e-14, 2.64349e-21, - 6.14272e+01, 2.47648e-06, 1.02696e-13, 4.37479e-21, - 1.03847e+02, 4.18665e-06, 1.73613e-13, 7.39586e-21, - 1.75507e+02, 7.07567e-06, 2.93416e-13, 1.24994e-20, - 2.82060e+02, 1.13715e-05, 4.71555e-13, 2.00880e-20, - 4.14519e+02, 1.67116e-05, 6.93003e-13, 2.95216e-20, - 5.59961e+02, 2.25752e-05, 9.36157e-13, 3.98799e-20, - 7.11024e+02, 2.86655e-05, 1.18871e-12, 5.06385e-20, - 8.40805e+02, 3.38977e-05, 1.40568e-12, 5.98813e-20, - 8.95312e+02, 3.60952e-05, 1.49681e-12, 6.37633e-20, - 8.40415e+02, 3.38819e-05, 1.40503e-12, 5.98535e-20, - 6.96693e+02, 2.80877e-05, 1.16475e-12, 4.96178e-20, - 5.18202e+02, 2.08917e-05, 8.66344e-13, 3.69059e-20, - 3.52864e+02, 1.42260e-05, 5.89927e-13, 2.51306e-20, - 2.24210e+02, 9.03919e-06, 3.74840e-13, 1.59680e-20, - 1.35138e+02, 5.44818e-06, 2.25927e-13, 9.62439e-21, - 7.83119e+01, 3.15720e-06, 1.30924e-13, 5.57730e-21, - 4.41553e+01, 1.78015e-06, 7.38199e-14, 3.14470e-21, - 2.45888e+01, 9.91317e-07, 4.11082e-14, 1.75119e-21 }; - - double F13_kpFe3O4[] = - { 1.47700e-02, 5.95693e-10, 2.47155e-17, 1.05363e-24, - 2.47694e-02, 9.98982e-10, 4.14481e-17, 1.76695e-24, - 3.73580e-02, 1.50669e-09, 6.25133e-17, 2.66496e-24, - 5.32060e-02, 2.14587e-09, 8.90327e-17, 3.79549e-24, - 8.50036e-02, 3.42830e-09, 1.42241e-16, 6.06380e-24, - 1.29213e-01, 5.21132e-09, 2.16220e-16, 9.21750e-24, - 2.00170e-01, 8.07309e-09, 3.34956e-16, 1.42793e-23, - 3.15560e-01, 1.27269e-08, 5.28045e-16, 2.25107e-23, - 5.01384e-01, 2.02214e-08, 8.38995e-16, 3.57666e-23, - 7.88907e-01, 3.18176e-08, 1.32012e-15, 5.62773e-23, - 1.24250e+00, 5.01116e-08, 2.07915e-15, 8.86347e-23, - 1.95225e+00, 7.87365e-08, 3.26681e-15, 1.39265e-22, - 3.04002e+00, 1.22608e-07, 5.08704e-15, 2.16862e-22, - 4.68918e+00, 1.89120e-07, 7.84668e-15, 3.34506e-22, - 7.12599e+00, 2.87400e-07, 1.19243e-14, 5.08338e-22, - 1.05834e+01, 4.26842e-07, 1.77098e-14, 7.54974e-22, - 1.52356e+01, 6.14471e-07, 2.54946e-14, 1.08684e-21, - 2.13345e+01, 8.60449e-07, 3.57003e-14, 1.52192e-21, - 2.98061e+01, 1.20212e-06, 4.98762e-14, 2.12624e-21, - 4.27642e+01, 1.72473e-06, 7.15598e-14, 3.05062e-21, - 6.30370e+01, 2.54236e-06, 1.05483e-13, 4.49679e-21, - 9.29361e+01, 3.74823e-06, 1.55515e-13, 6.62967e-21, - 1.32987e+02, 5.36353e-06, 2.22535e-13, 9.48673e-21, - 1.82150e+02, 7.34635e-06, 3.04803e-13, 1.29938e-20, - 2.40388e+02, 9.69513e-06, 4.02254e-13, 1.71482e-20, - 3.12065e+02, 1.25860e-05, 5.22197e-13, 2.22614e-20, - 4.08414e+02, 1.64718e-05, 6.83423e-13, 2.91345e-20, - 5.49591e+02, 2.21657e-05, 9.19662e-13, 3.92055e-20, - 7.67451e+02, 3.09523e-05, 1.28422e-12, 5.47467e-20, - 1.10725e+03, 4.46570e-05, 1.85283e-12, 7.89869e-20, - 1.62060e+03, 6.53608e-05, 2.71184e-12, 1.15607e-19, - 2.33999e+03, 9.43747e-05, 3.91564e-12, 1.66925e-19, - 3.24367e+03, 1.30821e-04, 5.42783e-12, 2.31390e-19, - 4.25716e+03, 1.71697e-04, 7.12376e-12, 3.03688e-19, - 5.34010e+03, 2.15373e-04, 8.93591e-12, 3.80941e-19 }; - - double F13_kpAC[] = - { 3.27960e-01, 2.16737e-06, 1.80151e-11, 1.72491e-16, - 4.38754e-01, 2.89959e-06, 2.41015e-11, 2.30770e-16, - 5.78235e-01, 3.82140e-06, 3.17638e-11, 3.04139e-16, - 7.53832e-01, 4.98189e-06, 4.14101e-11, 3.96504e-16, - 1.04018e+00, 6.87442e-06, 5.71418e-11, 5.47146e-16, - 1.41746e+00, 9.36786e-06, 7.78688e-11, 7.45623e-16, - 1.95306e+00, 1.29077e-05, 1.07295e-10, 1.02741e-15, - 2.71551e+00, 1.79470e-05, 1.49187e-10, 1.42858e-15, - 3.79717e+00, 2.50964e-05, 2.08623e-10, 1.99781e-15, - 5.29825e+00, 3.50184e-05, 2.91115e-10, 2.78791e-15, - 7.37979e+00, 4.87780e-05, 4.05522e-10, 3.88380e-15, - 1.02197e+01, 6.75525e-05, 5.61646e-10, 5.37953e-15, - 1.40472e+01, 9.28592e-05, 7.72124e-10, 7.39643e-15, - 1.92121e+01, 1.27015e-04, 1.05627e-09, 1.01201e-14, - 2.61803e+01, 1.73108e-04, 1.43985e-09, 1.37985e-14, - 3.55654e+01, 2.35211e-04, 1.95692e-09, 1.87600e-14, - 4.82268e+01, 3.19039e-04, 2.65535e-09, 2.54677e-14, - 6.54410e+01, 4.33093e-04, 3.60654e-09, 3.46142e-14, - 8.90033e+01, 5.89369e-04, 4.91159e-09, 4.71850e-14, - 1.21154e+02, 8.02913e-04, 6.69826e-09, 6.44364e-14, - 1.64484e+02, 1.09135e-03, 9.11847e-09, 8.78899e-14, - 2.22227e+02, 1.47698e-03, 1.23680e-08, 1.19551e-13, - 2.99250e+02, 1.99360e-03, 1.67456e-08, 1.62501e-13, - 4.02841e+02, 2.69134e-03, 2.26888e-08, 2.21192e-13, - 5.41754e+02, 3.62947e-03, 3.07031e-08, 3.00611e-13, - 7.24111e+02, 4.86183e-03, 4.12300e-08, 4.04886e-13, - 9.58822e+02, 6.44664e-03, 5.47294e-08, 5.38055e-13, - 1.26198e+03, 8.49034e-03, 7.20550e-08, 7.07781e-13, - 1.66376e+03, 1.11958e-02, 9.48672e-08, 9.29402e-13, - 2.21388e+03, 1.49013e-02, 1.25959e-07, 1.22898e-12, - 2.99023e+03, 2.01435e-02, 1.69784e-07, 1.64820e-12, - 4.11644e+03, 2.77858e-02, 2.33536e-07, 2.25436e-12, - 5.78855e+03, 3.92074e-02, 3.28708e-07, 3.15462e-12, - 8.29050e+03, 5.63946e-02, 4.71738e-07, 4.50079e-12, - 1.19408e+04, 8.14776e-02, 6.79738e-07, 6.44637e-12 }; - - double F13_kpSiO2D[] = - { 7.60360e-02, 3.06536e-09, 1.27110e-16, 5.41456e-24, - 9.07207e-02, 3.65737e-09, 1.51659e-16, 6.46027e-24, - 1.09208e-01, 4.40266e-09, 1.82564e-16, 7.77673e-24, - 1.32481e-01, 5.34093e-09, 2.21471e-16, 9.43407e-24, - 1.58907e-01, 6.40629e-09, 2.65648e-16, 1.13159e-23, - 1.91565e-01, 7.72285e-09, 3.20241e-16, 1.36414e-23, - 2.30490e-01, 9.29212e-09, 3.85313e-16, 1.64133e-23, - 2.76795e-01, 1.11589e-08, 4.62722e-16, 1.97107e-23, - 3.33074e-01, 1.34277e-08, 5.56804e-16, 2.37184e-23, - 4.05325e-01, 1.63405e-08, 6.77586e-16, 2.88634e-23, - 5.08160e-01, 2.04863e-08, 8.49498e-16, 3.61863e-23, - 6.72472e-01, 2.71105e-08, 1.12418e-15, 4.78871e-23, - 9.48549e-01, 3.82404e-08, 1.58570e-15, 6.75467e-23, - 1.41787e+00, 5.71610e-08, 2.37028e-15, 1.00968e-22, - 2.19502e+00, 8.84912e-08, 3.66944e-15, 1.56308e-22, - 3.46719e+00, 1.39778e-07, 5.79615e-15, 2.46901e-22, - 5.76852e+00, 2.32556e-07, 9.64331e-15, 4.10780e-22, - 1.17194e+01, 4.72463e-07, 1.95915e-14, 8.34544e-22, - 3.16449e+01, 1.27575e-06, 5.29012e-14, 2.25345e-21, - 8.68296e+01, 3.50050e-06, 1.45154e-13, 6.18318e-21, - 1.92300e+02, 7.75250e-06, 3.21470e-13, 1.36938e-20, - 3.36231e+02, 1.35550e-05, 5.62081e-13, 2.39432e-20, - 5.05825e+02, 2.03921e-05, 8.45594e-13, 3.60201e-20, - 7.20624e+02, 2.90517e-05, 1.20468e-12, 5.13160e-20, - 9.77376e+02, 3.94025e-05, 1.63389e-12, 6.95995e-20, - 1.18646e+03, 4.78315e-05, 1.98341e-12, 8.44881e-20, - 1.23845e+03, 4.99275e-05, 2.07033e-12, 8.81904e-20, - 1.11188e+03, 4.48251e-05, 1.85875e-12, 7.91777e-20, - 8.76396e+02, 3.53316e-05, 1.46508e-12, 6.24086e-20, - 6.22207e+02, 2.50840e-05, 1.04015e-12, 4.43077e-20, - 4.07290e+02, 1.64197e-05, 6.80872e-13, 2.90033e-20, - 2.50573e+02, 1.01017e-05, 4.18886e-13, 1.78434e-20, - 1.47073e+02, 5.92921e-06, 2.45865e-13, 1.04732e-20, - 8.33122e+01, 3.35870e-06, 1.39274e-13, 5.93271e-21, - 4.59585e+01, 1.85280e-06, 7.68295e-14, 3.27273e-21 }; - - double F13_kpAl2O3[] = - { 9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07299e-26, - 1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25, - 2.84365e-03, 1.14641e-10, 4.75376e-18, 2.02498e-25, - 4.14191e-03, 1.66980e-10, 6.92409e-18, 2.94948e-25, - 7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11485e-25, - 1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07269e-25, - 1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24, - 2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84775e-24, - 3.45425e-02, 1.39257e-09, 5.77452e-17, 2.45979e-24, - 4.22006e-02, 1.70130e-09, 7.05474e-17, 3.00513e-24, - 4.71420e-02, 1.90051e-09, 7.88079e-17, 3.35701e-24, - 4.91934e-02, 1.98321e-09, 8.22373e-17, 3.50309e-24, - 5.05162e-02, 2.03654e-09, 8.44486e-17, 3.59729e-24, - 5.78201e-02, 2.33100e-09, 9.66587e-17, 4.11740e-24, - 8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29670e-24, - 1.78786e-01, 7.20769e-09, 2.98879e-16, 1.27315e-23, - 4.36404e-01, 1.75935e-08, 7.29542e-16, 3.10766e-23, - 1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22, - 8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05872e-22, - 3.92751e+01, 1.58336e-06, 6.56567e-14, 2.79680e-21, - 1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20, - 3.83709e+02, 1.54691e-05, 6.41451e-13, 2.73241e-20, - 7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48614e-20, - 1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28883e-20, - 1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79619e-20, - 1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47599e-20, - 1.09978e+03, 4.43371e-05, 1.83851e-12, 7.83159e-20, - 8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73700e-20, - 5.38690e+02, 2.17171e-05, 9.00535e-13, 3.83604e-20, - 3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39508e-20, - 1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20, - 1.13787e+02, 4.58728e-06, 1.90220e-13, 8.10285e-21, - 6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48919e-21, - 3.41529e+01, 1.37686e-06, 5.70939e-14, 2.43205e-21, - 1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpFeM [itab0] = F13_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = F13_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = F13_kpMgSiO3 [itab]; - my_rates->SN0_kpFe3O4 [itab0] = F13_kpFe3O4 [itab]; - my_rates->SN0_kpAC [itab0] = F13_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = F13_kpSiO2D [itab]; - my_rates->SN0_kpAl2O3 [itab0] = F13_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_F15(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 1.53361e-25; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 1.56864e-15; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.13810e-14; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 1.22287e-14; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.89229e-01; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.47463e-15; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 2.15191e-16; - - itab0 = 3 * iSN; - my_rates->SN0_r0FeM [itab0 + 0] = 4.02634e-08; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 4.03318e-08; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 4.03159e-08; - my_rates->SN0_r0Fe3O4 [itab0 + 0] = 4.03301e-08; - my_rates->SN0_r0AC [itab0 + 0] = 1.14540e-05; - my_rates->SN0_r0SiO2D [itab0 + 0] = 4.03146e-08; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 4.03146e-08; - - my_rates->SN0_r0FeM [itab0 + 1] = 1.66860e-15; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 1.67341e-15; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.67184e-15; - my_rates->SN0_r0Fe3O4 [itab0 + 1] = 1.67324e-15; - my_rates->SN0_r0AC [itab0 + 1] = 1.60512e-10; - my_rates->SN0_r0SiO2D [itab0 + 1] = 1.67171e-15; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 1.67171e-15; - - my_rates->SN0_r0FeM [itab0 + 2] = 7.10566e-23; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 7.13397e-23; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 7.12201e-23; - my_rates->SN0_r0Fe3O4 [itab0 + 2] = 7.13269e-23; - my_rates->SN0_r0AC [itab0 + 2] = 2.55303e-15; - my_rates->SN0_r0SiO2D [itab0 + 2] = 7.12105e-23; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 7.12106e-23; - - NTd = 35; - Nmom = 4; - - double F15_kpFeM[] = - { 1.23614e-05, 4.98551e-13, 2.06942e-20, 8.82572e-28, - 2.19525e-05, 8.85374e-13, 3.67505e-20, 1.56735e-27, - 3.40270e-05, 1.37235e-12, 5.69643e-20, 2.42942e-27, - 4.92280e-05, 1.98543e-12, 8.24119e-20, 3.51472e-27, - 8.08465e-05, 3.26062e-12, 1.35343e-19, 5.77209e-27, - 1.25012e-04, 5.04181e-12, 2.09274e-19, 8.92500e-27, - 1.96574e-04, 7.92769e-12, 3.29050e-19, 1.40328e-26, - 3.14473e-04, 1.26818e-11, 5.26348e-19, 2.24457e-26, - 5.06822e-04, 2.04373e-11, 8.48182e-19, 3.61680e-26, - 8.07243e-04, 3.25496e-11, 1.35079e-18, 5.75968e-26, - 1.28661e-03, 5.18753e-11, 2.15265e-18, 9.17827e-26, - 2.05232e-03, 8.27416e-11, 3.43325e-18, 1.46374e-25, - 3.27011e-03, 1.31826e-10, 5.46945e-18, 2.33165e-25, - 5.23877e-03, 2.11162e-10, 8.76012e-18, 3.73409e-25, - 8.44994e-03, 3.40550e-10, 1.41259e-17, 6.02059e-25, - 1.37154e-02, 5.52677e-10, 2.29218e-17, 9.76820e-25, - 2.24094e-02, 9.02883e-10, 3.74411e-17, 1.59536e-24, - 3.70035e-02, 1.49068e-09, 6.18079e-17, 2.63331e-24, - 6.21576e-02, 2.50369e-09, 1.03798e-16, 4.42178e-24, - 1.07032e-01, 4.31074e-09, 1.78696e-16, 7.61171e-24, - 1.90087e-01, 7.65516e-09, 3.17308e-16, 1.35149e-23, - 3.49468e-01, 1.40728e-08, 5.83283e-16, 2.48420e-23, - 6.64945e-01, 2.67755e-08, 1.10973e-15, 4.72613e-23, - 1.30413e+00, 5.25119e-08, 2.17633e-15, 9.26832e-23, - 2.61639e+00, 1.05349e-07, 4.36605e-15, 1.85933e-22, - 5.31790e+00, 2.14123e-07, 8.87391e-15, 3.77901e-22, - 1.08366e+01, 4.36326e-07, 1.80825e-14, 7.70051e-22, - 2.19131e+01, 8.82310e-07, 3.65652e-14, 1.55714e-21, - 4.35353e+01, 1.75290e-06, 7.26444e-14, 3.09356e-21, - 8.42362e+01, 3.39166e-06, 1.40558e-13, 5.98567e-21, - 1.57704e+02, 6.34974e-06, 2.63148e-13, 1.12061e-20, - 2.84822e+02, 1.14680e-05, 4.75258e-13, 2.02388e-20, - 4.96653e+02, 1.99971e-05, 8.28723e-13, 3.52910e-20, - 8.39966e+02, 3.38201e-05, 1.40158e-12, 5.96860e-20, - 1.38932e+03, 5.59392e-05, 2.31824e-12, 9.87221e-20 }; - - double F15_kpMg2SiO4[] = - { 1.05240e-01, 4.24452e-09, 1.76110e-16, 7.50779e-24, - 1.32588e-01, 5.34750e-09, 2.21874e-16, 9.45877e-24, - 1.67016e-01, 6.73607e-09, 2.79487e-16, 1.19149e-23, - 2.10360e-01, 8.48418e-09, 3.52018e-16, 1.50070e-23, - 2.71887e-01, 1.09657e-08, 4.54979e-16, 1.93963e-23, - 3.55694e-01, 1.43458e-08, 5.95222e-16, 2.53751e-23, - 4.84932e-01, 1.95582e-08, 8.11491e-16, 3.45949e-23, - 6.99767e-01, 2.82229e-08, 1.17100e-15, 4.99212e-23, - 1.05860e+00, 4.26950e-08, 1.77146e-15, 7.55199e-23, - 1.62902e+00, 6.57012e-08, 2.72602e-15, 1.16214e-22, - 2.54260e+00, 1.02548e-07, 4.25481e-15, 1.81388e-22, - 3.96488e+00, 1.59911e-07, 6.63487e-15, 2.82853e-22, - 6.10630e+00, 2.46278e-07, 1.02183e-14, 4.35621e-22, - 9.28766e+00, 3.74588e-07, 1.55421e-14, 6.62579e-22, - 1.39265e+01, 5.61679e-07, 2.33047e-14, 9.93510e-22, - 2.05382e+01, 8.28344e-07, 3.43689e-14, 1.46519e-21, - 3.00649e+01, 1.21257e-06, 5.03110e-14, 2.14482e-21, - 4.55102e+01, 1.83551e-06, 7.61572e-14, 3.24668e-21, - 7.47839e+01, 3.01617e-06, 1.25144e-13, 5.33506e-21, - 1.29621e+02, 5.22783e-06, 2.16909e-13, 9.24710e-21, - 2.14820e+02, 8.66407e-06, 3.59482e-13, 1.53252e-20, - 3.20002e+02, 1.29062e-05, 5.35494e-13, 2.28288e-20, - 4.29768e+02, 1.73333e-05, 7.19179e-13, 3.06596e-20, - 5.30827e+02, 2.14092e-05, 8.88291e-13, 3.78690e-20, - 5.99694e+02, 2.41867e-05, 1.00353e-12, 4.27820e-20, - 6.06537e+02, 2.44627e-05, 1.01498e-12, 4.32701e-20, - 5.43262e+02, 2.19107e-05, 9.09100e-13, 3.87561e-20, - 4.33545e+02, 1.74857e-05, 7.25499e-13, 3.09290e-20, - 3.13324e+02, 1.26369e-05, 5.24319e-13, 2.23524e-20, - 2.09006e+02, 8.42958e-06, 3.49753e-13, 1.49104e-20, - 1.31150e+02, 5.28951e-06, 2.19468e-13, 9.35620e-21, - 7.90681e+01, 3.18896e-06, 1.32313e-13, 5.64070e-21, - 4.73389e+01, 1.90926e-06, 7.92175e-14, 3.37715e-21, - 2.96409e+01, 1.19547e-06, 4.96014e-14, 2.11457e-21, - 2.04708e+01, 8.25623e-07, 3.42560e-14, 1.46038e-21 }; - - double F15_kpMgSiO3[] = - { 2.19890e-02, 8.86506e-10, 3.67621e-17, 1.56606e-24, - 3.90612e-02, 1.57479e-09, 6.53041e-17, 2.78195e-24, - 6.05539e-02, 2.44129e-09, 1.01236e-16, 4.31266e-24, - 8.76116e-02, 3.53214e-09, 1.46473e-16, 6.23971e-24, - 1.43288e-01, 5.77677e-09, 2.39554e-16, 1.02050e-23, - 2.19266e-01, 8.83991e-09, 3.66578e-16, 1.56162e-23, - 3.36256e-01, 1.35564e-08, 5.62165e-16, 2.39482e-23, - 5.14336e-01, 2.07359e-08, 8.59887e-16, 3.66311e-23, - 7.97216e-01, 3.21405e-08, 1.33282e-15, 5.67779e-23, - 1.25414e+00, 5.05618e-08, 2.09672e-15, 8.93200e-23, - 2.03450e+00, 8.20227e-08, 3.40136e-15, 1.44897e-22, - 3.34648e+00, 1.34916e-07, 5.59477e-15, 2.38337e-22, - 5.45893e+00, 2.20082e-07, 9.12646e-15, 3.88786e-22, - 8.82117e+00, 3.55633e-07, 1.47476e-14, 6.28245e-22, - 1.41825e+01, 5.71780e-07, 2.37109e-14, 1.01008e-21, - 2.28419e+01, 9.20892e-07, 3.81880e-14, 1.62680e-21, - 3.71178e+01, 1.49644e-06, 6.20550e-14, 2.64353e-21, - 6.14272e+01, 2.47649e-06, 1.02696e-13, 4.37486e-21, - 1.03847e+02, 4.18667e-06, 1.73615e-13, 7.39597e-21, - 1.75507e+02, 7.07570e-06, 2.93419e-13, 1.24996e-20, - 2.82060e+02, 1.13715e-05, 4.71559e-13, 2.00884e-20, - 4.14519e+02, 1.67117e-05, 6.93009e-13, 2.95221e-20, - 5.59961e+02, 2.25753e-05, 9.36165e-13, 3.98805e-20, - 7.11024e+02, 2.86656e-05, 1.18872e-12, 5.06393e-20, - 8.40805e+02, 3.38978e-05, 1.40569e-12, 5.98823e-20, - 8.95312e+02, 3.60953e-05, 1.49682e-12, 6.37643e-20, - 8.40415e+02, 3.38821e-05, 1.40504e-12, 5.98544e-20, - 6.96693e+02, 2.80878e-05, 1.16476e-12, 4.96186e-20, - 5.18202e+02, 2.08918e-05, 8.66351e-13, 3.69065e-20, - 3.52864e+02, 1.42260e-05, 5.89932e-13, 2.51310e-20, - 2.24210e+02, 9.03922e-06, 3.74843e-13, 1.59683e-20, - 1.35138e+02, 5.44820e-06, 2.25929e-13, 9.62454e-21, - 7.83119e+01, 3.15721e-06, 1.30925e-13, 5.57739e-21, - 4.41553e+01, 1.78016e-06, 7.38206e-14, 3.14475e-21, - 2.45888e+01, 9.91321e-07, 4.11086e-14, 1.75122e-21 }; - - double F15_kpFe3O4[] = - { 1.47700e-02, 5.95675e-10, 2.47138e-17, 1.05350e-24, - 2.47694e-02, 9.98953e-10, 4.14453e-17, 1.76673e-24, - 3.73580e-02, 1.50665e-09, 6.25090e-17, 2.66463e-24, - 5.32060e-02, 2.14580e-09, 8.90266e-17, 3.79502e-24, - 8.50036e-02, 3.42820e-09, 1.42232e-16, 6.06304e-24, - 1.29213e-01, 5.21117e-09, 2.16205e-16, 9.21636e-24, - 2.00170e-01, 8.07286e-09, 3.34932e-16, 1.42775e-23, - 3.15560e-01, 1.27266e-08, 5.28008e-16, 2.25079e-23, - 5.01384e-01, 2.02209e-08, 8.38937e-16, 3.57622e-23, - 7.88907e-01, 3.18167e-08, 1.32003e-15, 5.62703e-23, - 1.24250e+00, 5.01101e-08, 2.07900e-15, 8.86237e-23, - 1.95225e+00, 7.87342e-08, 3.26658e-15, 1.39248e-22, - 3.04002e+00, 1.22604e-07, 5.08669e-15, 2.16835e-22, - 4.68918e+00, 1.89115e-07, 7.84613e-15, 3.34465e-22, - 7.12599e+00, 2.87392e-07, 1.19235e-14, 5.08275e-22, - 1.05834e+01, 4.26829e-07, 1.77086e-14, 7.54881e-22, - 1.52356e+01, 6.14453e-07, 2.54928e-14, 1.08671e-21, - 2.13345e+01, 8.60424e-07, 3.56978e-14, 1.52173e-21, - 2.98061e+01, 1.20208e-06, 4.98728e-14, 2.12597e-21, - 4.27642e+01, 1.72468e-06, 7.15548e-14, 3.05024e-21, - 6.30370e+01, 2.54229e-06, 1.05476e-13, 4.49623e-21, - 9.29361e+01, 3.74812e-06, 1.55505e-13, 6.62884e-21, - 1.32987e+02, 5.36337e-06, 2.22519e-13, 9.48555e-21, - 1.82150e+02, 7.34614e-06, 3.04782e-13, 1.29922e-20, - 2.40388e+02, 9.69485e-06, 4.02226e-13, 1.71461e-20, - 3.12065e+02, 1.25856e-05, 5.22160e-13, 2.22586e-20, - 4.08414e+02, 1.64714e-05, 6.83375e-13, 2.91309e-20, - 5.49591e+02, 2.21650e-05, 9.19598e-13, 3.92006e-20, - 7.67451e+02, 3.09514e-05, 1.28413e-12, 5.47399e-20, - 1.10725e+03, 4.46557e-05, 1.85271e-12, 7.89771e-20, - 1.62060e+03, 6.53589e-05, 2.71166e-12, 1.15592e-19, - 2.33999e+03, 9.43719e-05, 3.91537e-12, 1.66904e-19, - 3.24367e+03, 1.30818e-04, 5.42745e-12, 2.31361e-19, - 4.25716e+03, 1.71692e-04, 7.12327e-12, 3.03651e-19, - 5.34010e+03, 2.15367e-04, 8.93529e-12, 3.80893e-19 }; - - double F15_kpAC[] = - { 3.27956e-01, 3.75639e-06, 5.26403e-11, 8.37270e-16, - 4.38770e-01, 5.02579e-06, 7.04309e-11, 1.12026e-15, - 5.78277e-01, 6.62387e-06, 9.28278e-11, 1.47653e-15, - 7.53906e-01, 8.63573e-06, 1.21024e-10, 1.92505e-15, - 1.04036e+00, 1.19174e-05, 1.67020e-10, 2.65676e-15, - 1.41778e+00, 1.62414e-05, 2.27626e-10, 3.62091e-15, - 1.95366e+00, 2.23811e-05, 3.13688e-10, 4.99012e-15, - 2.71664e+00, 3.11237e-05, 4.36248e-10, 6.94018e-15, - 3.79935e+00, 4.35320e-05, 6.10219e-10, 9.70860e-15, - 5.30234e+00, 6.07596e-05, 8.51798e-10, 1.35534e-14, - 7.38743e+00, 8.46654e-05, 1.18710e-09, 1.88910e-14, - 1.02340e+01, 1.17314e-04, 1.64516e-09, 2.61851e-14, - 1.40739e+01, 1.61376e-04, 2.26365e-09, 3.60378e-14, - 1.92619e+01, 2.20951e-04, 3.10040e-09, 4.93757e-14, - 2.62735e+01, 3.01546e-04, 4.23341e-09, 6.74511e-14, - 3.57407e+01, 4.10519e-04, 5.76727e-09, 9.19507e-14, - 4.85587e+01, 5.58361e-04, 7.85200e-09, 1.25306e-13, - 6.60737e+01, 7.60948e-04, 1.07159e-08, 1.71237e-13, - 9.02145e+01, 1.04125e-03, 1.46920e-08, 2.35213e-13, - 1.23479e+02, 1.42959e-03, 2.02271e-08, 3.24675e-13, - 1.68976e+02, 1.96503e-03, 2.79128e-08, 4.49723e-13, - 2.30962e+02, 2.70317e-03, 3.86182e-08, 6.25581e-13, - 3.16043e+02, 3.73154e-03, 5.37252e-08, 8.76701e-13, - 4.33583e+02, 5.17180e-03, 7.51313e-08, 1.23638e-12, - 5.93567e+02, 7.14700e-03, 1.04677e-07, 1.73582e-12, - 8.03334e+02, 9.73553e-03, 1.43375e-07, 2.38969e-12, - 1.06890e+03, 1.29850e-02, 1.91575e-07, 3.19823e-12, - 1.40232e+03, 1.70036e-02, 2.50333e-07, 4.17041e-12, - 1.82952e+03, 2.20557e-02, 3.22829e-07, 5.34792e-12, - 2.39537e+03, 2.86193e-02, 4.15124e-07, 6.81663e-12, - 3.17137e+03, 3.74648e-02, 5.37088e-07, 8.71845e-12, - 4.27121e+03, 4.98190e-02, 7.04376e-07, 1.12776e-11, - 5.87303e+03, 6.75884e-02, 9.40996e-07, 1.48329e-11, - 8.22455e+03, 9.33574e-02, 1.27863e-06, 1.98186e-11, - 1.15719e+04, 1.29494e-01, 1.74429e-06, 2.65764e-11 }; - - double F15_kpSiO2D[] = - { 7.60360e-02, 3.06536e-09, 1.27110e-16, 5.41456e-24, - 9.07207e-02, 3.65737e-09, 1.51659e-16, 6.46027e-24, - 1.09208e-01, 4.40266e-09, 1.82564e-16, 7.77673e-24, - 1.32481e-01, 5.34093e-09, 2.21471e-16, 9.43407e-24, - 1.58907e-01, 6.40629e-09, 2.65648e-16, 1.13159e-23, - 1.91565e-01, 7.72285e-09, 3.20241e-16, 1.36414e-23, - 2.30490e-01, 9.29212e-09, 3.85313e-16, 1.64133e-23, - 2.76795e-01, 1.11589e-08, 4.62722e-16, 1.97107e-23, - 3.33074e-01, 1.34277e-08, 5.56804e-16, 2.37184e-23, - 4.05325e-01, 1.63405e-08, 6.77586e-16, 2.88634e-23, - 5.08160e-01, 2.04863e-08, 8.49498e-16, 3.61864e-23, - 6.72472e-01, 2.71105e-08, 1.12418e-15, 4.78871e-23, - 9.48549e-01, 3.82404e-08, 1.58570e-15, 6.75467e-23, - 1.41787e+00, 5.71610e-08, 2.37028e-15, 1.00968e-22, - 2.19502e+00, 8.84912e-08, 3.66944e-15, 1.56308e-22, - 3.46719e+00, 1.39778e-07, 5.79615e-15, 2.46901e-22, - 5.76852e+00, 2.32556e-07, 9.64331e-15, 4.10780e-22, - 1.17194e+01, 4.72463e-07, 1.95915e-14, 8.34544e-22, - 3.16449e+01, 1.27575e-06, 5.29013e-14, 2.25345e-21, - 8.68296e+01, 3.50050e-06, 1.45154e-13, 6.18318e-21, - 1.92300e+02, 7.75250e-06, 3.21470e-13, 1.36938e-20, - 3.36231e+02, 1.35550e-05, 5.62081e-13, 2.39432e-20, - 5.05825e+02, 2.03921e-05, 8.45594e-13, 3.60201e-20, - 7.20624e+02, 2.90517e-05, 1.20468e-12, 5.13160e-20, - 9.77376e+02, 3.94025e-05, 1.63389e-12, 6.95995e-20, - 1.18646e+03, 4.78315e-05, 1.98341e-12, 8.44881e-20, - 1.23845e+03, 4.99275e-05, 2.07033e-12, 8.81904e-20, - 1.11188e+03, 4.48251e-05, 1.85875e-12, 7.91777e-20, - 8.76396e+02, 3.53316e-05, 1.46508e-12, 6.24086e-20, - 6.22207e+02, 2.50840e-05, 1.04015e-12, 4.43077e-20, - 4.07290e+02, 1.64197e-05, 6.80872e-13, 2.90033e-20, - 2.50573e+02, 1.01017e-05, 4.18886e-13, 1.78434e-20, - 1.47073e+02, 5.92921e-06, 2.45865e-13, 1.04732e-20, - 8.33122e+01, 3.35870e-06, 1.39274e-13, 5.93271e-21, - 4.59585e+01, 1.85280e-06, 7.68295e-14, 3.27273e-21 }; - - double F15_kpAl2O3[] = - { 9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07299e-26, - 1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25, - 2.84365e-03, 1.14641e-10, 4.75376e-18, 2.02498e-25, - 4.14191e-03, 1.66980e-10, 6.92409e-18, 2.94948e-25, - 7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11485e-25, - 1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07269e-25, - 1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24, - 2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84775e-24, - 3.45425e-02, 1.39257e-09, 5.77452e-17, 2.45979e-24, - 4.22006e-02, 1.70130e-09, 7.05474e-17, 3.00513e-24, - 4.71420e-02, 1.90051e-09, 7.88079e-17, 3.35701e-24, - 4.91934e-02, 1.98321e-09, 8.22373e-17, 3.50309e-24, - 5.05162e-02, 2.03654e-09, 8.44486e-17, 3.59729e-24, - 5.78201e-02, 2.33100e-09, 9.66587e-17, 4.11741e-24, - 8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29670e-24, - 1.78786e-01, 7.20769e-09, 2.98879e-16, 1.27315e-23, - 4.36404e-01, 1.75935e-08, 7.29542e-16, 3.10766e-23, - 1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22, - 8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05872e-22, - 3.92751e+01, 1.58336e-06, 6.56567e-14, 2.79680e-21, - 1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20, - 3.83709e+02, 1.54691e-05, 6.41451e-13, 2.73241e-20, - 7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48614e-20, - 1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28883e-20, - 1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79619e-20, - 1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47599e-20, - 1.09978e+03, 4.43371e-05, 1.83851e-12, 7.83159e-20, - 8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73700e-20, - 5.38690e+02, 2.17171e-05, 9.00535e-13, 3.83604e-20, - 3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39508e-20, - 1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20, - 1.13787e+02, 4.58728e-06, 1.90220e-13, 8.10285e-21, - 6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48919e-21, - 3.41529e+01, 1.37686e-06, 5.70939e-14, 2.43205e-21, - 1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpFeM [itab0] = F15_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = F15_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = F15_kpMgSiO3 [itab]; - my_rates->SN0_kpFe3O4 [itab0] = F15_kpFe3O4 [itab]; - my_rates->SN0_kpAC [itab0] = F15_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = F15_kpSiO2D [itab]; - my_rates->SN0_kpAl2O3 [itab0] = F15_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_F50(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 2.33171e-24; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.62486e-10; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 1.21446e-09; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 2.41799e-13; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 1.09849e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 3.41863e-11; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 2.53950e-17; - - itab0 = 3 * iSN; - my_rates->SN0_r0FeM [itab0 + 0] = 4.02891e-08; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 1.68491e-07; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 1.33003e-07; - my_rates->SN0_r0Fe3O4 [itab0 + 0] = 5.89806e-08; - my_rates->SN0_r0AC [itab0 + 0] = 6.81790e-07; - my_rates->SN0_r0SiO2D [itab0 + 0] = 9.81613e-08; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 4.03146e-08; - - my_rates->SN0_r0FeM [itab0 + 1] = 1.67016e-15; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 3.02634e-14; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.84568e-14; - my_rates->SN0_r0Fe3O4 [itab0 + 1] = 3.51732e-15; - my_rates->SN0_r0AC [itab0 + 1] = 6.53175e-13; - my_rates->SN0_r0SiO2D [itab0 + 1] = 9.72845e-15; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 1.67172e-15; - - my_rates->SN0_r0FeM [itab0 + 2] = 7.11339e-23; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 5.60369e-21; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 2.62630e-21; - my_rates->SN0_r0Fe3O4 [itab0 + 2] = 2.11807e-22; - my_rates->SN0_r0AC [itab0 + 2] = 7.65748e-19; - my_rates->SN0_r0SiO2D [itab0 + 2] = 9.68327e-22; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 7.12107e-23; - - NTd = 35; - Nmom = 4; - - double F50_kpFeM[] = - { 1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28, - 2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27, - 3.40288e-05, 1.37326e-12, 5.70184e-20, 2.43208e-27, - 4.92305e-05, 1.98674e-12, 8.24901e-20, 3.51856e-27, - 8.08507e-05, 3.26278e-12, 1.35471e-19, 5.77841e-27, - 1.25019e-04, 5.04514e-12, 2.09472e-19, 8.93477e-27, - 1.96584e-04, 7.93293e-12, 3.29363e-19, 1.40481e-26, - 3.14489e-04, 1.26902e-11, 5.26848e-19, 2.24703e-26, - 5.06846e-04, 2.04508e-11, 8.48987e-19, 3.62076e-26, - 8.07280e-04, 3.25711e-11, 1.35207e-18, 5.76597e-26, - 1.28667e-03, 5.19094e-11, 2.15469e-18, 9.18830e-26, - 2.05240e-03, 8.27959e-11, 3.43651e-18, 1.46534e-25, - 3.27023e-03, 1.31912e-10, 5.47463e-18, 2.33420e-25, - 5.23895e-03, 2.11300e-10, 8.76840e-18, 3.73817e-25, - 8.45019e-03, 3.40772e-10, 1.41393e-17, 6.02717e-25, - 1.37157e-02, 5.53037e-10, 2.29434e-17, 9.77885e-25, - 2.24099e-02, 9.03468e-10, 3.74764e-17, 1.59710e-24, - 3.70041e-02, 1.49164e-09, 6.18661e-17, 2.63618e-24, - 6.21584e-02, 2.50530e-09, 1.03896e-16, 4.42660e-24, - 1.07033e-01, 4.31351e-09, 1.78864e-16, 7.62000e-24, - 1.90089e-01, 7.66007e-09, 3.17606e-16, 1.35297e-23, - 3.49470e-01, 1.40818e-08, 5.83831e-16, 2.48691e-23, - 6.64947e-01, 2.67926e-08, 1.11077e-15, 4.73128e-23, - 1.30413e+00, 5.25455e-08, 2.17837e-15, 9.27841e-23, - 2.61640e+00, 1.05417e-07, 4.37015e-15, 1.86136e-22, - 5.31790e+00, 2.14259e-07, 8.88223e-15, 3.78313e-22, - 1.08366e+01, 4.36604e-07, 1.80995e-14, 7.70889e-22, - 2.19132e+01, 8.82874e-07, 3.65995e-14, 1.55883e-21, - 4.35354e+01, 1.75402e-06, 7.27125e-14, 3.09693e-21, - 8.42362e+01, 3.39383e-06, 1.40690e-13, 5.99219e-21, - 1.57704e+02, 6.35380e-06, 2.63395e-13, 1.12183e-20, - 2.84822e+02, 1.14753e-05, 4.75704e-13, 2.02608e-20, - 4.96653e+02, 2.00098e-05, 8.29500e-13, 3.53294e-20, - 8.39966e+02, 3.38417e-05, 1.40289e-12, 5.97510e-20, - 1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20 }; - - double F50_kpMg2SiO4[] = - { 1.05240e-01, 1.77320e-08, 3.18492e-15, 5.89732e-22, - 1.32588e-01, 2.23399e-08, 4.01256e-15, 7.42980e-22, - 1.67016e-01, 2.81408e-08, 5.05449e-15, 9.35908e-22, - 2.10360e-01, 3.54438e-08, 6.36620e-15, 1.17879e-21, - 2.71887e-01, 4.58106e-08, 8.22824e-15, 1.52357e-21, - 3.55694e-01, 5.99313e-08, 1.07645e-14, 1.99320e-21, - 4.84932e-01, 8.17069e-08, 1.46757e-14, 2.71741e-21, - 6.99767e-01, 1.17905e-07, 2.11774e-14, 3.92128e-21, - 1.05860e+00, 1.78364e-07, 3.20367e-14, 5.93204e-21, - 1.62902e+00, 2.74475e-07, 4.92997e-14, 9.12851e-21, - 2.54260e+00, 4.28406e-07, 7.69478e-14, 1.42479e-20, - 3.96488e+00, 6.68047e-07, 1.19991e-13, 2.22179e-20, - 6.10630e+00, 1.02886e-06, 1.84797e-13, 3.42178e-20, - 9.28766e+00, 1.56489e-06, 2.81076e-13, 5.20451e-20, - 1.39265e+01, 2.34649e-06, 4.21463e-13, 7.80396e-20, - 2.05382e+01, 3.46051e-06, 6.21558e-13, 1.15090e-19, - 3.00649e+01, 5.06568e-06, 9.09868e-13, 1.68475e-19, - 4.55102e+01, 7.66807e-06, 1.37729e-12, 2.55025e-19, - 7.47839e+01, 1.26004e-05, 2.26322e-12, 4.19065e-19, - 1.29621e+02, 2.18400e-05, 3.92277e-12, 7.26354e-19, - 2.14820e+02, 3.61953e-05, 6.50119e-12, 1.20378e-18, - 3.20002e+02, 5.39175e-05, 9.68435e-12, 1.79319e-18, - 4.29768e+02, 7.24122e-05, 1.30063e-11, 2.40829e-18, - 5.30829e+02, 8.94401e-05, 1.60647e-11, 2.97460e-18, - 5.99696e+02, 1.01044e-04, 1.81489e-11, 3.36051e-18, - 6.06539e+02, 1.02197e-04, 1.83560e-11, 3.39886e-18, - 5.43264e+02, 9.15353e-05, 1.64410e-11, 3.04428e-18, - 4.33547e+02, 7.30489e-05, 1.31206e-11, 2.42946e-18, - 3.13324e+02, 5.27923e-05, 9.48225e-12, 1.75577e-18, - 2.09008e+02, 3.52161e-05, 6.32532e-12, 1.17122e-18, - 1.31150e+02, 2.20976e-05, 3.96905e-12, 7.34924e-19, - 7.90692e+01, 1.33225e-05, 2.39291e-12, 4.43080e-19, - 4.73403e+01, 7.97645e-06, 1.43269e-12, 2.65282e-19, - 2.96433e+01, 4.99469e-06, 8.97122e-13, 1.66115e-19, - 2.04754e+01, 3.45001e-06, 6.19680e-13, 1.14743e-19 }; - - double F50_kpMgSiO3[] = - { 2.19890e-02, 2.92460e-09, 4.05846e-16, 5.77498e-23, - 3.90612e-02, 5.19526e-09, 7.20944e-16, 1.02587e-22, - 6.05539e-02, 8.05385e-09, 1.11763e-15, 1.59033e-22, - 8.76116e-02, 1.16526e-08, 1.61703e-15, 2.30095e-22, - 1.43288e-01, 1.90577e-08, 2.64462e-15, 3.76317e-22, - 2.19266e-01, 2.91631e-08, 4.04694e-15, 5.75860e-22, - 3.36256e-01, 4.47230e-08, 6.20619e-15, 8.83109e-22, - 5.14336e-01, 6.84082e-08, 9.49297e-15, 1.35080e-21, - 7.97216e-01, 1.06032e-07, 1.47140e-14, 2.09373e-21, - 1.25414e+00, 1.66804e-07, 2.31474e-14, 3.29375e-21, - 2.03450e+00, 2.70594e-07, 3.75503e-14, 5.34322e-21, - 3.34648e+00, 4.45091e-07, 6.17651e-14, 8.78886e-21, - 5.45893e+00, 7.26054e-07, 1.00754e-13, 1.43368e-20, - 8.82117e+00, 1.17324e-06, 1.62810e-13, 2.31671e-20, - 1.41825e+01, 1.88631e-06, 2.61763e-13, 3.72475e-20, - 2.28419e+01, 3.03804e-06, 4.21588e-13, 5.99898e-20, - 3.71178e+01, 4.93677e-06, 6.85074e-13, 9.74826e-20, - 6.14273e+01, 8.17002e-06, 1.13375e-12, 1.61327e-19, - 1.03847e+02, 1.38119e-05, 1.91667e-12, 2.72733e-19, - 1.75507e+02, 2.33429e-05, 3.23928e-12, 4.60933e-19, - 2.82060e+02, 3.75148e-05, 5.20591e-12, 7.40775e-19, - 4.14519e+02, 5.51322e-05, 7.65067e-12, 1.08865e-18, - 5.59962e+02, 7.44767e-05, 1.03351e-11, 1.47063e-18, - 7.11026e+02, 9.45685e-05, 1.31232e-11, 1.86737e-18, - 8.40809e+02, 1.11830e-04, 1.55186e-11, 2.20822e-18, - 8.95315e+02, 1.19080e-04, 1.65246e-11, 2.35137e-18, - 8.40416e+02, 1.11778e-04, 1.55114e-11, 2.20719e-18, - 6.96694e+02, 9.26624e-05, 1.28587e-11, 1.82973e-18, - 5.18204e+02, 6.89226e-05, 9.56436e-12, 1.36096e-18, - 3.52865e+02, 4.69321e-05, 6.51275e-12, 9.26731e-19, - 2.24211e+02, 2.98208e-05, 4.13822e-12, 5.88848e-19, - 1.35138e+02, 1.79738e-05, 2.49421e-12, 3.54913e-19, - 7.83122e+01, 1.04158e-05, 1.44539e-12, 2.05672e-19, - 4.41556e+01, 5.87282e-06, 8.14969e-13, 1.15966e-19, - 2.45896e+01, 3.27050e-06, 4.53847e-13, 6.45802e-20 }; - - double F50_kpFe3O4[] = - { 1.47700e-02, 8.71144e-10, 5.19508e-17, 3.12839e-24, - 2.47694e-02, 1.46092e-09, 8.71220e-17, 5.24635e-24, - 3.73580e-02, 2.20340e-09, 1.31400e-16, 7.91270e-24, - 5.32060e-02, 3.13813e-09, 1.87143e-16, 1.12694e-23, - 8.50036e-02, 5.01357e-09, 2.98985e-16, 1.80044e-23, - 1.29213e-01, 7.62106e-09, 4.54483e-16, 2.73683e-23, - 2.00170e-01, 1.18061e-08, 7.04061e-16, 4.23974e-23, - 3.15560e-01, 1.86119e-08, 1.10993e-15, 6.68379e-23, - 5.01384e-01, 2.95719e-08, 1.76353e-15, 1.06197e-22, - 7.88907e-01, 4.65303e-08, 2.77484e-15, 1.67096e-22, - 1.24250e+00, 7.32834e-08, 4.37027e-15, 2.63171e-22, - 1.95225e+00, 1.15145e-07, 6.86667e-15, 4.13500e-22, - 3.04002e+00, 1.79302e-07, 1.06927e-14, 6.43899e-22, - 4.68918e+00, 2.76571e-07, 1.64933e-14, 9.93203e-22, - 7.12599e+00, 4.20295e-07, 2.50644e-14, 1.50934e-21, - 1.05834e+01, 6.24215e-07, 3.72252e-14, 2.24164e-21, - 1.52356e+01, 8.98605e-07, 5.35885e-14, 3.22701e-21, - 2.13345e+01, 1.25832e-06, 7.50404e-14, 4.51881e-21, - 2.98061e+01, 1.75798e-06, 1.04837e-13, 6.31314e-21, - 4.27642e+01, 2.52226e-06, 1.50415e-13, 9.05777e-21, - 6.30370e+01, 3.71796e-06, 2.21721e-13, 1.33517e-20, - 9.29361e+01, 5.48143e-06, 3.26886e-13, 1.96845e-20, - 1.32987e+02, 7.84365e-06, 4.67758e-13, 2.81676e-20, - 1.82150e+02, 1.07433e-05, 6.40681e-13, 3.85808e-20, - 2.40388e+02, 1.41782e-05, 8.45520e-13, 5.09158e-20, - 3.12065e+02, 1.84058e-05, 1.09763e-12, 6.60977e-20, - 4.08414e+02, 2.40885e-05, 1.43652e-12, 8.65051e-20, - 5.49591e+02, 3.24152e-05, 1.93309e-12, 1.16407e-19, - 7.67451e+02, 4.52647e-05, 2.69937e-12, 1.62552e-19, - 1.10725e+03, 6.53066e-05, 3.89457e-12, 2.34525e-19, - 1.62060e+03, 9.55840e-05, 5.70017e-12, 3.43255e-19, - 2.33999e+03, 1.38014e-04, 8.23049e-12, 4.95627e-19, - 3.24369e+03, 1.91315e-04, 1.14091e-11, 6.87037e-19, - 4.25718e+03, 2.51091e-04, 1.49739e-11, 9.01702e-19, - 5.34014e+03, 3.14965e-04, 1.87830e-11, 1.13108e-18 }; - - double F50_kpAC[] = - { 3.27960e-01, 2.23600e-07, 2.14215e-13, 2.51135e-19, - 4.38752e-01, 2.99136e-07, 2.86582e-13, 3.35973e-19, - 5.78230e-01, 3.94231e-07, 3.77685e-13, 4.42778e-19, - 7.53823e-01, 5.13949e-07, 4.92378e-13, 5.77238e-19, - 1.04013e+00, 7.09149e-07, 6.79388e-13, 7.96479e-19, - 1.41735e+00, 9.66336e-07, 9.25781e-13, 1.08534e-18, - 1.95292e+00, 1.33148e-06, 1.27560e-12, 1.49545e-18, - 2.71530e+00, 1.85127e-06, 1.77357e-12, 2.07925e-18, - 3.79675e+00, 2.58859e-06, 2.47995e-12, 2.90737e-18, - 5.29742e+00, 3.61173e-06, 3.46016e-12, 4.05652e-18, - 7.37832e+00, 5.03048e-06, 4.81937e-12, 5.65000e-18, - 1.02167e+01, 6.96570e-06, 6.67339e-12, 7.82359e-18, - 1.40420e+01, 9.57377e-06, 9.17203e-12, 1.07529e-17, - 1.92020e+01, 1.30918e-05, 1.25425e-11, 1.47044e-17, - 2.61614e+01, 1.78368e-05, 1.70885e-11, 2.00340e-17, - 3.55303e+01, 2.42246e-05, 2.32084e-11, 2.72089e-17, - 4.81604e+01, 3.28360e-05, 3.14588e-11, 3.68819e-17, - 6.53156e+01, 4.45330e-05, 4.26657e-11, 5.00213e-17, - 8.87641e+01, 6.05213e-05, 5.79846e-11, 6.79824e-17, - 1.20700e+02, 8.22973e-05, 7.88495e-11, 9.24471e-17, - 1.63611e+02, 1.11558e-04, 1.06888e-10, 1.25326e-16, - 2.20556e+02, 1.50393e-04, 1.44104e-10, 1.68969e-16, - 2.96069e+02, 2.01894e-04, 1.93464e-10, 2.26864e-16, - 3.96959e+02, 2.70713e-04, 2.59434e-10, 3.04254e-16, - 5.31398e+02, 3.62437e-04, 3.47381e-10, 4.07456e-16, - 7.06744e+02, 4.82105e-04, 4.62166e-10, 5.42204e-16, - 9.30503e+02, 6.34887e-04, 6.08797e-10, 7.14450e-16, - 1.21574e+03, 8.29802e-04, 7.96038e-10, 9.34622e-16, - 1.58603e+03, 1.08311e-03, 1.03970e-09, 1.22157e-15, - 2.07753e+03, 1.41988e-03, 1.36429e-09, 1.60466e-15, - 2.74067e+03, 1.87531e-03, 1.80443e-09, 2.12568e-15, - 3.64502e+03, 2.49832e-03, 2.40876e-09, 2.84400e-15, - 4.89065e+03, 3.35972e-03, 3.24810e-09, 3.84654e-15, - 6.62881e+03, 4.56615e-03, 4.42856e-09, 5.26292e-15, - 9.09708e+03, 6.28233e-03, 6.11057e-09, 7.28448e-15 }; - - double F50_kpSiO2D[] = - { 7.60360e-02, 7.46380e-09, 7.39712e-16, 7.36277e-23, - 9.07207e-02, 8.90526e-09, 8.82572e-16, 8.78473e-23, - 1.09208e-01, 1.07200e-08, 1.06242e-15, 1.05749e-22, - 1.32481e-01, 1.30045e-08, 1.28884e-15, 1.28285e-22, - 1.58907e-01, 1.55986e-08, 1.54592e-15, 1.53874e-22, - 1.91565e-01, 1.88042e-08, 1.86363e-15, 1.85497e-22, - 2.30490e-01, 2.26252e-08, 2.24231e-15, 2.23190e-22, - 2.76795e-01, 2.71706e-08, 2.69279e-15, 2.68028e-22, - 3.33074e-01, 3.26950e-08, 3.24029e-15, 3.22524e-22, - 4.05325e-01, 3.97872e-08, 3.94318e-15, 3.92487e-22, - 5.08160e-01, 4.98817e-08, 4.94361e-15, 4.92065e-22, - 6.72472e-01, 6.60108e-08, 6.54211e-15, 6.51173e-22, - 9.48549e-01, 9.31109e-08, 9.22792e-15, 9.18506e-22, - 1.41787e+00, 1.39180e-07, 1.37937e-14, 1.37297e-21, - 2.19502e+00, 2.15466e-07, 2.13541e-14, 2.12549e-21, - 3.46719e+00, 3.40344e-07, 3.37304e-14, 3.35738e-21, - 5.76852e+00, 5.66246e-07, 5.61188e-14, 5.58582e-21, - 1.17194e+01, 1.15039e-06, 1.14012e-13, 1.13482e-20, - 3.16449e+01, 3.10631e-06, 3.07856e-13, 3.06426e-20, - 8.68296e+01, 8.52331e-06, 8.44717e-13, 8.40795e-20, - 1.92300e+02, 1.88764e-05, 1.87078e-12, 1.86209e-19, - 3.36231e+02, 3.30049e-05, 3.27100e-12, 3.25581e-19, - 5.05825e+02, 4.96525e-05, 4.92089e-12, 4.89804e-19, - 7.20624e+02, 7.07374e-05, 7.01055e-12, 6.97800e-19, - 9.77376e+02, 9.59406e-05, 9.50836e-12, 9.46420e-19, - 1.18646e+03, 1.16464e-04, 1.15424e-11, 1.14888e-18, - 1.23845e+03, 1.21568e-04, 1.20482e-11, 1.19922e-18, - 1.11188e+03, 1.09144e-04, 1.08169e-11, 1.07667e-18, - 8.76396e+02, 8.60282e-05, 8.52597e-12, 8.48638e-19, - 6.22207e+02, 6.10766e-05, 6.05311e-12, 6.02500e-19, - 4.07290e+02, 3.99801e-05, 3.96230e-12, 3.94390e-19, - 2.50573e+02, 2.45966e-05, 2.43769e-12, 2.42636e-19, - 1.47073e+02, 1.44369e-05, 1.43080e-12, 1.42415e-19, - 8.33122e+01, 8.17804e-06, 8.10499e-13, 8.06735e-20, - 4.59586e+01, 4.51135e-06, 4.47106e-13, 4.45029e-20 }; - - double F50_kpAl2O3[] = - { 9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07300e-26, - 1.81240e-03, 7.30662e-11, 3.02982e-18, 1.29062e-25, - 2.84365e-03, 1.14641e-10, 4.75377e-18, 2.02498e-25, - 4.14191e-03, 1.66980e-10, 6.92410e-18, 2.94948e-25, - 7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11486e-25, - 1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07270e-25, - 1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24, - 2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84776e-24, - 3.45425e-02, 1.39257e-09, 5.77453e-17, 2.45980e-24, - 4.22006e-02, 1.70130e-09, 7.05475e-17, 3.00514e-24, - 4.71420e-02, 1.90051e-09, 7.88080e-17, 3.35701e-24, - 4.91934e-02, 1.98321e-09, 8.22374e-17, 3.50310e-24, - 5.05162e-02, 2.03654e-09, 8.44487e-17, 3.59729e-24, - 5.78201e-02, 2.33100e-09, 9.66588e-17, 4.11741e-24, - 8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29671e-24, - 1.78786e-01, 7.20770e-09, 2.98880e-16, 1.27315e-23, - 4.36404e-01, 1.75935e-08, 7.29543e-16, 3.10766e-23, - 1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22, - 8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05873e-22, - 3.92751e+01, 1.58336e-06, 6.56568e-14, 2.79681e-21, - 1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20, - 3.83709e+02, 1.54691e-05, 6.41452e-13, 2.73242e-20, - 7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48615e-20, - 1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28885e-20, - 1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79620e-20, - 1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47600e-20, - 1.09978e+03, 4.43372e-05, 1.83852e-12, 7.83160e-20, - 8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73701e-20, - 5.38690e+02, 2.17171e-05, 9.00536e-13, 3.83605e-20, - 3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39509e-20, - 1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20, - 1.13787e+02, 4.58729e-06, 1.90220e-13, 8.10286e-21, - 6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48920e-21, - 3.41529e+01, 1.37686e-06, 5.70940e-14, 2.43205e-21, - 1.81893e+01, 7.33294e-07, 3.04073e-14, 1.29527e-21 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpFeM [itab0] = F50_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = F50_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = F50_kpMgSiO3 [itab]; - my_rates->SN0_kpFe3O4 [itab0] = F50_kpFe3O4 [itab]; - my_rates->SN0_kpAC [itab0] = F50_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = F50_kpSiO2D [itab]; - my_rates->SN0_kpAl2O3 [itab0] = F50_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_F80(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.87590e-26; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.36180e-13; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 2.48190e-12; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = 3.01120e-15; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 8.68025e-03; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 3.70132e-14; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = 3.77811e-18; - - itab0 = 3 * iSN; - my_rates->SN0_r0FeM [itab0 + 0] = 4.02891e-08; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 5.88698e-08; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 5.87709e-08; - my_rates->SN0_r0Fe3O4 [itab0 + 0] = 4.03342e-08; - my_rates->SN0_r0AC [itab0 + 0] = 4.22607e-06; - my_rates->SN0_r0SiO2D [itab0 + 0] = 4.03439e-08; - my_rates->SN0_r0Al2O3 [itab0 + 0] = 4.03146e-08; - - my_rates->SN0_r0FeM [itab0 + 1] = 1.67016e-15; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 3.50624e-15; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 3.49547e-15; - my_rates->SN0_r0Fe3O4 [itab0 + 1] = 1.67365e-15; - my_rates->SN0_r0AC [itab0 + 1] = 2.30435e-11; - my_rates->SN0_r0SiO2D [itab0 + 1] = 1.67461e-15; - my_rates->SN0_r0Al2O3 [itab0 + 1] = 1.67171e-15; - - my_rates->SN0_r0FeM [itab0 + 2] = 7.11339e-23; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 2.10950e-22; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 2.10029e-22; - my_rates->SN0_r0Fe3O4 [itab0 + 2] = 7.13577e-23; - my_rates->SN0_r0AC [itab0 + 2] = 1.46801e-16; - my_rates->SN0_r0SiO2D [itab0 + 2] = 7.14309e-23; - my_rates->SN0_r0Al2O3 [itab0 + 2] = 7.12106e-23; - - NTd = 35; - Nmom = 4; - - double F80_kpFeM[] = - { 1.23620e-05, 4.98882e-13, 2.07138e-20, 8.83538e-28, - 2.19537e-05, 8.85960e-13, 3.67854e-20, 1.56906e-27, - 3.40288e-05, 1.37326e-12, 5.70184e-20, 2.43208e-27, - 4.92305e-05, 1.98674e-12, 8.24901e-20, 3.51856e-27, - 8.08507e-05, 3.26278e-12, 1.35471e-19, 5.77841e-27, - 1.25019e-04, 5.04514e-12, 2.09472e-19, 8.93477e-27, - 1.96584e-04, 7.93293e-12, 3.29363e-19, 1.40481e-26, - 3.14489e-04, 1.26902e-11, 5.26848e-19, 2.24703e-26, - 5.06846e-04, 2.04508e-11, 8.48987e-19, 3.62076e-26, - 8.07280e-04, 3.25711e-11, 1.35207e-18, 5.76597e-26, - 1.28667e-03, 5.19094e-11, 2.15469e-18, 9.18830e-26, - 2.05240e-03, 8.27959e-11, 3.43651e-18, 1.46534e-25, - 3.27023e-03, 1.31912e-10, 5.47463e-18, 2.33420e-25, - 5.23895e-03, 2.11300e-10, 8.76840e-18, 3.73817e-25, - 8.45019e-03, 3.40772e-10, 1.41393e-17, 6.02717e-25, - 1.37157e-02, 5.53037e-10, 2.29434e-17, 9.77885e-25, - 2.24099e-02, 9.03468e-10, 3.74764e-17, 1.59710e-24, - 3.70041e-02, 1.49164e-09, 6.18661e-17, 2.63618e-24, - 6.21584e-02, 2.50530e-09, 1.03896e-16, 4.42660e-24, - 1.07033e-01, 4.31351e-09, 1.78864e-16, 7.62000e-24, - 1.90089e-01, 7.66007e-09, 3.17606e-16, 1.35297e-23, - 3.49470e-01, 1.40818e-08, 5.83831e-16, 2.48691e-23, - 6.64947e-01, 2.67926e-08, 1.11077e-15, 4.73128e-23, - 1.30413e+00, 5.25455e-08, 2.17837e-15, 9.27841e-23, - 2.61640e+00, 1.05417e-07, 4.37015e-15, 1.86136e-22, - 5.31790e+00, 2.14259e-07, 8.88223e-15, 3.78313e-22, - 1.08366e+01, 4.36604e-07, 1.80995e-14, 7.70889e-22, - 2.19132e+01, 8.82874e-07, 3.65995e-14, 1.55883e-21, - 4.35354e+01, 1.75402e-06, 7.27125e-14, 3.09693e-21, - 8.42362e+01, 3.39383e-06, 1.40690e-13, 5.99219e-21, - 1.57704e+02, 6.35380e-06, 2.63395e-13, 1.12183e-20, - 2.84822e+02, 1.14753e-05, 4.75704e-13, 2.02608e-20, - 4.96653e+02, 2.00098e-05, 8.29500e-13, 3.53294e-20, - 8.39966e+02, 3.38417e-05, 1.40289e-12, 5.97510e-20, - 1.38932e+03, 5.59749e-05, 2.32042e-12, 9.88295e-20 }; - - double F80_kpMg2SiO4[] = - { 1.05240e-01, 6.19546e-09, 3.68996e-16, 2.22004e-23, - 1.32588e-01, 7.80541e-09, 4.64884e-16, 2.79694e-23, - 1.67016e-01, 9.83223e-09, 5.85599e-16, 3.52321e-23, - 2.10360e-01, 1.23838e-08, 7.37570e-16, 4.43753e-23, - 2.71887e-01, 1.60059e-08, 9.53300e-16, 5.73545e-23, - 3.55694e-01, 2.09396e-08, 1.24715e-15, 7.50336e-23, - 4.84932e-01, 2.85479e-08, 1.70029e-15, 1.02296e-22, - 6.99767e-01, 4.11952e-08, 2.45355e-15, 1.47616e-22, - 1.05860e+00, 6.23193e-08, 3.71169e-15, 2.23311e-22, - 1.62902e+00, 9.59000e-08, 5.71172e-15, 3.43641e-22, - 2.54260e+00, 1.49682e-07, 8.91495e-15, 5.36361e-22, - 3.96488e+00, 2.33412e-07, 1.39018e-14, 8.36390e-22, - 6.10630e+00, 3.59476e-07, 2.14101e-14, 1.28812e-21, - 9.28766e+00, 5.46763e-07, 3.25647e-14, 1.95923e-21, - 1.39265e+01, 8.19849e-07, 4.88295e-14, 2.93779e-21, - 2.05382e+01, 1.20908e-06, 7.20119e-14, 4.33254e-21, - 3.00649e+01, 1.76992e-06, 1.05415e-13, 6.34219e-21, - 4.55102e+01, 2.67918e-06, 1.59569e-13, 9.60036e-21, - 7.47839e+01, 4.40251e-06, 2.62210e-13, 1.57756e-20, - 1.29621e+02, 7.63075e-06, 4.54481e-13, 2.73435e-20, - 2.14820e+02, 1.26464e-05, 7.53210e-13, 4.53162e-20, - 3.20002e+02, 1.88384e-05, 1.12200e-12, 6.75043e-20, - 4.29768e+02, 2.53004e-05, 1.50687e-12, 9.06596e-20, - 5.30827e+02, 3.12497e-05, 1.86120e-12, 1.11978e-19, - 5.99694e+02, 3.53039e-05, 2.10267e-12, 1.26505e-19, - 6.06537e+02, 3.57067e-05, 2.12666e-12, 1.27949e-19, - 5.43262e+02, 3.19817e-05, 1.90480e-12, 1.14601e-19, - 4.33545e+02, 2.55227e-05, 1.52011e-12, 9.14563e-20, - 3.13324e+02, 1.84453e-05, 1.09859e-12, 6.60956e-20, - 2.09006e+02, 1.23041e-05, 7.32824e-13, 4.40898e-20, - 1.31150e+02, 7.72078e-06, 4.59843e-13, 2.76661e-20, - 7.90683e+01, 4.65474e-06, 2.77232e-13, 1.66794e-20, - 4.73389e+01, 2.78683e-06, 1.65981e-13, 9.98614e-21, - 2.96409e+01, 1.74496e-06, 1.03928e-13, 6.25275e-21, - 2.04709e+01, 1.20512e-06, 7.17759e-14, 4.31834e-21 }; - - double F80_kpMgSiO3[] = - { 2.19890e-02, 1.29231e-09, 7.68620e-17, 4.61833e-24, - 3.90612e-02, 2.29567e-09, 1.36538e-16, 8.20401e-24, - 6.05539e-02, 3.55881e-09, 2.11665e-16, 1.27181e-23, - 8.76116e-02, 5.14902e-09, 3.06244e-16, 1.84010e-23, - 1.43288e-01, 8.42115e-09, 5.00858e-16, 3.00946e-23, - 2.19266e-01, 1.28865e-08, 7.66440e-16, 4.60523e-23, - 3.36256e-01, 1.97621e-08, 1.17537e-15, 7.06235e-23, - 5.14336e-01, 3.02280e-08, 1.79785e-15, 1.08026e-22, - 7.97216e-01, 4.68532e-08, 2.78665e-15, 1.67439e-22, - 1.25414e+00, 7.37070e-08, 4.38381e-15, 2.63406e-22, - 2.03450e+00, 1.19569e-07, 7.11154e-15, 4.27305e-22, - 3.34648e+00, 1.96676e-07, 1.16975e-14, 7.02858e-22, - 5.45893e+00, 3.20827e-07, 1.90816e-14, 1.14654e-21, - 8.82117e+00, 5.18428e-07, 3.08342e-14, 1.85270e-21, - 1.41825e+01, 8.33519e-07, 4.95746e-14, 2.97874e-21, - 2.28419e+01, 1.34244e-06, 7.98433e-14, 4.79747e-21, - 3.71178e+01, 2.18145e-06, 1.29744e-13, 7.79582e-21, - 6.14272e+01, 3.61014e-06, 2.14717e-13, 1.29015e-20, - 1.03847e+02, 6.10317e-06, 3.62993e-13, 2.18108e-20, - 1.75507e+02, 1.03147e-05, 6.13479e-13, 3.68615e-20, - 2.82060e+02, 1.65769e-05, 9.85934e-13, 5.92409e-20, - 4.14519e+02, 2.43617e-05, 1.44894e-12, 8.70611e-20, - 5.59961e+02, 3.29094e-05, 1.95733e-12, 1.17608e-19, - 7.11024e+02, 4.17876e-05, 2.48537e-12, 1.49336e-19, - 8.40806e+02, 4.94150e-05, 2.93902e-12, 1.76594e-19, - 8.95312e+02, 5.26183e-05, 3.12954e-12, 1.88042e-19, - 8.40415e+02, 4.93920e-05, 2.93765e-12, 1.76512e-19, - 6.96693e+02, 4.09453e-05, 2.43527e-12, 1.46326e-19, - 5.18202e+02, 3.04552e-05, 1.81136e-12, 1.08838e-19, - 3.52864e+02, 2.07382e-05, 1.23343e-12, 7.41118e-20, - 2.24210e+02, 1.31770e-05, 7.83720e-13, 4.70907e-20, - 1.35138e+02, 7.94218e-06, 4.72371e-13, 2.83829e-20, - 7.83119e+01, 4.60247e-06, 2.73737e-13, 1.64478e-20, - 4.41553e+01, 2.59505e-06, 1.54344e-13, 9.27391e-21, - 2.45888e+01, 1.44511e-06, 8.59497e-14, 5.16438e-21 }; - - double F80_kpFe3O4[] = - { 1.47700e-02, 5.95736e-10, 2.47198e-17, 1.05395e-24, - 2.47694e-02, 9.99055e-10, 4.14553e-17, 1.76749e-24, - 3.73580e-02, 1.50680e-09, 6.25240e-17, 2.66578e-24, - 5.32060e-02, 2.14602e-09, 8.90481e-17, 3.79666e-24, - 8.50036e-02, 3.42855e-09, 1.42266e-16, 6.06566e-24, - 1.29213e-01, 5.21170e-09, 2.16257e-16, 9.22034e-24, - 2.00170e-01, 8.07368e-09, 3.35013e-16, 1.42836e-23, - 3.15560e-01, 1.27279e-08, 5.28136e-16, 2.25176e-23, - 5.01384e-01, 2.02229e-08, 8.39139e-16, 3.57776e-23, - 7.88907e-01, 3.18199e-08, 1.32035e-15, 5.62946e-23, - 1.24250e+00, 5.01152e-08, 2.07951e-15, 8.86619e-23, - 1.95225e+00, 7.87422e-08, 3.26737e-15, 1.39308e-22, - 3.04002e+00, 1.22617e-07, 5.08792e-15, 2.16929e-22, - 4.68918e+00, 1.89134e-07, 7.84803e-15, 3.34609e-22, - 7.12599e+00, 2.87421e-07, 1.19264e-14, 5.08494e-22, - 1.05834e+01, 4.26872e-07, 1.77129e-14, 7.55206e-22, - 1.52356e+01, 6.14515e-07, 2.54990e-14, 1.08718e-21, - 2.13345e+01, 8.60511e-07, 3.57065e-14, 1.52238e-21, - 2.98061e+01, 1.20220e-06, 4.98848e-14, 2.12689e-21, - 4.27642e+01, 1.72486e-06, 7.15721e-14, 3.05155e-21, - 6.30370e+01, 2.54254e-06, 1.05502e-13, 4.49817e-21, - 9.29361e+01, 3.74850e-06, 1.55542e-13, 6.63170e-21, - 1.32987e+02, 5.36392e-06, 2.22573e-13, 9.48964e-21, - 1.82150e+02, 7.34689e-06, 3.04855e-13, 1.29978e-20, - 2.40388e+02, 9.69583e-06, 4.02324e-13, 1.71535e-20, - 3.12065e+02, 1.25869e-05, 5.22286e-13, 2.22682e-20, - 4.08414e+02, 1.64730e-05, 6.83540e-13, 2.91435e-20, - 5.49591e+02, 2.21673e-05, 9.19821e-13, 3.92175e-20, - 7.67451e+02, 3.09545e-05, 1.28444e-12, 5.47635e-20, - 1.10725e+03, 4.46602e-05, 1.85315e-12, 7.90111e-20, - 1.62060e+03, 6.53655e-05, 2.71231e-12, 1.15642e-19, - 2.33999e+03, 9.43815e-05, 3.91631e-12, 1.66976e-19, - 3.24367e+03, 1.30831e-04, 5.42876e-12, 2.31461e-19, - 4.25716e+03, 1.71709e-04, 7.12499e-12, 3.03781e-19, - 5.34010e+03, 2.15389e-04, 8.93744e-12, 3.81058e-19 }; - - double F80_kpAC[] = - { 3.27960e-01, 1.38598e-06, 7.55735e-12, 4.81450e-17, - 4.38752e-01, 1.85420e-06, 1.01104e-11, 6.44096e-17, - 5.78230e-01, 2.44365e-06, 1.33245e-11, 8.48855e-17, - 7.53823e-01, 3.18572e-06, 1.73708e-11, 1.10663e-16, - 1.04016e+00, 4.39581e-06, 2.39692e-11, 1.52700e-16, - 1.41740e+00, 5.99012e-06, 3.26627e-11, 2.08084e-16, - 1.95298e+00, 8.25351e-06, 4.50044e-11, 2.86710e-16, - 2.71536e+00, 1.14754e-05, 6.25729e-11, 3.98636e-16, - 3.79688e+00, 1.60461e-05, 8.74963e-11, 5.57421e-16, - 5.29770e+00, 2.23889e-05, 1.22083e-10, 7.77774e-16, - 7.37879e+00, 3.11841e-05, 1.70043e-10, 1.08333e-15, - 1.02177e+01, 4.31826e-05, 2.35472e-10, 1.50021e-15, - 1.40437e+01, 5.93525e-05, 3.23651e-10, 2.06204e-15, - 1.92054e+01, 8.11692e-05, 4.42628e-10, 2.82017e-15, - 2.61678e+01, 1.10598e-04, 6.03124e-10, 3.84293e-15, - 3.55420e+01, 1.50223e-04, 8.19247e-10, 5.22035e-15, - 4.81826e+01, 2.03661e-04, 1.11074e-09, 7.07845e-15, - 6.53571e+01, 2.76274e-04, 1.50689e-09, 9.60430e-15, - 8.88432e+01, 3.75591e-04, 2.04885e-09, 1.30610e-14, - 1.20848e+02, 5.10965e-04, 2.78778e-09, 1.77762e-14, - 1.63896e+02, 6.93122e-04, 3.78255e-09, 2.41285e-14, - 2.21094e+02, 9.35280e-04, 5.10587e-09, 3.25877e-14, - 2.97091e+02, 1.25728e-03, 6.86710e-09, 4.38623e-14, - 3.98900e+02, 1.68904e-03, 9.23101e-09, 5.90159e-14, - 5.35045e+02, 2.26701e-03, 1.23979e-08, 7.93362e-14, - 7.13531e+02, 3.02568e-03, 1.65576e-08, 1.06036e-13, - 9.43152e+02, 4.00348e-03, 2.19225e-08, 1.40472e-13, - 1.23958e+03, 5.26932e-03, 2.88749e-08, 1.85093e-13, - 1.63174e+03, 6.95105e-03, 3.81274e-08, 2.44493e-13, - 2.16646e+03, 9.25803e-03, 5.08543e-08, 3.26274e-13, - 2.91544e+03, 1.25164e-02, 6.89019e-08, 4.42468e-13, - 3.98965e+03, 1.72412e-02, 9.52155e-08, 6.12399e-13, - 5.56191e+03, 2.42454e-02, 1.34481e-07, 8.66957e-13, - 7.88390e+03, 3.47095e-02, 1.93494e-07, 1.25089e-12, - 1.12585e+04, 4.99889e-02, 2.79860e-07, 1.81329e-12 }; - - double F80_kpSiO2D[] = - { 7.60360e-02, 3.06759e-09, 1.27330e-16, 5.43132e-24, - 9.07207e-02, 3.66003e-09, 1.51922e-16, 6.48026e-24, - 1.09208e-01, 4.40586e-09, 1.82880e-16, 7.80079e-24, - 1.32481e-01, 5.34481e-09, 2.21854e-16, 9.46325e-24, - 1.58907e-01, 6.41094e-09, 2.66108e-16, 1.13509e-23, - 1.91565e-01, 7.72847e-09, 3.20796e-16, 1.36836e-23, - 2.30490e-01, 9.29887e-09, 3.85981e-16, 1.64641e-23, - 2.76795e-01, 1.11670e-08, 4.63523e-16, 1.97717e-23, - 3.33074e-01, 1.34375e-08, 5.57768e-16, 2.37917e-23, - 4.05325e-01, 1.63524e-08, 6.78759e-16, 2.89527e-23, - 5.08160e-01, 2.05012e-08, 8.50969e-16, 3.62983e-23, - 6.72472e-01, 2.71301e-08, 1.12613e-15, 4.80353e-23, - 9.48549e-01, 3.82682e-08, 1.58845e-15, 6.77557e-23, - 1.41787e+00, 5.72025e-08, 2.37438e-15, 1.01280e-22, - 2.19502e+00, 8.85555e-08, 3.67579e-15, 1.56792e-22, - 3.46719e+00, 1.39880e-07, 5.80619e-15, 2.47665e-22, - 5.76852e+00, 2.32725e-07, 9.66001e-15, 4.12050e-22, - 1.17194e+01, 4.72806e-07, 1.96254e-14, 8.37126e-22, - 3.16449e+01, 1.27668e-06, 5.29928e-14, 2.26042e-21, - 8.68296e+01, 3.50304e-06, 1.45406e-13, 6.20231e-21, - 1.92300e+02, 7.75813e-06, 3.22027e-13, 1.37362e-20, - 3.36231e+02, 1.35649e-05, 5.63055e-13, 2.40173e-20, - 5.05825e+02, 2.04070e-05, 8.47058e-13, 3.61315e-20, - 7.20624e+02, 2.90728e-05, 1.20676e-12, 5.14748e-20, - 9.77376e+02, 3.94312e-05, 1.63672e-12, 6.98148e-20, - 1.18646e+03, 4.78662e-05, 1.98685e-12, 8.47495e-20, - 1.23845e+03, 4.99638e-05, 2.07391e-12, 8.84633e-20, - 1.11188e+03, 4.48576e-05, 1.86197e-12, 7.94227e-20, - 8.76396e+02, 3.53572e-05, 1.46762e-12, 6.26017e-20, - 6.22207e+02, 2.51022e-05, 1.04195e-12, 4.44448e-20, - 4.07290e+02, 1.64317e-05, 6.82051e-13, 2.90931e-20, - 2.50573e+02, 1.01091e-05, 4.19611e-13, 1.78986e-20, - 1.47073e+02, 5.93352e-06, 2.46290e-13, 1.05056e-20, - 8.33122e+01, 3.36114e-06, 1.39515e-13, 5.95106e-21, - 4.59585e+01, 1.85415e-06, 7.69625e-14, 3.28286e-21 }; - - double F80_kpAl2O3[] = - { 9.93250e-04, 4.00425e-11, 1.66043e-18, 7.07300e-26, - 1.81240e-03, 7.30662e-11, 3.02981e-18, 1.29062e-25, - 2.84365e-03, 1.14641e-10, 4.75377e-18, 2.02498e-25, - 4.14191e-03, 1.66980e-10, 6.92409e-18, 2.94948e-25, - 7.18271e-03, 2.89568e-10, 1.20074e-17, 5.11485e-25, - 1.13364e-02, 4.57021e-10, 1.89512e-17, 8.07269e-25, - 1.77361e-02, 7.15022e-10, 2.96496e-17, 1.26300e-24, - 2.59477e-02, 1.04607e-09, 4.33772e-17, 1.84775e-24, - 3.45425e-02, 1.39257e-09, 5.77452e-17, 2.45980e-24, - 4.22006e-02, 1.70130e-09, 7.05474e-17, 3.00513e-24, - 4.71420e-02, 1.90051e-09, 7.88080e-17, 3.35701e-24, - 4.91934e-02, 1.98321e-09, 8.22373e-17, 3.50309e-24, - 5.05162e-02, 2.03654e-09, 8.44486e-17, 3.59729e-24, - 5.78201e-02, 2.33100e-09, 9.66587e-17, 4.11741e-24, - 8.84237e-02, 3.56477e-09, 1.47819e-16, 6.29671e-24, - 1.78786e-01, 7.20770e-09, 2.98879e-16, 1.27315e-23, - 4.36404e-01, 1.75935e-08, 7.29543e-16, 3.10766e-23, - 1.63796e+00, 6.60337e-08, 2.73820e-15, 1.16640e-22, - 8.50817e+00, 3.43004e-07, 1.42232e-14, 6.05872e-22, - 3.92751e+01, 1.58336e-06, 6.56567e-14, 2.79680e-21, - 1.41436e+02, 5.70194e-06, 2.36441e-13, 1.00718e-20, - 3.83709e+02, 1.54691e-05, 6.41451e-13, 2.73241e-20, - 7.70411e+02, 3.10588e-05, 1.28791e-12, 5.48615e-20, - 1.16399e+03, 4.69258e-05, 1.94586e-12, 8.28884e-20, - 1.37566e+03, 5.54594e-05, 2.29972e-12, 9.79619e-20, - 1.33070e+03, 5.36466e-05, 2.22455e-12, 9.47599e-20, - 1.09978e+03, 4.43371e-05, 1.83852e-12, 7.83159e-20, - 8.05638e+02, 3.24790e-05, 1.34680e-12, 5.73700e-20, - 5.38690e+02, 2.17171e-05, 9.00536e-13, 3.83605e-20, - 3.36338e+02, 1.35593e-05, 5.62261e-13, 2.39508e-20, - 1.99460e+02, 8.04115e-06, 3.33440e-13, 1.42037e-20, - 1.13787e+02, 4.58729e-06, 1.90220e-13, 8.10285e-21, - 6.30411e+01, 2.54148e-06, 1.05387e-13, 4.48920e-21, - 3.41529e+01, 1.37686e-06, 5.70939e-14, 2.43205e-21, - 1.81893e+01, 7.33293e-07, 3.04073e-14, 1.29527e-21 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpFeM [itab0] = F80_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = F80_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = F80_kpMgSiO3 [itab]; - my_rates->SN0_kpFe3O4 [itab0] = F80_kpFe3O4 [itab]; - my_rates->SN0_kpAC [itab0] = F80_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = F80_kpSiO2D [itab]; - my_rates->SN0_kpAl2O3 [itab0] = F80_kpAl2O3 [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_P170(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 1.31079e-02; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 3.34688e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 2.84952e-13; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = 7.72302e-25; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 4.47758e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 1.23405e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 1.41247e-07; - - itab0 = 3 * iSN; - my_rates->SN0_r0SiM [itab0 + 0] = 2.72050e-06; - my_rates->SN0_r0FeM [itab0 + 0] = 1.08069e-05; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 1.79010e-05; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 2.51189e-05; - my_rates->SN0_r0AC [itab0 + 0] = 8.32266e-07; - my_rates->SN0_r0SiO2D [itab0 + 0] = 2.12560e-05; - my_rates->SN0_r0MgO [itab0 + 0] = 1.60812e-05; - - my_rates->SN0_r0SiM [itab0 + 1] = 2.87427e-11; - my_rates->SN0_r0FeM [itab0 + 1] = 1.19634e-10; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 3.24658e-10; - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 6.30957e-10; - my_rates->SN0_r0AC [itab0 + 1] = 1.33383e-12; - my_rates->SN0_r0SiO2D [itab0 + 1] = 4.59721e-10; - my_rates->SN0_r0MgO [itab0 + 1] = 2.65603e-10; - - my_rates->SN0_r0SiM [itab0 + 2] = 7.09270e-16; - my_rates->SN0_r0FeM [itab0 + 2] = 1.36724e-15; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 5.96244e-15; - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 1.58489e-14; - my_rates->SN0_r0AC [itab0 + 2] = 4.37739e-18; - my_rates->SN0_r0SiO2D [itab0 + 2] = 1.01590e-14; - my_rates->SN0_r0MgO [itab0 + 2] = 4.50188e-15; - - NTd = 35; - Nmom = 4; - - double P170_kpSiM[] = - { 1.54566e-01, 4.18815e-07, 4.38802e-12, 1.07634e-16, - 1.94597e-01, 5.27516e-07, 5.53200e-12, 1.35785e-16, - 2.44992e-01, 6.64362e-07, 6.97216e-12, 1.71223e-16, - 3.08437e-01, 8.36640e-07, 8.78521e-12, 2.15837e-16, - 3.88320e-01, 1.05373e-06, 1.10736e-11, 2.72217e-16, - 4.88890e-01, 1.32707e-06, 1.39559e-11, 3.43241e-16, - 6.15507e-01, 1.67134e-06, 1.75891e-11, 4.32825e-16, - 7.74906e-01, 2.10492e-06, 2.21686e-11, 5.45804e-16, - 9.75270e-01, 2.65013e-06, 2.79315e-11, 6.88059e-16, - 1.22485e+00, 3.32948e-06, 3.51169e-11, 8.65513e-16, - 1.52110e+00, 4.13615e-06, 4.36560e-11, 1.07652e-15, - 1.83679e+00, 4.99624e-06, 5.27698e-11, 1.30190e-15, - 2.15666e+00, 5.86838e-06, 6.20278e-11, 1.53115e-15, - 2.55518e+00, 6.95661e-06, 7.36137e-11, 1.81866e-15, - 3.22834e+00, 8.79676e-06, 9.32496e-11, 2.30667e-15, - 4.33225e+00, 1.18177e-05, 1.25559e-10, 3.11092e-15, - 5.81697e+00, 1.58892e-05, 1.69288e-10, 4.20258e-15, - 7.48671e+00, 2.04890e-05, 2.19146e-10, 5.45508e-15, - 9.22042e+00, 2.53165e-05, 2.72602e-10, 6.81745e-15, - 1.12094e+01, 3.09883e-05, 3.38326e-10, 8.54226e-15, - 1.40327e+01, 3.92793e-05, 4.39589e-10, 1.12871e-14, - 1.79556e+01, 5.11182e-05, 5.91090e-10, 1.55105e-14, - 2.19076e+01, 6.38759e-05, 7.72200e-10, 2.08556e-14, - 2.40396e+01, 7.32505e-05, 9.56570e-10, 2.71081e-14, - 2.35050e+01, 7.74606e-05, 1.14341e-09, 3.48207e-14, - 2.10698e+01, 7.75334e-05, 1.32500e-09, 4.37333e-14, - 1.81145e+01, 7.52350e-05, 1.46962e-09, 5.20115e-14, - 1.55283e+01, 7.16932e-05, 1.54535e-09, 5.74821e-14, - 1.35973e+01, 6.77513e-05, 1.55041e-09, 5.93660e-14, - 1.28568e+01, 6.72854e-05, 1.57294e-09, 6.05730e-14, - 1.62414e+01, 9.03391e-05, 2.02876e-09, 7.45675e-14, - 3.62078e+01, 2.25165e-04, 4.46960e-09, 1.44123e-13, - 1.13353e+02, 7.52538e-04, 1.29670e-08, 3.61005e-13, - 3.52139e+02, 2.31091e-03, 3.53205e-08, 8.74277e-13, - 9.61671e+02, 5.84143e-03, 8.01724e-08, 1.81153e-12 }; - - double P170_kpFeM[] = - { 1.89038e-02, 2.14190e-07, 2.52372e-12, 3.12761e-17, - 3.29962e-02, 3.72180e-07, 4.35946e-12, 5.36210e-17, - 5.06585e-02, 5.69928e-07, 6.65321e-12, 8.14803e-17, - 7.28477e-02, 8.18206e-07, 9.53077e-12, 1.16395e-16, - 1.17388e-01, 1.31311e-06, 1.52141e-11, 1.84531e-16, - 1.77851e-01, 1.98324e-06, 2.28841e-11, 2.76089e-16, - 2.70459e-01, 3.00576e-06, 3.45287e-11, 4.14188e-16, - 4.11194e-01, 4.55413e-06, 5.20790e-11, 6.21046e-16, - 6.23355e-01, 6.88052e-06, 7.83314e-11, 9.28691e-16, - 9.33206e-01, 1.02680e-05, 1.16407e-10, 1.37259e-15, - 1.38665e+00, 1.52105e-05, 1.71743e-10, 2.01438e-15, - 2.02921e+00, 2.21948e-05, 2.49647e-10, 2.91351e-15, - 2.90114e+00, 3.16481e-05, 3.54739e-10, 4.12109e-15, - 4.04178e+00, 4.39869e-05, 4.91497e-10, 5.68634e-15, - 5.48102e+00, 5.95254e-05, 6.63275e-10, 7.64576e-15, - 7.23953e+00, 7.84801e-05, 8.72371e-10, 1.00241e-14, - 9.32332e+00, 1.00911e-04, 1.11939e-09, 1.28274e-14, - 1.17250e+01, 1.26738e-04, 1.40342e-09, 1.60451e-14, - 1.44493e+01, 1.56015e-04, 1.72511e-09, 1.96853e-14, - 1.75655e+01, 1.89497e-04, 2.09290e-09, 2.38454e-14, - 2.12689e+01, 2.29295e-04, 2.53020e-09, 2.87941e-14, - 2.59441e+01, 2.79574e-04, 3.08321e-09, 3.50603e-14, - 3.22597e+01, 3.47571e-04, 3.83222e-09, 4.35643e-14, - 4.13113e+01, 4.45148e-04, 4.90883e-09, 5.58148e-14, - 5.48617e+01, 5.91330e-04, 6.52336e-09, 7.42101e-14, - 7.57474e+01, 8.16590e-04, 9.01042e-09, 1.02534e-13, - 1.08611e+02, 1.17059e-03, 1.29124e-08, 1.46875e-13, - 1.61171e+02, 1.73570e-03, 1.91260e-08, 2.17252e-13, - 2.46323e+02, 2.64930e-03, 2.91428e-08, 3.30280e-13, - 3.85260e+02, 4.13661e-03, 4.54013e-08, 5.13015e-13, - 6.12075e+02, 6.55899e-03, 7.17997e-08, 8.08495e-13, - 9.79548e+02, 1.04742e-02, 1.14330e-07, 1.28253e-12, - 1.56260e+03, 1.66712e-02, 1.81431e-07, 2.02722e-12, - 2.44258e+03, 2.60024e-02, 2.82158e-07, 3.14054e-12, - 3.65611e+03, 3.88442e-02, 4.20404e-07, 4.66303e-12 }; - - double P170_kpMg2SiO4[] = - { 1.05240e-01, 1.88391e-06, 3.41670e-11, 6.27487e-16, - 1.32588e-01, 2.37346e-06, 4.30456e-11, 7.90546e-16, - 1.67016e-01, 2.98977e-06, 5.42231e-11, 9.95825e-16, - 2.10360e-01, 3.76566e-06, 6.82948e-11, 1.25426e-15, - 2.71891e-01, 4.86713e-06, 8.82715e-11, 1.62113e-15, - 3.55703e-01, 6.36747e-06, 1.15482e-10, 2.12086e-15, - 4.84952e-01, 8.68116e-06, 1.57444e-10, 2.89150e-15, - 6.99815e-01, 1.25274e-05, 2.27201e-10, 4.17262e-15, - 1.05872e+00, 1.89523e-05, 3.43724e-10, 6.31261e-15, - 1.62931e+00, 2.91665e-05, 5.28972e-10, 9.71478e-15, - 2.54332e+00, 4.55285e-05, 8.25720e-10, 1.51647e-14, - 3.96674e+00, 7.10095e-05, 1.28786e-09, 2.36521e-14, - 6.11063e+00, 1.09388e-04, 1.98392e-09, 3.64359e-14, - 9.29771e+00, 1.66443e-04, 3.01871e-09, 5.54408e-14, - 1.39496e+01, 2.49721e-04, 4.52916e-09, 8.31823e-14, - 2.05907e+01, 3.68616e-04, 6.68568e-09, 1.22791e-13, - 3.01907e+01, 5.40495e-04, 9.80342e-09, 1.80058e-13, - 4.58362e+01, 8.20646e-04, 1.48857e-08, 2.73420e-13, - 7.56329e+01, 1.35424e-03, 2.45668e-08, 4.51281e-13, - 1.31563e+02, 2.35588e-03, 4.27405e-08, 7.85179e-13, - 2.18570e+02, 3.91412e-03, 7.10137e-08, 1.30465e-12, - 3.26293e+02, 5.84347e-03, 1.06022e-07, 1.94790e-12, - 4.39310e+02, 7.86786e-03, 1.42760e-07, 2.62299e-12, - 5.43909e+02, 9.74168e-03, 1.76768e-07, 3.24798e-12, - 6.15422e+02, 1.10228e-02, 2.00021e-07, 3.67534e-12, - 6.22866e+02, 1.11563e-02, 2.02446e-07, 3.71993e-12, - 5.58030e+02, 9.99504e-03, 1.81374e-07, 3.33274e-12, - 4.45434e+02, 7.97833e-03, 1.44778e-07, 2.66031e-12, - 3.22068e+02, 5.76874e-03, 1.04683e-07, 1.92357e-12, - 2.15071e+02, 3.85233e-03, 6.99082e-08, 1.28461e-12, - 1.35309e+02, 2.42376e-03, 4.39862e-08, 8.08311e-13, - 8.22952e+01, 1.47437e-03, 2.67608e-08, 4.91842e-13, - 5.06858e+01, 9.08497e-04, 1.64974e-08, 3.03339e-13, - 3.39204e+01, 6.08602e-04, 1.10623e-08, 2.03592e-13, - 2.60778e+01, 4.68473e-04, 8.52552e-09, 1.57083e-13 }; - - double P170_kpMgSiO3[] = - { 2.19890e-02, 5.52339e-07, 1.38741e-11, 3.48502e-16, - 3.90618e-02, 9.81187e-07, 2.46463e-11, 6.19087e-16, - 6.05551e-02, 1.52108e-06, 3.82077e-11, 9.59734e-16, - 8.76136e-02, 2.20075e-06, 5.52805e-11, 1.38858e-15, - 1.43295e-01, 3.59940e-06, 9.04128e-11, 2.27107e-15, - 2.19281e-01, 5.50809e-06, 1.38357e-10, 3.47537e-15, - 3.36283e-01, 8.44705e-06, 2.12180e-10, 5.32973e-15, - 5.14405e-01, 1.29213e-05, 3.24567e-10, 8.15276e-15, - 7.97396e-01, 2.00297e-05, 5.03123e-10, 1.26379e-14, - 1.25461e+00, 3.15143e-05, 7.91604e-10, 1.98842e-14, - 2.03570e+00, 5.11345e-05, 1.28444e-09, 3.22637e-14, - 3.34964e+00, 8.41390e-05, 2.11348e-09, 5.30881e-14, - 5.46697e+00, 1.37324e-04, 3.44942e-09, 8.66456e-14, - 8.84149e+00, 2.22088e-04, 5.57860e-09, 1.40128e-13, - 1.42340e+01, 3.57543e-04, 8.98107e-09, 2.25594e-13, - 2.29730e+01, 5.77056e-04, 1.44950e-08, 3.64097e-13, - 3.74525e+01, 9.40765e-04, 2.36310e-08, 5.93583e-13, - 6.22721e+01, 1.56420e-03, 3.92910e-08, 9.86946e-13, - 1.05860e+02, 2.65909e-03, 6.67934e-08, 1.67777e-12, - 1.79797e+02, 4.51630e-03, 1.13444e-07, 2.84959e-12, - 2.89938e+02, 7.28291e-03, 1.82938e-07, 4.59521e-12, - 4.27133e+02, 1.07291e-02, 2.69503e-07, 6.76961e-12, - 5.77898e+02, 1.45162e-02, 3.64629e-07, 9.15907e-12, - 7.33244e+02, 1.84183e-02, 4.62646e-07, 1.16211e-11, - 8.63989e+02, 2.17024e-02, 5.45140e-07, 1.36933e-11, - 9.15488e+02, 2.29960e-02, 5.77634e-07, 1.45095e-11, - 8.55336e+02, 2.14851e-02, 5.39680e-07, 1.35562e-11, - 7.06445e+02, 1.77451e-02, 4.45737e-07, 1.11964e-11, - 5.24103e+02, 1.31649e-02, 3.30686e-07, 8.30647e-12, - 3.56328e+02, 8.95056e-03, 2.24828e-07, 5.64742e-12, - 2.26296e+02, 5.68431e-03, 1.42783e-07, 3.58656e-12, - 1.36494e+02, 3.42857e-03, 8.61218e-08, 2.16328e-12, - 7.93347e+01, 1.99280e-03, 5.00568e-08, 1.25737e-12, - 4.50672e+01, 1.13204e-03, 2.84355e-08, 7.14267e-13, - 2.56082e+01, 6.43249e-04, 1.61577e-08, 4.05863e-13 }; - - double P170_kpAC[] = - { 3.27960e-01, 2.72950e-07, 4.37442e-13, 1.43560e-18, - 4.38752e-01, 3.65158e-07, 5.85222e-13, 1.92064e-18, - 5.78230e-01, 4.81242e-07, 7.71265e-13, 2.53127e-18, - 7.53823e-01, 6.27382e-07, 1.00548e-12, 3.30001e-18, - 1.04013e+00, 8.65671e-07, 1.38740e-12, 4.55369e-18, - 1.41735e+00, 1.17963e-06, 1.89059e-12, 6.20550e-18, - 1.95292e+00, 1.62537e-06, 2.60499e-12, 8.55074e-18, - 2.71531e+00, 2.25988e-06, 3.62196e-12, 1.18896e-17, - 3.79676e+00, 3.15995e-06, 5.06464e-12, 1.66270e-17, - 5.29743e+00, 4.40895e-06, 7.06667e-12, 2.32024e-17, - 7.37835e+00, 6.14088e-06, 9.84291e-12, 3.23229e-17, - 1.02168e+01, 8.50337e-06, 1.36303e-11, 4.47703e-17, - 1.40421e+01, 1.16873e-05, 1.87349e-11, 6.15552e-17, - 1.92022e+01, 1.59823e-05, 2.56223e-11, 8.42199e-17, - 2.61618e+01, 2.17754e-05, 3.49137e-11, 1.14828e-16, - 3.55310e+01, 2.95745e-05, 4.74267e-11, 1.56111e-16, - 4.81618e+01, 4.00896e-05, 6.43047e-11, 2.11918e-16, - 6.53182e+01, 5.43738e-05, 8.72469e-11, 2.88010e-16, - 8.87691e+01, 7.39018e-05, 1.18639e-10, 3.92576e-16, - 1.20709e+02, 1.00504e-04, 1.61458e-10, 5.36074e-16, - 1.63629e+02, 1.36264e-04, 2.19128e-10, 7.31160e-16, - 2.20590e+02, 1.83746e-04, 2.95924e-10, 9.94659e-16, - 2.96134e+02, 2.46760e-04, 3.98255e-10, 1.35250e-15, - 3.97082e+02, 3.31036e-04, 5.35697e-10, 1.84221e-15, - 5.31629e+02, 4.43468e-04, 7.19648e-10, 2.50526e-15, - 7.07172e+02, 5.90324e-04, 9.60341e-10, 3.37390e-15, - 9.31294e+02, 7.78129e-04, 1.26840e-09, 4.47614e-15, - 1.21722e+03, 1.01834e-03, 1.66280e-09, 5.86569e-15, - 1.58885e+03, 1.33177e-03, 2.17875e-09, 7.65284e-15, - 2.08299e+03, 1.75095e-03, 2.87268e-09, 1.00241e-14, - 2.75132e+03, 2.32265e-03, 3.82862e-09, 1.32680e-14, - 3.66587e+03, 3.11403e-03, 5.17218e-09, 1.78307e-14, - 4.93093e+03, 4.22440e-03, 7.09398e-09, 2.43990e-14, - 6.70346e+03, 5.80132e-03, 9.87242e-09, 3.39492e-14, - 9.22475e+03, 8.05642e-03, 1.38679e-08, 4.76003e-14 }; - - double P170_kpSiO2D[] = - { 7.60055e-02, 1.61556e-06, 3.49407e-11, 7.72118e-16, - 9.06897e-02, 1.92769e-06, 4.16913e-11, 9.21295e-16, - 1.09176e-01, 2.32063e-06, 5.01898e-11, 1.10910e-15, - 1.32449e-01, 2.81532e-06, 6.08888e-11, 1.34553e-15, - 1.58880e-01, 3.37714e-06, 7.30398e-11, 1.61404e-15, - 1.91543e-01, 4.07143e-06, 8.80558e-11, 1.94587e-15, - 2.30474e-01, 4.89894e-06, 1.05953e-10, 2.34138e-15, - 2.76789e-01, 5.88341e-06, 1.27245e-10, 2.81190e-15, - 3.33087e-01, 7.08010e-06, 1.53127e-10, 3.38385e-15, - 4.05372e-01, 8.61660e-06, 1.86359e-10, 4.11822e-15, - 5.08264e-01, 1.08037e-05, 2.33661e-10, 5.16354e-15, - 6.72714e-01, 1.42993e-05, 3.09265e-10, 6.83430e-15, - 9.49132e-01, 2.01750e-05, 4.36348e-10, 9.64271e-15, - 1.41935e+00, 3.01704e-05, 6.52536e-10, 1.44204e-14, - 2.19866e+00, 4.67362e-05, 1.01084e-09, 2.23390e-14, - 3.47731e+00, 7.39180e-05, 1.59880e-09, 3.53339e-14, - 5.80454e+00, 1.23397e-04, 2.66922e-09, 5.89965e-14, - 1.18802e+01, 2.52595e-04, 5.46495e-09, 1.20817e-13, - 3.22814e+01, 6.86446e-04, 1.48537e-08, 3.28442e-13, - 8.86792e+01, 1.88575e-03, 4.08062e-08, 9.02327e-13, - 1.96255e+02, 4.17327e-03, 9.03045e-08, 1.99681e-12, - 3.42549e+02, 7.28388e-03, 1.57607e-07, 3.48479e-12, - 5.11736e+02, 1.08798e-02, 2.35370e-07, 5.20299e-12, - 7.16479e+02, 1.52272e-02, 3.29269e-07, 7.27459e-12, - 9.48899e+02, 2.01568e-02, 4.35598e-07, 9.61645e-12, - 1.12707e+03, 2.39309e-02, 5.16871e-07, 1.14029e-11, - 1.15762e+03, 2.45716e-02, 5.30490e-07, 1.16974e-11, - 1.02786e+03, 2.18125e-02, 4.70793e-07, 1.03775e-11, - 8.04358e+02, 1.70671e-02, 3.68303e-07, 8.11658e-12, - 5.68400e+02, 1.20593e-02, 2.60207e-07, 5.73357e-12, - 3.70952e+02, 7.86976e-03, 1.69795e-07, 3.74103e-12, - 2.27785e+02, 4.83229e-03, 1.04255e-07, 2.29687e-12, - 1.33544e+02, 2.83297e-03, 6.11184e-08, 1.34647e-12, - 7.56194e+01, 1.60416e-03, 3.46077e-08, 7.62416e-13, - 4.17402e+01, 8.85464e-04, 1.91029e-08, 4.20847e-13 }; - - double P170_kpMgO[] = - { 2.25358e-04, 3.62400e-09, 5.98548e-14, 1.01451e-18, - 4.04933e-04, 6.51178e-09, 1.07551e-13, 1.82293e-18, - 6.31005e-04, 1.01473e-08, 1.67596e-13, 2.84068e-18, - 9.15612e-04, 1.47241e-08, 2.43188e-13, 4.12194e-18, - 1.52196e-03, 2.44750e-08, 4.04238e-13, 6.85169e-18, - 2.37413e-03, 3.81788e-08, 6.30577e-13, 1.06881e-17, - 3.77230e-03, 6.06633e-08, 1.00194e-12, 1.69826e-17, - 6.14410e-03, 9.88050e-08, 1.63191e-12, 2.76605e-17, - 1.01925e-02, 1.63910e-07, 2.70723e-12, 4.58870e-17, - 1.68946e-02, 2.71691e-07, 4.48743e-12, 7.60616e-17, - 2.96294e-02, 4.76492e-07, 7.87018e-12, 1.33401e-16, - 6.11307e-02, 9.83118e-07, 1.62386e-11, 2.75255e-16, - 1.43660e-01, 2.31047e-06, 3.81646e-11, 6.46939e-16, - 3.28203e-01, 5.27865e-06, 8.71964e-11, 1.47815e-15, - 6.41613e-01, 1.03199e-05, 1.70479e-10, 2.89009e-15, - 1.05901e+00, 1.70371e-05, 2.81505e-10, 4.77324e-15, - 1.60722e+00, 2.58913e-05, 4.28363e-10, 7.27252e-15, - 3.19739e+00, 5.16560e-05, 8.57040e-10, 1.45895e-14, - 1.40905e+01, 2.27322e-04, 3.76636e-09, 6.40310e-14, - 7.15093e+01, 1.15025e-03, 1.90029e-08, 3.22170e-13, - 2.48952e+02, 3.99764e-03, 6.59323e-08, 1.11600e-12, - 5.77048e+02, 9.25757e-03, 1.52545e-07, 2.57979e-12, - 9.46693e+02, 1.51796e-02, 2.49995e-07, 4.22569e-12, - 1.17600e+03, 1.88501e-02, 3.10343e-07, 5.24410e-12, - 1.17447e+03, 1.88215e-02, 3.09806e-07, 5.23395e-12, - 9.91612e+02, 1.58888e-02, 2.61497e-07, 4.41720e-12, - 7.37095e+02, 1.18095e-02, 1.94341e-07, 3.28252e-12, - 4.97965e+02, 7.97772e-03, 1.31276e-07, 2.21717e-12, - 3.13212e+02, 5.01764e-03, 8.25631e-08, 1.39438e-12, - 1.86742e+02, 2.99150e-03, 4.92223e-08, 8.31277e-13, - 1.06960e+02, 1.71340e-03, 2.81918e-08, 4.76098e-13, - 5.94287e+01, 9.51978e-04, 1.56633e-08, 2.64516e-13, - 3.22675e+01, 5.16881e-04, 8.50437e-09, 1.43617e-13, - 1.72142e+01, 2.75746e-04, 4.53688e-09, 7.66156e-14, - 9.06015e+00, 1.45130e-04, 2.38782e-09, 4.03237e-14 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab0] = P170_kpSiM [itab]; - my_rates->SN0_kpFeM [itab0] = P170_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = P170_kpMg2SiO4 [itab]; - my_rates->SN0_kpMgSiO3 [itab0] = P170_kpMgSiO3 [itab]; - my_rates->SN0_kpAC [itab0] = P170_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = P170_kpSiO2D [itab]; - my_rates->SN0_kpMgO [itab0] = P170_kpMgO [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_P200(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = 5.90622e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = 4.26809e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = 4.08246e-15; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 3.72287e-05; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = 4.59330e-04; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = 5.38389e-09; - - itab0 = 3 * iSN; - my_rates->SN0_r0SiM [itab0 + 0] = 8.86269e-07; - my_rates->SN0_r0FeM [itab0 + 0] = 2.02272e-06; - my_rates->SN0_r0Mg2SiO4 [itab0 + 0] = 1.42189e-05; - my_rates->SN0_r0AC [itab0 + 0] = 7.46096e-07; - my_rates->SN0_r0SiO2D [itab0 + 0] = 1.73471e-05; - my_rates->SN0_r0MgO [itab0 + 0] = 1.26307e-05; - - my_rates->SN0_r0SiM [itab0 + 1] = 1.71166e-12; - my_rates->SN0_r0FeM [itab0 + 1] = 5.41308e-12; - my_rates->SN0_r0Mg2SiO4 [itab0 + 1] = 2.04834e-10; - my_rates->SN0_r0AC [itab0 + 1] = 9.32091e-13; - my_rates->SN0_r0SiO2D [itab0 + 1] = 3.08556e-10; - my_rates->SN0_r0MgO [itab0 + 1] = 1.59673e-10; - - my_rates->SN0_r0SiM [itab0 + 2] = 5.46663e-18; - my_rates->SN0_r0FeM [itab0 + 2] = 2.06248e-17; - my_rates->SN0_r0Mg2SiO4 [itab0 + 2] = 2.98805e-15; - my_rates->SN0_r0AC [itab0 + 2] = 1.99556e-18; - my_rates->SN0_r0SiO2D [itab0 + 2] = 5.66409e-15; - my_rates->SN0_r0MgO [itab0 + 2] = 2.02075e-15; - - NTd = 35; - Nmom = 4; - - double P200_kpSiM[] = - { 1.54645e-01, 1.37048e-07, 2.64662e-13, 8.45209e-19, - 1.94685e-01, 1.72534e-07, 3.33193e-13, 1.06408e-18, - 2.45092e-01, 2.17207e-07, 4.19469e-13, 1.33961e-18, - 3.08551e-01, 2.73447e-07, 5.28084e-13, 1.68649e-18, - 3.88446e-01, 3.44254e-07, 6.64830e-13, 2.12322e-18, - 4.89028e-01, 4.33396e-07, 8.36986e-13, 2.67303e-18, - 6.15654e-01, 5.45619e-07, 1.05372e-12, 3.36522e-18, - 7.75056e-01, 6.86892e-07, 1.32656e-12, 4.23661e-18, - 9.75414e-01, 8.64464e-07, 1.66951e-12, 5.33191e-18, - 1.22498e+00, 1.08564e-06, 2.09668e-12, 6.69620e-18, - 1.52119e+00, 1.34817e-06, 2.60370e-12, 8.31550e-18, - 1.83682e+00, 1.62792e-06, 3.14401e-12, 1.00412e-17, - 2.15660e+00, 1.91133e-06, 3.69138e-12, 1.17894e-17, - 2.55494e+00, 2.26439e-06, 4.37331e-12, 1.39675e-17, - 3.22768e+00, 2.86067e-06, 5.52501e-12, 1.76460e-17, - 4.33077e+00, 3.83839e-06, 7.41349e-12, 2.36779e-17, - 5.81399e+00, 5.15308e-06, 9.95292e-12, 3.17892e-17, - 7.48107e+00, 6.63084e-06, 1.28076e-11, 4.09082e-17, - 9.20965e+00, 8.16336e-06, 1.57686e-11, 5.03682e-17, - 1.11868e+01, 9.91669e-06, 1.91573e-11, 6.11981e-17, - 1.39824e+01, 1.23969e-05, 2.39531e-11, 7.65315e-17, - 1.78531e+01, 1.58317e-05, 3.05972e-11, 9.77803e-17, - 2.17179e+01, 1.92624e-05, 3.72355e-11, 1.19020e-16, - 2.37018e+01, 2.10255e-05, 4.06526e-11, 1.29977e-16, - 2.29438e+01, 2.03578e-05, 3.93739e-11, 1.25940e-16, - 2.02577e+01, 1.79829e-05, 3.48015e-11, 1.11389e-16, - 1.70972e+01, 1.51927e-05, 2.94374e-11, 9.43240e-17, - 1.43876e+01, 1.28090e-05, 2.48736e-11, 7.98414e-17, - 1.23927e+01, 1.10758e-05, 2.16034e-11, 6.95714e-17, - 1.14807e+01, 1.03984e-05, 2.05890e-11, 6.70125e-17, - 1.34941e+01, 1.30878e-05, 2.78918e-11, 9.54730e-17, - 2.46530e+01, 2.87907e-05, 7.29927e-11, 2.79411e-16, - 6.22628e+01, 8.83029e-05, 2.60128e-10, 1.09021e-15, - 1.73608e+02, 2.73721e-04, 8.65552e-10, 3.78030e-15, - 4.81453e+02, 7.67244e-04, 2.43830e-09, 1.06714e-14 }; - - double P200_kpFeM[] = - { 9.09085e-04, 3.41941e-09, 1.80920e-14, 1.27369e-19, - 1.61039e-03, 6.04845e-09, 3.18823e-14, 2.22622e-19, - 2.49320e-03, 9.35673e-09, 4.92187e-14, 3.42113e-19, - 3.60452e-03, 1.35207e-08, 7.10297e-14, 4.92299e-19, - 5.89215e-03, 2.20677e-08, 1.15535e-13, 7.95087e-19, - 9.02912e-03, 3.37737e-08, 1.76355e-13, 1.20713e-18, - 1.39130e-02, 5.19580e-08, 2.70494e-13, 1.84076e-18, - 2.14719e-02, 8.00206e-08, 4.15192e-13, 2.80850e-18, - 3.30912e-02, 1.23012e-07, 6.35936e-13, 4.27570e-18, - 5.03917e-02, 1.86799e-07, 9.62098e-13, 6.43127e-18, - 7.63291e-02, 2.81960e-07, 1.44615e-12, 9.61004e-18, - 1.14179e-01, 4.19929e-07, 2.14346e-12, 1.41576e-17, - 1.67303e-01, 6.12055e-07, 3.10728e-12, 2.03974e-17, - 2.39689e-01, 8.71248e-07, 4.39580e-12, 2.86715e-17, - 3.35470e-01, 1.21013e-06, 6.06256e-12, 3.92787e-17, - 4.59119e-01, 1.64148e-06, 8.15789e-12, 5.24812e-17, - 6.15407e-01, 2.17768e-06, 1.07246e-11, 6.84719e-17, - 8.10332e-01, 2.83301e-06, 1.38055e-11, 8.74075e-17, - 1.05438e+00, 3.63322e-06, 1.74835e-11, 1.09639e-16, - 1.37021e+00, 4.63773e-06, 2.19726e-11, 1.36212e-16, - 1.80496e+00, 5.97282e-06, 2.77433e-11, 1.69529e-16, - 2.45118e+00, 7.88356e-06, 3.57016e-11, 2.14206e-16, - 3.48432e+00, 1.08228e-05, 4.74799e-11, 2.78412e-16, - 5.23381e+00, 1.56143e-05, 6.59474e-11, 3.76121e-16, - 8.31585e+00, 2.37506e-05, 9.61230e-11, 5.31044e-16, - 1.38802e+01, 3.79407e-05, 1.46823e-10, 7.83600e-16, - 2.40529e+01, 6.30826e-05, 2.33568e-10, 1.20322e-15, - 4.26908e+01, 1.07918e-04, 3.83527e-10, 1.90929e-15, - 7.65687e+01, 1.87651e-04, 6.43418e-10, 3.10502e-15, - 1.37077e+02, 3.27739e-04, 1.09108e-09, 5.12746e-15, - 2.42517e+02, 5.69117e-04, 1.85185e-09, 8.51948e-15, - 4.21112e+02, 9.75067e-04, 3.11997e-09, 1.41236e-14, - 7.14738e+02, 1.63904e-03, 5.18038e-09, 2.31656e-14, - 1.18235e+03, 2.68818e-03, 8.40281e-09, 3.71602e-14, - 1.90342e+03, 4.27908e-03, 1.31829e-08, 5.74720e-14 }; - - double P200_kpMg2SiO4[] = - { 1.05240e-01, 1.49640e-06, 2.15567e-11, 3.14463e-16, - 1.32588e-01, 1.88525e-06, 2.71584e-11, 3.96179e-16, - 1.67016e-01, 2.37479e-06, 3.42106e-11, 4.99054e-16, - 2.10360e-01, 2.99108e-06, 4.30887e-11, 6.28566e-16, - 2.71889e-01, 3.86597e-06, 5.56922e-11, 8.12421e-16, - 3.55700e-01, 5.05766e-06, 7.28594e-11, 1.06285e-15, - 4.84944e-01, 6.89538e-06, 9.93331e-11, 1.44904e-15, - 6.99796e-01, 9.95035e-06, 1.43342e-10, 2.09104e-15, - 1.05867e+00, 1.50532e-05, 2.16853e-10, 3.16340e-15, - 1.62919e+00, 2.31655e-05, 3.33717e-10, 4.86818e-15, - 2.54303e+00, 3.61594e-05, 5.20906e-10, 7.59887e-15, - 3.96603e+00, 5.63932e-05, 8.12393e-10, 1.18511e-14, - 6.10897e+00, 8.68643e-05, 1.25136e-09, 1.82548e-14, - 9.29384e+00, 1.32151e-04, 1.90378e-09, 2.77724e-14, - 1.39407e+01, 1.98229e-04, 2.85574e-09, 4.16600e-14, - 2.05705e+01, 2.92507e-04, 4.21400e-09, 6.14759e-14, - 3.01423e+01, 4.28630e-04, 6.17529e-09, 9.00909e-14, - 4.57104e+01, 6.50055e-04, 9.36595e-09, 1.36648e-13, - 7.53064e+01, 1.07104e-03, 1.54328e-08, 2.25181e-13, - 1.30815e+02, 1.86065e-03, 2.68126e-08, 3.91253e-13, - 2.17127e+02, 3.08849e-03, 4.45083e-08, 6.49502e-13, - 3.23880e+02, 4.60717e-03, 6.63972e-08, 9.68963e-13, - 4.35662e+02, 6.19759e-03, 8.93224e-08, 1.30358e-12, - 5.38932e+02, 7.66706e-03, 1.10506e-07, 1.61282e-12, - 6.09467e+02, 8.67078e-03, 1.24977e-07, 1.82406e-12, - 6.16707e+02, 8.77390e-03, 1.26464e-07, 1.84580e-12, - 5.52479e+02, 7.86016e-03, 1.13294e-07, 1.65358e-12, - 4.40975e+02, 6.27379e-03, 9.04293e-08, 1.31986e-12, - 3.18791e+02, 4.53552e-03, 6.53747e-08, 9.54183e-13, - 2.12803e+02, 3.02766e-03, 4.36414e-08, 6.36986e-13, - 1.33761e+02, 1.90318e-03, 2.74344e-08, 4.00448e-13, - 8.11305e+01, 1.15453e-03, 1.66451e-08, 2.42996e-13, - 4.95598e+01, 7.05594e-04, 1.01773e-08, 1.48640e-13, - 3.25906e+01, 4.64465e-04, 6.70585e-09, 9.80294e-14, - 2.45153e+01, 3.49814e-04, 5.05664e-09, 7.40047e-14 }; - - double P200_kpAC[] = - { 3.27960e-01, 2.44690e-07, 3.05689e-13, 6.54462e-19, - 4.38752e-01, 3.27351e-07, 4.08957e-13, 8.75569e-19, - 5.78230e-01, 4.31415e-07, 5.38965e-13, 1.15393e-18, - 7.53823e-01, 5.62424e-07, 7.02635e-13, 1.50436e-18, - 1.04013e+00, 7.76039e-07, 9.69511e-13, 2.07581e-18, - 1.41735e+00, 1.05749e-06, 1.32113e-12, 2.82873e-18, - 1.95292e+00, 1.45707e-06, 1.82034e-12, 3.89771e-18, - 2.71531e+00, 2.02589e-06, 2.53098e-12, 5.41951e-18, - 3.79675e+00, 2.83276e-06, 3.53905e-12, 7.57851e-18, - 5.29742e+00, 3.95242e-06, 4.93793e-12, 1.05749e-17, - 7.37833e+00, 5.50501e-06, 6.87773e-12, 1.47304e-17, - 1.02168e+01, 7.62282e-06, 9.52385e-12, 2.04006e-17, - 1.40421e+01, 1.04770e-05, 1.30901e-11, 2.80446e-17, - 1.92021e+01, 1.43270e-05, 1.79012e-11, 3.83618e-17, - 2.61616e+01, 1.95199e-05, 2.43907e-11, 5.22874e-17, - 3.55307e+01, 2.65108e-05, 3.31285e-11, 7.10543e-17, - 4.81611e+01, 3.59357e-05, 4.49107e-11, 9.63939e-17, - 6.53170e+01, 4.87382e-05, 6.09196e-11, 1.30888e-16, - 8.87668e+01, 6.62390e-05, 8.28118e-11, 1.78181e-16, - 1.20705e+02, 9.00772e-05, 1.12647e-10, 2.42873e-16, - 1.63621e+02, 1.22115e-04, 1.52778e-10, 3.30388e-16, - 2.20575e+02, 1.64642e-04, 2.06114e-10, 4.47715e-16, - 2.96104e+02, 2.21060e-04, 2.76991e-10, 6.05473e-16, - 3.97026e+02, 2.96479e-04, 3.71917e-10, 8.19263e-16, - 5.31526e+02, 3.97049e-04, 4.98696e-10, 1.10695e-15, - 7.06983e+02, 5.28345e-04, 6.64405e-10, 1.48343e-15, - 9.30949e+02, 6.96139e-04, 8.76417e-10, 1.96294e-15, - 1.21659e+03, 9.10536e-04, 1.14776e-09, 2.57160e-15, - 1.58765e+03, 1.18982e-03, 1.50225e-09, 3.36001e-15, - 2.08069e+03, 1.56242e-03, 1.97748e-09, 4.41103e-15, - 2.74685e+03, 2.06876e-03, 2.62823e-09, 5.84923e-15, - 3.65712e+03, 2.76611e-03, 3.53431e-09, 7.86205e-15, - 4.91402e+03, 3.73838e-03, 4.81486e-09, 1.07337e-14, - 6.67206e+03, 5.11081e-03, 6.64539e-09, 1.48739e-14, - 9.17096e+03, 7.06881e-03, 9.26820e-09, 2.07940e-14 }; - - double P200_kpSiO2D[] = - { 7.60136e-02, 1.31860e-06, 2.34539e-11, 4.30529e-16, - 9.06981e-02, 1.57333e-06, 2.79848e-11, 5.13702e-16, - 1.09185e-01, 1.89402e-06, 3.36890e-11, 6.18411e-16, - 1.32458e-01, 2.29774e-06, 4.08700e-11, 7.50232e-16, - 1.58888e-01, 2.75623e-06, 4.90252e-11, 8.99935e-16, - 1.91549e-01, 3.32281e-06, 5.91032e-11, 1.08494e-15, - 2.30478e-01, 3.99813e-06, 7.11152e-11, 1.30544e-15, - 2.76790e-01, 4.80151e-06, 8.54053e-11, 1.56776e-15, - 3.33085e-01, 5.77806e-06, 1.02776e-10, 1.88663e-15, - 4.05362e-01, 7.03188e-06, 1.25078e-10, 2.29603e-15, - 5.08238e-01, 8.81651e-06, 1.56822e-10, 2.87877e-15, - 6.72650e-01, 1.16686e-05, 2.07555e-10, 3.81010e-15, - 9.48976e-01, 1.64623e-05, 2.92824e-10, 5.37545e-15, - 1.41897e+00, 2.46158e-05, 4.37862e-10, 8.03808e-15, - 2.19768e+00, 3.81252e-05, 6.78181e-10, 1.24501e-14, - 3.47459e+00, 6.02792e-05, 1.07231e-09, 1.96868e-14, - 5.79486e+00, 1.00542e-04, 1.78877e-09, 3.28453e-14, - 1.18370e+01, 2.05418e-04, 3.65563e-09, 6.71473e-14, - 3.21108e+01, 5.57348e-04, 9.92083e-09, 1.82279e-13, - 8.81851e+01, 1.53068e-03, 2.72473e-08, 5.00649e-13, - 1.95201e+02, 3.38815e-03, 6.03099e-08, 1.10811e-12, - 3.40883e+02, 5.91645e-03, 1.05307e-07, 1.93471e-12, - 5.10268e+02, 8.85442e-03, 1.57557e-07, 2.89365e-12, - 7.17917e+02, 1.24511e-02, 2.21410e-07, 4.06297e-12, - 9.57120e+02, 1.65879e-02, 2.94709e-07, 5.40198e-12, - 1.14369e+03, 1.98088e-02, 3.51649e-07, 6.43917e-12, - 1.17995e+03, 2.04271e-02, 3.62410e-07, 6.63127e-12, - 1.05086e+03, 1.81866e-02, 3.22531e-07, 5.89860e-12, - 8.23986e+02, 1.42573e-02, 2.52780e-07, 4.62145e-12, - 5.83014e+02, 1.00864e-02, 1.78801e-07, 3.26825e-12, - 3.80801e+02, 6.58750e-03, 1.16763e-07, 2.13399e-12, - 2.33954e+02, 4.04697e-03, 7.17275e-08, 1.31079e-12, - 1.37203e+02, 2.37328e-03, 4.20617e-08, 7.68622e-13, - 7.77017e+01, 1.34403e-03, 2.38199e-08, 4.35268e-13, - 4.28856e+01, 7.41814e-04, 1.31471e-08, 2.40245e-13 }; - - double P200_kpMgO[] = - { 2.25374e-04, 2.84663e-09, 3.59861e-14, 4.55424e-19, - 4.04950e-04, 5.11481e-09, 6.46597e-14, 8.18303e-19, - 6.31024e-04, 7.97028e-09, 1.00758e-13, 1.27514e-18, - 9.15633e-04, 1.15651e-08, 1.46202e-13, 1.85026e-18, - 1.52197e-03, 1.92235e-08, 2.43017e-13, 3.07552e-18, - 2.37410e-03, 2.99866e-08, 3.79080e-13, 4.79746e-18, - 3.77219e-03, 4.76455e-08, 6.02318e-13, 7.62266e-18, - 6.14378e-03, 7.76004e-08, 9.80998e-13, 1.24151e-17, - 1.01916e-02, 1.28728e-07, 1.62733e-12, 2.05948e-17, - 1.68921e-02, 2.13360e-07, 2.69722e-12, 3.41348e-17, - 2.96213e-02, 3.74139e-07, 4.72974e-12, 5.98574e-17, - 6.10970e-02, 7.71701e-07, 9.75560e-12, 1.23463e-16, - 1.43533e-01, 1.81293e-06, 2.29185e-11, 2.90047e-16, - 3.27806e-01, 4.14044e-06, 5.23423e-11, 6.62424e-16, - 6.40565e-01, 8.09084e-06, 1.02282e-10, 1.29445e-15, - 1.05534e+00, 1.33298e-05, 1.68513e-10, 2.13267e-15, - 1.58348e+00, 2.00015e-05, 2.52868e-10, 3.20044e-15, - 3.07310e+00, 3.88206e-05, 4.90841e-10, 6.21320e-15, - 1.37089e+01, 1.73169e-04, 2.18940e-09, 2.77122e-14, - 7.13521e+01, 9.01235e-04, 1.13932e-08, 1.44189e-13, - 2.52035e+02, 3.18325e-03, 4.02394e-08, 5.09217e-13, - 5.88759e+02, 7.43595e-03, 9.39947e-08, 1.18943e-12, - 9.70270e+02, 1.22542e-02, 1.54897e-07, 1.96005e-12, - 1.20866e+03, 1.52648e-02, 1.92951e-07, 2.44153e-12, - 1.20927e+03, 1.52725e-02, 1.93046e-07, 2.44272e-12, - 1.02223e+03, 1.29102e-02, 1.63185e-07, 2.06485e-12, - 7.60460e+02, 9.60416e-03, 1.21396e-07, 1.53608e-12, - 5.14029e+02, 6.49187e-03, 8.20570e-08, 1.03830e-12, - 3.23438e+02, 4.08481e-03, 5.16318e-08, 6.53316e-13, - 1.92889e+02, 2.43607e-03, 3.07917e-08, 3.89618e-13, - 1.10502e+02, 1.39557e-03, 1.76399e-08, 2.23204e-13, - 6.14046e+01, 7.75500e-04, 9.80225e-09, 1.24031e-13, - 3.33434e+01, 4.21106e-04, 5.32274e-09, 6.73503e-14, - 1.77894e+01, 2.24668e-04, 2.83978e-09, 3.59327e-14, - 9.36317e+00, 1.18251e-04, 1.49468e-09, 1.89126e-14 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpSiM [itab0] = P200_kpSiM [itab]; - my_rates->SN0_kpFeM [itab0] = P200_kpFeM [itab]; - my_rates->SN0_kpMg2SiO4 [itab0] = P200_kpMg2SiO4 [itab]; - my_rates->SN0_kpAC [itab0] = P200_kpAC [itab]; - my_rates->SN0_kpSiO2D [itab0] = P200_kpSiO2D [itab]; - my_rates->SN0_kpMgO [itab0] = P200_kpMgO [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -int calc_rates_dust_Y19(int iSN, chemistry_data *my_chemistry, chemistry_data_storage *my_rates) -{ - - int NTd, Nmom; - int iTd, imom, itab0, itab; - - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust][iSN] = 2.50000e-01; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = 2.50000e-01; - - itab0 = 3 * iSN; - my_rates->SN0_r0MgSiO3 [itab0 + 0] = 1.00000e-05; - my_rates->SN0_r0AC [itab0 + 0] = 1.00000e-05; - - my_rates->SN0_r0MgSiO3 [itab0 + 1] = 1.00000e-10; - my_rates->SN0_r0AC [itab0 + 1] = 1.00000e-10; - - my_rates->SN0_r0MgSiO3 [itab0 + 2] = 1.00000e-15; - my_rates->SN0_r0AC [itab0 + 2] = 1.00000e-15; - - NTd = 35; - Nmom = 4; - - double Y19_kpMgSiO3[] = - { 2.19890e-02, 2.19890e-07, 2.19890e-12, 2.19890e-17, - 3.90612e-02, 3.90612e-07, 3.90612e-12, 3.90612e-17, - 6.05539e-02, 6.05539e-07, 6.05539e-12, 6.05539e-17, - 8.76116e-02, 8.76116e-07, 8.76116e-12, 8.76116e-17, - 1.43288e-01, 1.43288e-06, 1.43288e-11, 1.43288e-16, - 2.19266e-01, 2.19266e-06, 2.19266e-11, 2.19266e-16, - 3.36256e-01, 3.36256e-06, 3.36256e-11, 3.36256e-16, - 5.14336e-01, 5.14336e-06, 5.14336e-11, 5.14336e-16, - 7.97216e-01, 7.97216e-06, 7.97216e-11, 7.97216e-16, - 1.25414e+00, 1.25414e-05, 1.25414e-10, 1.25414e-15, - 2.03450e+00, 2.03450e-05, 2.03450e-10, 2.03450e-15, - 3.34654e+00, 3.34654e-05, 3.34654e-10, 3.34654e-15, - 5.45913e+00, 5.45913e-05, 5.45913e-10, 5.45913e-15, - 8.82166e+00, 8.82166e-05, 8.82166e-10, 8.82166e-15, - 1.41836e+01, 1.41836e-04, 1.41836e-09, 1.41836e-14, - 2.28449e+01, 2.28449e-04, 2.28449e-09, 2.28449e-14, - 3.71258e+01, 3.71258e-04, 3.71258e-09, 3.71258e-14, - 6.14485e+01, 6.14485e-04, 6.14485e-09, 6.14485e-14, - 1.03898e+02, 1.03898e-03, 1.03898e-08, 1.03898e-13, - 1.75627e+02, 1.75627e-03, 1.75627e-08, 1.75627e-13, - 2.82290e+02, 2.82290e-03, 2.82290e-08, 2.82290e-13, - 4.14908e+02, 4.14908e-03, 4.14908e-08, 4.14908e-13, - 5.60606e+02, 5.60606e-03, 5.60606e-08, 5.60606e-13, - 7.12020e+02, 7.12020e-03, 7.12020e-08, 7.12020e-13, - 8.42130e+02, 8.42130e-03, 8.42130e-08, 8.42130e-13, - 8.96812e+02, 8.96812e-03, 8.96812e-08, 8.96812e-13, - 8.41845e+02, 8.41845e-03, 8.41845e-08, 8.41845e-13, - 6.97883e+02, 6.97883e-03, 6.97883e-08, 6.97883e-13, - 5.19082e+02, 5.19082e-03, 5.19082e-08, 5.19082e-13, - 3.53464e+02, 3.53464e-03, 3.53464e-08, 3.53464e-13, - 2.24610e+02, 2.24610e-03, 2.24610e-08, 2.24610e-13, - 1.35389e+02, 1.35389e-03, 1.35389e-08, 1.35389e-13, - 7.84898e+01, 7.84898e-04, 7.84898e-09, 7.84898e-14, - 4.43113e+01, 4.43113e-04, 4.43113e-09, 4.43113e-14, - 2.49396e+01, 2.49396e-04, 2.49396e-09, 2.49396e-14 }; - - double Y19_kpAC[] = - { 6.76020e-02, 6.76020e-07, 6.76020e-12, 6.76020e-17, - 1.20181e-01, 1.20181e-06, 1.20181e-11, 1.20181e-16, - 1.86375e-01, 1.86375e-06, 1.86375e-11, 1.86375e-16, - 2.69708e-01, 2.69708e-06, 2.69708e-11, 2.69708e-16, - 4.44368e-01, 4.44368e-06, 4.44368e-11, 4.44368e-16, - 6.87406e-01, 6.87406e-06, 6.87406e-11, 6.87406e-16, - 1.07797e+00, 1.07797e-05, 1.07797e-10, 1.07797e-15, - 1.71241e+00, 1.71241e-05, 1.71241e-10, 1.71241e-15, - 2.74163e+00, 2.74163e-05, 2.74163e-10, 2.74163e-15, - 4.35812e+00, 4.35812e-05, 4.35812e-10, 4.35812e-15, - 6.98720e+00, 6.98720e-05, 6.98720e-10, 6.98720e-15, - 1.13206e+01, 1.13206e-04, 1.13206e-09, 1.13206e-14, - 1.85159e+01, 1.85159e-04, 1.85159e-09, 1.85159e-14, - 3.09414e+01, 3.09414e-04, 3.09414e-09, 3.09414e-14, - 5.34575e+01, 5.34575e-04, 5.34575e-09, 5.34575e-14, - 9.60912e+01, 9.60912e-04, 9.60912e-09, 9.60912e-14, - 1.76000e+02, 1.76000e-03, 1.76000e-08, 1.76000e-13, - 3.10598e+02, 3.10598e-03, 3.10598e-08, 3.10598e-13, - 4.95502e+02, 4.95502e-03, 4.95502e-08, 4.95502e-13, - 6.87389e+02, 6.87389e-03, 6.87389e-08, 6.87389e-13, - 8.21760e+02, 8.21760e-03, 8.21760e-08, 8.21760e-13, - 8.55209e+02, 8.55209e-03, 8.55209e-08, 8.55209e-13, - 7.90315e+02, 7.90315e-03, 7.90315e-08, 7.90315e-13, - 6.63814e+02, 6.63814e-03, 6.63814e-08, 6.63814e-13, - 5.19410e+02, 5.19410e-03, 5.19410e-08, 5.19410e-13, - 3.88956e+02, 3.88956e-03, 3.88956e-08, 3.88956e-13, - 2.88141e+02, 2.88141e-03, 2.88141e-08, 2.88141e-13, - 2.20698e+02, 2.20698e-03, 2.20698e-08, 2.20698e-13, - 1.84716e+02, 1.84716e-03, 1.84716e-08, 1.84716e-13, - 1.78316e+02, 1.78316e-03, 1.78316e-08, 1.78316e-13, - 2.05010e+02, 2.05010e-03, 2.05010e-08, 2.05010e-13, - 2.82760e+02, 2.82760e-03, 2.82760e-08, 2.82760e-13, - 4.70437e+02, 4.70437e-03, 4.70437e-08, 4.70437e-13, - 9.49808e+02, 9.49808e-03, 9.49808e-08, 9.49808e-13, - 2.18634e+03, 2.18634e-02, 2.18634e-07, 2.18634e-12 }; - - - itab0 = Nmom * NTd * iSN; - itab = 0; - for(imom = 0; imom < Nmom; imom++) { - for(iTd = 0; iTd < NTd; iTd++) { - my_rates->SN0_kpMgSiO3 [itab0] = Y19_kpMgSiO3 [itab]; - my_rates->SN0_kpAC [itab0] = Y19_kpAC [itab]; - itab0++; - itab ++; - } - } - - return SUCCESS; -} - -} // anonymous namespace From 8af2e5e0cd35ec13b5075ee11711bb96ca26c386 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sun, 7 Dec 2025 15:59:56 -0500 Subject: [PATCH 038/111] finish replacing my_rates->SN0_[fX] --- src/clib/initialize_chemistry_data.cpp | 7 --- src/clib/initialize_dust_yields.cpp | 26 ++-------- src/clib/make_consistent.cpp | 72 +++++++++++++++----------- src/include/grackle_chemistry_data.h | 1 - 4 files changed, 45 insertions(+), 61 deletions(-) diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 462d5d59a..4279aab75 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -154,13 +154,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag my_rates->gr_dT = 0.; my_rates->gr_Td = NULL; my_rates->SN0_N = 0; - my_rates->SN0_XC = nullptr; - my_rates->SN0_XO = nullptr; - my_rates->SN0_XMg = nullptr; - my_rates->SN0_XAl = nullptr; - my_rates->SN0_XSi = nullptr; - my_rates->SN0_XS = nullptr; - my_rates->SN0_XFe = nullptr; my_rates->SN0_fC = nullptr; my_rates->SN0_fO = nullptr; my_rates->SN0_fMg = nullptr; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 9643b8391..22f666df5 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -334,17 +334,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int NSN = n_pathways; // todo: delete me! my_rates->SN0_N = n_pathways; - // crude hack (until we delete all of chemistry_data_storage's SN0_X* and - // SN0_f* members -- this has to wait until after we merge in the - // transcription of make_consistent) - my_rates->SN0_XC = inject_pathway_props->total_metal_nuclide_yields.C; - my_rates->SN0_XO = inject_pathway_props->total_metal_nuclide_yields.O; - my_rates->SN0_XMg = inject_pathway_props->total_metal_nuclide_yields.Mg; - my_rates->SN0_XAl = inject_pathway_props->total_metal_nuclide_yields.Al; - my_rates->SN0_XSi = inject_pathway_props->total_metal_nuclide_yields.Si; - my_rates->SN0_XS = inject_pathway_props->total_metal_nuclide_yields.S; - my_rates->SN0_XFe = inject_pathway_props->total_metal_nuclide_yields.Fe; - + // crude hack (holding onto this momentarily) my_rates->SN0_fC = inject_pathway_props->gas_metal_nuclide_yields.C; my_rates->SN0_fO = inject_pathway_props->gas_metal_nuclide_yields.O; my_rates->SN0_fMg = inject_pathway_props->gas_metal_nuclide_yields.Mg; @@ -442,18 +432,8 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, if (my_chemistry->metal_chemistry == 0) return SUCCESS; - // reminder: we have adopted a crude hack (until we delete all of - // chemistry_data_storage's SN0_X* and SN0_f* members -- this has to wait - // until after we merge in the transcription of make_consistent), where - // the yield fraction for each metal nuclide is an alias to a pointer - my_rates->SN0_XC = nullptr; - my_rates->SN0_XO = nullptr; - my_rates->SN0_XMg = nullptr; - my_rates->SN0_XAl = nullptr; - my_rates->SN0_XSi = nullptr; - my_rates->SN0_XS = nullptr; - my_rates->SN0_XFe = nullptr; - + // reminder: we are holding on to SN0_f as a crude hack (we will + // delete them later) my_rates->SN0_fC = nullptr; my_rates->SN0_fO = nullptr; my_rates->SN0_fMg = nullptr; diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index 701606036..980e9d37d 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -18,6 +18,8 @@ #include "grackle.h" #include "fortran_func_decls.h" +#include "inject_model/grain_metal_inject_pathways.hpp" +#include "opaque_storage.hpp" #include "utils-cpp.hpp" #include "make_consistent.hpp" @@ -267,6 +269,9 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, std::vector Sd(my_fields->grid_dimension[0]); std::vector Fed(my_fields->grid_dimension[0]); + const grackle::impl::GrainMetalInjectPathways* inject_pathway_props = + my_rates->opaque_storage->inject_pathway_props; + // Loop over all zones for (k = my_fields->grid_start[2]; k <= my_fields->grid_end[2]; k++) { @@ -337,27 +342,34 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, // endif if (my_chemistry->metal_chemistry > 0) { - if (my_chemistry->multi_metals == 0) { + // compute the expected mass density for each metal nuclide using the + // yields from every injection pathway + const grackle::impl::yields::MetalTables& total_metal_yields = + inject_pathway_props->total_metal_nuclide_yields; + const grackle::impl::yields::MetalTables& onlygas_metal_yields = + inject_pathway_props->gas_metal_nuclide_yields; + + if (my_chemistry->multi_metals == 0) { // case with 1 injection pathway iSN0 = my_chemistry->metal_abundances; for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { - Ct[i] = my_rates->SN0_XC[iSN0] * metal(i, j, k); - Ot[i] = my_rates->SN0_XO[iSN0] * metal(i, j, k); - Mgt[i] = my_rates->SN0_XMg[iSN0] * metal(i, j, k); - Alt[i] = my_rates->SN0_XAl[iSN0] * metal(i, j, k); - Sit[i] = my_rates->SN0_XSi[iSN0] * metal(i, j, k); - St[i] = my_rates->SN0_XS[iSN0] * metal(i, j, k); - Fet[i] = my_rates->SN0_XFe[iSN0] * metal(i, j, k); + Ct[i] = total_metal_yields.C[iSN0] * metal(i, j, k); + Ot[i] = total_metal_yields.O[iSN0] * metal(i, j, k); + Mgt[i] = total_metal_yields.Mg[iSN0] * metal(i, j, k); + Alt[i] = total_metal_yields.Al[iSN0] * metal(i, j, k); + Sit[i] = total_metal_yields.Si[iSN0] * metal(i, j, k); + St[i] = total_metal_yields.S[iSN0] * metal(i, j, k); + Fet[i] = total_metal_yields.Fe[iSN0] * metal(i, j, k); - Cg[i] = my_rates->SN0_fC[iSN0] * metal(i, j, k); - Og[i] = my_rates->SN0_fO[iSN0] * metal(i, j, k); - Mgg[i] = my_rates->SN0_fMg[iSN0] * metal(i, j, k); - Alg[i] = my_rates->SN0_fAl[iSN0] * metal(i, j, k); - Sig[i] = my_rates->SN0_fSi[iSN0] * metal(i, j, k); - Sg[i] = my_rates->SN0_fS[iSN0] * metal(i, j, k); - Feg[i] = my_rates->SN0_fFe[iSN0] * metal(i, j, k); + Cg[i] = onlygas_metal_yields.C[iSN0] * metal(i, j, k); + Og[i] = onlygas_metal_yields.O[iSN0] * metal(i, j, k); + Mgg[i] = onlygas_metal_yields.Mg[iSN0] * metal(i, j, k); + Alg[i] = onlygas_metal_yields.Al[iSN0] * metal(i, j, k); + Sig[i] = onlygas_metal_yields.Si[iSN0] * metal(i, j, k); + Sg[i] = onlygas_metal_yields.S[iSN0] * metal(i, j, k); + Feg[i] = onlygas_metal_yields.Fe[iSN0] * metal(i, j, k); } - } else { + } else { // case with multiple injection pathways // do i = is+1, ie+1 // totalZ = metal_loc(i,j,k) // & + metal_C13(i,j,k) + metal_C20(i,j,k) @@ -413,21 +425,21 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, Fet[i] = 0.; Feg[i] = 0.; for (iSN = 0; iSN < nSN; iSN++) { - Ct[i] = Ct[i] + my_rates->SN0_XC[iSN] * SN_metal(i, iSN); - Ot[i] = Ot[i] + my_rates->SN0_XO[iSN] * SN_metal(i, iSN); - Mgt[i] = Mgt[i] + my_rates->SN0_XMg[iSN] * SN_metal(i, iSN); - Alt[i] = Alt[i] + my_rates->SN0_XAl[iSN] * SN_metal(i, iSN); - Sit[i] = Sit[i] + my_rates->SN0_XSi[iSN] * SN_metal(i, iSN); - St[i] = St[i] + my_rates->SN0_XS[iSN] * SN_metal(i, iSN); - Fet[i] = Fet[i] + my_rates->SN0_XFe[iSN] * SN_metal(i, iSN); + Ct[i] = Ct[i] + total_metal_yields.C[iSN] * SN_metal(i, iSN); + Ot[i] = Ot[i] + total_metal_yields.O[iSN] * SN_metal(i, iSN); + Mgt[i] = Mgt[i] + total_metal_yields.Mg[iSN] * SN_metal(i, iSN); + Alt[i] = Alt[i] + total_metal_yields.Al[iSN] * SN_metal(i, iSN); + Sit[i] = Sit[i] + total_metal_yields.Si[iSN] * SN_metal(i, iSN); + St[i] = St[i] + total_metal_yields.S[iSN] * SN_metal(i, iSN); + Fet[i] = Fet[i] + total_metal_yields.Fe[iSN] * SN_metal(i, iSN); - Cg[i] = Cg[i] + my_rates->SN0_fC[iSN] * SN_metal(i, iSN); - Og[i] = Og[i] + my_rates->SN0_fO[iSN] * SN_metal(i, iSN); - Mgg[i] = Mgg[i] + my_rates->SN0_fMg[iSN] * SN_metal(i, iSN); - Alg[i] = Alg[i] + my_rates->SN0_fAl[iSN] * SN_metal(i, iSN); - Sig[i] = Sig[i] + my_rates->SN0_fSi[iSN] * SN_metal(i, iSN); - Sg[i] = Sg[i] + my_rates->SN0_fS[iSN] * SN_metal(i, iSN); - Feg[i] = Feg[i] + my_rates->SN0_fFe[iSN] * SN_metal(i, iSN); + Cg[i] = Cg[i] + onlygas_metal_yields.C[iSN] * SN_metal(i, iSN); + Og[i] = Og[i] + onlygas_metal_yields.O[iSN] * SN_metal(i, iSN); + Mgg[i] = Mgg[i] + onlygas_metal_yields.Mg[iSN] * SN_metal(i, iSN); + Alg[i] = Alg[i] + onlygas_metal_yields.Al[iSN] * SN_metal(i, iSN); + Sig[i] = Sig[i] + onlygas_metal_yields.Si[iSN] * SN_metal(i, iSN); + Sg[i] = Sg[i] + onlygas_metal_yields.S[iSN] * SN_metal(i, iSN); + Feg[i] = Feg[i] + onlygas_metal_yields.Fe[iSN] * SN_metal(i, iSN); } } } diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index d34a1e323..f18cfe928 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -609,7 +609,6 @@ typedef struct int *gr_N, gr_Size; double gr_dT, *gr_Td; int SN0_N; - double *SN0_XC , *SN0_XO , *SN0_XMg, *SN0_XAl, *SN0_XSi, *SN0_XS , *SN0_XFe; double *SN0_fC , *SN0_fO , *SN0_fMg, *SN0_fAl, *SN0_fSi, *SN0_fS , *SN0_fFe; double *SN0_r0SiM, *SN0_r0FeM, *SN0_r0Mg2SiO4, *SN0_r0MgSiO3, *SN0_r0Fe3O4 , *SN0_r0AC, *SN0_r0SiO2D, *SN0_r0MgO, *SN0_r0FeS, *SN0_r0Al2O3 From 7a61b34ccebda6562ed3e5b8b574bd8c72fe9695 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Sun, 7 Dec 2025 17:17:57 -0500 Subject: [PATCH 039/111] incremental commit --- src/clib/initialize_dust_yields.cpp | 119 +++++++++++----------------- 1 file changed, 47 insertions(+), 72 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 22f666df5..093ac9a24 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -125,61 +125,47 @@ extern "C" int setup_yield_table_callback( input->initial_grain_props[yield_idx]; int grain_species_idx = -1; - double* size_mom_table = nullptr; double* opac_coef_table = nullptr; // with a little refactoring, this will get a lot more concise if (std::strcmp("MgSiO3_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; - size_mom_table = my_rates->SN0_r0MgSiO3; opac_coef_table = my_rates->SN0_kpMgSiO3; } else if (std::strcmp("AC_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::AC_dust; - size_mom_table = my_rates->SN0_r0AC; opac_coef_table = my_rates->SN0_kpAC; } else if (std::strcmp("SiM_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::SiM_dust; - size_mom_table = my_rates->SN0_r0SiM; opac_coef_table = my_rates->SN0_kpSiM; } else if (std::strcmp("FeM_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::FeM_dust; - size_mom_table = my_rates->SN0_r0FeM; opac_coef_table = my_rates->SN0_kpFeM; } else if (std::strcmp("Mg2SiO4_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; - size_mom_table = my_rates->SN0_r0Mg2SiO4; opac_coef_table = my_rates->SN0_kpMg2SiO4; } else if (std::strcmp("Fe3O4_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; - size_mom_table = my_rates->SN0_r0Fe3O4; opac_coef_table = my_rates->SN0_kpFe3O4; } else if (std::strcmp("SiO2_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::SiO2_dust; - size_mom_table = my_rates->SN0_r0SiO2D; opac_coef_table = my_rates->SN0_kpSiO2D; } else if (std::strcmp("MgO_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::MgO_dust; - size_mom_table = my_rates->SN0_r0MgO; opac_coef_table = my_rates->SN0_kpMgO; } else if (std::strcmp("FeS_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::FeS_dust; - size_mom_table = my_rates->SN0_r0FeS; opac_coef_table = my_rates->SN0_kpFeS; } else if (std::strcmp("Al2O3_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; - size_mom_table = my_rates->SN0_r0Al2O3; opac_coef_table = my_rates->SN0_kpAl2O3; } else if (std::strcmp("ref_org_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::ref_org_dust; - size_mom_table = my_rates->SN0_r0reforg; opac_coef_table = my_rates->SN0_kpreforg; } else if (std::strcmp("vol_org_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::vol_org_dust; - size_mom_table = my_rates->SN0_r0volorg; opac_coef_table = my_rates->SN0_kpvolorg; } else if (std::strcmp("H2O_ice_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; - size_mom_table = my_rates->SN0_r0H2Oice; opac_coef_table = my_rates->SN0_kpH2Oice; } else { return GrPrintAndReturnErr( @@ -192,6 +178,8 @@ extern "C" int setup_yield_table_callback( // copy the 1st, 2nd, and 3rd moments of the size distribution // (the 0th moment isn't recorded anywhere + double* size_mom_table = + inject_pathway_props->size_moments.data[grain_species_idx]; for (int i = 0; i < 3; i++) { size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; } @@ -251,44 +239,31 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; - if (inject_pathway_props != nullptr) { - // handle the grain yields + GRIMPL_REQUIRE(inject_pathway_props != nullptr, + "sanity check -- should never ever fail!"); + + const int n_grain_species = OnlyGrainSpLUT::NUM_ENTRIES; + + // handle the grain yields + for (int grain_species_idx = 0; grain_species_idx < n_grain_species; + grain_species_idx++){ + double* arr = inject_pathway_props->grain_yields.data[grain_species_idx]; for(int iSN = 0; iSN < n_pathways; iSN++) { - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust] [iSN] = value; - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust] [iSN] = value; + arr[iSN] = value; } } - if (true) { // NOLINT(readability-simplify-boolean-expr) - - // handle the size moments - int moment_table_len = n_pathways * 3; // there are 3 size moments + // handle the size moments + int moment_table_len = n_pathways * 3; // there are 3 size moments + for (int grain_species_idx = 0; grain_species_idx < n_grain_species; + grain_species_idx++){ + double* arr = inject_pathway_props->size_moments.data[grain_species_idx]; for(int i = 0; i < moment_table_len; i++) { - my_rates->SN0_r0SiM [i] = value; - my_rates->SN0_r0FeM [i] = value; - my_rates->SN0_r0Mg2SiO4 [i] = value; - my_rates->SN0_r0MgSiO3 [i] = value; - my_rates->SN0_r0Fe3O4 [i] = value; - my_rates->SN0_r0AC [i] = value; - my_rates->SN0_r0SiO2D [i] = value; - my_rates->SN0_r0MgO [i] = value; - my_rates->SN0_r0FeS [i] = value; - my_rates->SN0_r0Al2O3 [i] = value; - my_rates->SN0_r0reforg [i] = value; - my_rates->SN0_r0volorg [i] = value; - my_rates->SN0_r0H2Oice [i] = value; + arr[i] = value; } + } + + if (true) { // NOLINT(readability-simplify-boolean-expr) // handle the opacity coefficient table int opac_table_len = n_pathways * my_rates->gr_Size; @@ -343,19 +318,19 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = inject_pathway_props->gas_metal_nuclide_yields.S; my_rates->SN0_fFe = inject_pathway_props->gas_metal_nuclide_yields.Fe; - my_rates->SN0_r0SiM = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0FeM = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0Mg2SiO4 = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0MgSiO3 = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0Fe3O4 = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0AC = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0SiO2D = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0MgO = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0FeS = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0Al2O3 = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0reforg = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0volorg = (double*)malloc(NSN * 3 * sizeof(double)); - my_rates->SN0_r0H2Oice = (double*)malloc(NSN * 3 * sizeof(double)); + my_rates->SN0_r0SiM = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust]; + my_rates->SN0_r0FeM = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust]; + my_rates->SN0_r0Mg2SiO4 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust]; + my_rates->SN0_r0MgSiO3 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust]; + my_rates->SN0_r0Fe3O4 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust]; + my_rates->SN0_r0AC = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust]; + my_rates->SN0_r0SiO2D = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust]; + my_rates->SN0_r0MgO = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust]; + my_rates->SN0_r0FeS = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust]; + my_rates->SN0_r0Al2O3 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust]; + my_rates->SN0_r0reforg = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust]; + my_rates->SN0_r0volorg = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust]; + my_rates->SN0_r0H2Oice = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust]; // write out the opacity related quantities @@ -442,19 +417,19 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = nullptr; my_rates->SN0_fFe = nullptr; - GRACKLE_FREE(my_rates->SN0_r0SiM); - GRACKLE_FREE(my_rates->SN0_r0FeM); - GRACKLE_FREE(my_rates->SN0_r0Mg2SiO4); - GRACKLE_FREE(my_rates->SN0_r0MgSiO3); - GRACKLE_FREE(my_rates->SN0_r0Fe3O4); - GRACKLE_FREE(my_rates->SN0_r0AC); - GRACKLE_FREE(my_rates->SN0_r0SiO2D); - GRACKLE_FREE(my_rates->SN0_r0MgO); - GRACKLE_FREE(my_rates->SN0_r0FeS); - GRACKLE_FREE(my_rates->SN0_r0Al2O3); - GRACKLE_FREE(my_rates->SN0_r0reforg); - GRACKLE_FREE(my_rates->SN0_r0volorg); - GRACKLE_FREE(my_rates->SN0_r0H2Oice); + my_rates->SN0_r0SiM = nullptr; + my_rates->SN0_r0FeM = nullptr; + my_rates->SN0_r0Mg2SiO4 = nullptr; + my_rates->SN0_r0MgSiO3 = nullptr; + my_rates->SN0_r0Fe3O4 = nullptr; + my_rates->SN0_r0AC = nullptr; + my_rates->SN0_r0SiO2D = nullptr; + my_rates->SN0_r0MgO = nullptr; + my_rates->SN0_r0FeS = nullptr; + my_rates->SN0_r0Al2O3 = nullptr; + my_rates->SN0_r0reforg = nullptr; + my_rates->SN0_r0volorg = nullptr; + my_rates->SN0_r0H2Oice = nullptr; GRACKLE_FREE(my_rates->gr_Td); From d5cac76200bc0c649c482b03bcb4620756a45936 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 14:49:52 -0500 Subject: [PATCH 040/111] rm erroneous docstring comment (Basically, I forgot to remove the comment sooner) --- src/clib/inject_model/grain_metal_inject_pathways.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/clib/inject_model/grain_metal_inject_pathways.hpp b/src/clib/inject_model/grain_metal_inject_pathways.hpp index 1fb39e9e5..e7460f527 100644 --- a/src/clib/inject_model/grain_metal_inject_pathways.hpp +++ b/src/clib/inject_model/grain_metal_inject_pathways.hpp @@ -141,9 +141,6 @@ struct GrainMetalInjectPathways { /// when injected by pathway ``j``. The value has units of centimeters /// cubed. /// - /// @todo - /// What are the units of each quantity? (the dimensionality is obvious) - /// /// where \f$\langle r^2 \rangle_j=\int_0^\infty r^p \Phi_j(r)\, {\rm d}r\f$ /// is an abbreviation for the ``p``th moment of the \f$\Phi_j(r)\f$, or the /// initial differential grain size distribution for pathway ``j`` (this From 1d49a4258d8249dc19ff11f84ca42b939a10b92d Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 16:36:14 -0500 Subject: [PATCH 041/111] introduce all remaining members GrainMetalInjectPathways (they aren't actually used yet) --- src/clib/initialize_dust_yields.cpp | 13 +- .../grain_metal_inject_pathways.hpp | 149 ++++++++++++++++-- 2 files changed, 150 insertions(+), 12 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 093ac9a24..026ae42b0 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -297,14 +297,21 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, } int n_pathways = 12; + int n_log10Tdust_vals = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; + int n_opac_poly_coef = grackle::impl::inj_model_input::N_Opacity_Coef; my_rates->opaque_storage->inject_pathway_props = new grackle::impl::GrainMetalInjectPathways; *(my_rates->opaque_storage->inject_pathway_props) = - new_GrainMetalInjectPathways(n_pathways); + new_GrainMetalInjectPathways(n_pathways, n_log10Tdust_vals, + n_opac_poly_coef); grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_rates->opaque_storage->inject_pathway_props; + if (!GrainMetalInjectPathways_is_valid(inject_pathway_props)) { + return GR_FAIL; + } + int NSN = n_pathways; // todo: delete me! my_rates->SN0_N = n_pathways; @@ -335,7 +342,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // write out the opacity related quantities // todo: consider renaming Nmom -> Ncoef - int Nmom = 4; // todo: remove me! + int Nmom = n_opac_poly_coef; // todo: remove me! // todo: more this into GrainMetalInjectPathways // - essentially, each SN0_kpGRSP array is a 3D array of shape // (n_pathways, NTd, Nmom). This shape uses numpy conventions (i.e. Nmom is @@ -354,7 +361,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // - δr(t) refers to the derived "size increment" (it is a central // quantity in the model) // - I **think** the resulting quantity is the optical cross-section - double NTd = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; + double NTd = n_log10Tdust_vals; double Td0 = 0.0000000; // todo: remove me! double dTd = 0.1000000; // todo: remove me! diff --git a/src/clib/inject_model/grain_metal_inject_pathways.hpp b/src/clib/inject_model/grain_metal_inject_pathways.hpp index e7460f527..27e0da85f 100644 --- a/src/clib/inject_model/grain_metal_inject_pathways.hpp +++ b/src/clib/inject_model/grain_metal_inject_pathways.hpp @@ -12,9 +12,12 @@ #ifndef GRAIN_METAL_INJECT_PATHWAYS_HPP #define GRAIN_METAL_INJECT_PATHWAYS_HPP -#include "LUT.hpp" -#include "internal_types.hpp" -#include "visitor/common.hpp" +#include "grackle.h" // gr_interp_grid_props +#include "../LUT.hpp" +#include "../internal_types.hpp" +#include "../interp_table_utils.hpp" +#include "../status_reporting.h" +#include "../visitor/common.hpp" // this is a separate namespace because we are probably going to delete the // contents (when we deal with GH Issue #446) @@ -155,30 +158,158 @@ struct GrainMetalInjectPathways { /// functions to the narrative docs and refer the reader to the appropriate /// section of documentation GrainSpeciesCollection size_moments; + + /// Tracks 1D grid constant-spaced log10(Tdust) values used for interpolation + /// in opacity calculations. + /// + /// @note + /// Using a full #gr_interp_grid_props seems like it's a little overkill for + /// holding values for 1D interpolation, but it may be worthwhile that this + /// datatype is **ONLY** used for interpolation. Maybe in the future, we + /// should make a specialized version for 1D data? + gr_interp_grid_props log10Tdust_interp_props; + + /// the number of polynomial coefficients that will be computed from the + /// opacity_coef_table. They are used in a polynomial of degree + /// `(n_opac_poly_coef-1)` + int n_opac_poly_coef; + + /// tables of values for opacity calculations. + /// + /// This holds a 3D array for each grain species. Each array has the shape + /// `(n_pathways, nTd, n_opac_poly_coef)`, where + /// - `nTd` is `log10Tdust_interp_props.dimension[0]` + /// - the axis follows numpy conventions (i.e. `n_opac_poly_coef` is the + /// contiguous axis). + /// + /// What the data means + /// =================== + /// + /// To be more concrete, consider a grain species that maps to data at an + /// index `grsp_i` and an injection pathway that maps to data at an index + /// `injp_i`. Then, let's consider `p`, which is given by + /// `p = opacity_coef_table.data[grsp_i] + (injp_i * nTd * n_opac_poly_coef)`. + /// In this scenario, `p` points to a 2D array that holds `n_opac_poly_coef` + /// coefficients for each dust temperatures in `log10Tdust_interp_props`. + /// + /// In practice, we construct a vector, `vec`, of values for all `nTd` dust + /// temperatures. The value computed for dust temperature `j` is: + /// + /// `vec[j] = 4πζ/3 * ∑ᵢ₌₀ ( p[j * n_opac_poly_coef + i] * δrⁱ(t) )` + /// + /// where: + /// - the summation runs from `i=0` through `i = n_opac_poly_coef - 1`. + /// - `ζ` is the "bulk density" of the considered grain species (in g/cm³). + /// In other words, it's the mass density of a single grain. + /// - `δr(t)` refers to the derived "size increment", in units of cm, + /// computed at the current time `t`. Recall that Grackle's multi-grain + /// species dust model involves the initial size distribution functions for + /// grain species when they are initially injected. This is allowed to vary + /// across injection pathway and grain species (in fact, moments of these + /// functions are stored by `GrainMetalInjectPathways::size_moments`). If + /// grains undergo growth, the model assumes that the distribution function + /// is simply translated by the size increment, `δr` (the shape doesn't + /// change). Thus, a `δr` of `0` means that there's been no growth. + /// + /// `vec[j]` holds a quantity related to computing opacity. I, MWA, **THINK** + /// that `vec[j]`: + /// - it directly stores opacity, in units of `cm^2/g`. + /// - is "per unit grain mass." If my understanding of this quantity and + /// related logic is indeed correct, this is noteworthy because subsequent + /// calculations appear use values deriving from `vec[j]` to compute + /// opacity measured "per unit gas mass." + /// + /// @todo + /// Determine whether my statements in the preceeding paragraphs are indeed + /// correct. More generally, what kind of weighted opacity is this? (e.g. a + /// a Rosseland mean opacity or a Planck mean opacity?)? Does it describe a + /// restricted wavelength range? + /// + /// The resulting vector of values is subsequently interpolated with respect + /// to log10Tdust_interp_props + /// + /// @todo + /// Ideally, we would move some of this description to the narrative docs and + /// then refer the reader to the appropriate section of the documentation. + /// (This could certainly be done for the description of the size increment) + GrainSpeciesCollection opacity_coef_table; }; /// allocates the contents of a new GrainMetalInjectPathways /// -/// @param n_pathways The number of modeled injection pathways -inline GrainMetalInjectPathways new_GrainMetalInjectPathways(int n_pathways) { +/// @param[in] n_pathways Number of modelled injection pathways +/// @param[in] n_log10Tdust_vals Number of log10(Tdust) values that are relevant +/// for the opacity coefficient table. +/// @param[in] n_opac_poly_coef Number of opacity coefficients that are +/// computed from the opacity coefficient table. +inline GrainMetalInjectPathways new_GrainMetalInjectPathways( + int n_pathways, int n_log10Tdust_vals, int n_opac_poly_coef) { + + bool err = false; + + if (n_pathways <= 0) { + GrPrintErrMsg("n_pathways must be positive\n"); + err = true; + } else if (n_log10Tdust_vals <= 1) { + GrPrintErrMsg("n_log10Tdust_vals must exceed 1\n"); + err = true; + } else if (n_opac_poly_coef != 4) { + GrPrintErrMsg( + "the logic that uses the opacity table is hardcoded to assume that " + "the number of opacity polynomial coefficients is exactly 4\n"); + err = true; + } + GrainMetalInjectPathways out; + + if (err) { + out.n_pathways = -1; + return out; + } + out.n_pathways = n_pathways; + out.total_metal_nuclide_yields = yields::new_MetalTables(n_pathways); out.gas_metal_nuclide_yields = yields::new_MetalTables(n_pathways); + out.grain_yields = new_GrainSpeciesCollection(n_pathways); out.size_moments = new_GrainSpeciesCollection(3 * n_pathways); + init_empty_interp_grid_props_(&out.log10Tdust_interp_props); + out.log10Tdust_interp_props.rank = 1LL; + long long n_log10Tdust_vals_LL = static_cast(n_log10Tdust_vals); + out.log10Tdust_interp_props.dimension[0] = n_log10Tdust_vals_LL; + out.log10Tdust_interp_props.data_size = n_log10Tdust_vals_LL; + out.log10Tdust_interp_props.parameters[0] = new double[n_log10Tdust_vals]; + + out.n_opac_poly_coef = n_opac_poly_coef; + + out.opacity_coef_table = new_GrainSpeciesCollection( + n_pathways * n_log10Tdust_vals * n_opac_poly_coef); + return out; } +/// Checks whether the GrainMetalInjectPathways that is returned by +/// new_GrainMetalInjectPathways is valid +inline bool GrainMetalInjectPathways_is_valid(const GrainMetalInjectPathways* ptr) { + return ptr->n_pathways != -1; +} + + /// performs cleanup of the contents of GrainMetalInjectPathways /// /// This effectively invokes a destructor inline void drop_GrainMetalInjectPathways(GrainMetalInjectPathways* ptr) { - yields::drop_MetalTables(&ptr->total_metal_nuclide_yields); - yields::drop_MetalTables(&ptr->gas_metal_nuclide_yields); - drop_GrainSpeciesCollection(&ptr->grain_yields); - drop_GrainSpeciesCollection(&ptr->size_moments); + if (GrainMetalInjectPathways_is_valid(ptr)){ + yields::drop_MetalTables(&ptr->total_metal_nuclide_yields); + yields::drop_MetalTables(&ptr->gas_metal_nuclide_yields); + drop_GrainSpeciesCollection(&ptr->grain_yields); + drop_GrainSpeciesCollection(&ptr->size_moments); + free_interp_grid_props_(&ptr->log10Tdust_interp_props, + /* use_delete = */ true); + drop_GrainSpeciesCollection(&ptr->opacity_coef_table); + } } } // namespace grackle::impl From 4766aa7c72b5bbcb5ebbf362d63584cfd1f2c252 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 16:55:33 -0500 Subject: [PATCH 042/111] a large step towards changing how opacity coefficients get stored --- src/clib/initialize_dust_yields.cpp | 98 ++++++++++++----------------- 1 file changed, 39 insertions(+), 59 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 026ae42b0..22f6bc49c 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -125,48 +125,34 @@ extern "C" int setup_yield_table_callback( input->initial_grain_props[yield_idx]; int grain_species_idx = -1; - double* opac_coef_table = nullptr; // with a little refactoring, this will get a lot more concise if (std::strcmp("MgSiO3_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; - opac_coef_table = my_rates->SN0_kpMgSiO3; } else if (std::strcmp("AC_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::AC_dust; - opac_coef_table = my_rates->SN0_kpAC; } else if (std::strcmp("SiM_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::SiM_dust; - opac_coef_table = my_rates->SN0_kpSiM; } else if (std::strcmp("FeM_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::FeM_dust; - opac_coef_table = my_rates->SN0_kpFeM; } else if (std::strcmp("Mg2SiO4_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; - opac_coef_table = my_rates->SN0_kpMg2SiO4; } else if (std::strcmp("Fe3O4_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; - opac_coef_table = my_rates->SN0_kpFe3O4; } else if (std::strcmp("SiO2_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::SiO2_dust; - opac_coef_table = my_rates->SN0_kpSiO2D; } else if (std::strcmp("MgO_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::MgO_dust; - opac_coef_table = my_rates->SN0_kpMgO; } else if (std::strcmp("FeS_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::FeS_dust; - opac_coef_table = my_rates->SN0_kpFeS; } else if (std::strcmp("Al2O3_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; - opac_coef_table = my_rates->SN0_kpAl2O3; } else if (std::strcmp("ref_org_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::ref_org_dust; - opac_coef_table = my_rates->SN0_kpreforg; } else if (std::strcmp("vol_org_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::vol_org_dust; - opac_coef_table = my_rates->SN0_kpvolorg; } else if (std::strcmp("H2O_ice_dust", yield_info.name) == 0) { grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; - opac_coef_table = my_rates->SN0_kpH2Oice; } else { return GrPrintAndReturnErr( "`%s` not a known grain species", yield_info.name); @@ -186,6 +172,8 @@ extern "C" int setup_yield_table_callback( // copy over the opacity coefficients table { + double* opac_coef_table = + inject_pathway_props->opacity_coef_table.data[grain_species_idx]; int n_Td = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; int n_coef = grackle::impl::inj_model_input::N_Opacity_Coef; @@ -232,7 +220,7 @@ void override_metal_inject_props( /// @note /// to start, this only handles the grain yields void override_dust_inject_props(chemistry_data_storage *my_rates, - double value, int n_pathways) { + double value) { GRIMPL_REQUIRE(my_rates != nullptr && my_rates->opaque_storage != nullptr, "sanity check -- should never ever fail!"); @@ -244,6 +232,8 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, const int n_grain_species = OnlyGrainSpLUT::NUM_ENTRIES; + int n_pathways = inject_pathway_props->n_pathways; + // handle the grain yields for (int grain_species_idx = 0; grain_species_idx < n_grain_species; grain_species_idx++){ @@ -263,24 +253,14 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, } } - if (true) { // NOLINT(readability-simplify-boolean-expr) - - // handle the opacity coefficient table - int opac_table_len = n_pathways * my_rates->gr_Size; + // handle the opacity coefficient table + int opac_table_len = n_pathways * my_rates->gr_Size; + for (int grain_species_idx = 0; grain_species_idx < n_grain_species; + grain_species_idx++){ + double* arr = + inject_pathway_props->opacity_coef_table.data[grain_species_idx]; for(int i = 0; i < opac_table_len; i++) { - my_rates->SN0_kpSiM [i] = value; - my_rates->SN0_kpFeM [i] = value; - my_rates->SN0_kpMg2SiO4 [i] = value; - my_rates->SN0_kpMgSiO3 [i] = value; - my_rates->SN0_kpFe3O4 [i] = value; - my_rates->SN0_kpAC [i] = value; - my_rates->SN0_kpSiO2D [i] = value; - my_rates->SN0_kpMgO [i] = value; - my_rates->SN0_kpFeS [i] = value; - my_rates->SN0_kpAl2O3 [i] = value; - my_rates->SN0_kpreforg [i] = value; - my_rates->SN0_kpvolorg [i] = value; - my_rates->SN0_kpH2Oice [i] = value; + arr[i] = value; } } } @@ -375,24 +355,24 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; } - my_rates->SN0_kpSiM = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpFeM = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpMg2SiO4 = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpMgSiO3 = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpFe3O4 = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpAC = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpSiO2D = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpMgO = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpFeS = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpAl2O3 = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpreforg = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpvolorg = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); - my_rates->SN0_kpH2Oice = (double*)malloc(NSN * Nmom * NTd * sizeof(double)); + my_rates->SN0_kpSiM = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust]; + my_rates->SN0_kpFeM = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust]; + my_rates->SN0_kpMg2SiO4 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust]; + my_rates->SN0_kpMgSiO3 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust]; + my_rates->SN0_kpFe3O4 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust]; + my_rates->SN0_kpAC = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust]; + my_rates->SN0_kpSiO2D = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust]; + my_rates->SN0_kpMgO = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust]; + my_rates->SN0_kpFeS = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust]; + my_rates->SN0_kpAl2O3 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust]; + my_rates->SN0_kpreforg = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust]; + my_rates->SN0_kpvolorg = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust]; + my_rates->SN0_kpH2Oice = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust]; // zero-out all metal injection yield fractions and dust grain properties override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); - override_dust_inject_props(my_rates, 0.0, n_pathways); + override_dust_inject_props(my_rates, 0.0); SetupCallbackCtx ctx = {my_rates, 0}; @@ -440,19 +420,19 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, GRACKLE_FREE(my_rates->gr_Td); - GRACKLE_FREE(my_rates->SN0_kpSiM); - GRACKLE_FREE(my_rates->SN0_kpFeM); - GRACKLE_FREE(my_rates->SN0_kpMg2SiO4); - GRACKLE_FREE(my_rates->SN0_kpMgSiO3); - GRACKLE_FREE(my_rates->SN0_kpFe3O4); - GRACKLE_FREE(my_rates->SN0_kpAC); - GRACKLE_FREE(my_rates->SN0_kpSiO2D); - GRACKLE_FREE(my_rates->SN0_kpMgO); - GRACKLE_FREE(my_rates->SN0_kpFeS); - GRACKLE_FREE(my_rates->SN0_kpAl2O3); - GRACKLE_FREE(my_rates->SN0_kpreforg); - GRACKLE_FREE(my_rates->SN0_kpvolorg); - GRACKLE_FREE(my_rates->SN0_kpH2Oice); + my_rates->SN0_kpSiM = nullptr; + my_rates->SN0_kpFeM = nullptr; + my_rates->SN0_kpMg2SiO4 = nullptr; + my_rates->SN0_kpMgSiO3 = nullptr; + my_rates->SN0_kpFe3O4 = nullptr; + my_rates->SN0_kpAC = nullptr; + my_rates->SN0_kpSiO2D = nullptr; + my_rates->SN0_kpMgO = nullptr; + my_rates->SN0_kpFeS = nullptr; + my_rates->SN0_kpAl2O3 = nullptr; + my_rates->SN0_kpreforg = nullptr; + my_rates->SN0_kpvolorg = nullptr; + my_rates->SN0_kpH2Oice = nullptr; return SUCCESS; } From 6468b3bca6fdae3342d86ba80d7a5047d969eaad Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 17:04:00 -0500 Subject: [PATCH 043/111] another massive step towards removing SN0_kp and SN0_r0 --- src/clib/fortran_func_wrappers.hpp | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index d6d893edc..c92c24fec 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -122,15 +122,33 @@ inline void calc_grain_size_increment_1d ( my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust], my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust], my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], - my_rates->SN0_r0SiM, my_rates->SN0_r0FeM, my_rates->SN0_r0Mg2SiO4, my_rates->SN0_r0MgSiO3, - my_rates->SN0_r0Fe3O4, my_rates->SN0_r0AC, my_rates->SN0_r0SiO2D, my_rates->SN0_r0MgO, - my_rates->SN0_r0FeS, my_rates->SN0_r0Al2O3, - my_rates->SN0_r0reforg, my_rates->SN0_r0volorg, my_rates->SN0_r0H2Oice, + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], + my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], my_rates->gr_N, &my_rates->gr_Size, &my_rates->gr_dT, my_rates->gr_Td, - my_rates->SN0_kpSiM, my_rates->SN0_kpFeM, my_rates->SN0_kpMg2SiO4, my_rates->SN0_kpMgSiO3, - my_rates->SN0_kpFe3O4, my_rates->SN0_kpAC, my_rates->SN0_kpSiO2D, my_rates->SN0_kpMgO, - my_rates->SN0_kpFeS, my_rates->SN0_kpAl2O3, - my_rates->SN0_kpreforg, my_rates->SN0_kpvolorg, my_rates->SN0_kpH2Oice, + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], + my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.sigma_per_gas_mass_tot, From 4eee4ee47860a7051ffcc64beeb56f4d8837d31b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 17:37:42 -0500 Subject: [PATCH 044/111] finish removing SN0_kp and SN0_r0 --- src/clib/initialize_chemistry_data.cpp | 26 ------------ src/clib/initialize_dust_yields.cpp | 56 -------------------------- src/include/grackle_chemistry_data.h | 6 --- 3 files changed, 88 deletions(-) diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 4279aab75..e42e07896 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -161,32 +161,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag my_rates->SN0_fSi = nullptr; my_rates->SN0_fS = nullptr; my_rates->SN0_fFe = nullptr; - my_rates->SN0_r0SiM = NULL; - my_rates->SN0_r0FeM = NULL; - my_rates->SN0_r0Mg2SiO4 = NULL; - my_rates->SN0_r0MgSiO3 = NULL; - my_rates->SN0_r0Fe3O4 = NULL; - my_rates->SN0_r0AC = NULL; - my_rates->SN0_r0SiO2D = NULL; - my_rates->SN0_r0MgO = NULL; - my_rates->SN0_r0FeS = NULL; - my_rates->SN0_r0Al2O3 = NULL; - my_rates->SN0_r0reforg = NULL; - my_rates->SN0_r0volorg = NULL; - my_rates->SN0_r0H2Oice = NULL; - my_rates->SN0_kpSiM = NULL; - my_rates->SN0_kpFeM = NULL; - my_rates->SN0_kpMg2SiO4 = NULL; - my_rates->SN0_kpMgSiO3 = NULL; - my_rates->SN0_kpFe3O4 = NULL; - my_rates->SN0_kpAC = NULL; - my_rates->SN0_kpSiO2D = NULL; - my_rates->SN0_kpMgO = NULL; - my_rates->SN0_kpFeS = NULL; - my_rates->SN0_kpAl2O3 = NULL; - my_rates->SN0_kpreforg = NULL; - my_rates->SN0_kpvolorg = NULL; - my_rates->SN0_kpH2Oice = NULL; my_rates->cloudy_data_new = -1; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 22f6bc49c..3594d098b 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -305,20 +305,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = inject_pathway_props->gas_metal_nuclide_yields.S; my_rates->SN0_fFe = inject_pathway_props->gas_metal_nuclide_yields.Fe; - my_rates->SN0_r0SiM = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust]; - my_rates->SN0_r0FeM = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust]; - my_rates->SN0_r0Mg2SiO4 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust]; - my_rates->SN0_r0MgSiO3 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust]; - my_rates->SN0_r0Fe3O4 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust]; - my_rates->SN0_r0AC = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust]; - my_rates->SN0_r0SiO2D = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust]; - my_rates->SN0_r0MgO = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust]; - my_rates->SN0_r0FeS = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust]; - my_rates->SN0_r0Al2O3 = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust]; - my_rates->SN0_r0reforg = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust]; - my_rates->SN0_r0volorg = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust]; - my_rates->SN0_r0H2Oice = inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust]; - // write out the opacity related quantities // todo: consider renaming Nmom -> Ncoef @@ -355,20 +341,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; } - my_rates->SN0_kpSiM = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust]; - my_rates->SN0_kpFeM = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust]; - my_rates->SN0_kpMg2SiO4 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust]; - my_rates->SN0_kpMgSiO3 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust]; - my_rates->SN0_kpFe3O4 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust]; - my_rates->SN0_kpAC = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust]; - my_rates->SN0_kpSiO2D = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust]; - my_rates->SN0_kpMgO = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust]; - my_rates->SN0_kpFeS = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust]; - my_rates->SN0_kpAl2O3 = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust]; - my_rates->SN0_kpreforg = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust]; - my_rates->SN0_kpvolorg = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust]; - my_rates->SN0_kpH2Oice = inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust]; - // zero-out all metal injection yield fractions and dust grain properties override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); @@ -404,36 +376,8 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, my_rates->SN0_fS = nullptr; my_rates->SN0_fFe = nullptr; - my_rates->SN0_r0SiM = nullptr; - my_rates->SN0_r0FeM = nullptr; - my_rates->SN0_r0Mg2SiO4 = nullptr; - my_rates->SN0_r0MgSiO3 = nullptr; - my_rates->SN0_r0Fe3O4 = nullptr; - my_rates->SN0_r0AC = nullptr; - my_rates->SN0_r0SiO2D = nullptr; - my_rates->SN0_r0MgO = nullptr; - my_rates->SN0_r0FeS = nullptr; - my_rates->SN0_r0Al2O3 = nullptr; - my_rates->SN0_r0reforg = nullptr; - my_rates->SN0_r0volorg = nullptr; - my_rates->SN0_r0H2Oice = nullptr; - GRACKLE_FREE(my_rates->gr_Td); - my_rates->SN0_kpSiM = nullptr; - my_rates->SN0_kpFeM = nullptr; - my_rates->SN0_kpMg2SiO4 = nullptr; - my_rates->SN0_kpMgSiO3 = nullptr; - my_rates->SN0_kpFe3O4 = nullptr; - my_rates->SN0_kpAC = nullptr; - my_rates->SN0_kpSiO2D = nullptr; - my_rates->SN0_kpMgO = nullptr; - my_rates->SN0_kpFeS = nullptr; - my_rates->SN0_kpAl2O3 = nullptr; - my_rates->SN0_kpreforg = nullptr; - my_rates->SN0_kpvolorg = nullptr; - my_rates->SN0_kpH2Oice = nullptr; - return SUCCESS; } diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index f18cfe928..91d989186 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -610,12 +610,6 @@ typedef struct double gr_dT, *gr_Td; int SN0_N; double *SN0_fC , *SN0_fO , *SN0_fMg, *SN0_fAl, *SN0_fSi, *SN0_fS , *SN0_fFe; - double *SN0_r0SiM, *SN0_r0FeM, *SN0_r0Mg2SiO4, *SN0_r0MgSiO3, *SN0_r0Fe3O4 - , *SN0_r0AC, *SN0_r0SiO2D, *SN0_r0MgO, *SN0_r0FeS, *SN0_r0Al2O3 - , *SN0_r0reforg , *SN0_r0volorg , *SN0_r0H2Oice; - double *SN0_kpSiM, *SN0_kpFeM, *SN0_kpMg2SiO4, *SN0_kpMgSiO3, *SN0_kpFe3O4 - , *SN0_kpAC, *SN0_kpSiO2D, *SN0_kpMgO, *SN0_kpFeS, *SN0_kpAl2O3 - , *SN0_kpreforg , *SN0_kpvolorg , *SN0_kpH2Oice; /* UV background data */ UVBtable UVbackground_table; From 762e53c5c41423e7548697e011af3ad233e2bf93 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 17:41:30 -0500 Subject: [PATCH 045/111] remove SN0_f --- src/clib/initialize_chemistry_data.cpp | 7 ------- src/clib/initialize_dust_yields.cpp | 21 --------------------- src/include/grackle_chemistry_data.h | 1 - 3 files changed, 29 deletions(-) diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index e42e07896..3b956779f 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -154,13 +154,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag my_rates->gr_dT = 0.; my_rates->gr_Td = NULL; my_rates->SN0_N = 0; - my_rates->SN0_fC = nullptr; - my_rates->SN0_fO = nullptr; - my_rates->SN0_fMg = nullptr; - my_rates->SN0_fAl = nullptr; - my_rates->SN0_fSi = nullptr; - my_rates->SN0_fS = nullptr; - my_rates->SN0_fFe = nullptr; my_rates->cloudy_data_new = -1; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 3594d098b..74d67a75b 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -296,17 +296,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int NSN = n_pathways; // todo: delete me! my_rates->SN0_N = n_pathways; - // crude hack (holding onto this momentarily) - my_rates->SN0_fC = inject_pathway_props->gas_metal_nuclide_yields.C; - my_rates->SN0_fO = inject_pathway_props->gas_metal_nuclide_yields.O; - my_rates->SN0_fMg = inject_pathway_props->gas_metal_nuclide_yields.Mg; - my_rates->SN0_fAl = inject_pathway_props->gas_metal_nuclide_yields.Al; - my_rates->SN0_fSi = inject_pathway_props->gas_metal_nuclide_yields.Si; - my_rates->SN0_fS = inject_pathway_props->gas_metal_nuclide_yields.S; - my_rates->SN0_fFe = inject_pathway_props->gas_metal_nuclide_yields.Fe; - - // write out the opacity related quantities - // todo: consider renaming Nmom -> Ncoef int Nmom = n_opac_poly_coef; // todo: remove me! // todo: more this into GrainMetalInjectPathways @@ -366,16 +355,6 @@ int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, if (my_chemistry->metal_chemistry == 0) return SUCCESS; - // reminder: we are holding on to SN0_f as a crude hack (we will - // delete them later) - my_rates->SN0_fC = nullptr; - my_rates->SN0_fO = nullptr; - my_rates->SN0_fMg = nullptr; - my_rates->SN0_fAl = nullptr; - my_rates->SN0_fSi = nullptr; - my_rates->SN0_fS = nullptr; - my_rates->SN0_fFe = nullptr; - GRACKLE_FREE(my_rates->gr_Td); return SUCCESS; diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index 91d989186..24839baed 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -609,7 +609,6 @@ typedef struct int *gr_N, gr_Size; double gr_dT, *gr_Td; int SN0_N; - double *SN0_fC , *SN0_fO , *SN0_fMg, *SN0_fAl, *SN0_fSi, *SN0_fS , *SN0_fFe; /* UV background data */ UVBtable UVbackground_table; From 57caed782deea8c7fb02f18451fabf94d451dc20 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 17:50:56 -0500 Subject: [PATCH 046/111] remove gr_dT --- src/clib/fortran_func_wrappers.hpp | 7 +++++-- src/clib/initialize_chemistry_data.cpp | 1 - src/clib/initialize_dust_yields.cpp | 8 ++++---- src/include/grackle_chemistry_data.h | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index c92c24fec..469445a56 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -56,7 +56,8 @@ inline void calc_all_tdust_gasgr_1d_g( &trad, my_rates->gas_grain, logTlininterp_buf.indixe, logTlininterp_buf.tdef, tgas, tdust, metallicity, dust2gas, nh, gasgr_tdust, itmask_metal, - &my_chemistry->dust_species, &my_chemistry->use_multiple_dust_temperatures, my_rates->gr_N, &my_rates->gr_Size, &my_rates->gr_dT, + &my_chemistry->dust_species, &my_chemistry->use_multiple_dust_temperatures, my_rates->gr_N, &my_rates->gr_Size, + &my_rates->opaque_storage->inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], my_rates->gr_Td, grain_temperatures.data[OnlyGrainSpLUT::SiM_dust], grain_temperatures.data[OnlyGrainSpLUT::FeM_dust], grain_temperatures.data[OnlyGrainSpLUT::Mg2SiO4_dust], grain_temperatures.data[OnlyGrainSpLUT::MgSiO3_dust], grain_temperatures.data[OnlyGrainSpLUT::Fe3O4_dust], grain_temperatures.data[OnlyGrainSpLUT::AC_dust], grain_temperatures.data[OnlyGrainSpLUT::SiO2_dust], grain_temperatures.data[OnlyGrainSpLUT::MgO_dust], grain_temperatures.data[OnlyGrainSpLUT::FeS_dust], grain_temperatures.data[OnlyGrainSpLUT::Al2O3_dust], grain_temperatures.data[OnlyGrainSpLUT::ref_org_dust], grain_temperatures.data[OnlyGrainSpLUT::vol_org_dust], grain_temperatures.data[OnlyGrainSpLUT::H2O_ice_dust], my_rates->gas_grain2, &my_rates->gamma_isrf2, @@ -135,7 +136,9 @@ inline void calc_grain_size_increment_1d ( my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], - my_rates->gr_N, &my_rates->gr_Size, &my_rates->gr_dT, my_rates->gr_Td, + my_rates->gr_N, &my_rates->gr_Size, + &my_rates->opaque_storage->inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], + my_rates->gr_Td, my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 3b956779f..5e484581d 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -151,7 +151,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag my_rates->gr_N = NULL; my_rates->gr_Size = 0; - my_rates->gr_dT = 0.; my_rates->gr_Td = NULL; my_rates->SN0_N = 0; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 74d67a75b..f5f35c61d 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -321,14 +321,14 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, double dTd = 0.1000000; // todo: remove me! // todo: rename gr_Td, dTd since they are related to log10(Tdust) or ln(Tdust) + inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0] = dTd; my_rates->gr_Td = (double*)malloc(NTd * Nmom * sizeof(double)); my_rates->gr_Size = NTd * Nmom; my_rates->gr_N[0] = Nmom; my_rates->gr_N[1] = NTd; - my_rates->gr_dT = dTd; - for(int iTd = 0; iTd < NTd; iTd++) { - my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; - } + for(int iTd = 0; iTd < NTd; iTd++) { + my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; + } // zero-out all metal injection yield fractions and dust grain properties diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index 24839baed..9cc3dc1e5 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -607,7 +607,7 @@ typedef struct /* metal/dust abundance */ int *gr_N, gr_Size; - double gr_dT, *gr_Td; + double *gr_Td; int SN0_N; /* UV background data */ From d0a37483c57bb42dc809ef7ada9218fea1daae6e Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 19:06:16 -0500 Subject: [PATCH 047/111] Some steps towards removing gr_N and gr_Size It turns out that `gr_N[1]` is accessed in a lot of places! --- src/clib/fortran_func_wrappers.hpp | 41 +++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index 469445a56..95ca7d0df 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -50,14 +50,36 @@ inline void calc_all_tdust_gasgr_1d_g( grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) { + // after transcription, we should obviously move this logic inside of + // the transcribed function + grackle::impl::GrainMetalInjectPathways* inject_pathway_props = + my_rates->opaque_storage->inject_pathway_props; + + double dlog10Tdust = 0.0; + + // NOTE: gr_N and gr_Size are historical names + // -> they are pretty uninformative and should be changed! + int gr_N[2] = {0, 0}; + int gr_Size = 0; + if (inject_pathway_props != nullptr) { + dlog10Tdust = + inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0]; + + gr_N[0] = inject_pathway_props->n_opac_poly_coef; + gr_N[1] = static_cast( + inject_pathway_props->log10Tdust_interp_props.dimension[0]); + }; + gr_Size = gr_N[0] * gr_N[1]; + + FORTRAN_NAME(calc_all_tdust_gasgr_1d_g)( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &my_chemistry->NumberOfTemperatureBins, &my_chemistry->use_dust_density_field, &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &my_chemistry->local_dust_to_gas_ratio, &my_rates->gamma_isrf, &trad, my_rates->gas_grain, logTlininterp_buf.indixe, logTlininterp_buf.tdef, tgas, tdust, metallicity, dust2gas, nh, gasgr_tdust, itmask_metal, - &my_chemistry->dust_species, &my_chemistry->use_multiple_dust_temperatures, my_rates->gr_N, &my_rates->gr_Size, - &my_rates->opaque_storage->inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], + &my_chemistry->dust_species, &my_chemistry->use_multiple_dust_temperatures, + gr_N, &gr_Size, &dlog10Tdust, my_rates->gr_Td, grain_temperatures.data[OnlyGrainSpLUT::SiM_dust], grain_temperatures.data[OnlyGrainSpLUT::FeM_dust], grain_temperatures.data[OnlyGrainSpLUT::Mg2SiO4_dust], grain_temperatures.data[OnlyGrainSpLUT::MgSiO3_dust], grain_temperatures.data[OnlyGrainSpLUT::Fe3O4_dust], grain_temperatures.data[OnlyGrainSpLUT::AC_dust], grain_temperatures.data[OnlyGrainSpLUT::SiO2_dust], grain_temperatures.data[OnlyGrainSpLUT::MgO_dust], grain_temperatures.data[OnlyGrainSpLUT::FeS_dust], grain_temperatures.data[OnlyGrainSpLUT::Al2O3_dust], grain_temperatures.data[OnlyGrainSpLUT::ref_org_dust], grain_temperatures.data[OnlyGrainSpLUT::vol_org_dust], grain_temperatures.data[OnlyGrainSpLUT::H2O_ice_dust], my_rates->gas_grain2, &my_rates->gamma_isrf2, @@ -99,6 +121,19 @@ inline void calc_grain_size_increment_1d ( grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) { + // we can be VERY confident that inject_pathway_props is not a nullptr + grackle::impl::GrainMetalInjectPathways* inject_pathway_props = + my_rates->opaque_storage->inject_pathway_props; + + // NOTE: gr_N and gr_Size are historical names + // -> they are pretty uninformative and should be changed! + int gr_N[2] = { + inject_pathway_props->n_opac_poly_coef, + static_cast(inject_pathway_props->log10Tdust_interp_props.dimension[0]) + }; + int gr_Size = gr_N[0] * gr_N[1]; + + FORTRAN_NAME(calc_grain_size_increment_1d)( &my_chemistry->multi_metals, &my_chemistry->metal_abundances, &my_chemistry->dust_species, &my_chemistry->grain_growth, itmask_metal, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, @@ -136,7 +171,7 @@ inline void calc_grain_size_increment_1d ( my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], - my_rates->gr_N, &my_rates->gr_Size, + gr_N, &gr_Size, &my_rates->opaque_storage->inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], my_rates->gr_Td, my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], From 30fee62f43fdcc9d433bf63763cc83950bba01a0 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 19:18:36 -0500 Subject: [PATCH 048/111] finish removing gr_N and gr_Size --- src/clib/calc_tdust_3d.cpp | 6 ++++- src/clib/cool1d_multi_g.cpp | 11 +++++--- src/clib/initialize_chemistry_data.cpp | 4 --- src/clib/initialize_dust_yields.cpp | 25 +++++++------------ src/clib/initialize_rates.cpp | 3 --- .../grain_metal_inject_pathways.hpp | 18 +++++++++++++ src/clib/solve_rate_cool_g-cpp.cpp | 9 +++++-- src/clib/step_rate_newton_raphson.hpp | 8 +++++- src/include/grackle_chemistry_data.h | 1 - 9 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/clib/calc_tdust_3d.cpp b/src/clib/calc_tdust_3d.cpp index 282e89175..82955483b 100644 --- a/src/clib/calc_tdust_3d.cpp +++ b/src/clib/calc_tdust_3d.cpp @@ -21,6 +21,7 @@ #include "fortran_func_wrappers.hpp" #include "grackle.h" #include "index_helper.h" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" #include "scale_fields.hpp" #include "utils-cpp.hpp" @@ -111,7 +112,10 @@ void calc_tdust_3d_g( grackle::impl::InternalDustPropBuf internal_dust_prop_buf = grackle::impl::new_InternalDustPropBuf( - my_fields->grid_dimension[0], my_rates->gr_N[1] + my_fields->grid_dimension[0], + grackle::impl::GrainMetalInjectPathways_get_n_log10Tdust_vals( + my_rates->opaque_storage->inject_pathway_props + ) ); // these next buffer variables hold values that are computed as side-effect diff --git a/src/clib/cool1d_multi_g.cpp b/src/clib/cool1d_multi_g.cpp index 02793cc90..b4295c6be 100644 --- a/src/clib/cool1d_multi_g.cpp +++ b/src/clib/cool1d_multi_g.cpp @@ -22,6 +22,7 @@ #include "fortran_func_decls.h" #include "fortran_func_wrappers.hpp" #include "dust_props.hpp" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" #include "utils-cpp.hpp" @@ -184,8 +185,12 @@ void grackle::impl::cool1d_multi_g( // buffers of intermediate quantities used within dust-routines (for // calculating quantites related to heating/cooling) grackle::impl::InternalDustPropBuf internal_dust_prop_buf = - grackle::impl::new_InternalDustPropBuf(my_fields->grid_dimension[0], - my_rates->gr_N[1]); + grackle::impl::new_InternalDustPropBuf( + my_fields->grid_dimension[0], + GrainMetalInjectPathways_get_n_log10Tdust_vals( + my_rates->opaque_storage->inject_pathway_props + ) + ); // opacity coefficients for each dust grain (the product of opacity // coefficient & gas mass density is the linear absortpion coefficient) grackle::impl::GrainSpeciesCollection grain_kappa = @@ -1969,4 +1974,4 @@ void grackle::impl::cool1d_multi_g( grackle::impl::drop_GrainSpeciesCollection(&gas_grainsp_heatrate); return; -} \ No newline at end of file +} diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 5e484581d..90097ef0a 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -149,8 +149,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag grackle::impl::initialize_empty_interp_grid_(&my_rates->alphap); - my_rates->gr_N = NULL; - my_rates->gr_Size = 0; my_rates->gr_Td = NULL; my_rates->SN0_N = 0; @@ -513,8 +511,6 @@ extern "C" int local_free_chemistry_data(chemistry_data *my_chemistry, grackle::impl::free_interp_grid_(&my_rates->alphap); - GRACKLE_FREE(my_rates->gr_N); - GRACKLE_FREE(my_rates->k13dd); GRACKLE_FREE(my_rates->h2dust); GRACKLE_FREE(my_rates->n_cr_n); diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index f5f35c61d..3672d230a 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -219,16 +219,9 @@ void override_metal_inject_props( /// /// @note /// to start, this only handles the grain yields -void override_dust_inject_props(chemistry_data_storage *my_rates, - double value) { - - GRIMPL_REQUIRE(my_rates != nullptr && my_rates->opaque_storage != nullptr, - "sanity check -- should never ever fail!"); - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; - - GRIMPL_REQUIRE(inject_pathway_props != nullptr, - "sanity check -- should never ever fail!"); +void override_dust_inject_props( + grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + double value) { const int n_grain_species = OnlyGrainSpLUT::NUM_ENTRIES; @@ -254,12 +247,15 @@ void override_dust_inject_props(chemistry_data_storage *my_rates, } // handle the opacity coefficient table - int opac_table_len = n_pathways * my_rates->gr_Size; + long long opac_table_len = ( + static_cast(n_pathways) * + static_cast(inject_pathway_props->n_opac_poly_coef) * + inject_pathway_props->log10Tdust_interp_props.dimension[0]); for (int grain_species_idx = 0; grain_species_idx < n_grain_species; grain_species_idx++){ double* arr = inject_pathway_props->opacity_coef_table.data[grain_species_idx]; - for(int i = 0; i < opac_table_len; i++) { + for(long long i = 0LL; i < opac_table_len; i++) { arr[i] = value; } } @@ -323,9 +319,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // todo: rename gr_Td, dTd since they are related to log10(Tdust) or ln(Tdust) inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0] = dTd; my_rates->gr_Td = (double*)malloc(NTd * Nmom * sizeof(double)); - my_rates->gr_Size = NTd * Nmom; - my_rates->gr_N[0] = Nmom; - my_rates->gr_N[1] = NTd; for(int iTd = 0; iTd < NTd; iTd++) { my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; } @@ -333,7 +326,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // zero-out all metal injection yield fractions and dust grain properties override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); - override_dust_inject_props(my_rates, 0.0); + override_dust_inject_props(inject_pathway_props, 0.0); SetupCallbackCtx ctx = {my_rates, 0}; diff --git a/src/clib/initialize_rates.cpp b/src/clib/initialize_rates.cpp index 18909b011..4a3d6c1c2 100644 --- a/src/clib/initialize_rates.cpp +++ b/src/clib/initialize_rates.cpp @@ -471,9 +471,6 @@ int grackle::impl::initialize_rates( double coolingUnits = (pow(my_units->a_units, 5) * pow(lengthBase1, 2) * pow(mh, 2)) / (densityBase1 * pow(timeBase1, 3)); - // These always need to be allocated since we define other variables by them. - my_rates->gr_N = (int*)calloc(2, sizeof(int)); - if (my_chemistry->use_primordial_continuum_opacity == 1) { initialize_primordial_opacity(my_chemistry, my_rates); } diff --git a/src/clib/inject_model/grain_metal_inject_pathways.hpp b/src/clib/inject_model/grain_metal_inject_pathways.hpp index 27e0da85f..9bd59c8fe 100644 --- a/src/clib/inject_model/grain_metal_inject_pathways.hpp +++ b/src/clib/inject_model/grain_metal_inject_pathways.hpp @@ -296,6 +296,24 @@ inline bool GrainMetalInjectPathways_is_valid(const GrainMetalInjectPathways* pt return ptr->n_pathways != -1; } +/// Queries the specified GrainMetalInjectPathways instance for the number of +/// log10(Tdust) values that are relevant for the opacity coefficient table. +/// +/// This function is intended to be called whenever we construct a new +/// InternalDustPropBuf instance. +/// +/// @param[in] ptr The instance to query. It is ok for this to be a `nullptr`, +/// however the result is undefined if GrainMetalInjectPathways_is_valid +/// would return false. +/// +/// @note +/// Frankly, this is intended to be short-term solution until we have a chance +/// to reduce the number of places where InternalDustPropBuf is constructed +inline int GrainMetalInjectPathways_get_n_log10Tdust_vals + (const GrainMetalInjectPathways* ptr) { + return (ptr == nullptr) ? 0 : ptr->log10Tdust_interp_props.dimension[0]; +} + /// performs cleanup of the contents of GrainMetalInjectPathways /// diff --git a/src/clib/solve_rate_cool_g-cpp.cpp b/src/clib/solve_rate_cool_g-cpp.cpp index c7305d6aa..8936c736b 100644 --- a/src/clib/solve_rate_cool_g-cpp.cpp +++ b/src/clib/solve_rate_cool_g-cpp.cpp @@ -21,6 +21,7 @@ #include "grackle.h" #include "fortran_func_wrappers.hpp" #include "index_helper.h" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" #include "internal_units.h" #include "lookup_cool_rates1d.hpp" @@ -712,8 +713,12 @@ int solve_rate_cool_g( // (we can't do it right now since we need to pass in 2 arguments to the // factory function) grackle::impl::InternalDustPropBuf internal_dust_prop_scratch_buf = - grackle::impl::new_InternalDustPropBuf(my_fields->grid_dimension[0], - my_rates->gr_N[1]); + grackle::impl::new_InternalDustPropBuf( + my_fields->grid_dimension[0], + grackle::impl::GrainMetalInjectPathways_get_n_log10Tdust_vals( + my_rates->opaque_storage->inject_pathway_props + ) + ); // holds buffers exclusively used for solving species rate equations // (i.e. in the future, we could have the constructor skip allocations of diff --git a/src/clib/step_rate_newton_raphson.hpp b/src/clib/step_rate_newton_raphson.hpp index e97d5cc68..1d51dac25 100644 --- a/src/clib/step_rate_newton_raphson.hpp +++ b/src/clib/step_rate_newton_raphson.hpp @@ -15,8 +15,10 @@ #include "fortran_func_decls.h" // gr_mask_int #include "fortran_func_wrappers.hpp" // grackle::impl::fortran_wrapper::gaussj_g #include "index_helper.h" +#include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" #include "internal_units.h" +#include "opaque_storage.hpp" #include "utils-cpp.hpp" #include "utils-field.hpp" @@ -212,7 +214,11 @@ inline void step_rate_newton_raphson( // forward the buffers passed into this routine as arguments rather than // allocating separate buffers t_deriv::MainScratchBuf main_scratch_buf = - t_deriv::new_MainScratchBuf(my_rates->gr_N[1]); + t_deriv::new_MainScratchBuf( + grackle::impl::GrainMetalInjectPathways_get_n_log10Tdust_vals( + my_rates->opaque_storage->inject_pathway_props + ) + ); // collect args that are forwarded to the time-derivative calculation and are // effectively frozen between various calls diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index 9cc3dc1e5..c3bec8011 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -606,7 +606,6 @@ typedef struct gr_interp_grid alphap; /* metal/dust abundance */ - int *gr_N, gr_Size; double *gr_Td; int SN0_N; From b9f7893a03dc21f3646104defe384687318cacdc Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 19:53:46 -0500 Subject: [PATCH 049/111] remove SN0_N --- src/clib/fortran_func_wrappers.hpp | 2 +- src/clib/initialize_chemistry_data.cpp | 1 - src/clib/initialize_dust_yields.cpp | 21 --------------------- src/clib/make_consistent.cpp | 22 +++++++++++++--------- src/include/grackle_chemistry_data.h | 1 - 5 files changed, 14 insertions(+), 33 deletions(-) diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index 95ca7d0df..c1c6a1e94 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -144,7 +144,7 @@ inline void calc_grain_size_increment_1d ( my_fields->ccsn13_metal_density, my_fields->ccsn20_metal_density, my_fields->ccsn25_metal_density, my_fields->ccsn30_metal_density, my_fields->fsn13_metal_density, my_fields->fsn15_metal_density, my_fields->fsn50_metal_density, my_fields->fsn80_metal_density, my_fields->pisn170_metal_density, my_fields->pisn200_metal_density, my_fields->y19_metal_density, - &my_rates->SN0_N, + &inject_pathway_props->n_pathways, my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust], my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust], my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 90097ef0a..46cf4020d 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -150,7 +150,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag grackle::impl::initialize_empty_interp_grid_(&my_rates->alphap); my_rates->gr_Td = NULL; - my_rates->SN0_N = 0; my_rates->cloudy_data_new = -1; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 3672d230a..ef85692d7 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -289,29 +289,8 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, } - int NSN = n_pathways; // todo: delete me! - my_rates->SN0_N = n_pathways; - // todo: consider renaming Nmom -> Ncoef int Nmom = n_opac_poly_coef; // todo: remove me! - // todo: more this into GrainMetalInjectPathways - // - essentially, each SN0_kpGRSP array is a 3D array of shape - // (n_pathways, NTd, Nmom). This shape uses numpy conventions (i.e. Nmom is - // the fast-axis). - // - In more detail: - // - n_pathways is the number of injection pathways - // - NTd corresponds to the number of dust temperatures we consider - // - Nmom corresponds to the number of coefficients that we track for - // computing an opacity related quantity. This quantity is given by - // 4πζ/3 * ( SN0_kpGRSP[path_j, iTd, 3] + - // SN0_kpGRSP[path_j, iTd, 2] * δr(t) + - // SN0_kpGRSP[path_j, iTd, 1] * δr²(t) + - // SN0_kpGRSP[path_j, iTd, 0] * δr³(t)) - // where - // - ζ is the mass density of a single grain (in g/cm³) - // - δr(t) refers to the derived "size increment" (it is a central - // quantity in the model) - // - I **think** the resulting quantity is the optical cross-section double NTd = n_log10Tdust_vals; double Td0 = 0.0000000; // todo: remove me! double dTd = 0.1000000; // todo: remove me! diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index 980e9d37d..b5f5eed89 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -242,11 +242,19 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, correctFe; gr_float correctCg, correctOg, correctMgg, correctSig, correctFeg; gr_float correctCd, correctOd, correctMgd, correctSid, correctFed; - int iSN, nSN, iSN0; + int iSN, iSN0; + + const grackle::impl::GrainMetalInjectPathways* inject_pathway_props = + my_rates->opaque_storage->inject_pathway_props; + const int n_pathways = (inject_pathway_props == nullptr) ? 0 : + inject_pathway_props->n_pathways; std::vector SN_metal_data_(my_fields->grid_dimension[0] * - my_rates->SN0_N); - grackle::impl::View SN_metal( - SN_metal_data_.data(), my_fields->grid_dimension[0], my_rates->SN0_N); + n_pathways); + grackle::impl::View SN_metal; + if (n_pathways > 0) { + SN_metal = grackle::impl::View( + SN_metal_data_.data(), my_fields->grid_dimension[0], n_pathways); + } std::vector Ct(my_fields->grid_dimension[0]); std::vector Ot(my_fields->grid_dimension[0]); std::vector Mgt(my_fields->grid_dimension[0]); @@ -269,9 +277,6 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, std::vector Sd(my_fields->grid_dimension[0]); std::vector Fed(my_fields->grid_dimension[0]); - const grackle::impl::GrainMetalInjectPathways* inject_pathway_props = - my_rates->opaque_storage->inject_pathway_props; - // Loop over all zones for (k = my_fields->grid_start[2]; k <= my_fields->grid_end[2]; k++) { @@ -393,7 +398,6 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, // metal_Y19(i,j,k) = metal_Y19(i,j,k) * correctZ // enddo - nSN = 12; for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { SN_metal(i, 0) = metal_loc(i, j, k); SN_metal(i, 1) = metal_C13(i, j, k); @@ -424,7 +428,7 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, Sg[i] = 0.; Fet[i] = 0.; Feg[i] = 0.; - for (iSN = 0; iSN < nSN; iSN++) { + for (iSN = 0; iSN < n_pathways; iSN++) { Ct[i] = Ct[i] + total_metal_yields.C[iSN] * SN_metal(i, iSN); Ot[i] = Ot[i] + total_metal_yields.O[iSN] * SN_metal(i, iSN); Mgt[i] = Mgt[i] + total_metal_yields.Mg[iSN] * SN_metal(i, iSN); diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index c3bec8011..c7b059b5f 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -607,7 +607,6 @@ typedef struct /* metal/dust abundance */ double *gr_Td; - int SN0_N; /* UV background data */ UVBtable UVbackground_table; From 8dccc0e7d27cb817a754f9bb3b0c01a0d1fd67a1 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 20:11:05 -0500 Subject: [PATCH 050/111] remove gr_Td --- src/clib/fortran_func_wrappers.hpp | 9 ++++++--- src/clib/initialize_chemistry_data.cpp | 2 -- src/clib/initialize_dust_yields.cpp | 27 +++++++++----------------- src/include/grackle_chemistry_data.h | 3 --- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index c1c6a1e94..e02cc9eed 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -56,6 +56,7 @@ inline void calc_all_tdust_gasgr_1d_g( my_rates->opaque_storage->inject_pathway_props; double dlog10Tdust = 0.0; + double* log10Tdust_vals = nullptr; // NOTE: gr_N and gr_Size are historical names // -> they are pretty uninformative and should be changed! @@ -64,6 +65,8 @@ inline void calc_all_tdust_gasgr_1d_g( if (inject_pathway_props != nullptr) { dlog10Tdust = inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0]; + log10Tdust_vals = + inject_pathway_props->log10Tdust_interp_props.parameters[0]; gr_N[0] = inject_pathway_props->n_opac_poly_coef; gr_N[1] = static_cast( @@ -79,8 +82,8 @@ inline void calc_all_tdust_gasgr_1d_g( metallicity, dust2gas, nh, gasgr_tdust, itmask_metal, &my_chemistry->dust_species, &my_chemistry->use_multiple_dust_temperatures, - gr_N, &gr_Size, &dlog10Tdust, - my_rates->gr_Td, grain_temperatures.data[OnlyGrainSpLUT::SiM_dust], grain_temperatures.data[OnlyGrainSpLUT::FeM_dust], grain_temperatures.data[OnlyGrainSpLUT::Mg2SiO4_dust], grain_temperatures.data[OnlyGrainSpLUT::MgSiO3_dust], grain_temperatures.data[OnlyGrainSpLUT::Fe3O4_dust], + gr_N, &gr_Size, &dlog10Tdust, log10Tdust_vals, + grain_temperatures.data[OnlyGrainSpLUT::SiM_dust], grain_temperatures.data[OnlyGrainSpLUT::FeM_dust], grain_temperatures.data[OnlyGrainSpLUT::Mg2SiO4_dust], grain_temperatures.data[OnlyGrainSpLUT::MgSiO3_dust], grain_temperatures.data[OnlyGrainSpLUT::Fe3O4_dust], grain_temperatures.data[OnlyGrainSpLUT::AC_dust], grain_temperatures.data[OnlyGrainSpLUT::SiO2_dust], grain_temperatures.data[OnlyGrainSpLUT::MgO_dust], grain_temperatures.data[OnlyGrainSpLUT::FeS_dust], grain_temperatures.data[OnlyGrainSpLUT::Al2O3_dust], grain_temperatures.data[OnlyGrainSpLUT::ref_org_dust], grain_temperatures.data[OnlyGrainSpLUT::vol_org_dust], grain_temperatures.data[OnlyGrainSpLUT::H2O_ice_dust], my_rates->gas_grain2, &my_rates->gamma_isrf2, &coolunit, gasgr, myisrf, internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], @@ -173,7 +176,7 @@ inline void calc_grain_size_increment_1d ( my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N, &gr_Size, &my_rates->opaque_storage->inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], - my_rates->gr_Td, + inject_pathway_props->log10Tdust_interp_props.parameters[0], my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index 46cf4020d..f3c266c7d 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -149,8 +149,6 @@ static void initialize_empty_chemistry_data_storage_struct(chemistry_data_storag grackle::impl::initialize_empty_interp_grid_(&my_rates->alphap); - my_rates->gr_Td = NULL; - my_rates->cloudy_data_new = -1; my_rates->opaque_storage = NULL; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index ef85692d7..4f1acdaa1 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -288,18 +288,15 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, return GR_FAIL; } - - // todo: consider renaming Nmom -> Ncoef - int Nmom = n_opac_poly_coef; // todo: remove me! - double NTd = n_log10Tdust_vals; - double Td0 = 0.0000000; // todo: remove me! - double dTd = 0.1000000; // todo: remove me! - - // todo: rename gr_Td, dTd since they are related to log10(Tdust) or ln(Tdust) - inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0] = dTd; - my_rates->gr_Td = (double*)malloc(NTd * Nmom * sizeof(double)); - for(int iTd = 0; iTd < NTd; iTd++) { - my_rates->gr_Td[iTd] = Td0 + (double)iTd * dTd; + double log10Tdust_lo = 0.0; + double log10Tdust_step = 0.1; + + inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0] + = log10Tdust_step; + double* log10Tdust_vals = + inject_pathway_props->log10Tdust_interp_props.parameters[0]; + for(int iTd = 0; iTd < n_log10Tdust_vals; iTd++) { + log10Tdust_vals[iTd] = log10Tdust_lo + (double)iTd * log10Tdust_step; } @@ -323,12 +320,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, chemistry_data_storage *my_rates) { - - if (my_chemistry->metal_chemistry == 0) - return SUCCESS; - - GRACKLE_FREE(my_rates->gr_Td); - return SUCCESS; } diff --git a/src/include/grackle_chemistry_data.h b/src/include/grackle_chemistry_data.h index c7b059b5f..0881952b3 100644 --- a/src/include/grackle_chemistry_data.h +++ b/src/include/grackle_chemistry_data.h @@ -605,9 +605,6 @@ typedef struct * -> alphap.parameters[1] is log10(temperature) */ gr_interp_grid alphap; - /* metal/dust abundance */ - double *gr_Td; - /* UV background data */ UVBtable UVbackground_table; From 24748cbd83b9a67e940c5404e0509c3822d8094b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 20:37:20 -0500 Subject: [PATCH 051/111] tweak signature of f_wrap::calc_grain_size_increment_1d --- src/clib/calc_tdust_3d.cpp | 3 +- src/clib/cool1d_multi_g.cpp | 3 +- src/clib/fortran_func_wrappers.hpp | 90 +++++++++++++++--------------- src/clib/lookup_cool_rates1d.hpp | 4 +- 4 files changed, 51 insertions(+), 49 deletions(-) diff --git a/src/clib/calc_tdust_3d.cpp b/src/clib/calc_tdust_3d.cpp index 82955483b..27dbc6e54 100644 --- a/src/clib/calc_tdust_3d.cpp +++ b/src/clib/calc_tdust_3d.cpp @@ -165,7 +165,8 @@ void calc_tdust_3d_g( if ( (my_chemistry->use_dust_density_field > 0) && (my_chemistry->dust_species > 0) ) { f_wrap::calc_grain_size_increment_1d ( - dom, idx_range, itmask_metal.data(), my_chemistry, my_rates, + dom, idx_range, itmask_metal.data(), my_chemistry, + my_rates->opaque_storage->inject_pathway_props, my_fields, internal_dust_prop_buf ); diff --git a/src/clib/cool1d_multi_g.cpp b/src/clib/cool1d_multi_g.cpp index b4295c6be..5bf09eb77 100644 --- a/src/clib/cool1d_multi_g.cpp +++ b/src/clib/cool1d_multi_g.cpp @@ -1107,7 +1107,8 @@ void grackle::impl::cool1d_multi_g( if ((my_chemistry->use_dust_density_field > 0) && (my_chemistry->dust_species > 0)) { grackle::impl::fortran_wrapper::calc_grain_size_increment_1d( - dom, idx_range, itmask_metal, my_chemistry, my_rates, my_fields, + dom, idx_range, itmask_metal, my_chemistry, + my_rates->opaque_storage->inject_pathway_props, my_fields, internal_dust_prop_buf); } diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index e02cc9eed..bf84c665d 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -113,21 +113,19 @@ inline void calc_all_tdust_gasgr_1d_g( /// @param[in] idx_range Specifies the current index-range /// @param[in] itmask_metal Specifies the `idx_range`'s iteration-mask /// @param[in] my_chemistry holds a number of configuration parameters -/// @param[in] my_rates holds assorted rate data. +/// @param[in] inject_pathway_props holds data about the modelled injection +/// pathways for all of the grain species. /// @param[in] my_fields specifies the field data /// @param[in,out] internal_dust_prop_buf Holds dust-specific information that /// gets updated by this function inline void calc_grain_size_increment_1d ( double dom, IndexRange idx_range, const gr_mask_type* itmask_metal, - chemistry_data* my_chemistry, chemistry_data_storage* my_rates, + chemistry_data* my_chemistry, + grackle::impl::GrainMetalInjectPathways* inject_pathway_props, grackle_field_data* my_fields, grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) { - // we can be VERY confident that inject_pathway_props is not a nullptr - grackle::impl::GrainMetalInjectPathways* inject_pathway_props = - my_rates->opaque_storage->inject_pathway_props; - // NOTE: gr_N and gr_Size are historical names // -> they are pretty uninformative and should be changed! int gr_N[2] = { @@ -148,48 +146,48 @@ inline void calc_grain_size_increment_1d ( my_fields->fsn13_metal_density, my_fields->fsn15_metal_density, my_fields->fsn50_metal_density, my_fields->fsn80_metal_density, my_fields->pisn170_metal_density, my_fields->pisn200_metal_density, my_fields->y19_metal_density, &inject_pathway_props->n_pathways, - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust], - my_rates->opaque_storage->inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], - my_rates->opaque_storage->inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust], + inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], + inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N, &gr_Size, - &my_rates->opaque_storage->inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], + &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], - my_rates->opaque_storage->inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], + inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.sigma_per_gas_mass_tot, diff --git a/src/clib/lookup_cool_rates1d.hpp b/src/clib/lookup_cool_rates1d.hpp index 299f8e1f9..b3387e3a1 100644 --- a/src/clib/lookup_cool_rates1d.hpp +++ b/src/clib/lookup_cool_rates1d.hpp @@ -810,7 +810,9 @@ inline void lookup_cool_rates1d( if ((anydust != MASK_FALSE) && (my_chemistry->dust_species > 0)) { f_wrap::calc_grain_size_increment_1d(dom, idx_range, itmask_metal, - my_chemistry, my_rates, my_fields, + my_chemistry, + my_rates->opaque_storage->inject_pathway_props, + my_fields, internal_dust_prop_scratch_buf); } From 3825dc776e8d9b1f7183810416aff01d37d3535c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 20:48:59 -0500 Subject: [PATCH 052/111] tweak signature of make_consistent --- src/clib/make_consistent.cpp | 4 +--- src/clib/make_consistent.hpp | 15 ++++++++++++--- src/clib/solve_rate_cool_g-cpp.cpp | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index b5f5eed89..2734ed35a 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -27,7 +27,7 @@ namespace grackle::impl { void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, - chemistry_data_storage* my_rates, + const grackle::impl::GrainMetalInjectPathways* inject_pathway_props, grackle_field_data* my_fields) { // Arguments @@ -244,8 +244,6 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, gr_float correctCd, correctOd, correctMgd, correctSid, correctFed; int iSN, iSN0; - const grackle::impl::GrainMetalInjectPathways* inject_pathway_props = - my_rates->opaque_storage->inject_pathway_props; const int n_pathways = (inject_pathway_props == nullptr) ? 0 : inject_pathway_props->n_pathways; std::vector SN_metal_data_(my_fields->grid_dimension[0] * diff --git a/src/clib/make_consistent.hpp b/src/clib/make_consistent.hpp index 3d0c6bd60..2edb6c91f 100644 --- a/src/clib/make_consistent.hpp +++ b/src/clib/make_consistent.hpp @@ -16,13 +16,22 @@ #ifndef MAKE_CONSISTENT_HPP #define MAKE_CONSISTENT_HPP -#include "grackle.h" // gr_float -#include "fortran_func_decls.h" // gr_mask_int +#include "grackle.h" +#include "inject_model/grain_metal_inject_pathways.hpp" namespace grackle::impl { +/// Enforces consistency of species fields with expected total abundances +/// +/// @param[in] imetal specifies whether or not the caller provided a metal +/// field (0 = no, 1 = yes) +/// @param[in] dom +/// @param[in] my_chemistry holds a number of configuration parameters +/// @param[in] inject_pathway_props holds data about the modelled injection +/// pathways for all metals and grain species +/// @param[in] my_fields specifies the field data void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, - chemistry_data_storage* my_rates, + const grackle::impl::GrainMetalInjectPathways* inject_pathway_props, grackle_field_data* my_fields); } // namespace grackle::impl diff --git a/src/clib/solve_rate_cool_g-cpp.cpp b/src/clib/solve_rate_cool_g-cpp.cpp index 8936c736b..b6a6101eb 100644 --- a/src/clib/solve_rate_cool_g-cpp.cpp +++ b/src/clib/solve_rate_cool_g-cpp.cpp @@ -1014,7 +1014,9 @@ int solve_rate_cool_g( // Correct the species to ensure consistency (i.e. type conservation) - grackle::impl::make_consistent(imetal, dom, my_chemistry, my_rates, my_fields); + grackle::impl::make_consistent( + imetal, dom, my_chemistry, + my_rates->opaque_storage->inject_pathway_props, my_fields); } From bb6cec672b58174d1db26251f0d585e03ab9c636 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 20:53:05 -0500 Subject: [PATCH 053/111] delete grackle::impl::free_dust_yields --- src/clib/initialize_chemistry_data.cpp | 6 ------ src/clib/initialize_dust_yields.cpp | 7 ------- src/clib/initialize_dust_yields.hpp | 3 --- 3 files changed, 16 deletions(-) diff --git a/src/clib/initialize_chemistry_data.cpp b/src/clib/initialize_chemistry_data.cpp index f3c266c7d..f0ab4f7a9 100644 --- a/src/clib/initialize_chemistry_data.cpp +++ b/src/clib/initialize_chemistry_data.cpp @@ -23,7 +23,6 @@ #include "interp_table_utils.hpp" #include "init_misc_species_cool_rates.hpp" // free_misc_species_cool_rates #include "initialize_cloudy_data.h" -#include "initialize_dust_yields.hpp" // free_dust_yields #include "initialize_rates.hpp" #include "initialize_UVbackground_data.h" #include "internal_types.hpp" // drop_CollisionalRxnRateCollection @@ -549,11 +548,6 @@ extern "C" int local_free_chemistry_data(chemistry_data *my_chemistry, return GR_FAIL; } - if (grackle::impl::free_dust_yields(my_chemistry, my_rates) == FAIL) { - fprintf(stderr, "Error in local_free_dust_yields.\n"); - return FAIL; - } - // start freeing memory associated with opaque storage // --------------------------------------------------- if (my_rates->opaque_storage->kcol_rate_tables != nullptr) { diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 4f1acdaa1..e5e73fa42 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -316,10 +316,3 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, return GR_SUCCESS; } - -int grackle::impl::free_dust_yields(chemistry_data *my_chemistry, - chemistry_data_storage *my_rates) -{ - return SUCCESS; -} - diff --git a/src/clib/initialize_dust_yields.hpp b/src/clib/initialize_dust_yields.hpp index 2c66f63fe..c8f53609e 100644 --- a/src/clib/initialize_dust_yields.hpp +++ b/src/clib/initialize_dust_yields.hpp @@ -21,9 +21,6 @@ int initialize_dust_yields(chemistry_data* my_chemistry, chemistry_data_storage* my_rates, code_units* my_units); -int free_dust_yields(chemistry_data* my_chemistry, - chemistry_data_storage* my_rates); - } // namespace grackle::impl #endif /* INITIALIZE_DUST_YIELDS_HPP */ From 9e9bcfd9bb40569a8850ac704ae708e0ffb4dab2 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 21:03:42 -0500 Subject: [PATCH 054/111] slightly simplify zero-out logic --- src/clib/initialize_dust_yields.cpp | 42 +++++-------------- .../grain_metal_inject_pathways.hpp | 13 ++++++ 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index e5e73fa42..b831f91c2 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -191,37 +191,12 @@ extern "C" int setup_yield_table_callback( return GR_SUCCESS; } -/// a helper function override the values of all metal injection properties -void override_metal_inject_props( - grackle::impl::GrainMetalInjectPathways* inject_pathway_props, - double value, int n_pathways) -{ - for(int iSN = 0; iSN < n_pathways; iSN++) { - inject_pathway_props->total_metal_nuclide_yields.C [iSN] = value; - inject_pathway_props->total_metal_nuclide_yields.O [iSN] = value; - inject_pathway_props->total_metal_nuclide_yields.Mg[iSN] = value; - inject_pathway_props->total_metal_nuclide_yields.Al[iSN] = value; - inject_pathway_props->total_metal_nuclide_yields.Si[iSN] = value; - inject_pathway_props->total_metal_nuclide_yields.S [iSN] = value; - inject_pathway_props->total_metal_nuclide_yields.Fe[iSN] = value; - - inject_pathway_props->gas_metal_nuclide_yields.C [iSN] = value; - inject_pathway_props->gas_metal_nuclide_yields.O [iSN] = value; - inject_pathway_props->gas_metal_nuclide_yields.Mg[iSN] = value; - inject_pathway_props->gas_metal_nuclide_yields.Al[iSN] = value; - inject_pathway_props->gas_metal_nuclide_yields.Si[iSN] = value; - inject_pathway_props->gas_metal_nuclide_yields.S [iSN] = value; - inject_pathway_props->gas_metal_nuclide_yields.Fe[iSN] = value; - } -} - /// a helper function to override the values of all dust inject properties /// /// @note /// to start, this only handles the grain yields -void override_dust_inject_props( - grackle::impl::GrainMetalInjectPathways* inject_pathway_props, - double value) { +void zero_out_dust_inject_props( + grackle::impl::GrainMetalInjectPathways* inject_pathway_props) { const int n_grain_species = OnlyGrainSpLUT::NUM_ENTRIES; @@ -232,7 +207,7 @@ void override_dust_inject_props( grain_species_idx++){ double* arr = inject_pathway_props->grain_yields.data[grain_species_idx]; for(int iSN = 0; iSN < n_pathways; iSN++) { - arr[iSN] = value; + arr[iSN] = 0.0; } } @@ -242,7 +217,7 @@ void override_dust_inject_props( grain_species_idx++){ double* arr = inject_pathway_props->size_moments.data[grain_species_idx]; for(int i = 0; i < moment_table_len; i++) { - arr[i] = value; + arr[i] = 0.0; } } @@ -256,7 +231,7 @@ void override_dust_inject_props( double* arr = inject_pathway_props->opacity_coef_table.data[grain_species_idx]; for(long long i = 0LL; i < opac_table_len; i++) { - arr[i] = value; + arr[i] = 0.0; } } } @@ -301,8 +276,11 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, // zero-out all metal injection yield fractions and dust grain properties - override_metal_inject_props(inject_pathway_props, 0.0, n_pathways); - override_dust_inject_props(inject_pathway_props, 0.0); + yields::MetalTables_zero_out( + &inject_pathway_props->total_metal_nuclide_yields, n_pathways); + yields::MetalTables_zero_out( + &inject_pathway_props->gas_metal_nuclide_yields, n_pathways); + zero_out_dust_inject_props(inject_pathway_props); SetupCallbackCtx ctx = {my_rates, 0}; diff --git a/src/clib/inject_model/grain_metal_inject_pathways.hpp b/src/clib/inject_model/grain_metal_inject_pathways.hpp index 9bd59c8fe..2da3da2ec 100644 --- a/src/clib/inject_model/grain_metal_inject_pathways.hpp +++ b/src/clib/inject_model/grain_metal_inject_pathways.hpp @@ -73,6 +73,19 @@ inline void drop_MetalTables(MetalTables* ptr) { delete[] ptr->Fe; } +/// fills elements with zeros +inline void MetalTables_zero_out(MetalTables* ptr, int nelem) { + for (int i = 0; i < nelem; i++) { + ptr->C [i] = 0.0; + ptr->O [i] = 0.0; + ptr->Mg[i] = 0.0; + ptr->Al[i] = 0.0; + ptr->Si[i] = 0.0; + ptr->S [i] = 0.0; + ptr->Fe[i] = 0.0; + } +} + } // namespace grackle::impl::yields namespace grackle::impl { From b79ba758720fd0d1a66e6b66a6c8225b29a0c710 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 8 Dec 2025 21:32:34 -0500 Subject: [PATCH 055/111] start using FrozenKeyIdxBiMap for model names --- src/clib/initialize_dust_yields.cpp | 105 ++++++++++++++++++++------- src/clib/utils/FrozenKeyIdxBiMap.hpp | 2 +- 2 files changed, 80 insertions(+), 27 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index b831f91c2..9fe8fd63c 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -22,27 +22,53 @@ #include "LUT.hpp" #include "opaque_storage.hpp" #include "status_reporting.h" // GrPrintAndReturnErr +#include "utils/FrozenKeyIdxBiMap.hpp" namespace { // stuff inside an anonymous namespace is local to this file -int lookup_pathway_idx(const char* name) { - const char * known_names[12] = { - "local_ISM", "ccsn13", "ccsn20", "ccsn25", "ccsn30", "fsn13", - "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", - }; - - for (int i = 0; i < 12; i++){ - if (std::strcmp(known_names[i], name) == 0){ - return i; - } - } - return -1; -} +/// names of all injection pathways known to grackle listed in the order +/// in other parts of the codebase +/// +/// @see SetupCallbackCtx::inj_path_names - The entity that is initialized with +/// the values in this variable. Its docstring provides more details. +constexpr const char * const known_inj_path_names[] = { + "local_ISM", "ccsn13", "ccsn20", "ccsn25", "ccsn30", "fsn13", + "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", +}; /// the context object for setup_yield_table_callback struct SetupCallbackCtx{ - chemistry_data_storage *my_rates; + /// The object that gets updated by the values that the callback loads + grackle::impl::GrainMetalInjectPathways* inject_pathway_props; + + /// a counter that is incremented every time setup_yield_table_callback loads + /// data from an injection pathway int counter; + + /// maps the names of known injection pathways to a unique index + /// + /// The callback function reports an error if an injection is encountered + /// that has a name that isn't included in this map. Furthermore, data is + /// organized within GrainMetalInjectPathways according to the order of keys + /// in this map. + /// + /// @par Why This Is Needed + /// For some background context: + /// - to make use of the injection pathway information, Grackle requires + /// users to provide mass densities fields specifying the total amount of + /// injected metals by each pathway + /// - currently, the names of the user accessed fields have hard-coded names + /// - currently, Grackle loops over the data specified by these fields in a + /// standardized order and assumes data within an instance of + /// grackle::impl::GrainMetalInjectPathways has the same order + /// + /// @par How this should change + /// Before any functionality involving injection pathways is included in a + /// public release of Grackle, the plan is to stop hard-coding the names of + /// injection pathway density fields, and to load in injection pathway data + /// from HDF5 files. At that point, we'll need to tweak the callback function + /// to load in data for models with arbitrary names. + const grackle::impl::FrozenKeyIdxBiMap* inj_path_names; }; /// a callback function that sets up the appropriate parts of @@ -62,19 +88,23 @@ extern "C" int setup_yield_table_callback( { namespace inj_input = ::grackle::impl::inj_model_input; + SetupCallbackCtx* my_ctx = static_cast(ctx); - int pathway_idx = lookup_pathway_idx(name); - - if (pathway_idx < 0) { + // lookup the pathway associated with the current injection pathway name + // and report an error if there is one + // -> see the docstring for SetupCallbackCtx::inj_path_names for how this + // behavior will change when we start loading data from HDF5 files + int pathway_idx = static_cast( + FrozenKeyIdxBiMap_idx_from_key(my_ctx->inj_path_names, name) + ); + if (pathway_idx == static_cast(grackle::impl::bimap::invalid_val)) { return GrPrintAndReturnErr( "`%s` is an unexpected injection pathway name", name); } - chemistry_data_storage *my_rates = - static_cast(ctx)->my_rates; - + // load the object that we update with the data we read grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; + = my_ctx->inject_pathway_props; // record each metal nuclide yield // -> there is less value to using string keys in this case, but it makes @@ -186,7 +216,7 @@ extern "C" int setup_yield_table_callback( } } - (static_cast(ctx)->counter)++; + (my_ctx->counter)++; return GR_SUCCESS; } @@ -244,10 +274,23 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, { if (my_chemistry->metal_chemistry == 0) { - return SUCCESS; + return GR_SUCCESS; + } + + // construct a mapping of all known models + // -> in the future, we are going to move away from this hardcoded approach + // -> since the strings are statically allocates, the map won't make copies + // of the strings + constexpr int n_pathways = static_cast( + sizeof(known_inj_path_names) / sizeof(char*)); + + FrozenKeyIdxBiMap inj_path_names = new_FrozenKeyIdxBiMap( + known_inj_path_names, n_pathways, BiMapMode::REFS_KEYDATA); + if (!FrozenKeyIdxBiMap_is_ok(&inj_path_names)) { + return GrPrintAndReturnErr( + "there was a problem building the map of model names"); } - int n_pathways = 12; int n_log10Tdust_vals = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; int n_opac_poly_coef = grackle::impl::inj_model_input::N_Opacity_Coef; my_rates->opaque_storage->inject_pathway_props = @@ -260,6 +303,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, = my_rates->opaque_storage->inject_pathway_props; if (!GrainMetalInjectPathways_is_valid(inject_pathway_props)) { + drop_FrozenKeyIdxBiMap(&inj_path_names); return GR_FAIL; } @@ -282,12 +326,21 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, &inject_pathway_props->gas_metal_nuclide_yields, n_pathways); zero_out_dust_inject_props(inject_pathway_props); - SetupCallbackCtx ctx = {my_rates, 0}; + // actually load in the data for each injection pathway + SetupCallbackCtx ctx = { + /* inject_pathway_props = */ my_rates->opaque_storage->inject_pathway_props, + /* counter = */ 0, + /* inj_path_names = */ &inj_path_names, + }; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( &setup_yield_table_callback, static_cast(&ctx)); + + drop_FrozenKeyIdxBiMap(&inj_path_names); if (ret != GR_SUCCESS) { - return GR_FAIL; + return GrPrintAndReturnErr( + "some kind of unspecified error occured when loading data from each " + "injection pathway"); } GR_INTERNAL_REQUIRE(ctx.counter == 12, "sanity-checking"); diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp index a9537a5c0..4b3fe6114 100644 --- a/src/clib/utils/FrozenKeyIdxBiMap.hpp +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -117,7 +117,7 @@ struct FrozenKeyIdxBiMap { /// > This is pretty ugly/clunky, but its the only practical way to achieve /// > comparable behavior to other internal datatypes (ideally, we would make /// > this a simple C++ class instead) -inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], +inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* const keys[], int key_count, BiMapMode mode) { // this will be returned if there is an error FrozenKeyIdxBiMap erroneous_obj{0, nullptr, BiMapMode::REFS_KEYDATA}; From 51610dd330f989ac7d63285e1f774b553da13250 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 10:11:34 -0500 Subject: [PATCH 056/111] lightly refactor loading of metal nuclide yields --- src/clib/initialize_dust_yields.cpp | 68 ++++++++++++++++------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 9fe8fd63c..0ba707f2a 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -36,6 +36,40 @@ constexpr const char * const known_inj_path_names[] = { "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", }; +/// a crude map-like function +bool lookup_metal_yield_ptrs( + grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + const char* metal_nuclide_name, double** total_yield_ptr, + double** gasonly_yield_ptr +) { + if (std::strcmp("C", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.C; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.C; + } else if (std::strcmp("O", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.O; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.O; + } else if (std::strcmp("Mg", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.Mg; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.Mg; + } else if (std::strcmp("Al", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.Al; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.Al; + } else if (std::strcmp("Si", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.Si; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.Si; + } else if (std::strcmp("S", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.S; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.S; + } else if (std::strcmp("Fe", metal_nuclide_name) == 0) { + (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.Fe; + (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.Fe; + } else { + return false; + } + return true; + +} + /// the context object for setup_yield_table_callback struct SetupCallbackCtx{ /// The object that gets updated by the values that the callback loads @@ -106,40 +140,14 @@ extern "C" int setup_yield_table_callback( grackle::impl::GrainMetalInjectPathways* inject_pathway_props = my_ctx->inject_pathway_props; - // record each metal nuclide yield - // -> there is less value to using string keys in this case, but it makes - // some sense to be semi-consistent with the handling of the dust species - // yields + // record the yields for each metal nuclide for (int i = 0; i < input->n_metal_nuclide_yields; i++) { const inj_input::MetalNuclideYieldProps& yield_info = input->metal_nuclide_yields[i]; - double* total_yield = nullptr; - double* gas_yield = nullptr; - - // todo: refactor to use a map (I have a rough plan) - if (std::strcmp("C", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.C; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.C; - } else if (std::strcmp("O", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.O; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.O; - } else if (std::strcmp("Mg", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Mg; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Mg; - } else if (std::strcmp("Al", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Al; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Al; - } else if (std::strcmp("Si", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Si; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Si; - } else if (std::strcmp("S", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.S; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.S; - } else if (std::strcmp("Fe", yield_info.name) == 0) { - total_yield = inject_pathway_props->total_metal_nuclide_yields.Fe; - gas_yield = inject_pathway_props->gas_metal_nuclide_yields.Fe; - } else { + double *total_yield, *gas_yield; + if (!lookup_metal_yield_ptrs(inject_pathway_props, yield_info.name, + &total_yield, &gas_yield)){ return GrPrintAndReturnErr( "`%s` not a known metal nuclide", yield_info.name); } From 24ff4cec7d57b91d56c2779ab6a0d8463c8db929 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 10:16:22 -0500 Subject: [PATCH 057/111] confirm that just loading the relevant dust species produces the correct results --- src/clib/initialize_dust_yields.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 0ba707f2a..bc2d8d1b4 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -15,6 +15,7 @@ #include #include #include +#include "dust/grain_species_info.hpp" #include "grackle_macros.h" #include "grackle_chemistry_data.h" #include "initialize_dust_yields.hpp" // forward declarations @@ -79,6 +80,9 @@ struct SetupCallbackCtx{ /// data from an injection pathway int counter; + /// the number of dust grain species + const int n_grain_species; + /// maps the names of known injection pathways to a unique index /// /// The callback function reports an error if an injection is encountered @@ -196,6 +200,10 @@ extern "C" int setup_yield_table_callback( "`%s` not a known grain species", yield_info.name); } + if (grain_species_idx >= my_ctx->n_grain_species) { + continue; + } + // copy the nonprimordial yield fraction inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] = yield_info.nonprimoridal_yield_frac; @@ -338,6 +346,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, SetupCallbackCtx ctx = { /* inject_pathway_props = */ my_rates->opaque_storage->inject_pathway_props, /* counter = */ 0, + /* n_grain_species = */ get_n_grain_species(my_chemistry->dust_species), /* inj_path_names = */ &inj_path_names, }; From 18020b69fcab5710bbda52223d3355d07fd9375c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 19:37:25 -0500 Subject: [PATCH 058/111] use FrozenKeyIdxBiMap within GrainSpeciesInfo (1/3) One minor change involved formally making it illegal to construct a GrainSpeciesInfo instance that holds 0 dust species. That's perfectly fine. `GrainSpeciesInfo` holds some redundant info that we will remove in the a subsequent commit --- src/clib/dust/grain_species_info.cpp | 68 ++++++++++++++++++-------- src/clib/dust/grain_species_info.hpp | 12 +++++ src/clib/utils/FrozenKeyIdxBiMap.hpp | 21 ++++---- tests/unit/test_grain_species_info.cpp | 12 +---- 4 files changed, 73 insertions(+), 40 deletions(-) diff --git a/src/clib/dust/grain_species_info.cpp b/src/clib/dust/grain_species_info.cpp index 3a6a76f80..d60eef6c4 100644 --- a/src/clib/dust/grain_species_info.cpp +++ b/src/clib/dust/grain_species_info.cpp @@ -15,6 +15,7 @@ #include "LUT.hpp" #include "grain_species_info.hpp" +#include "../utils/FrozenKeyIdxBiMap.hpp" // The following logic effectively does 2 (related things): // 1. it serves as a human-readable registry of all known grain species and @@ -85,18 +86,23 @@ grackle::impl::GrainSpeciesInfoEntry mk_gsp_info_entry_helper_( out_ingredient_ptr}; } +// ugh, I don't like this... +grackle::impl::GrainSpeciesInfo mk_invalid_GrainSpeciesInfo() { + return {-1, nullptr, grackle::impl::mk_invalid_FrozenKeyIdxBiMap()}; +} + } // anonymous namespace grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( int dust_species_parameter) { - GrainSpeciesInfo out{-1, nullptr}; // indicates an error - out.n_species = get_n_grain_species(dust_species_parameter); - - if (out.n_species <= 0) { - return out; + int n_species = get_n_grain_species(dust_species_parameter); + if (n_species <= 0) { + return mk_invalid_GrainSpeciesInfo(); } - out.species_info = new GrainSpeciesInfoEntry[out.n_species]; + // names is allocated with the max number of known grain species + const char* names[OnlyGrainSpLUT::NUM_ENTRIES]; + GrainSpeciesInfoEntry* species_info = new GrainSpeciesInfoEntry[n_species]; // At the time of writing: // - we **only** use h2rate_carbonaceous_coef_table for the AC_dust @@ -126,7 +132,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( {1, SpLUT::SiOI, 44.}, {2, SpLUT::H2O, 18.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[0] = mk_gsp_info_entry_helper_( + names[0] = "MgSiO3_dust"; + species_info[0] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::MgSiO3_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::MgSiO3_dust, /* name = */ "MgSiO3_dust", @@ -140,7 +147,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( // {coef, species_idx, particle mass} {1, SpLUT::CI, 12.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[1] = mk_gsp_info_entry_helper_( + names[1] = "AC_dust"; + species_info[1] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::AC_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::AC_dust, /* name = */ "AC_dust", @@ -156,7 +164,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( // {coef, species_idx, particle mass} {1, SpLUT::SiI, 28.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[2] = mk_gsp_info_entry_helper_( + names[2] = "SiM_dust"; + species_info[2] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::SiM_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::SiM_dust, /* name = */ "SiM_dust", @@ -170,7 +179,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( // {coef, species_idx, particle mass} {1, SpLUT::Fe, 56.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[3] = mk_gsp_info_entry_helper_( + names[3] = "FeM_dust"; + species_info[3] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::FeM_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::FeM_dust, /* name = */ "FeM_dust", @@ -186,7 +196,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( {1, SpLUT::SiOI, 44.}, {3, SpLUT::H2O, 18.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[4] = mk_gsp_info_entry_helper_( + names[4] = "Mg2SiO4_dust"; + species_info[4] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::Mg2SiO4_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::Mg2SiO4_dust, /* name = */ "Mg2SiO4_dust", @@ -201,7 +212,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( {3, SpLUT::Fe, 56.}, {4, SpLUT::H2O, 18.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[5] = mk_gsp_info_entry_helper_( + names[5] = "Fe3O4_dust"; + species_info[5] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::Fe3O4_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::Fe3O4_dust, /* name = */ "Fe3O4_dust", @@ -215,7 +227,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( // {coef, species_idx, particle mass} {1, SpLUT::SiO2I, 60.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[6] = mk_gsp_info_entry_helper_( + names[6] = "SiO2_dust"; + species_info[6] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::SiO2_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::SiO2_dust, /* name = */ "SiO2_dust", @@ -230,7 +243,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( {1, SpLUT::Mg, 24.}, {1, SpLUT::H2O, 18.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[7] = mk_gsp_info_entry_helper_( + names[7] = "MgO_dust"; + species_info[7] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::MgO_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::MgO_dust, /* name = */ "MgO_dust", @@ -245,7 +259,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( {1, SpLUT::Fe, 56.}, {1, SpLUT::S, 32.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[8] = mk_gsp_info_entry_helper_( + names[8] = "FeS_dust"; + species_info[8] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::FeS_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::FeS_dust, /* name = */ "FeS_dust", @@ -260,7 +275,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( {2, SpLUT::Al, 27.}, {3, SpLUT::H2O, 18.}, GRIMPL_INGREDIENT_LIST_SENTINEL}; - out.species_info[9] = mk_gsp_info_entry_helper_( + names[9] = "Al2O3_dust"; + species_info[9] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::Al2O3_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::Al2O3_dust, /* name = */ "Al2O3_dust", @@ -277,7 +293,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( // nominal growth rxn: "0.5CO + 0.5CH2 + 1.2N -> ref_org_dust" // nuclide ratios: C:H:O:N = 1:1:0.5:1.2 - out.species_info[10] = mk_gsp_info_entry_helper_( + names[10] = "ref_org_dust"; + species_info[10] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::ref_org_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::ref_org_dust, /* name = */ "ref_org_dust", @@ -288,7 +305,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( // nominal growth rxn: "CO + 2H2I -> vol_org_dust" // effective formula: CH3OH - out.species_info[11] = mk_gsp_info_entry_helper_( + names[11] = "vol_org_dust"; + species_info[11] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::vol_org_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::vol_org_dust, /* name = */ "vol_org_dust", @@ -298,7 +316,8 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( /* growth_ingredients = */ nullptr); // nominal growth rxn: "H2O -> H2O_ice_dust" - out.species_info[12] = mk_gsp_info_entry_helper_( + names[12] = "H2O_ice_dust"; + species_info[12] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::H2O_ice_dust, /* onlygrainsp_idx = */ OnlyGrainSpLUT::H2O_ice_dust, /* name = */ "H2O_ice_dust", @@ -308,7 +327,16 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( /* growth_ingredients = */ nullptr); } - return out; + GrainSpeciesInfo out{ + n_species, species_info, + new_FrozenKeyIdxBiMap(names, n_species, BiMapMode::COPIES_KEYDATA)}; + + if (FrozenKeyIdxBiMap_is_ok(&out.name_map)) { + return out; + } else { + drop_GrainSpeciesInfo(&out); + return mk_invalid_GrainSpeciesInfo(); + } } #undef GRIMPL_INGREDIENT_LIST_SENTINEL diff --git a/src/clib/dust/grain_species_info.hpp b/src/clib/dust/grain_species_info.hpp index 1f20c52ea..6785624d9 100644 --- a/src/clib/dust/grain_species_info.hpp +++ b/src/clib/dust/grain_species_info.hpp @@ -13,6 +13,8 @@ #ifndef GRAIN_SPECIES_INFO_HPP #define GRAIN_SPECIES_INFO_HPP +#include "../utils/FrozenKeyIdxBiMap.hpp" + namespace grackle::impl { /// holds information about a single gas species that is an ingredient for @@ -116,6 +118,15 @@ struct GrainSpeciesInfo { /// an out.species_infoay of length of length @ref n_species where each entry /// holds info about a separate grain species GrainSpeciesInfoEntry* species_info; + + /// maps between grain species names and the associated index. The mapping is + /// **ALWAYS** consistent with ``OnlyGrainSpLUT``. + /// + /// @note + /// An argument could be made for storing this separately from the rest of + /// the struct since the core grackle calculations don't (or at least + /// shouldn't) use this data structure during the calculation. + FrozenKeyIdxBiMap name_map; }; /// return the number of grain species @@ -164,6 +175,7 @@ inline void drop_GrainSpeciesInfo(GrainSpeciesInfo* ptr) { } } delete[] ptr->species_info; + drop_FrozenKeyIdxBiMap(&ptr->name_map); // the following 2 lines are not strictly necessary, but they may help us // avoid a double-free and a dangling pointer ptr->n_species = 0; diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/utils/FrozenKeyIdxBiMap.hpp index a9537a5c0..bdb3537a2 100644 --- a/src/clib/utils/FrozenKeyIdxBiMap.hpp +++ b/src/clib/utils/FrozenKeyIdxBiMap.hpp @@ -103,6 +103,12 @@ struct FrozenKeyIdxBiMap { BiMapMode mode; }; +// ugh, it's unfortunate that we need to make this... but for now its useful. +// Ideally, we would refactor so that we can get rid of this function. +inline FrozenKeyIdxBiMap mk_invalid_FrozenKeyIdxBiMap() { + return FrozenKeyIdxBiMap{0, nullptr, BiMapMode::REFS_KEYDATA}; +} + /// Constructs a new FrozenKeyIdxBiMap /// /// @param[in] keys Sequence of 1 or more unique strings. Each string must @@ -119,18 +125,15 @@ struct FrozenKeyIdxBiMap { /// > this a simple C++ class instead) inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], int key_count, BiMapMode mode) { - // this will be returned if there is an error - FrozenKeyIdxBiMap erroneous_obj{0, nullptr, BiMapMode::REFS_KEYDATA}; - // check the specified keys long long max_keys = static_cast(bimap::invalid_val) - 1LL; if (key_count < 1 || static_cast(key_count) > max_keys) { GrPrintErrMsg("key_count must be positive and cannot exceed %lld", max_keys); - return erroneous_obj; + return mk_invalid_FrozenKeyIdxBiMap(); } else if (keys == nullptr) { GrPrintErrMsg("keys must not be a nullptr"); - return erroneous_obj; + return mk_invalid_FrozenKeyIdxBiMap(); } for (int i = 0; i < key_count; i++) { GR_INTERNAL_REQUIRE(keys[i] != nullptr, "Can't specify a nullptr key"); @@ -140,13 +143,13 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], "calling strlen on \"%s\", the key @ index %d, yields 0 or a length " "exceeding %d", keys[i], i, bimap::keylen_max); - return erroneous_obj; + return mk_invalid_FrozenKeyIdxBiMap(); } // check uniqueness for (int j = 0; j < i; j++) { if (strcmp(keys[i], keys[j]) == 0) { GrPrintErrMsg("\"%s\" key repeats", keys[i]); - return erroneous_obj; + return mk_invalid_FrozenKeyIdxBiMap(); } } } @@ -173,7 +176,7 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], } default: { GrPrintErrMsg("unknown mode"); - return erroneous_obj; + return mk_invalid_FrozenKeyIdxBiMap(); } } @@ -208,7 +211,7 @@ inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { /// > This is pretty ugly/clunky, but its the only practical way to achieve /// > comparable behavior to other internal datatypes (ideally, we would make /// > this a simple C++ class instead) -FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { +inline FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { return new_FrozenKeyIdxBiMap(ptr->keys, ptr->length, ptr->mode); }; diff --git a/tests/unit/test_grain_species_info.cpp b/tests/unit/test_grain_species_info.cpp index 19bd87f4e..c09e7ccbf 100644 --- a/tests/unit/test_grain_species_info.cpp +++ b/tests/unit/test_grain_species_info.cpp @@ -194,17 +194,7 @@ INSTANTIATE_TEST_SUITE_P( // check the GrainSpeciesInfo object when constructed from dust_species // parameters that hold extreme values TEST(GrainSpeciesInfoTestMisc, DustSpeciesExtremeValues) { - { - unique_GrainSpeciesInfo_ptr ptr = make_unique_GrainSpeciesInfo(0); - EXPECT_EQ(ptr->n_species, 0) - << "GrainSpeciesInfo::n_species should be 0 when the dust_species " - << "parameter is 0."; - EXPECT_EQ(ptr->species_info, nullptr) - << "GrainSpeciesInfo::species_info should be a nullptr when " - << "dust_species parameter is 0."; - } - - int invalid_dust_species_values[2] = {-42423, MAX_dust_species_VAL + 1}; + int invalid_dust_species_values[3] = {-42423, 0, MAX_dust_species_VAL + 1}; for (auto dust_species_param : invalid_dust_species_values) { unique_GrainSpeciesInfo_ptr ptr = make_unique_GrainSpeciesInfo(dust_species_param); From 00865dd5ffe9af1b3729ab04a09997adc8d3df72 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 20:23:00 -0500 Subject: [PATCH 059/111] use FrozenKeyIdxBiMap within GrainSpeciesInfo (2/3) Modify tests to start using `FrozenKeyIdxBiMap` rather than `GrainSpeciesInfoEntry::onlygrainsp_idx` and `GrainSpeciesInfoEntry::name`. In the next commit, we'll remove these members from `GrainSpeciesInfoEntry` --- tests/unit/test_grain_species_info.cpp | 53 ++++++++++++++++++-------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/tests/unit/test_grain_species_info.cpp b/tests/unit/test_grain_species_info.cpp index c09e7ccbf..b941d55a0 100644 --- a/tests/unit/test_grain_species_info.cpp +++ b/tests/unit/test_grain_species_info.cpp @@ -17,6 +17,7 @@ #include "LUT.hpp" #include "dust/grain_species_info.hpp" +#include "utils/FrozenKeyIdxBiMap.hpp" namespace { // stuff in an anonymous namespace is local to this file @@ -130,27 +131,48 @@ class GrainSpeciesInfoTest : public testing::TestWithParam { unique_GrainSpeciesInfo_ptr grain_species_info_; }; +// the following test is somewhat redundant with the SpeciesLUTCompare tests +// and is more work to maintain TEST_P(GrainSpeciesInfoTest, CheckOnlyGrainSpeciesLUTConsistency) { + // construct a vector with an element for each entry in OnlyGrainSpeciesLUT + std::vector ref_l{ + {"MgSiO3_dust", OnlyGrainSpLUT::MgSiO3_dust}, + {"AC_dust", OnlyGrainSpLUT::AC_dust}, + {"SiM_dust", OnlyGrainSpLUT::SiM_dust}, + {"FeM_dust", OnlyGrainSpLUT::FeM_dust}, + {"Mg2SiO4_dust", OnlyGrainSpLUT::Mg2SiO4_dust}, + {"Fe3O4_dust", OnlyGrainSpLUT::Fe3O4_dust}, + {"SiO2_dust", OnlyGrainSpLUT::SiO2_dust}, + {"MgO_dust", OnlyGrainSpLUT::MgO_dust}, + {"FeS_dust", OnlyGrainSpLUT::FeS_dust}, + {"Al2O3_dust", OnlyGrainSpLUT::Al2O3_dust}, + {"ref_org_dust", OnlyGrainSpLUT::ref_org_dust}, + {"vol_org_dust", OnlyGrainSpLUT::vol_org_dust}, + {"H2O_ice_dust", OnlyGrainSpLUT::H2O_ice_dust}, + }; + const int n_species = grain_species_info_->n_species; for (int i = 0; i < n_species; i++) { - // sanity check! - ASSERT_NE(grain_species_info_->species_info[i].name, nullptr); - // actual check! - EXPECT_EQ(i, grain_species_info_->species_info[i].onlygrainsp_idx) - << "element " << i << " of the GrainSpeciesInfo::species_info array " - << "doesn't seem to be synchronized with the OnlyGrainSpeciesLUT " - << "enumeration. At face value (there aren't other related bugs), " - << "OnlyGrainSpeciesLUT::" << grain_species_info_->species_info[i].name - << " seems to have a value of " - << grain_species_info_->species_info[i].onlygrainsp_idx; + const char* name = grackle::impl::FrozenKeyIdxBiMap_key_from_idx( + &grain_species_info_->name_map, static_cast(i)); + + ASSERT_NE(name, nullptr); // sanity check! + EXPECT_EQ(i, ref_l[i].index); // sanity check! + + // actual check: + EXPECT_EQ(std::string(name), ref_l[i].name) + << "the grain species associated with index " << i << " in the " + << "GrainSpeciesInfo instance doesn't seem to be synchronized with " + << "the OnlyGrainSpeciesLUT enumeration."; } } TEST_P(GrainSpeciesInfoTest, SublimationTemperature) { const int n_species = grain_species_info_->n_species; for (int i = 0; i < n_species; i++) { - // sanity check! - ASSERT_NE(grain_species_info_->species_info[i].name, nullptr); + const char* name = grackle::impl::FrozenKeyIdxBiMap_key_from_idx( + &grain_species_info_->name_map, static_cast(i)); + ASSERT_NE(name, nullptr); // sanity check! // actual check! EXPECT_GT(grain_species_info_->species_info[i].sublimation_temperature, 0) << "element " << i << " of the GrainSpeciesInfo::species_info array " @@ -165,10 +187,11 @@ TEST_P(GrainSpeciesInfoTest, SpeciesLUTCompare) { const int n_species = grain_species_info_->n_species; for (int i = 0; i < n_species; i++) { - // sanity check! - ASSERT_NE(grain_species_info_->species_info[i].name, nullptr); + const char* name_cstr = grackle::impl::FrozenKeyIdxBiMap_key_from_idx( + &grain_species_info_->name_map, static_cast(i)); + ASSERT_NE(name_cstr, nullptr); // sanity check! // actual check! - std::string actual_name(grain_species_info_->species_info[i].name); + std::string actual_name(name_cstr); EXPECT_EQ(actual_name, ref_list[i].name) << "according to the reference list, the grain species at index " << i << " should be `" << ref_list[i].name << "` (not `" << actual_name From fa08c26c6c74d98a4c90c5f38181a3a28fad3b8c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 20:28:26 -0500 Subject: [PATCH 060/111] use FrozenKeyIdxBiMap within GrainSpeciesInfo (3/3) Delete `GrainSpeciesInfoEntry::onlygrainsp_idx` and `GrainSpeciesInfoEntry::name`. --- src/clib/dust/grain_species_info.cpp | 33 ++-------------------------- src/clib/dust/grain_species_info.hpp | 13 ----------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/clib/dust/grain_species_info.cpp b/src/clib/dust/grain_species_info.cpp index d60eef6c4..d82aa4340 100644 --- a/src/clib/dust/grain_species_info.cpp +++ b/src/clib/dust/grain_species_info.cpp @@ -52,9 +52,8 @@ namespace { // stuff inside an anonymous namespace is local to this file /// - the ingredient list in the returned instance is **NOT** terminated by /// the sentinel grackle::impl::GrainSpeciesInfoEntry mk_gsp_info_entry_helper_( - int species_idx, int onlygrainsp_idx, const char* name, - bool h2dust_uses_carbonaceous_table, double sublimation_temperature, - double bulk_density_cgs, + int species_idx, bool h2dust_uses_carbonaceous_table, + double sublimation_temperature, double bulk_density_cgs, const grackle::impl::GrainGrowthIngredient* growth_ingredients) { using grackle::impl::GrainGrowthIngredient; @@ -77,8 +76,6 @@ grackle::impl::GrainSpeciesInfoEntry mk_gsp_info_entry_helper_( } return grackle::impl::GrainSpeciesInfoEntry{species_idx, - onlygrainsp_idx, - name, h2dust_uses_carbonaceous_table, sublimation_temperature, bulk_density_cgs, @@ -135,8 +132,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[0] = "MgSiO3_dust"; species_info[0] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::MgSiO3_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::MgSiO3_dust, - /* name = */ "MgSiO3_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1222.0, /* bulk_density_cgs = */ 3.20185, @@ -150,8 +145,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[1] = "AC_dust"; species_info[1] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::AC_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::AC_dust, - /* name = */ "AC_dust", /* h2dust_uses_carbonaceous_table = */ true, /* sublimation_temperature = */ 1800.0, /* bulk_density_cgs = */ 2.27949, @@ -167,8 +160,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[2] = "SiM_dust"; species_info[2] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::SiM_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::SiM_dust, - /* name = */ "SiM_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1500.0, /* bulk_density_cgs = */ 2.34118, @@ -182,8 +173,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[3] = "FeM_dust"; species_info[3] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::FeM_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::FeM_dust, - /* name = */ "FeM_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1500.0, /* bulk_density_cgs = */ 7.95995, @@ -199,8 +188,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[4] = "Mg2SiO4_dust"; species_info[4] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::Mg2SiO4_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::Mg2SiO4_dust, - /* name = */ "Mg2SiO4_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1277.0, /* bulk_density_cgs = */ 3.22133, @@ -215,8 +202,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[5] = "Fe3O4_dust"; species_info[5] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::Fe3O4_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::Fe3O4_dust, - /* name = */ "Fe3O4_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1500.0, /* bulk_density_cgs = */ 5.25096, @@ -230,8 +215,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[6] = "SiO2_dust"; species_info[6] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::SiO2_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::SiO2_dust, - /* name = */ "SiO2_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1500.0, /* bulk_density_cgs = */ 2.66235, @@ -246,8 +229,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[7] = "MgO_dust"; species_info[7] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::MgO_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::MgO_dust, - /* name = */ "MgO_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1500.0, /* bulk_density_cgs = */ 3.58157, @@ -262,8 +243,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[8] = "FeS_dust"; species_info[8] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::FeS_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::FeS_dust, - /* name = */ "FeS_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 680.0, /* bulk_density_cgs = */ 4.87265, @@ -278,8 +257,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[9] = "Al2O3_dust"; species_info[9] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::Al2O3_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::Al2O3_dust, - /* name = */ "Al2O3_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 1500.0, /* bulk_density_cgs = */ 4.01610, @@ -296,8 +273,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[10] = "ref_org_dust"; species_info[10] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::ref_org_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::ref_org_dust, - /* name = */ "ref_org_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 575.0, /* bulk_density_cgs = */ 1.5, @@ -308,8 +283,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[11] = "vol_org_dust"; species_info[11] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::vol_org_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::vol_org_dust, - /* name = */ "vol_org_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 375.0, /* bulk_density_cgs = */ 1.0, @@ -319,8 +292,6 @@ grackle::impl::GrainSpeciesInfo grackle::impl::new_GrainSpeciesInfo( names[12] = "H2O_ice_dust"; species_info[12] = mk_gsp_info_entry_helper_( /* species_idx = */ SpLUT::H2O_ice_dust, - /* onlygrainsp_idx = */ OnlyGrainSpLUT::H2O_ice_dust, - /* name = */ "H2O_ice_dust", /* h2dust_uses_carbonaceous_table = */ false, /* sublimation_temperature = */ 153.0, /* bulk_density_cgs = */ 0.92, diff --git a/src/clib/dust/grain_species_info.hpp b/src/clib/dust/grain_species_info.hpp index 6785624d9..b306c154e 100644 --- a/src/clib/dust/grain_species_info.hpp +++ b/src/clib/dust/grain_species_info.hpp @@ -41,19 +41,6 @@ struct GrainSpeciesInfoEntry { /// the species index of the grain in the #GrainSpLUT lookup table int species_idx; - /// the species index of the grain in the #OnlyGrainSpLUT lookup table - /// - /// @note - /// It's frankly a little redundant to track this information (since an - /// instance of this struct is found at this index of an out.species_infoay) - int onlygrainsp_idx; - - /// name of the dust species - /// - /// @note - /// This primarily exists for debuging purposes - const char* name; - /// indicates whether to use the carbonaceous or silicate coefficient table /// to computing contributions of the grain species to the total h2dust rate /// (or the rate of H2 formation) From 89f3f35ba2cd0208ce3a939b322288375ee6c550 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 21:09:30 -0500 Subject: [PATCH 061/111] switch to using a map of grain species --- src/clib/initialize_dust_yields.cpp | 100 +++++++++++----------------- 1 file changed, 40 insertions(+), 60 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index bc2d8d1b4..0ca8b7c41 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -80,9 +80,6 @@ struct SetupCallbackCtx{ /// data from an injection pathway int counter; - /// the number of dust grain species - const int n_grain_species; - /// maps the names of known injection pathways to a unique index /// /// The callback function reports an error if an injection is encountered @@ -107,6 +104,10 @@ struct SetupCallbackCtx{ /// from HDF5 files. At that point, we'll need to tweak the callback function /// to load in data for models with arbitrary names. const grackle::impl::FrozenKeyIdxBiMap* inj_path_names; + + /// maps the names of the grain species for which data will be loaded to the + /// appropriate grain species index + const grackle::impl::FrozenKeyIdxBiMap* grain_species_names; }; /// a callback function that sets up the appropriate parts of @@ -125,6 +126,7 @@ extern "C" int setup_yield_table_callback( void* ctx) { namespace inj_input = ::grackle::impl::inj_model_input; + namespace bimap = ::grackle::impl::bimap; SetupCallbackCtx* my_ctx = static_cast(ctx); @@ -135,7 +137,7 @@ extern "C" int setup_yield_table_callback( int pathway_idx = static_cast( FrozenKeyIdxBiMap_idx_from_key(my_ctx->inj_path_names, name) ); - if (pathway_idx == static_cast(grackle::impl::bimap::invalid_val)) { + if (pathway_idx == static_cast(bimap::invalid_val)) { return GrPrintAndReturnErr( "`%s` is an unexpected injection pathway name", name); } @@ -160,64 +162,35 @@ extern "C" int setup_yield_table_callback( gas_yield[pathway_idx] = yield_info.gas_yield; } - // record each grain species yield - for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; - yield_idx++) { - const inj_input::GrainSpeciesYieldProps& yield_info = - input->initial_grain_props[yield_idx]; - - int grain_species_idx = -1; - - // with a little refactoring, this will get a lot more concise - if (std::strcmp("MgSiO3_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::MgSiO3_dust; - } else if (std::strcmp("AC_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::AC_dust; - } else if (std::strcmp("SiM_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::SiM_dust; - } else if (std::strcmp("FeM_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::FeM_dust; - } else if (std::strcmp("Mg2SiO4_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Mg2SiO4_dust; - } else if (std::strcmp("Fe3O4_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Fe3O4_dust; - } else if (std::strcmp("SiO2_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::SiO2_dust; - } else if (std::strcmp("MgO_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::MgO_dust; - } else if (std::strcmp("FeS_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::FeS_dust; - } else if (std::strcmp("Al2O3_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::Al2O3_dust; - } else if (std::strcmp("ref_org_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::ref_org_dust; - } else if (std::strcmp("vol_org_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::vol_org_dust; - } else if (std::strcmp("H2O_ice_dust", yield_info.name) == 0) { - grain_species_idx = OnlyGrainSpLUT::H2O_ice_dust; - } else { - return GrPrintAndReturnErr( - "`%s` not a known grain species", yield_info.name); - } - - if (grain_species_idx >= my_ctx->n_grain_species) { - continue; - } + if (my_ctx->grain_species_names != nullptr) { + // loop over chunks of yield data. Each chunk holds data for the current + // pathway that corresponds to a distinct grain species + for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; + yield_idx++) { + const inj_input::GrainSpeciesYieldProps& yield_info = + input->initial_grain_props[yield_idx]; + + int grain_species_idx = static_cast( + FrozenKeyIdxBiMap_idx_from_key(my_ctx->grain_species_names, + yield_info.name) + ); + if (grain_species_idx == static_cast(bimap::invalid_val)) { + continue; + } - // copy the nonprimordial yield fraction - inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] - = yield_info.nonprimoridal_yield_frac; + // copy the nonprimordial yield fraction + inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] + = yield_info.nonprimoridal_yield_frac; - // copy the 1st, 2nd, and 3rd moments of the size distribution - // (the 0th moment isn't recorded anywhere - double* size_mom_table = - inject_pathway_props->size_moments.data[grain_species_idx]; - for (int i = 0; i < 3; i++) { - size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; - } + // copy the 1st, 2nd, and 3rd moments of the size distribution + // (the 0th moment isn't recorded anywhere + double* size_mom_table = + inject_pathway_props->size_moments.data[grain_species_idx]; + for (int i = 0; i < 3; i++) { + size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; + } - // copy over the opacity coefficients table - { + // copy over the opacity coefficients table double* opac_coef_table = inject_pathway_props->opacity_coef_table.data[grain_species_idx]; int n_Td = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; @@ -229,7 +202,9 @@ extern "C" int setup_yield_table_callback( opac_coef_table[i] = yield_info.opacity_coef_table[i_Td][i_coef]; } } + } + } (my_ctx->counter)++; @@ -343,11 +318,16 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, zero_out_dust_inject_props(inject_pathway_props); // actually load in the data for each injection pathway + GrainSpeciesInfo* grain_species_info = + my_rates->opaque_storage->grain_species_info; + const FrozenKeyIdxBiMap* grain_species_names = + (grain_species_info == nullptr) ? nullptr : &grain_species_info->name_map; + SetupCallbackCtx ctx = { /* inject_pathway_props = */ my_rates->opaque_storage->inject_pathway_props, /* counter = */ 0, - /* n_grain_species = */ get_n_grain_species(my_chemistry->dust_species), /* inj_path_names = */ &inj_path_names, + /* grain_species_names = */ grain_species_names, }; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( From 45d2d14e1d547f0104a6f1773c854d533e88be0c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 9 Dec 2025 21:33:53 -0500 Subject: [PATCH 062/111] add a few comments and a little assorted refactoring --- src/clib/initialize_dust_yields.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/initialize_dust_yields.cpp index 0ca8b7c41..b59598f91 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/initialize_dust_yields.cpp @@ -282,6 +282,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, "there was a problem building the map of model names"); } + // initialize the object that will hold the loaded data int n_log10Tdust_vals = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; int n_opac_poly_coef = grackle::impl::inj_model_input::N_Opacity_Coef; my_rates->opaque_storage->inject_pathway_props = @@ -298,6 +299,7 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, return GR_FAIL; } + // initialize the grid of dust temperatures associated with the opacity table double log10Tdust_lo = 0.0; double log10Tdust_step = 0.1; @@ -309,7 +311,6 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, log10Tdust_vals[iTd] = log10Tdust_lo + (double)iTd * log10Tdust_step; } - // zero-out all metal injection yield fractions and dust grain properties yields::MetalTables_zero_out( &inject_pathway_props->total_metal_nuclide_yields, n_pathways); @@ -337,10 +338,12 @@ int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, if (ret != GR_SUCCESS) { return GrPrintAndReturnErr( "some kind of unspecified error occured when loading data from each " - "injection pathway"); + "injection pathway\n"); + } else if (ctx.counter != n_pathways) { + return GrPrintAndReturnErr( + "Only loaded data for %d of the %d available pathways\n", + ctx.counter, n_pathways); } - GR_INTERNAL_REQUIRE(ctx.counter == 12, "sanity-checking"); - return GR_SUCCESS; } From d0d8a92a493798633eb370461765ec244bef27ed Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 09:22:55 -0500 Subject: [PATCH 063/111] rename initialize_dust_yields -> load_data --- .clang-format-ignore | 1 - src/clib/CMakeLists.txt | 2 +- src/clib/Make.config.objects | 3 ++- src/clib/initialize_rates.cpp | 10 ++++---- .../load_data.cpp} | 24 +++++++++++-------- .../load_data.hpp} | 17 +++++++------ 6 files changed, 32 insertions(+), 25 deletions(-) rename src/clib/{initialize_dust_yields.cpp => inject_model/load_data.cpp} (95%) rename src/clib/{initialize_dust_yields.hpp => inject_model/load_data.hpp} (51%) diff --git a/.clang-format-ignore b/.clang-format-ignore index d15536e08..1ee1005f9 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -32,7 +32,6 @@ src/clib/init_misc_species_cool_rates.cpp src/clib/initialize_UVbackground_data.c src/clib/initialize_chemistry_data.cpp src/clib/initialize_cloudy_data.c -src/clib/initialize_dust_yields.cpp src/clib/initialize_rates.cpp src/clib/internal_types.hpp src/clib/internal_units.h diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 67f545d74..f96e50882 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -115,9 +115,9 @@ add_library(Grackle_Grackle dust/grain_species_info.cpp dust/grain_species_info.hpp init_misc_species_cool_rates.cpp init_misc_species_cool_rates.hpp initialize_chemistry_data.cpp - initialize_dust_yields.cpp initialize_dust_yields.hpp initialize_rates.cpp initialize_rates.hpp inject_model/grain_metal_inject_pathways.hpp + inject_model/load_data.cpp inject_model/load_data.hpp inject_model/raw_data.cpp inject_model/raw_data.hpp internal_types.cpp internal_types.hpp interp_table_utils.hpp diff --git a/src/clib/Make.config.objects b/src/clib/Make.config.objects index 7a4bb87af..372724187 100644 --- a/src/clib/Make.config.objects +++ b/src/clib/Make.config.objects @@ -31,10 +31,11 @@ OBJS_CONFIG_LIB = \ index_helper.lo \ initialize_chemistry_data.lo \ initialize_cloudy_data.lo \ - initialize_dust_yields.lo \ init_misc_species_cool_rates.lo \ initialize_rates.lo \ initialize_UVbackground_data.lo \ + inject_model/load_data.lo \ + inject_model/raw_data.lo \ interpolators_g.lo \ make_consistent.lo \ scale_fields.lo \ diff --git a/src/clib/initialize_rates.cpp b/src/clib/initialize_rates.cpp index 4a3d6c1c2..f9ee8708e 100644 --- a/src/clib/initialize_rates.cpp +++ b/src/clib/initialize_rates.cpp @@ -47,7 +47,7 @@ #include "collisional_rate_props.hpp" // init_extra_collisional_rates #include "dust/grain_species_info.hpp" #include "init_misc_species_cool_rates.hpp" // init_misc_species_cool_rates -#include "initialize_dust_yields.hpp" // initialize_dust_yields +#include "inject_model/load_data.hpp" // load_inject_path_data #include "initialize_rates.hpp" #include "internal_types.hpp" // new_CollisionalRxnRateCollection #include "LUT.hpp" // CollisionalRxnLUT @@ -653,10 +653,10 @@ int grackle::impl::initialize_rates( grackle::impl::new_GrainSpeciesInfo(my_chemistry->dust_species); } - // Dust rates - if (grackle::impl::initialize_dust_yields(my_chemistry, my_rates, my_units) == FAIL) { - fprintf(stderr, "Error in initialize_dust_yields.\n"); - return FAIL; + // Load injection pathway data + if (grackle::impl::load_inject_path_data(my_chemistry, my_rates) + != GR_SUCCESS) { + return GrPrintAndReturnErr("Error in load_inject_path_data."); } return SUCCESS; diff --git a/src/clib/initialize_dust_yields.cpp b/src/clib/inject_model/load_data.cpp similarity index 95% rename from src/clib/initialize_dust_yields.cpp rename to src/clib/inject_model/load_data.cpp index b59598f91..71c3ea642 100644 --- a/src/clib/initialize_dust_yields.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// /// /// @file -/// Implements the functions to initialize the dust yields +/// Implments the function for loading injection pathway data /// //===----------------------------------------------------------------------===// @@ -16,13 +16,13 @@ #include #include #include "dust/grain_species_info.hpp" -#include "grackle_macros.h" +#include "../grackle_macros.h" #include "grackle_chemistry_data.h" -#include "initialize_dust_yields.hpp" // forward declarations -#include "inject_model/raw_data.hpp" -#include "LUT.hpp" -#include "opaque_storage.hpp" -#include "status_reporting.h" // GrPrintAndReturnErr +#include "load_data.hpp" // forward declarations +#include "raw_data.hpp" +#include "../LUT.hpp" +#include "../opaque_storage.hpp" +#include "../status_reporting.h" // GrPrintAndReturnErr #include "utils/FrozenKeyIdxBiMap.hpp" namespace { // stuff inside an anonymous namespace is local to this file @@ -259,10 +259,14 @@ void zero_out_dust_inject_props( } // anonymous namespace -int grackle::impl::initialize_dust_yields(chemistry_data *my_chemistry, - chemistry_data_storage *my_rates, - code_units *my_units) +int grackle::impl::load_inject_path_data(const chemistry_data *my_chemistry, + chemistry_data_storage *my_rates) { + // Currently, this function "loads" injection pathway data from data that is + // directly embedded as part of the Grackle library in a manner controlled + // by raw_data.hpp and raw_data.cpp + // + // Longer term, the goal is to "load" the data from an external HDF5 file if (my_chemistry->metal_chemistry == 0) { return GR_SUCCESS; diff --git a/src/clib/initialize_dust_yields.hpp b/src/clib/inject_model/load_data.hpp similarity index 51% rename from src/clib/initialize_dust_yields.hpp rename to src/clib/inject_model/load_data.hpp index c8f53609e..4ab8a0eed 100644 --- a/src/clib/initialize_dust_yields.hpp +++ b/src/clib/inject_model/load_data.hpp @@ -6,21 +6,24 @@ //===----------------------------------------------------------------------===// /// /// @file -/// Declares the function to initialize the dust yields +/// Declares the function for loading injection pathway data /// //===----------------------------------------------------------------------===// -#ifndef INITIALIZE_DUST_YIELDS_HPP -#define INITIALIZE_DUST_YIELDS_HPP +#ifndef INJECT_MODEL_LOAD_DATA_HPP +#define INJECT_MODEL_LOAD_DATA_HPP #include "grackle.h" namespace grackle::impl { -int initialize_dust_yields(chemistry_data* my_chemistry, - chemistry_data_storage* my_rates, - code_units* my_units); +/// loads the model data for the various injection pathways and update +/// @p my_rates, accordingly +/// +/// @returns GR_SUCCESS if successful +int load_inject_path_data(const chemistry_data* my_chemistry, + chemistry_data_storage* my_rates); } // namespace grackle::impl -#endif /* INITIALIZE_DUST_YIELDS_HPP */ +#endif /* INJECT_MODEL_LOAD_DATA_HPP */ From 51a55733bd4153ff9bcef45462aacb446f3b0722 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 09:26:56 -0500 Subject: [PATCH 064/111] some light cleanup of inject_model/load_data.cpp --- src/clib/inject_model/load_data.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/clib/inject_model/load_data.cpp b/src/clib/inject_model/load_data.cpp index 71c3ea642..37eb58f6a 100644 --- a/src/clib/inject_model/load_data.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -10,20 +10,15 @@ /// //===----------------------------------------------------------------------===// -#include -#include -#include -#include -#include -#include "dust/grain_species_info.hpp" -#include "../grackle_macros.h" +#include // std::strcmp +#include "../dust/grain_species_info.hpp" #include "grackle_chemistry_data.h" #include "load_data.hpp" // forward declarations #include "raw_data.hpp" #include "../LUT.hpp" #include "../opaque_storage.hpp" #include "../status_reporting.h" // GrPrintAndReturnErr -#include "utils/FrozenKeyIdxBiMap.hpp" +#include "../utils/FrozenKeyIdxBiMap.hpp" namespace { // stuff inside an anonymous namespace is local to this file @@ -342,10 +337,10 @@ int grackle::impl::load_inject_path_data(const chemistry_data *my_chemistry, if (ret != GR_SUCCESS) { return GrPrintAndReturnErr( "some kind of unspecified error occured when loading data from each " - "injection pathway\n"); + "injection pathway"); } else if (ctx.counter != n_pathways) { return GrPrintAndReturnErr( - "Only loaded data for %d of the %d available pathways\n", + "Only loaded data for %d of the %d available pathways", ctx.counter, n_pathways); } From 947faabc353c0daafacb390d5332b2beb5adc3a1 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 09:31:37 -0500 Subject: [PATCH 065/111] apply clang-format --- src/clib/cool1d_multi_g.cpp | 4 +- .../grain_metal_inject_pathways.hpp | 17 +-- src/clib/inject_model/load_data.cpp | 141 ++++++++---------- src/clib/lookup_cool_rates1d.hpp | 9 +- src/clib/make_consistent.cpp | 11 +- src/clib/make_consistent.hpp | 7 +- 6 files changed, 89 insertions(+), 100 deletions(-) diff --git a/src/clib/cool1d_multi_g.cpp b/src/clib/cool1d_multi_g.cpp index 5bf09eb77..d787ece1a 100644 --- a/src/clib/cool1d_multi_g.cpp +++ b/src/clib/cool1d_multi_g.cpp @@ -188,9 +188,7 @@ void grackle::impl::cool1d_multi_g( grackle::impl::new_InternalDustPropBuf( my_fields->grid_dimension[0], GrainMetalInjectPathways_get_n_log10Tdust_vals( - my_rates->opaque_storage->inject_pathway_props - ) - ); + my_rates->opaque_storage->inject_pathway_props)); // opacity coefficients for each dust grain (the product of opacity // coefficient & gas mass density is the linear absortpion coefficient) grackle::impl::GrainSpeciesCollection grain_kappa = diff --git a/src/clib/inject_model/grain_metal_inject_pathways.hpp b/src/clib/inject_model/grain_metal_inject_pathways.hpp index 2da3da2ec..7bfaa24a0 100644 --- a/src/clib/inject_model/grain_metal_inject_pathways.hpp +++ b/src/clib/inject_model/grain_metal_inject_pathways.hpp @@ -76,12 +76,12 @@ inline void drop_MetalTables(MetalTables* ptr) { /// fills elements with zeros inline void MetalTables_zero_out(MetalTables* ptr, int nelem) { for (int i = 0; i < nelem; i++) { - ptr->C [i] = 0.0; - ptr->O [i] = 0.0; + ptr->C[i] = 0.0; + ptr->O[i] = 0.0; ptr->Mg[i] = 0.0; ptr->Al[i] = 0.0; ptr->Si[i] = 0.0; - ptr->S [i] = 0.0; + ptr->S[i] = 0.0; ptr->Fe[i] = 0.0; } } @@ -257,7 +257,6 @@ struct GrainMetalInjectPathways { /// computed from the opacity coefficient table. inline GrainMetalInjectPathways new_GrainMetalInjectPathways( int n_pathways, int n_log10Tdust_vals, int n_opac_poly_coef) { - bool err = false; if (n_pathways <= 0) { @@ -305,7 +304,8 @@ inline GrainMetalInjectPathways new_GrainMetalInjectPathways( /// Checks whether the GrainMetalInjectPathways that is returned by /// new_GrainMetalInjectPathways is valid -inline bool GrainMetalInjectPathways_is_valid(const GrainMetalInjectPathways* ptr) { +inline bool GrainMetalInjectPathways_is_valid( + const GrainMetalInjectPathways* ptr) { return ptr->n_pathways != -1; } @@ -322,17 +322,16 @@ inline bool GrainMetalInjectPathways_is_valid(const GrainMetalInjectPathways* pt /// @note /// Frankly, this is intended to be short-term solution until we have a chance /// to reduce the number of places where InternalDustPropBuf is constructed -inline int GrainMetalInjectPathways_get_n_log10Tdust_vals - (const GrainMetalInjectPathways* ptr) { +inline int GrainMetalInjectPathways_get_n_log10Tdust_vals( + const GrainMetalInjectPathways* ptr) { return (ptr == nullptr) ? 0 : ptr->log10Tdust_interp_props.dimension[0]; } - /// performs cleanup of the contents of GrainMetalInjectPathways /// /// This effectively invokes a destructor inline void drop_GrainMetalInjectPathways(GrainMetalInjectPathways* ptr) { - if (GrainMetalInjectPathways_is_valid(ptr)){ + if (GrainMetalInjectPathways_is_valid(ptr)) { yields::drop_MetalTables(&ptr->total_metal_nuclide_yields); yields::drop_MetalTables(&ptr->gas_metal_nuclide_yields); drop_GrainSpeciesCollection(&ptr->grain_yields); diff --git a/src/clib/inject_model/load_data.cpp b/src/clib/inject_model/load_data.cpp index 37eb58f6a..ca13dc6ce 100644 --- a/src/clib/inject_model/load_data.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -17,7 +17,7 @@ #include "raw_data.hpp" #include "../LUT.hpp" #include "../opaque_storage.hpp" -#include "../status_reporting.h" // GrPrintAndReturnErr +#include "../status_reporting.h" // GrPrintAndReturnErr #include "../utils/FrozenKeyIdxBiMap.hpp" namespace { // stuff inside an anonymous namespace is local to this file @@ -27,17 +27,16 @@ namespace { // stuff inside an anonymous namespace is local to this file /// /// @see SetupCallbackCtx::inj_path_names - The entity that is initialized with /// the values in this variable. Its docstring provides more details. -constexpr const char * const known_inj_path_names[] = { - "local_ISM", "ccsn13", "ccsn20", "ccsn25", "ccsn30", "fsn13", - "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", +constexpr const char* const known_inj_path_names[] = { + "local_ISM", "ccsn13", "ccsn20", "ccsn25", "ccsn30", "fsn13", + "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", }; /// a crude map-like function bool lookup_metal_yield_ptrs( - grackle::impl::GrainMetalInjectPathways* inject_pathway_props, - const char* metal_nuclide_name, double** total_yield_ptr, - double** gasonly_yield_ptr -) { + grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + const char* metal_nuclide_name, double** total_yield_ptr, + double** gasonly_yield_ptr) { if (std::strcmp("C", metal_nuclide_name) == 0) { (*total_yield_ptr) = inject_pathway_props->total_metal_nuclide_yields.C; (*gasonly_yield_ptr) = inject_pathway_props->gas_metal_nuclide_yields.C; @@ -63,11 +62,10 @@ bool lookup_metal_yield_ptrs( return false; } return true; - } /// the context object for setup_yield_table_callback -struct SetupCallbackCtx{ +struct SetupCallbackCtx { /// The object that gets updated by the values that the callback loads grackle::impl::GrainMetalInjectPathways* inject_pathway_props; @@ -117,9 +115,8 @@ struct SetupCallbackCtx{ /// receiving this callback extern "C" int setup_yield_table_callback( const char* name, - const grackle::impl::inj_model_input::InjectionPathwayInputData *input, - void* ctx) -{ + const grackle::impl::inj_model_input::InjectionPathwayInputData* input, + void* ctx) { namespace inj_input = ::grackle::impl::inj_model_input; namespace bimap = ::grackle::impl::bimap; @@ -130,27 +127,26 @@ extern "C" int setup_yield_table_callback( // -> see the docstring for SetupCallbackCtx::inj_path_names for how this // behavior will change when we start loading data from HDF5 files int pathway_idx = static_cast( - FrozenKeyIdxBiMap_idx_from_key(my_ctx->inj_path_names, name) - ); + FrozenKeyIdxBiMap_idx_from_key(my_ctx->inj_path_names, name)); if (pathway_idx == static_cast(bimap::invalid_val)) { - return GrPrintAndReturnErr( - "`%s` is an unexpected injection pathway name", name); + return GrPrintAndReturnErr("`%s` is an unexpected injection pathway name", + name); } // load the object that we update with the data we read - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_ctx->inject_pathway_props; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props = + my_ctx->inject_pathway_props; // record the yields for each metal nuclide for (int i = 0; i < input->n_metal_nuclide_yields; i++) { const inj_input::MetalNuclideYieldProps& yield_info = - input->metal_nuclide_yields[i]; + input->metal_nuclide_yields[i]; double *total_yield, *gas_yield; - if (!lookup_metal_yield_ptrs(inject_pathway_props, yield_info.name, - &total_yield, &gas_yield)){ - return GrPrintAndReturnErr( - "`%s` not a known metal nuclide", yield_info.name); + if (!lookup_metal_yield_ptrs(inject_pathway_props, yield_info.name, + &total_yield, &gas_yield)) { + return GrPrintAndReturnErr("`%s` not a known metal nuclide", + yield_info.name); } total_yield[pathway_idx] = yield_info.total_yield; @@ -163,31 +159,29 @@ extern "C" int setup_yield_table_callback( for (int yield_idx = 0; yield_idx < input->n_injected_grain_species; yield_idx++) { const inj_input::GrainSpeciesYieldProps& yield_info = - input->initial_grain_props[yield_idx]; + input->initial_grain_props[yield_idx]; - int grain_species_idx = static_cast( - FrozenKeyIdxBiMap_idx_from_key(my_ctx->grain_species_names, - yield_info.name) - ); + int grain_species_idx = static_cast(FrozenKeyIdxBiMap_idx_from_key( + my_ctx->grain_species_names, yield_info.name)); if (grain_species_idx == static_cast(bimap::invalid_val)) { continue; } // copy the nonprimordial yield fraction - inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] - = yield_info.nonprimoridal_yield_frac; + inject_pathway_props->grain_yields.data[grain_species_idx][pathway_idx] = + yield_info.nonprimoridal_yield_frac; // copy the 1st, 2nd, and 3rd moments of the size distribution // (the 0th moment isn't recorded anywhere double* size_mom_table = - inject_pathway_props->size_moments.data[grain_species_idx]; + inject_pathway_props->size_moments.data[grain_species_idx]; for (int i = 0; i < 3; i++) { - size_mom_table[pathway_idx*3+i] = yield_info.size_moments[i]; + size_mom_table[pathway_idx * 3 + i] = yield_info.size_moments[i]; } // copy over the opacity coefficients table double* opac_coef_table = - inject_pathway_props->opacity_coef_table.data[grain_species_idx]; + inject_pathway_props->opacity_coef_table.data[grain_species_idx]; int n_Td = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; int n_coef = grackle::impl::inj_model_input::N_Opacity_Coef; @@ -197,9 +191,7 @@ extern "C" int setup_yield_table_callback( opac_coef_table[i] = yield_info.opacity_coef_table[i_Td][i_coef]; } } - } - } (my_ctx->counter)++; @@ -213,40 +205,39 @@ extern "C" int setup_yield_table_callback( /// to start, this only handles the grain yields void zero_out_dust_inject_props( grackle::impl::GrainMetalInjectPathways* inject_pathway_props) { - const int n_grain_species = OnlyGrainSpLUT::NUM_ENTRIES; int n_pathways = inject_pathway_props->n_pathways; // handle the grain yields for (int grain_species_idx = 0; grain_species_idx < n_grain_species; - grain_species_idx++){ + grain_species_idx++) { double* arr = inject_pathway_props->grain_yields.data[grain_species_idx]; - for(int iSN = 0; iSN < n_pathways; iSN++) { + for (int iSN = 0; iSN < n_pathways; iSN++) { arr[iSN] = 0.0; } } // handle the size moments - int moment_table_len = n_pathways * 3; // there are 3 size moments + int moment_table_len = n_pathways * 3; // there are 3 size moments for (int grain_species_idx = 0; grain_species_idx < n_grain_species; - grain_species_idx++){ + grain_species_idx++) { double* arr = inject_pathway_props->size_moments.data[grain_species_idx]; - for(int i = 0; i < moment_table_len; i++) { + for (int i = 0; i < moment_table_len; i++) { arr[i] = 0.0; } } // handle the opacity coefficient table - long long opac_table_len = ( - static_cast(n_pathways) * - static_cast(inject_pathway_props->n_opac_poly_coef) * - inject_pathway_props->log10Tdust_interp_props.dimension[0]); + long long opac_table_len = + (static_cast(n_pathways) * + static_cast(inject_pathway_props->n_opac_poly_coef) * + inject_pathway_props->log10Tdust_interp_props.dimension[0]); for (int grain_species_idx = 0; grain_species_idx < n_grain_species; - grain_species_idx++){ + grain_species_idx++) { double* arr = - inject_pathway_props->opacity_coef_table.data[grain_species_idx]; - for(long long i = 0LL; i < opac_table_len; i++) { + inject_pathway_props->opacity_coef_table.data[grain_species_idx]; + for (long long i = 0LL; i < opac_table_len; i++) { arr[i] = 0.0; } } @@ -254,9 +245,8 @@ void zero_out_dust_inject_props( } // anonymous namespace -int grackle::impl::load_inject_path_data(const chemistry_data *my_chemistry, - chemistry_data_storage *my_rates) -{ +int grackle::impl::load_inject_path_data(const chemistry_data* my_chemistry, + chemistry_data_storage* my_rates) { // Currently, this function "loads" injection pathway data from data that is // directly embedded as part of the Grackle library in a manner controlled // by raw_data.hpp and raw_data.cpp @@ -271,27 +261,27 @@ int grackle::impl::load_inject_path_data(const chemistry_data *my_chemistry, // -> in the future, we are going to move away from this hardcoded approach // -> since the strings are statically allocates, the map won't make copies // of the strings - constexpr int n_pathways = static_cast( - sizeof(known_inj_path_names) / sizeof(char*)); + constexpr int n_pathways = + static_cast(sizeof(known_inj_path_names) / sizeof(char*)); FrozenKeyIdxBiMap inj_path_names = new_FrozenKeyIdxBiMap( known_inj_path_names, n_pathways, BiMapMode::REFS_KEYDATA); if (!FrozenKeyIdxBiMap_is_ok(&inj_path_names)) { return GrPrintAndReturnErr( - "there was a problem building the map of model names"); + "there was a problem building the map of model names"); } // initialize the object that will hold the loaded data int n_log10Tdust_vals = grackle::impl::inj_model_input::N_Tdust_Opacity_Table; int n_opac_poly_coef = grackle::impl::inj_model_input::N_Opacity_Coef; my_rates->opaque_storage->inject_pathway_props = - new grackle::impl::GrainMetalInjectPathways; + new grackle::impl::GrainMetalInjectPathways; *(my_rates->opaque_storage->inject_pathway_props) = - new_GrainMetalInjectPathways(n_pathways, n_log10Tdust_vals, - n_opac_poly_coef); + new_GrainMetalInjectPathways(n_pathways, n_log10Tdust_vals, + n_opac_poly_coef); - grackle::impl::GrainMetalInjectPathways* inject_pathway_props - = my_rates->opaque_storage->inject_pathway_props; + grackle::impl::GrainMetalInjectPathways* inject_pathway_props = + my_rates->opaque_storage->inject_pathway_props; if (!GrainMetalInjectPathways_is_valid(inject_pathway_props)) { drop_FrozenKeyIdxBiMap(&inj_path_names); @@ -302,32 +292,33 @@ int grackle::impl::load_inject_path_data(const chemistry_data *my_chemistry, double log10Tdust_lo = 0.0; double log10Tdust_step = 0.1; - inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0] - = log10Tdust_step; + inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0] = + log10Tdust_step; double* log10Tdust_vals = - inject_pathway_props->log10Tdust_interp_props.parameters[0]; - for(int iTd = 0; iTd < n_log10Tdust_vals; iTd++) { + inject_pathway_props->log10Tdust_interp_props.parameters[0]; + for (int iTd = 0; iTd < n_log10Tdust_vals; iTd++) { log10Tdust_vals[iTd] = log10Tdust_lo + (double)iTd * log10Tdust_step; } // zero-out all metal injection yield fractions and dust grain properties yields::MetalTables_zero_out( &inject_pathway_props->total_metal_nuclide_yields, n_pathways); - yields::MetalTables_zero_out( - &inject_pathway_props->gas_metal_nuclide_yields, n_pathways); + yields::MetalTables_zero_out(&inject_pathway_props->gas_metal_nuclide_yields, + n_pathways); zero_out_dust_inject_props(inject_pathway_props); // actually load in the data for each injection pathway - GrainSpeciesInfo* grain_species_info = - my_rates->opaque_storage->grain_species_info; + GrainSpeciesInfo* grain_species_info = + my_rates->opaque_storage->grain_species_info; const FrozenKeyIdxBiMap* grain_species_names = - (grain_species_info == nullptr) ? nullptr : &grain_species_info->name_map; + (grain_species_info == nullptr) ? nullptr : &grain_species_info->name_map; SetupCallbackCtx ctx = { - /* inject_pathway_props = */ my_rates->opaque_storage->inject_pathway_props, - /* counter = */ 0, - /* inj_path_names = */ &inj_path_names, - /* grain_species_names = */ grain_species_names, + /* inject_pathway_props = */ my_rates->opaque_storage + ->inject_pathway_props, + /* counter = */ 0, + /* inj_path_names = */ &inj_path_names, + /* grain_species_names = */ grain_species_names, }; int ret = grackle::impl::inj_model_input::input_inject_model_iterate( @@ -340,8 +331,8 @@ int grackle::impl::load_inject_path_data(const chemistry_data *my_chemistry, "injection pathway"); } else if (ctx.counter != n_pathways) { return GrPrintAndReturnErr( - "Only loaded data for %d of the %d available pathways", - ctx.counter, n_pathways); + "Only loaded data for %d of the %d available pathways", ctx.counter, + n_pathways); } return GR_SUCCESS; diff --git a/src/clib/lookup_cool_rates1d.hpp b/src/clib/lookup_cool_rates1d.hpp index b3387e3a1..fb041799f 100644 --- a/src/clib/lookup_cool_rates1d.hpp +++ b/src/clib/lookup_cool_rates1d.hpp @@ -809,11 +809,10 @@ inline void lookup_cool_rates1d( // Compute grain size increment if ((anydust != MASK_FALSE) && (my_chemistry->dust_species > 0)) { - f_wrap::calc_grain_size_increment_1d(dom, idx_range, itmask_metal, - my_chemistry, - my_rates->opaque_storage->inject_pathway_props, - my_fields, - internal_dust_prop_scratch_buf); + f_wrap::calc_grain_size_increment_1d( + dom, idx_range, itmask_metal, my_chemistry, + my_rates->opaque_storage->inject_pathway_props, my_fields, + internal_dust_prop_scratch_buf); } // Look-up rate for H2 formation on dust & (when relevant) grain growth rates diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index 2734ed35a..5363c2fea 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -26,9 +26,10 @@ namespace grackle::impl { -void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, - const grackle::impl::GrainMetalInjectPathways* inject_pathway_props, - grackle_field_data* my_fields) { +void make_consistent( + int imetal, double dom, chemistry_data* my_chemistry, + const grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + grackle_field_data* my_fields) { // Arguments grackle::impl::View de( @@ -244,8 +245,8 @@ void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, gr_float correctCd, correctOd, correctMgd, correctSid, correctFed; int iSN, iSN0; - const int n_pathways = (inject_pathway_props == nullptr) ? 0 : - inject_pathway_props->n_pathways; + const int n_pathways = + (inject_pathway_props == nullptr) ? 0 : inject_pathway_props->n_pathways; std::vector SN_metal_data_(my_fields->grid_dimension[0] * n_pathways); grackle::impl::View SN_metal; diff --git a/src/clib/make_consistent.hpp b/src/clib/make_consistent.hpp index 2edb6c91f..d571b0428 100644 --- a/src/clib/make_consistent.hpp +++ b/src/clib/make_consistent.hpp @@ -30,9 +30,10 @@ namespace grackle::impl { /// @param[in] inject_pathway_props holds data about the modelled injection /// pathways for all metals and grain species /// @param[in] my_fields specifies the field data -void make_consistent(int imetal, double dom, chemistry_data* my_chemistry, - const grackle::impl::GrainMetalInjectPathways* inject_pathway_props, - grackle_field_data* my_fields); +void make_consistent( + int imetal, double dom, chemistry_data* my_chemistry, + const grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + grackle_field_data* my_fields); } // namespace grackle::impl From d8137d6af7689a8a5ef5d4d0fbe686144aa5d02b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 09:47:37 -0500 Subject: [PATCH 066/111] update Makefile to remove object files in subdirectories --- src/clib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clib/Makefile b/src/clib/Makefile index 9a5563757..d7866478e 100644 --- a/src/clib/Makefile +++ b/src/clib/Makefile @@ -338,7 +338,8 @@ install: #----------------------------------------------------------------------- clean: - -@rm -f *.la .libs/* *.o *.lo DEPEND.bak *~ $(OUTPUT) *.exe DEPEND out.make.DEPEND + -@rm -f *.la .libs/* DEPEND.bak *~ $(OUTPUT) *.exe DEPEND out.make.DEPEND + -@find . \( -name '*.o' -o -name '*.lo' \) -exec rm '{}' \; -@rm -rf $(AUTOGEN_DIR) -@touch DEPEND From 721d1a0d0794e334a508676709857782c675ff53 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 10:33:45 -0500 Subject: [PATCH 067/111] fix a few typos --- src/clib/dust/grain_species_info.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/clib/dust/grain_species_info.hpp b/src/clib/dust/grain_species_info.hpp index b306c154e..bddafc11d 100644 --- a/src/clib/dust/grain_species_info.hpp +++ b/src/clib/dust/grain_species_info.hpp @@ -81,17 +81,17 @@ struct GrainSpeciesInfoEntry { /// Relationship with OnlyGrainSpLUT /// -------------------------------- /// In the short term, the index of each species in the -/// @ref GrainSpeciesInfo::species_info out.species_infoay is dictated by the +/// @ref GrainSpeciesInfo::species_info out.species_info is dictated by the /// order of enumerators in the OnlyGrainSpLUT enumeration. /// /// In the medium term, we plan to entirely eliminate the OnlyGrainSpLUT -/// enumeration because all of the grain species can be treated very uniformly -/// uniformly. At the time of writing, just about every place where we would -/// use OnlyGrainSpLUT corresponds to a location where would enumerate every +/// enumeration because all of the grain species can be treated very uniformly. +/// At the time of writing, just about every place where we would use +/// OnlyGrainSpLUT corresponds to a location where we would enumerate every /// possible grain species and perform nearly identical operations on each /// species. In each case, it is straight-forward to replace these blocks of /// logic with for-loops (we just need to encode species-specific variations in -/// the calculations in out.species_infoays that have the same ordering as the +/// the calculations in out.species_info that have the same ordering as the /// species). To phrase it another way, in nearly all of the places where we /// would use OnlyGrainSpLUT, we don't need to know the grain species identity. /// @@ -102,7 +102,7 @@ struct GrainSpeciesInfo { /// number of grain species considered for the current Grackle configuration int n_species; - /// an out.species_infoay of length of length @ref n_species where each entry + /// an out.species_info of length of length @ref n_species where each entry /// holds info about a separate grain species GrainSpeciesInfoEntry* species_info; From eca5fb0f00d65b99392c22b63f56c92e5c1fb30f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 10:39:18 -0500 Subject: [PATCH 068/111] another tweak to `make clean` --- src/clib/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/clib/Makefile b/src/clib/Makefile index d7866478e..10800b9ab 100644 --- a/src/clib/Makefile +++ b/src/clib/Makefile @@ -338,9 +338,10 @@ install: #----------------------------------------------------------------------- clean: - -@rm -f *.la .libs/* DEPEND.bak *~ $(OUTPUT) *.exe DEPEND out.make.DEPEND - -@find . \( -name '*.o' -o -name '*.lo' \) -exec rm '{}' \; + -@rm -f *.la DEPEND.bak *~ $(OUTPUT) *.exe DEPEND out.make.DEPEND -@rm -rf $(AUTOGEN_DIR) + -@find . -type d -name '.libs' -exec rm -rf '{}' + + -@find . \( -name '*.o' -o -name '*.lo' \) -exec rm -f '{}' \; -@touch DEPEND #----------------------------------------------------------------------- From 38a1685fa87830f271098933a446e4f57f7f4b13 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 14:54:22 -0500 Subject: [PATCH 069/111] Introduce ``InjectPathFieldPack`` 1/3 Essentially, this type holds pointers to the various injection pathway fields in the order that is implicitly assumed throughout the codebase. This change helps simplify make_consistent and it will also simplify `calc_grain_size_increment_1d` (once transcribed). Longer term, I have a plan that will let use dispose of this ``InjectPathFieldPack`` type (but, we need to make a few changes before we get to that). --- src/clib/CMakeLists.txt | 1 + .../inject_model/inject_path_field_pack.hpp | 60 +++++++++++ src/clib/inject_model/load_data.cpp | 8 +- src/clib/inject_model/raw_data.hpp | 3 + src/clib/make_consistent.cpp | 100 ++++++------------ 5 files changed, 101 insertions(+), 71 deletions(-) create mode 100644 src/clib/inject_model/inject_path_field_pack.hpp diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index f96e50882..5ac458b1d 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -117,6 +117,7 @@ add_library(Grackle_Grackle initialize_chemistry_data.cpp initialize_rates.cpp initialize_rates.hpp inject_model/grain_metal_inject_pathways.hpp + inject_model/inject_path_field_pack.hpp inject_model/load_data.cpp inject_model/load_data.hpp inject_model/raw_data.cpp inject_model/raw_data.hpp internal_types.cpp internal_types.hpp diff --git a/src/clib/inject_model/inject_path_field_pack.hpp b/src/clib/inject_model/inject_path_field_pack.hpp new file mode 100644 index 000000000..67e05fcb5 --- /dev/null +++ b/src/clib/inject_model/inject_path_field_pack.hpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Declares the InjectPathFieldPack type +/// +//===----------------------------------------------------------------------===// +#ifndef INJECT_MODEL_INJECT_PATH_FIELD_PACK_HPP +#define INJECT_MODEL_INJECT_PATH_FIELD_PACK_HPP + +#include "raw_data.hpp" // grackle::impl::inj_model_input::N_Injection_Pathways + +namespace grackle::impl { + +/// A temporary type that is used to collect the injection pathway metal +/// density fields in the order that is assumed throughout Grackle +/// +/// I have some ideas that will let us dispose of this type in the near future. +struct InjectPathFieldPack { + const gr_float* fields[inj_model_input::N_Injection_Pathways]; +}; + +/// Setup an InjectPathFieldPack instance +inline InjectPathFieldPack setup_InjectPathFieldPack( + const chemistry_data* my_chem, const grackle_field_data* my_fields) { + if ((my_chem->metal_chemistry > 0) && (my_chem->multi_metals == 1)) { + return InjectPathFieldPack{{ + my_fields->local_ISM_metal_density, + my_fields->ccsn13_metal_density, + my_fields->ccsn20_metal_density, + my_fields->ccsn25_metal_density, + my_fields->ccsn30_metal_density, + my_fields->fsn13_metal_density, + my_fields->fsn15_metal_density, + my_fields->fsn50_metal_density, + my_fields->fsn80_metal_density, + my_fields->pisn170_metal_density, + my_fields->pisn200_metal_density, + my_fields->y19_metal_density, + }}; + } + + InjectPathFieldPack out; + for (int i = 0; i < inj_model_input::N_Injection_Pathways; i++) { + out.fields[i] = nullptr; + } + + if ((my_chem->metal_chemistry > 0) && (my_chem->multi_metals == 0)) { + out.fields[my_chem->metal_abundances] = my_fields->metal_density; + } + return out; +} + +} // namespace grackle::impl + +#endif /* INJECT_MODEL_INJECT_PATH_FIELD_PACK_HPP */ diff --git a/src/clib/inject_model/load_data.cpp b/src/clib/inject_model/load_data.cpp index ca13dc6ce..ed3af2408 100644 --- a/src/clib/inject_model/load_data.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -23,7 +23,7 @@ namespace { // stuff inside an anonymous namespace is local to this file /// names of all injection pathways known to grackle listed in the order -/// in other parts of the codebase +/// consistent with the logic for implementing InjectPathFieldPack /// /// @see SetupCallbackCtx::inj_path_names - The entity that is initialized with /// the values in this variable. Its docstring provides more details. @@ -32,6 +32,12 @@ constexpr const char* const known_inj_path_names[] = { "fsn15", "fsn50", "fsn80", "pisn170", "pisn200", "y19", }; +static_assert(sizeof(known_inj_path_names) == + (sizeof(char*) * + grackle::impl::inj_model_input::N_Injection_Pathways), + "inconsistency b/t number of entries in known_inj_path_names and " + "grackle::impl::inj_model_input::N_Injection_Pathways"); + /// a crude map-like function bool lookup_metal_yield_ptrs( grackle::impl::GrainMetalInjectPathways* inject_pathway_props, diff --git a/src/clib/inject_model/raw_data.hpp b/src/clib/inject_model/raw_data.hpp index c1e2ddc03..6486b5602 100644 --- a/src/clib/inject_model/raw_data.hpp +++ b/src/clib/inject_model/raw_data.hpp @@ -36,6 +36,9 @@ static constexpr int N_Opacity_Coef = 4; /// and injection pathway. For each Tdust, there are N_Opacity_Coef coefficients static constexpr int N_Tdust_Opacity_Table = 35; +/// the number of hard-coded injection pathways +static constexpr int N_Injection_Pathways = 12; + struct MetalNuclideYieldProps; struct GrainSpeciesYieldProps; diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index 5363c2fea..6e78e22c0 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -19,6 +19,7 @@ #include "grackle.h" #include "fortran_func_decls.h" #include "inject_model/grain_metal_inject_pathways.hpp" +#include "inject_model/inject_path_field_pack.hpp" #include "opaque_storage.hpp" #include "utils-cpp.hpp" @@ -191,42 +192,6 @@ void make_consistent( grackle::impl::View H2Oice( my_fields->H2O_ice_dust_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_loc( - my_fields->local_ISM_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C13( - my_fields->ccsn13_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C20( - my_fields->ccsn20_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C25( - my_fields->ccsn25_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C30( - my_fields->ccsn30_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F13( - my_fields->fsn13_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F15( - my_fields->fsn15_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F50( - my_fields->fsn50_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F80( - my_fields->fsn80_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_P170( - my_fields->pisn170_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_P200( - my_fields->pisn200_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_Y19( - my_fields->y19_metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); // locals @@ -249,10 +214,18 @@ void make_consistent( (inject_pathway_props == nullptr) ? 0 : inject_pathway_props->n_pathways; std::vector SN_metal_data_(my_fields->grid_dimension[0] * n_pathways); - grackle::impl::View SN_metal; - if (n_pathways > 0) { - SN_metal = grackle::impl::View( - SN_metal_data_.data(), my_fields->grid_dimension[0], n_pathways); + + grackle::impl::View + SN_metal_arr[inj_model_input::N_Injection_Pathways]; + if ((my_chemistry->metal_chemistry > 0) && + (my_chemistry->multi_metals == 1)) { + InjectPathFieldPack tmp = + setup_InjectPathFieldPack(my_chemistry, my_fields); + for (int i = 0; i < n_pathways; i++) { + SN_metal_arr[i] = grackle::impl::View( + tmp.fields[i], my_fields->grid_dimension[0], + my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + } } std::vector Ct(my_fields->grid_dimension[0]); std::vector Ot(my_fields->grid_dimension[0]); @@ -397,21 +370,6 @@ void make_consistent( // metal_Y19(i,j,k) = metal_Y19(i,j,k) * correctZ // enddo - for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { - SN_metal(i, 0) = metal_loc(i, j, k); - SN_metal(i, 1) = metal_C13(i, j, k); - SN_metal(i, 2) = metal_C20(i, j, k); - SN_metal(i, 3) = metal_C25(i, j, k); - SN_metal(i, 4) = metal_C30(i, j, k); - SN_metal(i, 5) = metal_F13(i, j, k); - SN_metal(i, 6) = metal_F15(i, j, k); - SN_metal(i, 7) = metal_F50(i, j, k); - SN_metal(i, 8) = metal_F80(i, j, k); - SN_metal(i, 9) = metal_P170(i, j, k); - SN_metal(i, 10) = metal_P200(i, j, k); - SN_metal(i, 11) = metal_Y19(i, j, k); - } - for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { Ct[i] = 0.; Cg[i] = 0.; @@ -428,21 +386,23 @@ void make_consistent( Fet[i] = 0.; Feg[i] = 0.; for (iSN = 0; iSN < n_pathways; iSN++) { - Ct[i] = Ct[i] + total_metal_yields.C[iSN] * SN_metal(i, iSN); - Ot[i] = Ot[i] + total_metal_yields.O[iSN] * SN_metal(i, iSN); - Mgt[i] = Mgt[i] + total_metal_yields.Mg[iSN] * SN_metal(i, iSN); - Alt[i] = Alt[i] + total_metal_yields.Al[iSN] * SN_metal(i, iSN); - Sit[i] = Sit[i] + total_metal_yields.Si[iSN] * SN_metal(i, iSN); - St[i] = St[i] + total_metal_yields.S[iSN] * SN_metal(i, iSN); - Fet[i] = Fet[i] + total_metal_yields.Fe[iSN] * SN_metal(i, iSN); - - Cg[i] = Cg[i] + onlygas_metal_yields.C[iSN] * SN_metal(i, iSN); - Og[i] = Og[i] + onlygas_metal_yields.O[iSN] * SN_metal(i, iSN); - Mgg[i] = Mgg[i] + onlygas_metal_yields.Mg[iSN] * SN_metal(i, iSN); - Alg[i] = Alg[i] + onlygas_metal_yields.Al[iSN] * SN_metal(i, iSN); - Sig[i] = Sig[i] + onlygas_metal_yields.Si[iSN] * SN_metal(i, iSN); - Sg[i] = Sg[i] + onlygas_metal_yields.S[iSN] * SN_metal(i, iSN); - Feg[i] = Feg[i] + onlygas_metal_yields.Fe[iSN] * SN_metal(i, iSN); + gr_float cur_val = SN_metal_arr[iSN](i, j, k); + + Ct[i] = Ct[i] + total_metal_yields.C[iSN] * cur_val; + Ot[i] = Ot[i] + total_metal_yields.O[iSN] * cur_val; + Mgt[i] = Mgt[i] + total_metal_yields.Mg[iSN] * cur_val; + Alt[i] = Alt[i] + total_metal_yields.Al[iSN] * cur_val; + Sit[i] = Sit[i] + total_metal_yields.Si[iSN] * cur_val; + St[i] = St[i] + total_metal_yields.S[iSN] * cur_val; + Fet[i] = Fet[i] + total_metal_yields.Fe[iSN] * cur_val; + + Cg[i] = Cg[i] + onlygas_metal_yields.C[iSN] * cur_val; + Og[i] = Og[i] + onlygas_metal_yields.O[iSN] * cur_val; + Mgg[i] = Mgg[i] + onlygas_metal_yields.Mg[iSN] * cur_val; + Alg[i] = Alg[i] + onlygas_metal_yields.Al[iSN] * cur_val; + Sig[i] = Sig[i] + onlygas_metal_yields.Si[iSN] * cur_val; + Sg[i] = Sg[i] + onlygas_metal_yields.S[iSN] * cur_val; + Feg[i] = Feg[i] + onlygas_metal_yields.Fe[iSN] * cur_val; } } } From 530aae34956dd7443f231cd58a6c9825240dafd7 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 15:58:11 -0500 Subject: [PATCH 070/111] Introduce ``InjectPathFieldPack`` 2/3 Introduce the start_idx and stop_idx members to the struct --- .../inject_model/inject_path_field_pack.hpp | 47 +++++++++++++------ src/clib/make_consistent.cpp | 33 ++++++++----- 2 files changed, 53 insertions(+), 27 deletions(-) diff --git a/src/clib/inject_model/inject_path_field_pack.hpp b/src/clib/inject_model/inject_path_field_pack.hpp index 67e05fcb5..0dd2526fd 100644 --- a/src/clib/inject_model/inject_path_field_pack.hpp +++ b/src/clib/inject_model/inject_path_field_pack.hpp @@ -21,6 +21,15 @@ namespace grackle::impl { /// /// I have some ideas that will let us dispose of this type in the near future. struct InjectPathFieldPack { + /// Specifies the bounds for a for-loop that you would use to iterate over + /// all relevant injection model density fields that are present in fields + /// + /// @todo + /// Some changes are required before we can safely assume that start_idx is + /// always 0 + int start_idx, stop_idx; + + /// holds pointers to the various injection model density fields const gr_float* fields[inj_model_input::N_Injection_Pathways]; }; @@ -28,20 +37,24 @@ struct InjectPathFieldPack { inline InjectPathFieldPack setup_InjectPathFieldPack( const chemistry_data* my_chem, const grackle_field_data* my_fields) { if ((my_chem->metal_chemistry > 0) && (my_chem->multi_metals == 1)) { - return InjectPathFieldPack{{ - my_fields->local_ISM_metal_density, - my_fields->ccsn13_metal_density, - my_fields->ccsn20_metal_density, - my_fields->ccsn25_metal_density, - my_fields->ccsn30_metal_density, - my_fields->fsn13_metal_density, - my_fields->fsn15_metal_density, - my_fields->fsn50_metal_density, - my_fields->fsn80_metal_density, - my_fields->pisn170_metal_density, - my_fields->pisn200_metal_density, - my_fields->y19_metal_density, - }}; + return InjectPathFieldPack{ + /* start_idx = */ 0, + /* stop_idx = */ inj_model_input::N_Injection_Pathways, + /* fields = */ + { + my_fields->local_ISM_metal_density, + my_fields->ccsn13_metal_density, + my_fields->ccsn20_metal_density, + my_fields->ccsn25_metal_density, + my_fields->ccsn30_metal_density, + my_fields->fsn13_metal_density, + my_fields->fsn15_metal_density, + my_fields->fsn50_metal_density, + my_fields->fsn80_metal_density, + my_fields->pisn170_metal_density, + my_fields->pisn200_metal_density, + my_fields->y19_metal_density, + }}; } InjectPathFieldPack out; @@ -50,8 +63,14 @@ inline InjectPathFieldPack setup_InjectPathFieldPack( } if ((my_chem->metal_chemistry > 0) && (my_chem->multi_metals == 0)) { + out.start_idx = my_chem->metal_abundances; + out.stop_idx = out.start_idx + 1; out.fields[my_chem->metal_abundances] = my_fields->metal_density; + } else { + out.start_idx = 0; + out.stop_idx = out.start_idx; } + return out; } diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index 6e78e22c0..cbd4dca47 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -208,25 +208,32 @@ void make_consistent( correctFe; gr_float correctCg, correctOg, correctMgg, correctSig, correctFeg; gr_float correctCd, correctOd, correctMgd, correctSid, correctFed; - int iSN, iSN0; - - const int n_pathways = - (inject_pathway_props == nullptr) ? 0 : inject_pathway_props->n_pathways; - std::vector SN_metal_data_(my_fields->grid_dimension[0] * - n_pathways); + // when relevant, each view within SN_metal_arr wraps a field specifying the + // total metal density that corresponds to an injection pathway grackle::impl::View SN_metal_arr[inj_model_input::N_Injection_Pathways]; + // declare variables used to hold bounds for iterating over SN_metal_arr + int inj_path_idx_start, inj_path_idx_stop; + + // construct view of each specified injection pathway metal density field if ((my_chemistry->metal_chemistry > 0) && (my_chemistry->multi_metals == 1)) { - InjectPathFieldPack tmp = - setup_InjectPathFieldPack(my_chemistry, my_fields); - for (int i = 0; i < n_pathways; i++) { - SN_metal_arr[i] = grackle::impl::View( - tmp.fields[i], my_fields->grid_dimension[0], + InjectPathFieldPack p = setup_InjectPathFieldPack(my_chemistry, my_fields); + + inj_path_idx_start = p.start_idx; + inj_path_idx_stop = p.stop_idx; + + for (int iSN = inj_path_idx_start; iSN < inj_path_idx_stop; iSN++) { + SN_metal_arr[iSN] = grackle::impl::View( + p.fields[iSN], my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); } + } else { + inj_path_idx_start = 0; + inj_path_idx_stop = 0; } + std::vector Ct(my_fields->grid_dimension[0]); std::vector Ot(my_fields->grid_dimension[0]); std::vector Mgt(my_fields->grid_dimension[0]); @@ -327,7 +334,7 @@ void make_consistent( inject_pathway_props->gas_metal_nuclide_yields; if (my_chemistry->multi_metals == 0) { // case with 1 injection pathway - iSN0 = my_chemistry->metal_abundances; + int iSN0 = my_chemistry->metal_abundances; for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { Ct[i] = total_metal_yields.C[iSN0] * metal(i, j, k); Ot[i] = total_metal_yields.O[iSN0] * metal(i, j, k); @@ -385,7 +392,7 @@ void make_consistent( Sg[i] = 0.; Fet[i] = 0.; Feg[i] = 0.; - for (iSN = 0; iSN < n_pathways; iSN++) { + for (int iSN = inj_path_idx_start; iSN < inj_path_idx_stop; iSN++) { gr_float cur_val = SN_metal_arr[iSN](i, j, k); Ct[i] = Ct[i] + total_metal_yields.C[iSN] * cur_val; From f6bf2460eeec38e32d4205545627a033ef492961 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 16:36:40 -0500 Subject: [PATCH 071/111] Introduce ``InjectPathFieldPack`` 3/3 Use the start_idx and stop_idx members to simplify make_consistent --- src/clib/make_consistent.cpp | 132 ++++++++++++----------------------- 1 file changed, 46 insertions(+), 86 deletions(-) diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index cbd4dca47..8d520497e 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -51,12 +51,14 @@ void make_consistent( grackle::impl::View HeIII( my_fields->HeIII_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View d( - my_fields->density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal( - my_fields->metal_density, my_fields->grid_dimension[0], - my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View d( + const_cast(my_fields->density), + my_fields->grid_dimension[0], my_fields->grid_dimension[1], + my_fields->grid_dimension[2]); + grackle::impl::View metal( + const_cast(my_fields->metal_density), + my_fields->grid_dimension[0], my_fields->grid_dimension[1], + my_fields->grid_dimension[2]); grackle::impl::View HM( my_fields->HM_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); @@ -217,8 +219,11 @@ void make_consistent( int inj_path_idx_start, inj_path_idx_stop; // construct view of each specified injection pathway metal density field - if ((my_chemistry->metal_chemistry > 0) && - (my_chemistry->multi_metals == 1)) { + if (my_chemistry->metal_chemistry > 0) { + // note: when (my_chemistry->multi_metals == 0) a view within + // SN_metal_arr will wrap my_fields->metal_density. In other words, + // that view will be an alias of the `metal` view. This is ok because + // my_fields->metal_density is **NOT** mutated by this function. InjectPathFieldPack p = setup_InjectPathFieldPack(my_chemistry, my_fields); inj_path_idx_start = p.start_idx; @@ -333,84 +338,39 @@ void make_consistent( const grackle::impl::yields::MetalTables& onlygas_metal_yields = inject_pathway_props->gas_metal_nuclide_yields; - if (my_chemistry->multi_metals == 0) { // case with 1 injection pathway - int iSN0 = my_chemistry->metal_abundances; - for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { - Ct[i] = total_metal_yields.C[iSN0] * metal(i, j, k); - Ot[i] = total_metal_yields.O[iSN0] * metal(i, j, k); - Mgt[i] = total_metal_yields.Mg[iSN0] * metal(i, j, k); - Alt[i] = total_metal_yields.Al[iSN0] * metal(i, j, k); - Sit[i] = total_metal_yields.Si[iSN0] * metal(i, j, k); - St[i] = total_metal_yields.S[iSN0] * metal(i, j, k); - Fet[i] = total_metal_yields.Fe[iSN0] * metal(i, j, k); - - Cg[i] = onlygas_metal_yields.C[iSN0] * metal(i, j, k); - Og[i] = onlygas_metal_yields.O[iSN0] * metal(i, j, k); - Mgg[i] = onlygas_metal_yields.Mg[iSN0] * metal(i, j, k); - Alg[i] = onlygas_metal_yields.Al[iSN0] * metal(i, j, k); - Sig[i] = onlygas_metal_yields.Si[iSN0] * metal(i, j, k); - Sg[i] = onlygas_metal_yields.S[iSN0] * metal(i, j, k); - Feg[i] = onlygas_metal_yields.Fe[iSN0] * metal(i, j, k); - } - - } else { // case with multiple injection pathways - // do i = is+1, ie+1 - // totalZ = metal_loc(i,j,k) - // & + metal_C13(i,j,k) + metal_C20(i,j,k) - // & + metal_C25(i,j,k) + metal_C30(i,j,k) - // & + metal_F13(i,j,k) + metal_F15(i,j,k) - // & + metal_F50(i,j,k) + metal_F80(i,j,k) - // & + metal_P170(i,j,k)+ metal_P200(i,j,k) - // & + metal_Y19(i,j,k) - // correctZ = metal(i,j,k) / totalZ - // metal_loc(i,j,k) = metal_loc(i,j,k) * correctZ - // metal_C13(i,j,k) = metal_C13(i,j,k) * correctZ - // metal_C20(i,j,k) = metal_C20(i,j,k) * correctZ - // metal_C25(i,j,k) = metal_C25(i,j,k) * correctZ - // metal_C30(i,j,k) = metal_C30(i,j,k) * correctZ - // metal_F13(i,j,k) = metal_F13(i,j,k) * correctZ - // metal_F15(i,j,k) = metal_F15(i,j,k) * correctZ - // metal_F50(i,j,k) = metal_F50(i,j,k) * correctZ - // metal_F80(i,j,k) = metal_F80(i,j,k) * correctZ - // metal_P170(i,j,k)= metal_P170(i,j,k)* correctZ - // metal_P200(i,j,k)= metal_P200(i,j,k)* correctZ - // metal_Y19(i,j,k) = metal_Y19(i,j,k) * correctZ - // enddo - - for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { - Ct[i] = 0.; - Cg[i] = 0.; - Ot[i] = 0.; - Og[i] = 0.; - Mgt[i] = 0.; - Mgg[i] = 0.; - Alt[i] = 0.; - Alg[i] = 0.; - Sit[i] = 0.; - Sig[i] = 0.; - St[i] = 0.; - Sg[i] = 0.; - Fet[i] = 0.; - Feg[i] = 0.; - for (int iSN = inj_path_idx_start; iSN < inj_path_idx_stop; iSN++) { - gr_float cur_val = SN_metal_arr[iSN](i, j, k); - - Ct[i] = Ct[i] + total_metal_yields.C[iSN] * cur_val; - Ot[i] = Ot[i] + total_metal_yields.O[iSN] * cur_val; - Mgt[i] = Mgt[i] + total_metal_yields.Mg[iSN] * cur_val; - Alt[i] = Alt[i] + total_metal_yields.Al[iSN] * cur_val; - Sit[i] = Sit[i] + total_metal_yields.Si[iSN] * cur_val; - St[i] = St[i] + total_metal_yields.S[iSN] * cur_val; - Fet[i] = Fet[i] + total_metal_yields.Fe[iSN] * cur_val; - - Cg[i] = Cg[i] + onlygas_metal_yields.C[iSN] * cur_val; - Og[i] = Og[i] + onlygas_metal_yields.O[iSN] * cur_val; - Mgg[i] = Mgg[i] + onlygas_metal_yields.Mg[iSN] * cur_val; - Alg[i] = Alg[i] + onlygas_metal_yields.Al[iSN] * cur_val; - Sig[i] = Sig[i] + onlygas_metal_yields.Si[iSN] * cur_val; - Sg[i] = Sg[i] + onlygas_metal_yields.S[iSN] * cur_val; - Feg[i] = Feg[i] + onlygas_metal_yields.Fe[iSN] * cur_val; - } + for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) { + Ct[i] = 0.; + Cg[i] = 0.; + Ot[i] = 0.; + Og[i] = 0.; + Mgt[i] = 0.; + Mgg[i] = 0.; + Alt[i] = 0.; + Alg[i] = 0.; + Sit[i] = 0.; + Sig[i] = 0.; + St[i] = 0.; + Sg[i] = 0.; + Fet[i] = 0.; + Feg[i] = 0.; + for (int iSN = inj_path_idx_start; iSN < inj_path_idx_stop; iSN++) { + gr_float cur_val = SN_metal_arr[iSN](i, j, k); + + Ct[i] = Ct[i] + total_metal_yields.C[iSN] * cur_val; + Ot[i] = Ot[i] + total_metal_yields.O[iSN] * cur_val; + Mgt[i] = Mgt[i] + total_metal_yields.Mg[iSN] * cur_val; + Alt[i] = Alt[i] + total_metal_yields.Al[iSN] * cur_val; + Sit[i] = Sit[i] + total_metal_yields.Si[iSN] * cur_val; + St[i] = St[i] + total_metal_yields.S[iSN] * cur_val; + Fet[i] = Fet[i] + total_metal_yields.Fe[iSN] * cur_val; + + Cg[i] = Cg[i] + onlygas_metal_yields.C[iSN] * cur_val; + Og[i] = Og[i] + onlygas_metal_yields.O[iSN] * cur_val; + Mgg[i] = Mgg[i] + onlygas_metal_yields.Mg[iSN] * cur_val; + Alg[i] = Alg[i] + onlygas_metal_yields.Al[iSN] * cur_val; + Sig[i] = Sig[i] + onlygas_metal_yields.Si[iSN] * cur_val; + Sg[i] = Sg[i] + onlygas_metal_yields.S[iSN] * cur_val; + Feg[i] = Feg[i] + onlygas_metal_yields.Fe[iSN] * cur_val; } } From 522b412d8491ae672abd41155e2c218cc16d496f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 17:48:43 -0500 Subject: [PATCH 072/111] calc_grain_size_increment: replace some array operations with explicit for-loops --- src/clib/calc_grain_size_increment_1d.F | 53 +++++++++++++++++++------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index 89dce70e0..a00bfc7a2 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -141,68 +141,95 @@ subroutine calc_grain_size_increment_1d( if (immulti .eq. 0) then nSN = 1 SN_i(1) = imabund + 1 - SN_metal(:,1) = metal(:,j,k) + + do i = is+1, ie+1 + SN_metal(i,1) = metal(i,j,k) + enddo else nSN = 0 if(maxval(metal_loc(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 1 - SN_metal(:,nSN) = metal_loc(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_loc(i,j,k) + enddo endif if(maxval(metal_C13(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 2 - SN_metal(:,nSN) = metal_C13(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_C13(i,j,k) + enddo endif if(maxval(metal_C20(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 3 - SN_metal(:,nSN) = metal_C20(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_C20(i,j,k) + enddo endif if(maxval(metal_C25(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 4 - SN_metal(:,nSN) = metal_C25(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_C25(i,j,k) + enddo endif if(maxval(metal_C30(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 5 - SN_metal(:,nSN) = metal_C30(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_C30(i,j,k) + enddo endif if(maxval(metal_F13(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 6 - SN_metal(:,nSN) = metal_F13(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_F13(i,j,k) + enddo endif if(maxval(metal_F15(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 7 - SN_metal(:,nSN) = metal_F15(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_F15(i,j,k) + enddo endif if(maxval(metal_F50(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 8 - SN_metal(:,nSN) = metal_F50(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_F50(i,j,k) + enddo endif if(maxval(metal_F80(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 9 - SN_metal(:,nSN) = metal_F80(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_F80(i,j,k) + enddo endif if(maxval(metal_P170(:,j,k)/metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 10 - SN_metal(:,nSN) = metal_P170(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_P170(i,j,k) + enddo endif if(maxval(metal_P200(:,j,k)/metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 11 - SN_metal(:,nSN) = metal_P200(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_P200(i,j,k) + enddo endif if(maxval(metal_Y19(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then nSN = nSN + 1 SN_i(nSN) = 12 - SN_metal(:,nSN) = metal_Y19(:,j,k) + do i = is+1, ie+1 + SN_metal(i,nSN) = metal_Y19(i,j,k) + enddo endif endif From ebc95d557bc75dca39cff3fa115ef439d5229495 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 18:02:15 -0500 Subject: [PATCH 073/111] calc_grain_size_increment: replace some array operations with explicit for-loops PART 2 --- src/clib/calc_grain_size_increment_1d.F | 69 +++++++++++++++---------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index a00bfc7a2..b0cc17a5e 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -122,7 +122,7 @@ subroutine calc_grain_size_increment_1d( & , SN_kpreforg(gr_Size,SN0_N) & , SN_kpvolorg(gr_Size,SN0_N), SN_kpH2Oice(gr_Size,SN0_N) ! local - integer i + integer i, idx !! integer iTd, iTd0 !! iSN0 = 2 @@ -238,10 +238,15 @@ subroutine calc_grain_size_increment_1d( if ( idspecies .gt. 0 ) then SN_fMgSiO3 (iSN) = SN0_fMgSiO3 (iSN0) SN_fAC (iSN) = SN0_fAC (iSN0) - SN_r0MgSiO3 (:,iSN) = SN0_r0MgSiO3 (:,iSN0) - SN_r0AC (:,iSN) = SN0_r0AC (:,iSN0) - SN_kpMgSiO3 (:,iSN) = SN0_kpMgSiO3 (:,iSN0) - SN_kpAC (:,iSN) = SN0_kpAC (:,iSN0) + + do idx = 1, 3 + SN_r0MgSiO3 (idx,iSN) = SN0_r0MgSiO3 (idx,iSN0) + SN_r0AC (idx,iSN) = SN0_r0AC (idx,iSN0) + enddo + do idx = 1, gr_Size + SN_kpMgSiO3 (idx,iSN) = SN0_kpMgSiO3 (idx,iSN0) + SN_kpAC (idx,iSN) = SN0_kpAC (idx,iSN0) + enddo endif if ( idspecies .gt. 1 ) then SN_fSiM (iSN) = SN0_fSiM (iSN0) @@ -252,33 +257,43 @@ subroutine calc_grain_size_increment_1d( SN_fMgO (iSN) = SN0_fMgO (iSN0) SN_fFeS (iSN) = SN0_fFeS (iSN0) SN_fAl2O3 (iSN) = SN0_fAl2O3 (iSN0) - SN_r0SiM (:,iSN) = SN0_r0SiM (:,iSN0) - SN_r0FeM (:,iSN) = SN0_r0FeM (:,iSN0) - SN_r0Mg2SiO4 (:,iSN) = SN0_r0Mg2SiO4 (:,iSN0) - SN_r0Fe3O4 (:,iSN) = SN0_r0Fe3O4 (:,iSN0) - SN_r0SiO2D (:,iSN) = SN0_r0SiO2D (:,iSN0) - SN_r0MgO (:,iSN) = SN0_r0MgO (:,iSN0) - SN_r0FeS (:,iSN) = SN0_r0FeS (:,iSN0) - SN_r0Al2O3 (:,iSN) = SN0_r0Al2O3 (:,iSN0) - SN_kpSiM (:,iSN) = SN0_kpSiM (:,iSN0) - SN_kpFeM (:,iSN) = SN0_kpFeM (:,iSN0) - SN_kpMg2SiO4 (:,iSN) = SN0_kpMg2SiO4 (:,iSN0) - SN_kpFe3O4 (:,iSN) = SN0_kpFe3O4 (:,iSN0) - SN_kpSiO2D (:,iSN) = SN0_kpSiO2D (:,iSN0) - SN_kpMgO (:,iSN) = SN0_kpMgO (:,iSN0) - SN_kpFeS (:,iSN) = SN0_kpFeS (:,iSN0) - SN_kpAl2O3 (:,iSN) = SN0_kpAl2O3 (:,iSN0) + + do idx = 1, 3 + SN_r0SiM (idx,iSN) = SN0_r0SiM (idx,iSN0) + SN_r0FeM (idx,iSN) = SN0_r0FeM (idx,iSN0) + SN_r0Mg2SiO4 (idx,iSN) = SN0_r0Mg2SiO4 (idx,iSN0) + SN_r0Fe3O4 (idx,iSN) = SN0_r0Fe3O4 (idx,iSN0) + SN_r0SiO2D (idx,iSN) = SN0_r0SiO2D (idx,iSN0) + SN_r0MgO (idx,iSN) = SN0_r0MgO (idx,iSN0) + SN_r0FeS (idx,iSN) = SN0_r0FeS (idx,iSN0) + SN_r0Al2O3 (idx,iSN) = SN0_r0Al2O3 (idx,iSN0) + enddo + do idx = 1, gr_Size + SN_kpSiM (idx,iSN) = SN0_kpSiM (idx,iSN0) + SN_kpFeM (idx,iSN) = SN0_kpFeM (idx,iSN0) + SN_kpMg2SiO4 (idx,iSN) = SN0_kpMg2SiO4 (idx,iSN0) + SN_kpFe3O4 (idx,iSN) = SN0_kpFe3O4 (idx,iSN0) + SN_kpSiO2D (idx,iSN) = SN0_kpSiO2D (idx,iSN0) + SN_kpMgO (idx,iSN) = SN0_kpMgO (idx,iSN0) + SN_kpFeS (idx,iSN) = SN0_kpFeS (idx,iSN0) + SN_kpAl2O3 (idx,iSN) = SN0_kpAl2O3 (idx,iSN0) + enddo endif if ( idspecies .gt. 2 ) then SN_freforg (iSN) = SN0_freforg (iSN0) SN_fvolorg (iSN) = SN0_fvolorg (iSN0) SN_fH2Oice (iSN) = SN0_fH2Oice (iSN0) - SN_r0reforg (:,iSN) = SN0_r0reforg (:,iSN0) - SN_r0volorg (:,iSN) = SN0_r0volorg (:,iSN0) - SN_r0H2Oice (:,iSN) = SN0_r0H2Oice (:,iSN0) - SN_kpreforg (:,iSN) = SN0_kpreforg (:,iSN0) - SN_kpvolorg (:,iSN) = SN0_kpvolorg (:,iSN0) - SN_kpH2Oice (:,iSN) = SN0_kpH2Oice (:,iSN0) + + do idx = 1, 3 + SN_r0reforg (idx,iSN) = SN0_r0reforg (idx,iSN0) + SN_r0volorg (idx,iSN) = SN0_r0volorg (idx,iSN0) + SN_r0H2Oice (idx,iSN) = SN0_r0H2Oice (idx,iSN0) + enddo + do idx = 1, gr_Size + SN_kpreforg (idx,iSN) = SN0_kpreforg (idx,iSN0) + SN_kpvolorg (idx,iSN) = SN0_kpvolorg (idx,iSN0) + SN_kpH2Oice (idx,iSN) = SN0_kpH2Oice (idx,iSN0) + enddo endif enddo From 1c7b5bbb515e2f181938e514c7e81596327ac235 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 18:08:30 -0500 Subject: [PATCH 074/111] calc_grain_size_increment: replace some array operations with explicit for-loops PART 3 --- src/clib/calc_grain_size_increment_1d.F | 44 +++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index b0cc17a5e..3203d121a 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -447,27 +447,29 @@ subroutine calc_grain_size_increment_1d( & + sgH2Oice (i) endif - if (idspecies .gt. 0) then - altot(:,i) = alMgSiO3 (:,i) - & + alAC (:,i) - endif - if (idspecies .gt. 1) then - altot(:,i) = altot (:,i) - & + alSiM (:,i) - & + alFeM (:,i) - & + alMg2SiO4 (:,i) - & + alFe3O4 (:,i) - & + alSiO2D (:,i) - & + alMgO (:,i) - & + alFeS (:,i) - & + alAl2O3 (:,i) - endif - if (idspecies .gt. 2) then - altot(:,i) = altot (:,i) - & + alreforg (:,i) - & + alvolorg (:,i) - & + alH2Oice (:,i) - endif + do idx = 1, gr_N(2) + if (idspecies .gt. 0) then + altot(idx,i) = alMgSiO3 (idx,i) + & + alAC (idx,i) + endif + if (idspecies .gt. 1) then + altot(idx,i) = altot (idx,i) + & + alSiM (idx,i) + & + alFeM (idx,i) + & + alMg2SiO4 (idx,i) + & + alFe3O4 (idx,i) + & + alSiO2D (idx,i) + & + alMgO (idx,i) + & + alFeS (idx,i) + & + alAl2O3 (idx,i) + endif + if (idspecies .gt. 2) then + altot(idx,i) = altot (idx,i) + & + alreforg (idx,i) + & + alvolorg (idx,i) + & + alH2Oice (idx,i) + endif + enddo endif enddo From 70c13f4aa93e9544ed68445ae49ebc4f2f4f08d1 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 19:06:42 -0500 Subject: [PATCH 075/111] initial commit of transcribed calc_grain_size_increment_1d.hpp --- .../calc_grain_size_increment_1d.hpp | 553 ++++++++++++++++++ src/clib/fortran_func_decls.h | 2 +- src/clib/fortran_func_wrappers.hpp | 10 +- 3 files changed, 563 insertions(+), 2 deletions(-) create mode 100644 src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp new file mode 100644 index 000000000..d6c2bb245 --- /dev/null +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -0,0 +1,553 @@ +//===----------------------------------------------------------------------===// +// +// See the LICENSE file for license and copyright information +// SPDX-License-Identifier: NCSA AND BSD-3-Clause +// +//===----------------------------------------------------------------------===// +/// +/// @file +/// Declares signature of calc_grain_size_increment_1d +/// +//===----------------------------------------------------------------------===// + +// This file was initially generated automatically during conversion of the +// calc_grain_size_increment_1d function from FORTRAN to C++ + +#include +#include +#include + +#include "grackle.h" +#include "dust_props.hpp" +#include "fortran_func_decls.h" +#include "index_helper.h" +#include "inject_model/grain_metal_inject_pathways.hpp" +#include "LUT.hpp" +#include "phys_constants.h" +#include "utils-cpp.hpp" + +namespace grackle::impl { + +inline void calc_grain_size_increment_1d( + const gr_mask_type* itmask, double* dom, int* gr_N, int* gr_Size, + const chemistry_data* my_chemistry, grackle_field_data* my_fields, + IndexRange idx_range, + grackle::impl::InternalDustPropBuf internal_dust_prop_buf, + grackle::impl::GrainMetalInjectPathways* inject_pathway_props +) +{ + + grackle::impl::View metal(my_fields->metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_loc(my_fields->local_ISM_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_C13(my_fields->ccsn13_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_C20(my_fields->ccsn20_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_C25(my_fields->ccsn25_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_C30(my_fields->ccsn30_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_F13(my_fields->fsn13_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_F15(my_fields->fsn15_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_F50(my_fields->fsn50_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_F80(my_fields->fsn80_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_P170(my_fields->pisn170_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_P200(my_fields->pisn200_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal_Y19(my_fields->y19_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + // table + grackle::impl::View SN0_r0SiM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0FeM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0Mg2SiO4(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0MgSiO3(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0Fe3O4(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0AC(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0SiO2D(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0MgO(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0FeS(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0Al2O3(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0reforg(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0volorg(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN0_r0H2Oice(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], 3, inject_pathway_props->n_pathways); + // opacity table + grackle::impl::View SN0_kpSiM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpFeM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpMg2SiO4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpMgSiO3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpFe3O4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpAC(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpSiO2D(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpMgO(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpFeS(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpAl2O3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpreforg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpvolorg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpH2Oice(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], (*gr_Size), inject_pathway_props->n_pathways); + // out + grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alMgSiO3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alFe3O4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alAC(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alSiO2D(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alMgO(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alFeS(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alAl2O3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alreforg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alvolorg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[2-1], my_fields->grid_dimension[0]); + // array + int iSN, nSN, iSN0; + std::vector SN_i(inject_pathway_props->n_pathways); + std::vector SN_metal_data_(my_fields->grid_dimension[0] * inject_pathway_props->n_pathways); + grackle::impl::View SN_metal(SN_metal_data_.data(), my_fields->grid_dimension[0], inject_pathway_props->n_pathways); + std::vector SN_fSiM(inject_pathway_props->n_pathways); + std::vector SN_fFeM(inject_pathway_props->n_pathways); + std::vector SN_fMg2SiO4(inject_pathway_props->n_pathways); + std::vector SN_fMgSiO3(inject_pathway_props->n_pathways); + std::vector SN_fFe3O4(inject_pathway_props->n_pathways); + std::vector SN_fAC(inject_pathway_props->n_pathways); + std::vector SN_fSiO2D(inject_pathway_props->n_pathways); + std::vector SN_fMgO(inject_pathway_props->n_pathways); + std::vector SN_fFeS(inject_pathway_props->n_pathways); + std::vector SN_fAl2O3(inject_pathway_props->n_pathways); + std::vector SN_freforg(inject_pathway_props->n_pathways); + std::vector SN_fvolorg(inject_pathway_props->n_pathways); + std::vector SN_fH2Oice(inject_pathway_props->n_pathways); + std::vector SN_r0SiM_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0SiM(SN_r0SiM_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0FeM_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0FeM(SN_r0FeM_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0Mg2SiO4_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0Mg2SiO4(SN_r0Mg2SiO4_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0MgSiO3_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0MgSiO3(SN_r0MgSiO3_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0Fe3O4_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0Fe3O4(SN_r0Fe3O4_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0AC_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0AC(SN_r0AC_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0SiO2D_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0SiO2D(SN_r0SiO2D_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0MgO_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0MgO(SN_r0MgO_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0FeS_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0FeS(SN_r0FeS_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0Al2O3_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0Al2O3(SN_r0Al2O3_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0reforg_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0reforg(SN_r0reforg_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0volorg_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0volorg(SN_r0volorg_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_r0H2Oice_data_(3 * inject_pathway_props->n_pathways); + grackle::impl::View SN_r0H2Oice(SN_r0H2Oice_data_.data(), 3, inject_pathway_props->n_pathways); + std::vector SN_kpSiM_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpSiM(SN_kpSiM_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpFeM_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFeM(SN_kpFeM_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpMg2SiO4_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMg2SiO4(SN_kpMg2SiO4_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpMgSiO3_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMgSiO3(SN_kpMgSiO3_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpFe3O4_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFe3O4(SN_kpFe3O4_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpAC_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpAC(SN_kpAC_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpSiO2D_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpSiO2D(SN_kpSiO2D_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpMgO_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMgO(SN_kpMgO_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpFeS_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFeS(SN_kpFeS_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpAl2O3_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpAl2O3(SN_kpAl2O3_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpreforg_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpreforg(SN_kpreforg_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpvolorg_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpvolorg(SN_kpvolorg_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpH2Oice_data_((*gr_Size) * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpH2Oice(SN_kpH2Oice_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + + // this is a stopgap solution + auto max_ratio_fn = [&](grackle::impl::View inj_path_metal_dens) { + gr_float max_ratio = std::numeric_limits::lowest(); + + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + gr_float cur_ratio = ( + inj_path_metal_dens(i, idx_range.j, idx_range.k) / + metal(i, idx_range.j, idx_range.k)); + max_ratio = std::fmax(cur_ratio, max_ratio); + } + return static_cast(max_ratio); + }; + + // local + int i, idx; + + + // make arrays + if (my_chemistry->multi_metals == 0) { + nSN = 1; + SN_i[1-1] = my_chemistry->metal_abundances + 1; + + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,1-1) = metal(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } else { + nSN = 0; + + if(max_ratio_fn(metal_loc) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 1; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_loc(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_C13) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 2; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_C13(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_C20) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 3; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_C20(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_C25) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 4; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_C25(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_C30) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 5; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_C30(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_F13) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 6; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_F13(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_F15) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 7; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_F15(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_F50) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 8; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_F50(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_F80) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 9; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_F80(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_P170) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 10; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_P170(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_P200) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 11; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_P200(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + + if (max_ratio_fn(metal_Y19) > 0.01) { + nSN = nSN + 1; + SN_i[nSN-1] = 12; + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + SN_metal(i-1,nSN-1) = metal_Y19(i-1,idx_range.jp1-1,idx_range.kp1-1); + } + } + } + + for (iSN = 1; iSN<=(nSN); iSN++) { + iSN0 = SN_i[iSN-1]; + if ( my_chemistry->dust_species > 0 ) { + SN_fMgSiO3 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN0-1]; + SN_fAC [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN0-1]; + + for (idx = 1; idx<=(3); idx++) { + SN_r0MgSiO3 (idx-1,iSN-1) = SN0_r0MgSiO3 (idx-1,iSN0-1); + SN_r0AC (idx-1,iSN-1) = SN0_r0AC (idx-1,iSN0-1); + } + for (idx = 1; idx<=((*gr_Size)); idx++) { + SN_kpMgSiO3 (idx-1,iSN-1) = SN0_kpMgSiO3 (idx-1,iSN0-1); + SN_kpAC (idx-1,iSN-1) = SN0_kpAC (idx-1,iSN0-1); + } + } + if ( my_chemistry->dust_species > 1 ) { + SN_fSiM [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN0-1]; + SN_fFeM [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN0-1]; + SN_fMg2SiO4 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN0-1]; + SN_fFe3O4 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN0-1]; + SN_fSiO2D [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN0-1]; + SN_fMgO [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN0-1]; + SN_fFeS [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN0-1]; + SN_fAl2O3 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN0-1]; + + for (idx = 1; idx<=(3); idx++) { + SN_r0SiM (idx-1,iSN-1) = SN0_r0SiM (idx-1,iSN0-1); + SN_r0FeM (idx-1,iSN-1) = SN0_r0FeM (idx-1,iSN0-1); + SN_r0Mg2SiO4 (idx-1,iSN-1) = SN0_r0Mg2SiO4 (idx-1,iSN0-1); + SN_r0Fe3O4 (idx-1,iSN-1) = SN0_r0Fe3O4 (idx-1,iSN0-1); + SN_r0SiO2D (idx-1,iSN-1) = SN0_r0SiO2D (idx-1,iSN0-1); + SN_r0MgO (idx-1,iSN-1) = SN0_r0MgO (idx-1,iSN0-1); + SN_r0FeS (idx-1,iSN-1) = SN0_r0FeS (idx-1,iSN0-1); + SN_r0Al2O3 (idx-1,iSN-1) = SN0_r0Al2O3 (idx-1,iSN0-1); + } + for (idx = 1; idx<=((*gr_Size)); idx++) { + SN_kpSiM (idx-1,iSN-1) = SN0_kpSiM (idx-1,iSN0-1); + SN_kpFeM (idx-1,iSN-1) = SN0_kpFeM (idx-1,iSN0-1); + SN_kpMg2SiO4 (idx-1,iSN-1) = SN0_kpMg2SiO4 (idx-1,iSN0-1); + SN_kpFe3O4 (idx-1,iSN-1) = SN0_kpFe3O4 (idx-1,iSN0-1); + SN_kpSiO2D (idx-1,iSN-1) = SN0_kpSiO2D (idx-1,iSN0-1); + SN_kpMgO (idx-1,iSN-1) = SN0_kpMgO (idx-1,iSN0-1); + SN_kpFeS (idx-1,iSN-1) = SN0_kpFeS (idx-1,iSN0-1); + SN_kpAl2O3 (idx-1,iSN-1) = SN0_kpAl2O3 (idx-1,iSN0-1); + } + } + if ( my_chemistry->dust_species > 2 ) { + SN_freforg [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust] [iSN0-1]; + SN_fvolorg [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust] [iSN0-1]; + SN_fH2Oice [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust] [iSN0-1]; + + for (idx = 1; idx<=(3); idx++) { + SN_r0reforg (idx-1,iSN-1) = SN0_r0reforg (idx-1,iSN0-1); + SN_r0volorg (idx-1,iSN-1) = SN0_r0volorg (idx-1,iSN0-1); + SN_r0H2Oice (idx-1,iSN-1) = SN0_r0H2Oice (idx-1,iSN0-1); + } + for (idx = 1; idx<=((*gr_Size)); idx++) { + SN_kpreforg (idx-1,iSN-1) = SN0_kpreforg (idx-1,iSN0-1); + SN_kpvolorg (idx-1,iSN-1) = SN0_kpvolorg (idx-1,iSN0-1); + SN_kpH2Oice (idx-1,iSN-1) = SN0_kpH2Oice (idx-1,iSN0-1); + } + } + } + + double bulk_densities[OnlyGrainSpLUT::NUM_ENTRIES] = { + sMgSiO3, + sAC, + sSiM, + sFeM, + sMg2SiO4, + sFe3O4, + sSiO2D, + sMgO, + sFeS, + sAl2O3, + sreforg, + svolorg, + sH2Oice, + }; + + + // ! calculate size increment + + if (my_chemistry->dust_species > 0) { + // ! write(*,*) 'MgSiO3' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), SN_fMgSiO3.data(), SN_r0MgSiO3.data(), + &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() + ); + + // ! write(*,*) 'AC' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->AC_dust_density, SN_metal.data(), SN_fAC.data(), SN_r0AC.data(), + &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() + ); + } + + if (my_chemistry->dust_species > 1) { + // ! write(*,*) 'SiM' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->SiM_dust_density, SN_metal.data(), SN_fSiM.data(), SN_r0SiM.data(), + &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() + ); + + // ! write(*,*) 'FeM' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->FeM_dust_density, SN_metal.data(), SN_fFeM.data(), SN_r0FeM.data(), + &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() + ); + + // ! write(*,*) 'Mg2SiO4' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), SN_fMg2SiO4.data(), SN_r0Mg2SiO4.data(), + &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() + ); + + // ! write(*,*) 'Fe3O4' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), SN_fFe3O4.data(), SN_r0Fe3O4.data(), + &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() + ); + + // ! write(*,*) 'SiO2D' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->SiO2_dust_density, SN_metal.data(), SN_fSiO2D.data(), SN_r0SiO2D.data(), + &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() + ); + + // ! write(*,*) 'MgO' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->MgO_dust_density, SN_metal.data(), SN_fMgO.data(), SN_r0MgO.data(), + &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() + ); + + // ! write(*,*) 'FeS' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->FeS_dust_density, SN_metal.data(), SN_fFeS.data(), SN_r0FeS.data(), + &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() + ); + + // ! write(*,*) 'Al2O3' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), SN_fAl2O3.data(), SN_r0Al2O3.data(), + &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() + ); + } + + if (my_chemistry->dust_species > 2) { + // ! write(*,*) 'reforg' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->ref_org_dust_density, SN_metal.data(), SN_freforg.data(), SN_r0reforg.data(), + &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() + ); + + // ! write(*,*) 'volorg' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->vol_org_dust_density, SN_metal.data(), SN_fvolorg.data(), SN_r0volorg.data(), + &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() + ); + + // ! write(*,*) 'H2Oice' + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), SN_fH2Oice.data(), SN_r0H2Oice.data(), + &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), + gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() + ); + } + + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { + if ( itmask[i-1] != MASK_FALSE ) { + + if (my_chemistry->dust_species > 0) { + internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] = internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust] [i-1]; + } + if (my_chemistry->dust_species > 1) { + internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] = internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust] [i-1]; + } + if (my_chemistry->dust_species > 2) { + internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] = internal_dust_prop_buf.sigma_per_gas_mass_tot[i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust] [i-1] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust] [i-1]; + } + + for (idx = 1; idx<=(gr_N [ 2-1 ]); idx++) { + if (my_chemistry->dust_species > 0) { + altot(idx-1,i-1) = alMgSiO3 (idx-1,i-1) + + alAC (idx-1,i-1); + } + if (my_chemistry->dust_species > 1) { + altot(idx-1,i-1) = altot (idx-1,i-1) + + alSiM (idx-1,i-1) + + alFeM (idx-1,i-1) + + alMg2SiO4 (idx-1,i-1) + + alFe3O4 (idx-1,i-1) + + alSiO2D (idx-1,i-1) + + alMgO (idx-1,i-1) + + alFeS (idx-1,i-1) + + alAl2O3 (idx-1,i-1); + } + if (my_chemistry->dust_species > 2) { + altot(idx-1,i-1) = altot (idx-1,i-1) + + alreforg (idx-1,i-1) + + alvolorg (idx-1,i-1) + + alH2Oice (idx-1,i-1); + } + } + + } + } + + return; +} + +} // namespace grackle::impl diff --git a/src/clib/fortran_func_decls.h b/src/clib/fortran_func_decls.h index ff6fd5755..76109e992 100644 --- a/src/clib/fortran_func_decls.h +++ b/src/clib/fortran_func_decls.h @@ -90,7 +90,7 @@ void FORTRAN_NAME(calc_grain_size_increment_1d)( ); void FORTRAN_NAME(calc_grain_size_increment_species_1d)( - int* igrgr, gr_mask_type* itmask, int* SN0_N, int* in, int* jn, int* kn, + const int* igrgr, const gr_mask_type* itmask, int* SN0_N, int* in, int* jn, int* kn, int* is, int* ie, int* j, int* k, double* dom, gr_float* d_data_ptr, int* nSN, gr_float* dsp_data_ptr, gr_float* SN_metal_data_ptr, double* SN_fsp, double* SN_r0sp_data_ptr, double* ssp, double* sgsp, double* alsp_data_ptr, diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index bf84c665d..89a583350 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -22,6 +22,9 @@ #error "This file must be read by a c++ compiler" #endif + +#include "dust/multi_grain_species/calc_grain_size_increment_1d.hpp" + #include "grackle.h" #include "dust_props.hpp" #include "fortran_func_decls.h" @@ -134,7 +137,11 @@ inline void calc_grain_size_increment_1d ( }; int gr_Size = gr_N[0] * gr_N[1]; - + ::grackle::impl::calc_grain_size_increment_1d( + itmask_metal, &dom, gr_N, &gr_Size, my_chemistry, my_fields, idx_range, + internal_dust_prop_buf, inject_pathway_props + ); + /* FORTRAN_NAME(calc_grain_size_increment_1d)( &my_chemistry->multi_metals, &my_chemistry->metal_abundances, &my_chemistry->dust_species, &my_chemistry->grain_growth, itmask_metal, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, @@ -195,6 +202,7 @@ inline void calc_grain_size_increment_1d ( internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.dyntab_kappa_tot ); + */ } inline void calc_temp1d_cloudy_g( From 7b39ac697c9fc96711bb93b8f97b59a698ea124c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 19:25:34 -0500 Subject: [PATCH 076/111] remove the original fortran version of calc_grain_size_increment_1d --- src/clib/CMakeLists.txt | 1 - src/clib/calc_grain_size_increment_1d.F | 477 ------------------------ src/clib/dust_const.def | 14 - src/clib/fortran_func_decls.h | 42 --- src/clib/fortran_func_wrappers.hpp | 62 --- 5 files changed, 596 deletions(-) delete mode 100644 src/clib/dust_const.def diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 5ac458b1d..5ffe057cb 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -181,7 +181,6 @@ add_library(Grackle_Grackle phys_constants.h collisional_rxn_rate_members.def # <-- acts as a C header utils.h - dust_const.def # Fortran public headers ../include/grackle.def diff --git a/src/clib/calc_grain_size_increment_1d.F b/src/clib/calc_grain_size_increment_1d.F index 3203d121a..61c7d2604 100644 --- a/src/clib/calc_grain_size_increment_1d.F +++ b/src/clib/calc_grain_size_increment_1d.F @@ -1,482 +1,5 @@ #include "phys_const.def" -! Compute grain size increment - - subroutine calc_grain_size_increment_1d( - & immulti, imabund, idspecies, igrgr, itmask - & , in, jn, kn, is, ie, j, k, dom, d - & , SiM, FeM, Mg2SiO4, MgSiO3, Fe3O4 - & , AC, SiO2D, MgO, FeS, Al2O3 - & , reforg, volorg, H2Oice - & , metal, metal_loc - & , metal_C13, metal_C20, metal_C25, metal_C30 - & , metal_F13, metal_F15, metal_F50, metal_F80 - & , metal_P170, metal_P200, metal_Y19 - & , SN0_N - & , SN0_fSiM, SN0_fFeM, SN0_fMg2SiO4, SN0_fMgSiO3 - & , SN0_fFe3O4, SN0_fAC, SN0_fSiO2D, SN0_fMgO - & , SN0_fFeS, SN0_fAl2O3 - & , SN0_freforg, SN0_fvolorg, SN0_fH2Oice - & , SN0_r0SiM, SN0_r0FeM, SN0_r0Mg2SiO4, SN0_r0MgSiO3 - & , SN0_r0Fe3O4, SN0_r0AC, SN0_r0SiO2D, SN0_r0MgO - & , SN0_r0FeS, SN0_r0Al2O3 - & , SN0_r0reforg, SN0_r0volorg, SN0_r0H2Oice - & , gr_N, gr_Size, gr_dT, gr_Td - & , SN0_kpSiM, SN0_kpFeM, SN0_kpMg2SiO4, SN0_kpMgSiO3 - & , SN0_kpFe3O4, SN0_kpAC, SN0_kpSiO2D, SN0_kpMgO - & , SN0_kpFeS, SN0_kpAl2O3 - & , SN0_kpreforg, SN0_kpvolorg, SN0_kpH2Oice - & , sgSiM, sgFeM, sgMg2SiO4, sgMgSiO3, sgFe3O4, sgAC - & , sgSiO2D, sgMgO, sgFeS, sgAl2O3 - & , sgreforg, sgvolorg, sgH2Oice, sgtot - & , alSiM, alFeM, alMg2SiO4, alMgSiO3, alFe3O4, alAC - & , alSiO2D, alMgO, alFeS, alAl2O3 - & , alreforg, alvolorg, alH2Oice, altot - & ) - - implicit NONE -#include "grackle_fortran_types.def" -#include "dust_const.def" - -! in - integer in, jn, kn, is, ie, j, k - MASK_TYPE itmask(in) - integer immulti, imabund, idspecies, igrgr - real*8 dom - R_PREC d(in,jn,kn) - R_PREC SiM(in,jn,kn), FeM(in,jn,kn), Mg2SiO4(in,jn,kn) - & , MgSiO3(in,jn,kn), Fe3O4(in,jn,kn), AC(in,jn,kn) - & , SiO2D(in,jn,kn), MgO(in,jn,kn), FeS(in,jn,kn) - & , Al2O3(in,jn,kn) - & , reforg(in,jn,kn), volorg(in,jn,kn), H2Oice(in,jn,kn) - R_PREC metal(in,jn,kn) - & , metal_loc(in,jn,kn) - & , metal_C13(in,jn,kn), metal_C20(in,jn,kn) - & , metal_C25(in,jn,kn), metal_C30(in,jn,kn) - & , metal_F13(in,jn,kn), metal_F15(in,jn,kn) - & , metal_F50(in,jn,kn), metal_F80(in,jn,kn) - & , metal_P170(in,jn,kn), metal_P200(in,jn,kn) - & , metal_Y19(in,jn,kn) -! table - integer SN0_N - real*8 SN0_fSiM(SN0_N), SN0_fFeM(SN0_N), SN0_fMg2SiO4(SN0_N) - & , SN0_fMgSiO3(SN0_N), SN0_fFe3O4(SN0_N), SN0_fAC(SN0_N) - & , SN0_fSiO2D(SN0_N), SN0_fMgO(SN0_N), SN0_fFeS(SN0_N) - & , SN0_fAl2O3(SN0_N) - & , SN0_freforg(SN0_N), SN0_fvolorg(SN0_N), SN0_fH2Oice(SN0_N) - real*8 SN0_r0SiM(3,SN0_N), SN0_r0FeM(3,SN0_N) - & , SN0_r0Mg2SiO4(3,SN0_N), SN0_r0MgSiO3(3,SN0_N) - & , SN0_r0Fe3O4(3,SN0_N), SN0_r0AC(3,SN0_N) - & , SN0_r0SiO2D(3,SN0_N), SN0_r0MgO(3,SN0_N) - & , SN0_r0FeS(3,SN0_N), SN0_r0Al2O3(3,SN0_N) - & , SN0_r0reforg(3,SN0_N) - & , SN0_r0volorg(3,SN0_N), SN0_r0H2Oice(3,SN0_N) -! opacity table - integer gr_N(2), gr_Size - real*8 gr_dT, gr_Td(gr_N(2)) - real*8 SN0_kpSiM(gr_Size,SN0_N), SN0_kpFeM(gr_Size,SN0_N) - & , SN0_kpMg2SiO4(gr_Size,SN0_N), SN0_kpMgSiO3(gr_Size,SN0_N) - & , SN0_kpFe3O4(gr_Size,SN0_N), SN0_kpAC(gr_Size,SN0_N) - & , SN0_kpSiO2D(gr_Size,SN0_N), SN0_kpMgO(gr_Size,SN0_N) - & , SN0_kpFeS(gr_Size,SN0_N), SN0_kpAl2O3(gr_Size,SN0_N) - & , SN0_kpreforg(gr_Size,SN0_N) - & , SN0_kpvolorg(gr_Size,SN0_N), SN0_kpH2Oice(gr_Size,SN0_N) -! out - real*8 sgSiM(in), sgFeM(in), sgMg2SiO4(in) - & , sgMgSiO3(in), sgFe3O4(in), sgAC(in) - & , sgSiO2D(in), sgMgO(in), sgFeS(in) - & , sgAl2O3(in) - & , sgreforg(in), sgvolorg(in), sgH2Oice(in) - & , sgtot(in) - real*8 alSiM(gr_N(2),in), alFeM(gr_N(2),in) - & , alMg2SiO4(gr_N(2),in), alMgSiO3(gr_N(2),in) - & , alFe3O4(gr_N(2),in), alAC(gr_N(2),in) - & , alSiO2D(gr_N(2),in), alMgO(gr_N(2),in) - & , alFeS(gr_N(2),in), alAl2O3(gr_N(2),in) - & , alreforg(gr_N(2),in) - & , alvolorg(gr_N(2),in), alH2Oice(gr_N(2),in) - & , altot(gr_N(2),in) -! array - integer iSN, nSN, iSN0 - integer SN_i(SN0_N) - R_PREC SN_metal(in, SN0_N) - real*8 SN_fSiM(SN0_N), SN_fFeM(SN0_N) - & , SN_fMg2SiO4(SN0_N), SN_fMgSiO3(SN0_N) - & , SN_fFe3O4(SN0_N), SN_fAC(SN0_N) - & , SN_fSiO2D(SN0_N), SN_fMgO(SN0_N) - & , SN_fFeS(SN0_N), SN_fAl2O3(SN0_N) - & , SN_freforg(SN0_N) - & , SN_fvolorg(SN0_N), SN_fH2Oice(SN0_N) - real*8 SN_r0SiM(3,SN0_N), SN_r0FeM(3,SN0_N) - & , SN_r0Mg2SiO4(3,SN0_N), SN_r0MgSiO3(3,SN0_N) - & , SN_r0Fe3O4(3,SN0_N), SN_r0AC(3,SN0_N) - & , SN_r0SiO2D(3,SN0_N), SN_r0MgO(3,SN0_N) - & , SN_r0FeS(3,SN0_N), SN_r0Al2O3(3,SN0_N) - & , SN_r0reforg(3,SN0_N) - & , SN_r0volorg(3,SN0_N), SN_r0H2Oice(3,SN0_N) - real*8 SN_kpSiM(gr_Size,SN0_N), SN_kpFeM(gr_Size,SN0_N) - & , SN_kpMg2SiO4(gr_Size,SN0_N), SN_kpMgSiO3(gr_Size,SN0_N) - & , SN_kpFe3O4(gr_Size,SN0_N), SN_kpAC(gr_Size,SN0_N) - & , SN_kpSiO2D(gr_Size,SN0_N), SN_kpMgO(gr_Size,SN0_N) - & , SN_kpFeS(gr_Size,SN0_N), SN_kpAl2O3(gr_Size,SN0_N) - & , SN_kpreforg(gr_Size,SN0_N) - & , SN_kpvolorg(gr_Size,SN0_N), SN_kpH2Oice(gr_Size,SN0_N) -! local - integer i, idx -!! integer iTd, iTd0 - -!! iSN0 = 2 -!! write(*,*) SN0_fMgSiO3(iSN0) -!! write(*,*) SN0_r0MgSiO3 (:,iSN0) -!! do iTd = 1, gr_N(2) -!! iTd0 = (iTd - 1) * gr_N(1) -!! write(*,*) SN0_kpMgSiO3 (iTd0+1,iSN0) -!! & , SN0_kpMgSiO3 (iTd0+2,iSN0) -!! & , SN0_kpMgSiO3 (iTd0+3,iSN0) -!! & , SN0_kpMgSiO3 (iTd0+4,iSN0) -!! enddo -!! stop - - ! make arrays - if (immulti .eq. 0) then - nSN = 1 - SN_i(1) = imabund + 1 - - do i = is+1, ie+1 - SN_metal(i,1) = metal(i,j,k) - enddo - else - nSN = 0 - if(maxval(metal_loc(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 1 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_loc(i,j,k) - enddo - endif - if(maxval(metal_C13(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 2 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_C13(i,j,k) - enddo - endif - if(maxval(metal_C20(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 3 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_C20(i,j,k) - enddo - endif - if(maxval(metal_C25(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 4 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_C25(i,j,k) - enddo - endif - if(maxval(metal_C30(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 5 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_C30(i,j,k) - enddo - endif - if(maxval(metal_F13(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 6 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_F13(i,j,k) - enddo - endif - if(maxval(metal_F15(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 7 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_F15(i,j,k) - enddo - endif - if(maxval(metal_F50(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 8 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_F50(i,j,k) - enddo - endif - if(maxval(metal_F80(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 9 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_F80(i,j,k) - enddo - endif - if(maxval(metal_P170(:,j,k)/metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 10 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_P170(i,j,k) - enddo - endif - if(maxval(metal_P200(:,j,k)/metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 11 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_P200(i,j,k) - enddo - endif - if(maxval(metal_Y19(:,j,k) /metal(:,j,k)) .gt. 0.01_DKIND) then - nSN = nSN + 1 - SN_i(nSN) = 12 - do i = is+1, ie+1 - SN_metal(i,nSN) = metal_Y19(i,j,k) - enddo - endif - endif - - do iSN = 1, nSN - iSN0 = SN_i(iSN) - if ( idspecies .gt. 0 ) then - SN_fMgSiO3 (iSN) = SN0_fMgSiO3 (iSN0) - SN_fAC (iSN) = SN0_fAC (iSN0) - - do idx = 1, 3 - SN_r0MgSiO3 (idx,iSN) = SN0_r0MgSiO3 (idx,iSN0) - SN_r0AC (idx,iSN) = SN0_r0AC (idx,iSN0) - enddo - do idx = 1, gr_Size - SN_kpMgSiO3 (idx,iSN) = SN0_kpMgSiO3 (idx,iSN0) - SN_kpAC (idx,iSN) = SN0_kpAC (idx,iSN0) - enddo - endif - if ( idspecies .gt. 1 ) then - SN_fSiM (iSN) = SN0_fSiM (iSN0) - SN_fFeM (iSN) = SN0_fFeM (iSN0) - SN_fMg2SiO4 (iSN) = SN0_fMg2SiO4 (iSN0) - SN_fFe3O4 (iSN) = SN0_fFe3O4 (iSN0) - SN_fSiO2D (iSN) = SN0_fSiO2D (iSN0) - SN_fMgO (iSN) = SN0_fMgO (iSN0) - SN_fFeS (iSN) = SN0_fFeS (iSN0) - SN_fAl2O3 (iSN) = SN0_fAl2O3 (iSN0) - - do idx = 1, 3 - SN_r0SiM (idx,iSN) = SN0_r0SiM (idx,iSN0) - SN_r0FeM (idx,iSN) = SN0_r0FeM (idx,iSN0) - SN_r0Mg2SiO4 (idx,iSN) = SN0_r0Mg2SiO4 (idx,iSN0) - SN_r0Fe3O4 (idx,iSN) = SN0_r0Fe3O4 (idx,iSN0) - SN_r0SiO2D (idx,iSN) = SN0_r0SiO2D (idx,iSN0) - SN_r0MgO (idx,iSN) = SN0_r0MgO (idx,iSN0) - SN_r0FeS (idx,iSN) = SN0_r0FeS (idx,iSN0) - SN_r0Al2O3 (idx,iSN) = SN0_r0Al2O3 (idx,iSN0) - enddo - do idx = 1, gr_Size - SN_kpSiM (idx,iSN) = SN0_kpSiM (idx,iSN0) - SN_kpFeM (idx,iSN) = SN0_kpFeM (idx,iSN0) - SN_kpMg2SiO4 (idx,iSN) = SN0_kpMg2SiO4 (idx,iSN0) - SN_kpFe3O4 (idx,iSN) = SN0_kpFe3O4 (idx,iSN0) - SN_kpSiO2D (idx,iSN) = SN0_kpSiO2D (idx,iSN0) - SN_kpMgO (idx,iSN) = SN0_kpMgO (idx,iSN0) - SN_kpFeS (idx,iSN) = SN0_kpFeS (idx,iSN0) - SN_kpAl2O3 (idx,iSN) = SN0_kpAl2O3 (idx,iSN0) - enddo - endif - if ( idspecies .gt. 2 ) then - SN_freforg (iSN) = SN0_freforg (iSN0) - SN_fvolorg (iSN) = SN0_fvolorg (iSN0) - SN_fH2Oice (iSN) = SN0_fH2Oice (iSN0) - - do idx = 1, 3 - SN_r0reforg (idx,iSN) = SN0_r0reforg (idx,iSN0) - SN_r0volorg (idx,iSN) = SN0_r0volorg (idx,iSN0) - SN_r0H2Oice (idx,iSN) = SN0_r0H2Oice (idx,iSN0) - enddo - do idx = 1, gr_Size - SN_kpreforg (idx,iSN) = SN0_kpreforg (idx,iSN0) - SN_kpvolorg (idx,iSN) = SN0_kpvolorg (idx,iSN0) - SN_kpH2Oice (idx,iSN) = SN0_kpH2Oice (idx,iSN0) - enddo - endif - enddo - - !! calculate size increment - - if (idspecies .gt. 0) then -!! write(*,*) 'MgSiO3' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, MgSiO3 , SN_metal, SN_fMgSiO3 , SN_r0MgSiO3 - & , sMgSiO3 , sgMgSiO3 , alMgSiO3 - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpMgSiO3 - & ) - -!! write(*,*) 'AC' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, AC , SN_metal, SN_fAC , SN_r0AC - & , sAC , sgAC , alAC - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpAC - & ) - endif - - if (idspecies .gt. 1) then -!! write(*,*) 'SiM' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, SiM , SN_metal, SN_fSiM , SN_r0SiM - & , sSiM , sgSiM , alSiM - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpSiM - & ) - -!! write(*,*) 'FeM' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, FeM , SN_metal, SN_fFeM , SN_r0FeM - & , sFeM , sgFeM , alFeM - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpFeM - & ) - -!! write(*,*) 'Mg2SiO4' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, Mg2SiO4 , SN_metal, SN_fMg2SiO4 , SN_r0Mg2SiO4 - & , sMg2SiO4 , sgMg2SiO4 , alMg2SiO4 - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpMg2SiO4 - & ) - -!! write(*,*) 'Fe3O4' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, Fe3O4 , SN_metal, SN_fFe3O4 , SN_r0Fe3O4 - & , sFe3O4 , sgFe3O4 , alFe3O4 - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpFe3O4 - & ) - -!! write(*,*) 'SiO2D' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, SiO2D , SN_metal, SN_fSiO2D , SN_r0SiO2D - & , sSiO2D , sgSiO2D , alSiO2D - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpSiO2D - & ) - -!! write(*,*) 'MgO' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, MgO , SN_metal, SN_fMgO , SN_r0MgO - & , sMgO , sgMgO , alMgO - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpMgO - & ) - -!! write(*,*) 'FeS' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, FeS , SN_metal, SN_fFeS , SN_r0FeS - & , sFeS , sgFeS , alFeS - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpFeS - & ) - -!! write(*,*) 'Al2O3' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, Al2O3 , SN_metal, SN_fAl2O3 , SN_r0Al2O3 - & , sAl2O3 , sgAl2O3 , alAl2O3 - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpAl2O3 - & ) - endif - - if (idspecies .gt. 2) then -!! write(*,*) 'reforg' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, reforg , SN_metal, SN_freforg , SN_r0reforg - & , sreforg , sgreforg , alreforg - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpreforg - & ) - -!! write(*,*) 'volorg' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, volorg , SN_metal, SN_fvolorg , SN_r0volorg - & , svolorg , sgvolorg , alvolorg - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpvolorg - & ) - -!! write(*,*) 'H2Oice' - call calc_grain_size_increment_species_1d( - & igrgr, itmask, SN0_N - & , in, jn, kn, is, ie, j, k, dom, d - & , nSN, H2Oice , SN_metal, SN_fH2Oice , SN_r0H2Oice - & , sH2Oice , sgH2Oice , alH2Oice - & , gr_N, gr_Size, gr_dT, gr_Td, SN_kpH2Oice - & ) - endif - - do i = is+1, ie+1 - if ( itmask(i) .ne. MASK_FALSE ) then - - if (idspecies .gt. 0) then - sgtot (i) = sgMgSiO3 (i) - & + sgAC (i) - endif - if (idspecies .gt. 1) then - sgtot (i) = sgtot (i) - & + sgSiM (i) - & + sgFeM (i) - & + sgMg2SiO4 (i) - & + sgFe3O4 (i) - & + sgSiO2D (i) - & + sgMgO (i) - & + sgFeS (i) - & + sgAl2O3 (i) - endif - if (idspecies .gt. 2) then - sgtot (i) = sgtot(i) - & + sgreforg (i) - & + sgvolorg (i) - & + sgH2Oice (i) - endif - - do idx = 1, gr_N(2) - if (idspecies .gt. 0) then - altot(idx,i) = alMgSiO3 (idx,i) - & + alAC (idx,i) - endif - if (idspecies .gt. 1) then - altot(idx,i) = altot (idx,i) - & + alSiM (idx,i) - & + alFeM (idx,i) - & + alMg2SiO4 (idx,i) - & + alFe3O4 (idx,i) - & + alSiO2D (idx,i) - & + alMgO (idx,i) - & + alFeS (idx,i) - & + alAl2O3 (idx,i) - endif - if (idspecies .gt. 2) then - altot(idx,i) = altot (idx,i) - & + alreforg (idx,i) - & + alvolorg (idx,i) - & + alH2Oice (idx,i) - endif - enddo - - endif - enddo - - return - end - !======================================================================= !////////////// CALC_GRAIN_SIZE_INCREMENT_SPECIES_1D \\\\\\\\\\\\\\\\\\ diff --git a/src/clib/dust_const.def b/src/clib/dust_const.def deleted file mode 100644 index 24fdd2c9a..000000000 --- a/src/clib/dust_const.def +++ /dev/null @@ -1,14 +0,0 @@ - -#define sSiM 2.34118d0 -#define sFeM 7.95995d0 -#define sMg2SiO4 3.22133d0 -#define sMgSiO3 3.20185d0 -#define sFe3O4 5.25096d0 -#define sAC 2.27949d0 -#define sSiO2D 2.66235d0 -#define sMgO 3.58157d0 -#define sFeS 4.87265d0 -#define sAl2O3 4.01610d0 -#define sreforg 1.5d0 -#define svolorg 1.0d0 -#define sH2Oice 0.92d0 diff --git a/src/clib/fortran_func_decls.h b/src/clib/fortran_func_decls.h index 76109e992..099797e2a 100644 --- a/src/clib/fortran_func_decls.h +++ b/src/clib/fortran_func_decls.h @@ -47,48 +47,6 @@ void FORTRAN_NAME(calc_all_tdust_gasgr_1d_g)( double* gasvolorg, double* gasH2Oice ); -void FORTRAN_NAME(calc_grain_size_increment_1d)( - int* immulti, int* imabund, int* idspecies, int* igrgr, - const gr_mask_type* itmask, int* in, int* jn, int* kn, int* is, int* ie, - int* j, int* k, double* dom, gr_float* d_data_ptr, gr_float* SiM_data_ptr, - gr_float* FeM_data_ptr, gr_float* Mg2SiO4_data_ptr, gr_float* MgSiO3_data_ptr, - gr_float* Fe3O4_data_ptr, gr_float* AC_data_ptr, gr_float* SiO2D_data_ptr, - gr_float* MgO_data_ptr, gr_float* FeS_data_ptr, gr_float* Al2O3_data_ptr, - gr_float* reforg_data_ptr, gr_float* volorg_data_ptr, - gr_float* H2Oice_data_ptr, gr_float* metal_data_ptr, - gr_float* metal_loc_data_ptr, gr_float* metal_C13_data_ptr, - gr_float* metal_C20_data_ptr, gr_float* metal_C25_data_ptr, - gr_float* metal_C30_data_ptr, gr_float* metal_F13_data_ptr, - gr_float* metal_F15_data_ptr, gr_float* metal_F50_data_ptr, - gr_float* metal_F80_data_ptr, gr_float* metal_P170_data_ptr, - gr_float* metal_P200_data_ptr, gr_float* metal_Y19_data_ptr, int* SN0_N, - double* SN0_fSiM, double* SN0_fFeM, double* SN0_fMg2SiO4, double* SN0_fMgSiO3, - double* SN0_fFe3O4, double* SN0_fAC, double* SN0_fSiO2D, double* SN0_fMgO, - double* SN0_fFeS, double* SN0_fAl2O3, double* SN0_freforg, - double* SN0_fvolorg, double* SN0_fH2Oice, double* SN0_r0SiM_data_ptr, - double* SN0_r0FeM_data_ptr, double* SN0_r0Mg2SiO4_data_ptr, - double* SN0_r0MgSiO3_data_ptr, double* SN0_r0Fe3O4_data_ptr, - double* SN0_r0AC_data_ptr, double* SN0_r0SiO2D_data_ptr, - double* SN0_r0MgO_data_ptr, double* SN0_r0FeS_data_ptr, - double* SN0_r0Al2O3_data_ptr, double* SN0_r0reforg_data_ptr, - double* SN0_r0volorg_data_ptr, double* SN0_r0H2Oice_data_ptr, int* gr_N, - int* gr_Size, double* gr_dT, double* gr_Td, double* SN0_kpSiM_data_ptr, - double* SN0_kpFeM_data_ptr, double* SN0_kpMg2SiO4_data_ptr, - double* SN0_kpMgSiO3_data_ptr, double* SN0_kpFe3O4_data_ptr, - double* SN0_kpAC_data_ptr, double* SN0_kpSiO2D_data_ptr, - double* SN0_kpMgO_data_ptr, double* SN0_kpFeS_data_ptr, - double* SN0_kpAl2O3_data_ptr, double* SN0_kpreforg_data_ptr, - double* SN0_kpvolorg_data_ptr, double* SN0_kpH2Oice_data_ptr, double* sgSiM, - double* sgFeM, double* sgMg2SiO4, double* sgMgSiO3, double* sgFe3O4, - double* sgAC, double* sgSiO2D, double* sgMgO, double* sgFeS, double* sgAl2O3, - double* sgreforg, double* sgvolorg, double* sgH2Oice, double* sgtot, - double* alSiM_data_ptr, double* alFeM_data_ptr, double* alMg2SiO4_data_ptr, - double* alMgSiO3_data_ptr, double* alFe3O4_data_ptr, double* alAC_data_ptr, - double* alSiO2D_data_ptr, double* alMgO_data_ptr, double* alFeS_data_ptr, - double* alAl2O3_data_ptr, double* alreforg_data_ptr, - double* alvolorg_data_ptr, double* alH2Oice_data_ptr, double* altot_data_ptr -); - void FORTRAN_NAME(calc_grain_size_increment_species_1d)( const int* igrgr, const gr_mask_type* itmask, int* SN0_N, int* in, int* jn, int* kn, int* is, int* ie, int* j, int* k, double* dom, gr_float* d_data_ptr, int* nSN, diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index 89a583350..baada879f 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -141,68 +141,6 @@ inline void calc_grain_size_increment_1d ( itmask_metal, &dom, gr_N, &gr_Size, my_chemistry, my_fields, idx_range, internal_dust_prop_buf, inject_pathway_props ); - /* - FORTRAN_NAME(calc_grain_size_increment_1d)( - &my_chemistry->multi_metals, &my_chemistry->metal_abundances, &my_chemistry->dust_species, &my_chemistry->grain_growth, itmask_metal, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - my_fields->SiM_dust_density, my_fields->FeM_dust_density, my_fields->Mg2SiO4_dust_density, my_fields->MgSiO3_dust_density, my_fields->Fe3O4_dust_density, - my_fields->AC_dust_density, my_fields->SiO2_dust_density, my_fields->MgO_dust_density, my_fields->FeS_dust_density, my_fields->Al2O3_dust_density, - my_fields->ref_org_dust_density, my_fields->vol_org_dust_density, my_fields->H2O_ice_dust_density, - my_fields->metal_density, my_fields->local_ISM_metal_density, - my_fields->ccsn13_metal_density, my_fields->ccsn20_metal_density, my_fields->ccsn25_metal_density, my_fields->ccsn30_metal_density, - my_fields->fsn13_metal_density, my_fields->fsn15_metal_density, my_fields->fsn50_metal_density, my_fields->fsn80_metal_density, - my_fields->pisn170_metal_density, my_fields->pisn200_metal_density, my_fields->y19_metal_density, - &inject_pathway_props->n_pathways, - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust], - inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], - inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], - gr_N, &gr_Size, - &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], - inject_pathway_props->log10Tdust_interp_props.parameters[0], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], - inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], - internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], - internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], - internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.sigma_per_gas_mass_tot, - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.dyntab_kappa_tot - ); - */ } inline void calc_temp1d_cloudy_g( From b97ec42575704d3e84a839f5b0a400ed7180c7b4 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 19:54:34 -0500 Subject: [PATCH 077/111] significantly simplify src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp --- src/clib/CMakeLists.txt | 1 + .../calc_grain_size_increment_1d.hpp | 154 ++++-------------- 2 files changed, 33 insertions(+), 122 deletions(-) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 5ffe057cb..a74c85955 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -113,6 +113,7 @@ add_library(Grackle_Grackle cool_multi_time_g.cpp cool_multi_time_g.h dust_props.hpp dust/grain_species_info.cpp dust/grain_species_info.hpp + dust/multi_grain_species/calc_grain_size_increment_1d.hpp init_misc_species_cool_rates.cpp init_misc_species_cool_rates.hpp initialize_chemistry_data.cpp initialize_rates.cpp initialize_rates.hpp diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index d6c2bb245..1c5b12ab8 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -22,6 +22,7 @@ #include "fortran_func_decls.h" #include "index_helper.h" #include "inject_model/grain_metal_inject_pathways.hpp" +#include "inject_model/inject_path_field_pack.hpp" #include "LUT.hpp" #include "phys_constants.h" #include "utils-cpp.hpp" @@ -37,19 +38,11 @@ inline void calc_grain_size_increment_1d( ) { - grackle::impl::View metal(my_fields->metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_loc(my_fields->local_ISM_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C13(my_fields->ccsn13_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C20(my_fields->ccsn20_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C25(my_fields->ccsn25_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_C30(my_fields->ccsn30_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F13(my_fields->fsn13_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F15(my_fields->fsn15_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F50(my_fields->fsn50_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_F80(my_fields->fsn80_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_P170(my_fields->pisn170_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_P200(my_fields->pisn200_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - grackle::impl::View metal_Y19(my_fields->y19_metal_density, my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::View metal( + const_cast(my_fields->metal_density), + my_fields->grid_dimension[0], my_fields->grid_dimension[1], + my_fields->grid_dimension[2]); + // table grackle::impl::View SN0_r0SiM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], 3, inject_pathway_props->n_pathways); grackle::impl::View SN0_r0FeM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], 3, inject_pathway_props->n_pathways); @@ -94,7 +87,7 @@ inline void calc_grain_size_increment_1d( grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[2-1], my_fields->grid_dimension[0]); grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[2-1], my_fields->grid_dimension[0]); // array - int iSN, nSN, iSN0; + int iSN, iSN0; std::vector SN_i(inject_pathway_props->n_pathways); std::vector SN_metal_data_(my_fields->grid_dimension[0] * inject_pathway_props->n_pathways); grackle::impl::View SN_metal(SN_metal_data_.data(), my_fields->grid_dimension[0], inject_pathway_props->n_pathways); @@ -164,130 +157,47 @@ inline void calc_grain_size_increment_1d( std::vector SN_kpH2Oice_data_((*gr_Size) * inject_pathway_props->n_pathways); grackle::impl::View SN_kpH2Oice(SN_kpH2Oice_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - // this is a stopgap solution - auto max_ratio_fn = [&](grackle::impl::View inj_path_metal_dens) { - gr_float max_ratio = std::numeric_limits::lowest(); - - for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - gr_float cur_ratio = ( - inj_path_metal_dens(i, idx_range.j, idx_range.k) / - metal(i, idx_range.j, idx_range.k)); - max_ratio = std::fmax(cur_ratio, max_ratio); - } - return static_cast(max_ratio); - }; - // local int i, idx; + InjectPathFieldPack inject_path_metal_densities = setup_InjectPathFieldPack( + my_chemistry, my_fields); - // make arrays - if (my_chemistry->multi_metals == 0) { - nSN = 1; - SN_i[1-1] = my_chemistry->metal_abundances + 1; - - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,1-1) = metal(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } else { - nSN = 0; - - if(max_ratio_fn(metal_loc) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 1; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_loc(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } - - if (max_ratio_fn(metal_C13) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 2; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_C13(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } - - if (max_ratio_fn(metal_C20) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 3; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_C20(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } - - if (max_ratio_fn(metal_C25) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 4; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_C25(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } + int start = inject_path_metal_densities.start_idx; + int stop = inject_path_metal_densities.stop_idx; - if (max_ratio_fn(metal_C30) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 5; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_C30(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } + // make arrays + int nSN = 0; + for (int count = start; count < stop; count++) { + // when my_chemistry->multi_metals == 0, inj_path_metal_dens wraps + // the same pointer as `metal` - if (max_ratio_fn(metal_F13) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 6; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_F13(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } + grackle::impl::View inj_path_metal_dens( + inject_path_metal_densities.fields[count], + my_fields->grid_dimension[0], my_fields->grid_dimension[1], + my_fields->grid_dimension[2]); - if (max_ratio_fn(metal_F15) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 7; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_F15(i-1,idx_range.jp1-1,idx_range.kp1-1); - } + // calculate the max ratio between inj_path_metal_dens and metal + gr_float max_ratio = std::numeric_limits::lowest(); + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + gr_float cur_ratio = ( + inj_path_metal_dens(i, idx_range.j, idx_range.k) / + metal(i, idx_range.j, idx_range.k)); + max_ratio = std::fmax(cur_ratio, max_ratio); } - if (max_ratio_fn(metal_F50) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 8; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_F50(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } + if (max_ratio > 0.01) { + nSN++; - if (max_ratio_fn(metal_F80) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 9; + SN_i[nSN-1] = count + 1; for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_F80(i-1,idx_range.jp1-1,idx_range.kp1-1); + SN_metal(i-1,nSN-1) = inj_path_metal_dens(i-1,idx_range.jp1-1,idx_range.kp1-1); } } + } - if (max_ratio_fn(metal_P170) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 10; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_P170(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } - if (max_ratio_fn(metal_P200) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 11; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_P200(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } - if (max_ratio_fn(metal_Y19) > 0.01) { - nSN = nSN + 1; - SN_i[nSN-1] = 12; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = metal_Y19(i-1,idx_range.jp1-1,idx_range.kp1-1); - } - } - } for (iSN = 1; iSN<=(nSN); iSN++) { iSN0 = SN_i[iSN-1]; From 5572b101e7baac0e6f7667eae7750cb8aac182f6 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 19:59:55 -0500 Subject: [PATCH 078/111] adjusting interface of calc_grain_size_increment_1d.hpp --- .../calc_grain_size_increment_1d.hpp | 30 +++++++++---------- src/clib/fortran_func_wrappers.hpp | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 1c5b12ab8..014bb7c57 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -30,9 +30,9 @@ namespace grackle::impl { inline void calc_grain_size_increment_1d( - const gr_mask_type* itmask, double* dom, int* gr_N, int* gr_Size, + double dom, IndexRange idx_range, + const gr_mask_type* itmask, int* gr_N, int* gr_Size, const chemistry_data* my_chemistry, grackle_field_data* my_fields, - IndexRange idx_range, grackle::impl::InternalDustPropBuf internal_dust_prop_buf, grackle::impl::GrainMetalInjectPathways* inject_pathway_props ) @@ -286,7 +286,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'MgSiO3' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), SN_fMgSiO3.data(), SN_r0MgSiO3.data(), &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() @@ -295,7 +295,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'AC' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->AC_dust_density, SN_metal.data(), SN_fAC.data(), SN_r0AC.data(), &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() @@ -306,7 +306,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'SiM' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->SiM_dust_density, SN_metal.data(), SN_fSiM.data(), SN_r0SiM.data(), &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() @@ -315,7 +315,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'FeM' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->FeM_dust_density, SN_metal.data(), SN_fFeM.data(), SN_r0FeM.data(), &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() @@ -324,7 +324,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'Mg2SiO4' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), SN_fMg2SiO4.data(), SN_r0Mg2SiO4.data(), &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() @@ -333,7 +333,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'Fe3O4' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), SN_fFe3O4.data(), SN_r0Fe3O4.data(), &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() @@ -342,7 +342,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'SiO2D' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->SiO2_dust_density, SN_metal.data(), SN_fSiO2D.data(), SN_r0SiO2D.data(), &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() @@ -351,7 +351,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'MgO' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->MgO_dust_density, SN_metal.data(), SN_fMgO.data(), SN_r0MgO.data(), &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() @@ -360,7 +360,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'FeS' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->FeS_dust_density, SN_metal.data(), SN_fFeS.data(), SN_r0FeS.data(), &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() @@ -369,7 +369,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'Al2O3' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), SN_fAl2O3.data(), SN_r0Al2O3.data(), &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() @@ -380,7 +380,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'reforg' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->ref_org_dust_density, SN_metal.data(), SN_freforg.data(), SN_r0reforg.data(), &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() @@ -389,7 +389,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'volorg' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->vol_org_dust_density, SN_metal.data(), SN_fvolorg.data(), SN_r0volorg.data(), &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() @@ -398,7 +398,7 @@ inline void calc_grain_size_increment_1d( // ! write(*,*) 'H2Oice' FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, dom, my_fields->density, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), SN_fH2Oice.data(), SN_r0H2Oice.data(), &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index baada879f..842b916c3 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -138,7 +138,7 @@ inline void calc_grain_size_increment_1d ( int gr_Size = gr_N[0] * gr_N[1]; ::grackle::impl::calc_grain_size_increment_1d( - itmask_metal, &dom, gr_N, &gr_Size, my_chemistry, my_fields, idx_range, + dom, idx_range, itmask_metal, gr_N, &gr_Size, my_chemistry, my_fields, internal_dust_prop_buf, inject_pathway_props ); } From b12e22e88b82671c5b4729dfe194b165fb4af51d Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 20:04:37 -0500 Subject: [PATCH 079/111] another interface adjustment --- .../calc_grain_size_increment_1d.hpp | 112 +++++++++--------- src/clib/fortran_func_wrappers.hpp | 2 +- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 014bb7c57..2c8e81712 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -31,7 +31,7 @@ namespace grackle::impl { inline void calc_grain_size_increment_1d( double dom, IndexRange idx_range, - const gr_mask_type* itmask, int* gr_N, int* gr_Size, + const gr_mask_type* itmask, int* gr_N, int gr_Size, const chemistry_data* my_chemistry, grackle_field_data* my_fields, grackle::impl::InternalDustPropBuf internal_dust_prop_buf, grackle::impl::GrainMetalInjectPathways* inject_pathway_props @@ -58,19 +58,19 @@ inline void calc_grain_size_increment_1d( grackle::impl::View SN0_r0volorg(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], 3, inject_pathway_props->n_pathways); grackle::impl::View SN0_r0H2Oice(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], 3, inject_pathway_props->n_pathways); // opacity table - grackle::impl::View SN0_kpSiM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpFeM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpMg2SiO4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpMgSiO3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpFe3O4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpAC(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpSiO2D(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpMgO(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpFeS(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpAl2O3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpreforg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpvolorg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], (*gr_Size), inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpH2Oice(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], (*gr_Size), inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpSiM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpFeM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpMg2SiO4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpMgSiO3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpFe3O4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpAC(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpSiO2D(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpMgO(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpFeS(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpAl2O3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpreforg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpvolorg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN0_kpH2Oice(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], gr_Size, inject_pathway_props->n_pathways); // out grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[2-1], my_fields->grid_dimension[0]); grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[2-1], my_fields->grid_dimension[0]); @@ -130,32 +130,32 @@ inline void calc_grain_size_increment_1d( grackle::impl::View SN_r0volorg(SN_r0volorg_data_.data(), 3, inject_pathway_props->n_pathways); std::vector SN_r0H2Oice_data_(3 * inject_pathway_props->n_pathways); grackle::impl::View SN_r0H2Oice(SN_r0H2Oice_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_kpSiM_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpSiM(SN_kpSiM_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpFeM_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFeM(SN_kpFeM_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpMg2SiO4_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMg2SiO4(SN_kpMg2SiO4_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpMgSiO3_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMgSiO3(SN_kpMgSiO3_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpFe3O4_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFe3O4(SN_kpFe3O4_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpAC_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpAC(SN_kpAC_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpSiO2D_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpSiO2D(SN_kpSiO2D_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpMgO_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMgO(SN_kpMgO_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpFeS_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFeS(SN_kpFeS_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpAl2O3_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpAl2O3(SN_kpAl2O3_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpreforg_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpreforg(SN_kpreforg_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpvolorg_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpvolorg(SN_kpvolorg_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); - std::vector SN_kpH2Oice_data_((*gr_Size) * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpH2Oice(SN_kpH2Oice_data_.data(), (*gr_Size), inject_pathway_props->n_pathways); + std::vector SN_kpSiM_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpSiM(SN_kpSiM_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpFeM_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFeM(SN_kpFeM_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpMg2SiO4_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMg2SiO4(SN_kpMg2SiO4_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpMgSiO3_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMgSiO3(SN_kpMgSiO3_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpFe3O4_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFe3O4(SN_kpFe3O4_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpAC_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpAC(SN_kpAC_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpSiO2D_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpSiO2D(SN_kpSiO2D_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpMgO_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMgO(SN_kpMgO_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpFeS_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFeS(SN_kpFeS_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpAl2O3_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpAl2O3(SN_kpAl2O3_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpreforg_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpreforg(SN_kpreforg_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpvolorg_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpvolorg(SN_kpvolorg_data_.data(), gr_Size, inject_pathway_props->n_pathways); + std::vector SN_kpH2Oice_data_(gr_Size * inject_pathway_props->n_pathways); + grackle::impl::View SN_kpH2Oice(SN_kpH2Oice_data_.data(), gr_Size, inject_pathway_props->n_pathways); // local int i, idx; @@ -209,7 +209,7 @@ inline void calc_grain_size_increment_1d( SN_r0MgSiO3 (idx-1,iSN-1) = SN0_r0MgSiO3 (idx-1,iSN0-1); SN_r0AC (idx-1,iSN-1) = SN0_r0AC (idx-1,iSN0-1); } - for (idx = 1; idx<=((*gr_Size)); idx++) { + for (idx = 1; idx<=(gr_Size); idx++) { SN_kpMgSiO3 (idx-1,iSN-1) = SN0_kpMgSiO3 (idx-1,iSN0-1); SN_kpAC (idx-1,iSN-1) = SN0_kpAC (idx-1,iSN0-1); } @@ -234,7 +234,7 @@ inline void calc_grain_size_increment_1d( SN_r0FeS (idx-1,iSN-1) = SN0_r0FeS (idx-1,iSN0-1); SN_r0Al2O3 (idx-1,iSN-1) = SN0_r0Al2O3 (idx-1,iSN0-1); } - for (idx = 1; idx<=((*gr_Size)); idx++) { + for (idx = 1; idx<=(gr_Size); idx++) { SN_kpSiM (idx-1,iSN-1) = SN0_kpSiM (idx-1,iSN0-1); SN_kpFeM (idx-1,iSN-1) = SN0_kpFeM (idx-1,iSN0-1); SN_kpMg2SiO4 (idx-1,iSN-1) = SN0_kpMg2SiO4 (idx-1,iSN0-1); @@ -255,7 +255,7 @@ inline void calc_grain_size_increment_1d( SN_r0volorg (idx-1,iSN-1) = SN0_r0volorg (idx-1,iSN0-1); SN_r0H2Oice (idx-1,iSN-1) = SN0_r0H2Oice (idx-1,iSN0-1); } - for (idx = 1; idx<=((*gr_Size)); idx++) { + for (idx = 1; idx<=(gr_Size); idx++) { SN_kpreforg (idx-1,iSN-1) = SN0_kpreforg (idx-1,iSN0-1); SN_kpvolorg (idx-1,iSN-1) = SN0_kpvolorg (idx-1,iSN0-1); SN_kpH2Oice (idx-1,iSN-1) = SN0_kpH2Oice (idx-1,iSN0-1); @@ -289,7 +289,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), SN_fMgSiO3.data(), SN_r0MgSiO3.data(), &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() ); // ! write(*,*) 'AC' @@ -298,7 +298,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->AC_dust_density, SN_metal.data(), SN_fAC.data(), SN_r0AC.data(), &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() ); } @@ -309,7 +309,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->SiM_dust_density, SN_metal.data(), SN_fSiM.data(), SN_r0SiM.data(), &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() ); // ! write(*,*) 'FeM' @@ -318,7 +318,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->FeM_dust_density, SN_metal.data(), SN_fFeM.data(), SN_r0FeM.data(), &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() ); // ! write(*,*) 'Mg2SiO4' @@ -327,7 +327,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), SN_fMg2SiO4.data(), SN_r0Mg2SiO4.data(), &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() ); // ! write(*,*) 'Fe3O4' @@ -336,7 +336,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), SN_fFe3O4.data(), SN_r0Fe3O4.data(), &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() ); // ! write(*,*) 'SiO2D' @@ -345,7 +345,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->SiO2_dust_density, SN_metal.data(), SN_fSiO2D.data(), SN_r0SiO2D.data(), &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() ); // ! write(*,*) 'MgO' @@ -354,7 +354,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->MgO_dust_density, SN_metal.data(), SN_fMgO.data(), SN_r0MgO.data(), &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() ); // ! write(*,*) 'FeS' @@ -363,7 +363,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->FeS_dust_density, SN_metal.data(), SN_fFeS.data(), SN_r0FeS.data(), &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() ); // ! write(*,*) 'Al2O3' @@ -372,7 +372,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), SN_fAl2O3.data(), SN_r0Al2O3.data(), &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() ); } @@ -383,7 +383,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->ref_org_dust_density, SN_metal.data(), SN_freforg.data(), SN_r0reforg.data(), &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() ); // ! write(*,*) 'volorg' @@ -392,7 +392,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->vol_org_dust_density, SN_metal.data(), SN_fvolorg.data(), SN_r0volorg.data(), &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() ); // ! write(*,*) 'H2Oice' @@ -401,7 +401,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), SN_fH2Oice.data(), SN_r0H2Oice.data(), &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), - gr_N, gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() ); } diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index 842b916c3..d12e6653a 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -138,7 +138,7 @@ inline void calc_grain_size_increment_1d ( int gr_Size = gr_N[0] * gr_N[1]; ::grackle::impl::calc_grain_size_increment_1d( - dom, idx_range, itmask_metal, gr_N, &gr_Size, my_chemistry, my_fields, + dom, idx_range, itmask_metal, gr_N, gr_Size, my_chemistry, my_fields, internal_dust_prop_buf, inject_pathway_props ); } From d86f7e56e795ecac32aa8af45a239f7f0d3ef677 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 20:07:11 -0500 Subject: [PATCH 080/111] a third interface adjustment --- .../calc_grain_size_increment_1d.hpp | 18 +++++++++++++----- src/clib/fortran_func_wrappers.hpp | 12 +++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 2c8e81712..70ba33605 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -30,13 +30,21 @@ namespace grackle::impl { inline void calc_grain_size_increment_1d( - double dom, IndexRange idx_range, - const gr_mask_type* itmask, int* gr_N, int gr_Size, - const chemistry_data* my_chemistry, grackle_field_data* my_fields, - grackle::impl::InternalDustPropBuf internal_dust_prop_buf, - grackle::impl::GrainMetalInjectPathways* inject_pathway_props + double dom, IndexRange idx_range, const gr_mask_type* itmask, + const chemistry_data* my_chemistry, + grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + grackle_field_data* my_fields, + grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) { + // NOTE: gr_N and gr_Size are historical names + // -> they are pretty uninformative and should be changed! + int gr_N[2] = { + inject_pathway_props->n_opac_poly_coef, + static_cast(inject_pathway_props->log10Tdust_interp_props.dimension[0]) + }; + int gr_Size = gr_N[0] * gr_N[1]; + grackle::impl::View metal( const_cast(my_fields->metal_density), diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index d12e6653a..63ffe4473 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -129,17 +129,11 @@ inline void calc_grain_size_increment_1d ( grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) { - // NOTE: gr_N and gr_Size are historical names - // -> they are pretty uninformative and should be changed! - int gr_N[2] = { - inject_pathway_props->n_opac_poly_coef, - static_cast(inject_pathway_props->log10Tdust_interp_props.dimension[0]) - }; - int gr_Size = gr_N[0] * gr_N[1]; ::grackle::impl::calc_grain_size_increment_1d( - dom, idx_range, itmask_metal, gr_N, gr_Size, my_chemistry, my_fields, - internal_dust_prop_buf, inject_pathway_props + dom, idx_range, itmask_metal, + my_chemistry, inject_pathway_props, my_fields, + internal_dust_prop_buf ); } From 43aa1c2698a687e3a9f59f32acb901014fb216ca Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 21:01:11 -0500 Subject: [PATCH 081/111] remove the old wrapper for calc_grain_size_increment_1d.hpp --- src/clib/calc_tdust_3d.cpp | 3 +- src/clib/cool1d_multi_g.cpp | 3 +- .../calc_grain_size_increment_1d.hpp | 38 +++++++++++++++++++ src/clib/fortran_func_wrappers.hpp | 32 ---------------- src/clib/lookup_cool_rates1d.hpp | 3 +- 5 files changed, 44 insertions(+), 35 deletions(-) diff --git a/src/clib/calc_tdust_3d.cpp b/src/clib/calc_tdust_3d.cpp index 27dbc6e54..0d0865b74 100644 --- a/src/clib/calc_tdust_3d.cpp +++ b/src/clib/calc_tdust_3d.cpp @@ -18,6 +18,7 @@ #include "calc_tdust_3d.h" #include "dust_props.hpp" +#include "dust/multi_grain_species/calc_grain_size_increment_1d.hpp" #include "fortran_func_wrappers.hpp" #include "grackle.h" #include "index_helper.h" @@ -164,7 +165,7 @@ void calc_tdust_3d_g( if ( (my_chemistry->use_dust_density_field > 0) && (my_chemistry->dust_species > 0) ) { - f_wrap::calc_grain_size_increment_1d ( + grackle::impl::calc_grain_size_increment_1d ( dom, idx_range, itmask_metal.data(), my_chemistry, my_rates->opaque_storage->inject_pathway_props, my_fields, internal_dust_prop_buf diff --git a/src/clib/cool1d_multi_g.cpp b/src/clib/cool1d_multi_g.cpp index d787ece1a..41c05ee8d 100644 --- a/src/clib/cool1d_multi_g.cpp +++ b/src/clib/cool1d_multi_g.cpp @@ -22,6 +22,7 @@ #include "fortran_func_decls.h" #include "fortran_func_wrappers.hpp" #include "dust_props.hpp" +#include "dust/multi_grain_species/calc_grain_size_increment_1d.hpp" #include "inject_model/grain_metal_inject_pathways.hpp" #include "internal_types.hpp" #include "utils-cpp.hpp" @@ -1104,7 +1105,7 @@ void grackle::impl::cool1d_multi_g( // Compute grain size increment if ((my_chemistry->use_dust_density_field > 0) && (my_chemistry->dust_species > 0)) { - grackle::impl::fortran_wrapper::calc_grain_size_increment_1d( + grackle::impl::calc_grain_size_increment_1d( dom, idx_range, itmask_metal, my_chemistry, my_rates->opaque_storage->inject_pathway_props, my_fields, internal_dust_prop_buf); diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 70ba33605..6c8ce61bc 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -10,6 +10,9 @@ /// //===----------------------------------------------------------------------===// +#ifndef CALC_GRAIN_SIZE_INCREMENT_1D_HPP +#define CALC_GRAIN_SIZE_INCREMENT_1D_HPP + // This file was initially generated automatically during conversion of the // calc_grain_size_increment_1d function from FORTRAN to C++ @@ -29,6 +32,38 @@ namespace grackle::impl { +/// For each grain species, compute quantities pertaining to the size +/// distribution along the specified index range. +/// +/// In slightly more detail, our model assumes that the a grain species's +/// current differential size distribution is the weighted sum of the +/// initial differential size distributions from each of the injection +/// pathways that is translated by a value known as the "size increment." +/// Internally, this function computes the size increment based on the amount +/// of amount of mass that has been transferred to the grain species (compared +/// to the initial injected amount) via grain growth. For context, if there +/// hasn't been growth, the size increment is zero. +/// +/// This function computes the size increment as an intermediate quantity. +/// Then, it uses that information to compute +/// - the current cross-section +/// - a 1D table of opacity-related values (for various possible dust +/// Temperatures). +/// +/// @todo +/// Consider writing some narrative documentation about the detailed model of +/// the multi-grain species dust model and revising this docstring so that its +/// less dense (and points the reader to the narrative docs for more details) +/// +/// @param[in] dom a standard quantity used throughout the codebase +/// @param[in] idx_range Specifies the current index-range +/// @param[in] itmask_metal Specifies the `idx_range`'s iteration-mask +/// @param[in] my_chemistry holds a number of configuration parameters +/// @param[in] inject_pathway_props holds data about the modelled injection +/// pathways for all of the grain species. +/// @param[in] my_fields specifies the field data +/// @param[in,out] internal_dust_prop_buf Holds dust-specific information that +/// gets updated by this function inline void calc_grain_size_increment_1d( double dom, IndexRange idx_range, const gr_mask_type* itmask, const chemistry_data* my_chemistry, @@ -469,3 +504,6 @@ inline void calc_grain_size_increment_1d( } } // namespace grackle::impl + + +#endif // CALC_GRAIN_SIZE_INCREMENT_1D_HPP diff --git a/src/clib/fortran_func_wrappers.hpp b/src/clib/fortran_func_wrappers.hpp index 63ffe4473..0a25cd27c 100644 --- a/src/clib/fortran_func_wrappers.hpp +++ b/src/clib/fortran_func_wrappers.hpp @@ -105,38 +105,6 @@ inline void calc_all_tdust_gasgr_1d_g( } -/// Compute grain size increment -/// -/// @note -/// The description could obviously be improved! My general sense is that we -/// are computing dust-properties in each zone. Among other things, this -/// computes size and precomputes the dust opacity table -/// -/// @param[in] dom a standard quantity used throughout the codebase -/// @param[in] idx_range Specifies the current index-range -/// @param[in] itmask_metal Specifies the `idx_range`'s iteration-mask -/// @param[in] my_chemistry holds a number of configuration parameters -/// @param[in] inject_pathway_props holds data about the modelled injection -/// pathways for all of the grain species. -/// @param[in] my_fields specifies the field data -/// @param[in,out] internal_dust_prop_buf Holds dust-specific information that -/// gets updated by this function -inline void calc_grain_size_increment_1d ( - double dom, IndexRange idx_range, const gr_mask_type* itmask_metal, - chemistry_data* my_chemistry, - grackle::impl::GrainMetalInjectPathways* inject_pathway_props, - grackle_field_data* my_fields, - grackle::impl::InternalDustPropBuf internal_dust_prop_buf -) { - - - ::grackle::impl::calc_grain_size_increment_1d( - dom, idx_range, itmask_metal, - my_chemistry, inject_pathway_props, my_fields, - internal_dust_prop_buf - ); -} - inline void calc_temp1d_cloudy_g( double* rhoH, IndexRange idx_range, double* tgas, double* mmw, double dom, double zr, int imetal, cloudy_data cloudy_primordial, gr_mask_type* itmask, diff --git a/src/clib/lookup_cool_rates1d.hpp b/src/clib/lookup_cool_rates1d.hpp index fb041799f..9c015da76 100644 --- a/src/clib/lookup_cool_rates1d.hpp +++ b/src/clib/lookup_cool_rates1d.hpp @@ -21,6 +21,7 @@ #include "grackle.h" #include "dust_props.hpp" #include "dust/grain_species_info.hpp" +#include "dust/multi_grain_species/calc_grain_size_increment_1d.hpp" #include "fortran_func_decls.h" #include "fortran_func_wrappers.hpp" #include "internal_types.hpp" @@ -809,7 +810,7 @@ inline void lookup_cool_rates1d( // Compute grain size increment if ((anydust != MASK_FALSE) && (my_chemistry->dust_species > 0)) { - f_wrap::calc_grain_size_increment_1d( + calc_grain_size_increment_1d( dom, idx_range, itmask_metal, my_chemistry, my_rates->opaque_storage->inject_pathway_props, my_fields, internal_dust_prop_scratch_buf); From 35aebcff895cfebf34cb9bd2d7217f57573ae645 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 21:19:14 -0500 Subject: [PATCH 082/111] replace constants with GrainSpeciesInfoEntry::bulk_density_cgs --- src/clib/calc_tdust_3d.cpp | 1 + src/clib/cool1d_multi_g.cpp | 5 +-- .../calc_grain_size_increment_1d.hpp | 26 +++++---------- src/clib/fortran_func_decls.h | 4 +-- src/clib/lookup_cool_rates1d.hpp | 5 +-- src/clib/phys_constants.h | 32 ------------------- 6 files changed, 17 insertions(+), 56 deletions(-) diff --git a/src/clib/calc_tdust_3d.cpp b/src/clib/calc_tdust_3d.cpp index 0d0865b74..2035b424d 100644 --- a/src/clib/calc_tdust_3d.cpp +++ b/src/clib/calc_tdust_3d.cpp @@ -167,6 +167,7 @@ void calc_tdust_3d_g( grackle::impl::calc_grain_size_increment_1d ( dom, idx_range, itmask_metal.data(), my_chemistry, + my_rates->opaque_storage->grain_species_info, my_rates->opaque_storage->inject_pathway_props, my_fields, internal_dust_prop_buf ); diff --git a/src/clib/cool1d_multi_g.cpp b/src/clib/cool1d_multi_g.cpp index 41c05ee8d..d3d10bc83 100644 --- a/src/clib/cool1d_multi_g.cpp +++ b/src/clib/cool1d_multi_g.cpp @@ -1107,8 +1107,9 @@ void grackle::impl::cool1d_multi_g( (my_chemistry->dust_species > 0)) { grackle::impl::calc_grain_size_increment_1d( dom, idx_range, itmask_metal, my_chemistry, - my_rates->opaque_storage->inject_pathway_props, my_fields, - internal_dust_prop_buf); + my_rates->opaque_storage->grain_species_info, + my_rates->opaque_storage->inject_pathway_props, + my_fields, internal_dust_prop_buf); } // Calculate dust to gas ratio AND interstellar radiation field diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 6c8ce61bc..e43860156 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -22,12 +22,12 @@ #include "grackle.h" #include "dust_props.hpp" +#include "dust/grain_species_info.hpp" #include "fortran_func_decls.h" #include "index_helper.h" #include "inject_model/grain_metal_inject_pathways.hpp" #include "inject_model/inject_path_field_pack.hpp" #include "LUT.hpp" -#include "phys_constants.h" #include "utils-cpp.hpp" namespace grackle::impl { @@ -59,6 +59,7 @@ namespace grackle::impl { /// @param[in] idx_range Specifies the current index-range /// @param[in] itmask_metal Specifies the `idx_range`'s iteration-mask /// @param[in] my_chemistry holds a number of configuration parameters +/// @param[in] grain_species_info holds information about each grain species /// @param[in] inject_pathway_props holds data about the modelled injection /// pathways for all of the grain species. /// @param[in] my_fields specifies the field data @@ -67,7 +68,8 @@ namespace grackle::impl { inline void calc_grain_size_increment_1d( double dom, IndexRange idx_range, const gr_mask_type* itmask, const chemistry_data* my_chemistry, - grackle::impl::GrainMetalInjectPathways* inject_pathway_props, + const GrainSpeciesInfo* grain_species_info, + const GrainMetalInjectPathways* inject_pathway_props, grackle_field_data* my_fields, grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) @@ -306,22 +308,10 @@ inline void calc_grain_size_increment_1d( } } - double bulk_densities[OnlyGrainSpLUT::NUM_ENTRIES] = { - sMgSiO3, - sAC, - sSiM, - sFeM, - sMg2SiO4, - sFe3O4, - sSiO2D, - sMgO, - sFeS, - sAl2O3, - sreforg, - svolorg, - sH2Oice, - }; - + double bulk_densities[OnlyGrainSpLUT::NUM_ENTRIES]; + for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { + bulk_densities[grsp_i] = grain_species_info->species_info[grsp_i].bulk_density_cgs; + } // ! calculate size increment diff --git a/src/clib/fortran_func_decls.h b/src/clib/fortran_func_decls.h index 099797e2a..4c0a14e87 100644 --- a/src/clib/fortran_func_decls.h +++ b/src/clib/fortran_func_decls.h @@ -48,11 +48,11 @@ void FORTRAN_NAME(calc_all_tdust_gasgr_1d_g)( ); void FORTRAN_NAME(calc_grain_size_increment_species_1d)( - const int* igrgr, const gr_mask_type* itmask, int* SN0_N, int* in, int* jn, int* kn, + const int* igrgr, const gr_mask_type* itmask, const int* SN0_N, int* in, int* jn, int* kn, int* is, int* ie, int* j, int* k, double* dom, gr_float* d_data_ptr, int* nSN, gr_float* dsp_data_ptr, gr_float* SN_metal_data_ptr, double* SN_fsp, double* SN_r0sp_data_ptr, double* ssp, double* sgsp, double* alsp_data_ptr, - int* gr_N, int* gr_Size, double* gr_dT, double* gr_Td, + const int* gr_N, const int* gr_Size, const double* gr_dT, const double* gr_Td, double* SN_kp0sp_data_ptr ); diff --git a/src/clib/lookup_cool_rates1d.hpp b/src/clib/lookup_cool_rates1d.hpp index 9c015da76..3f4b20028 100644 --- a/src/clib/lookup_cool_rates1d.hpp +++ b/src/clib/lookup_cool_rates1d.hpp @@ -812,8 +812,9 @@ inline void lookup_cool_rates1d( if ((anydust != MASK_FALSE) && (my_chemistry->dust_species > 0)) { calc_grain_size_increment_1d( dom, idx_range, itmask_metal, my_chemistry, - my_rates->opaque_storage->inject_pathway_props, my_fields, - internal_dust_prop_scratch_buf); + my_rates->opaque_storage->grain_species_info, + my_rates->opaque_storage->inject_pathway_props, + my_fields, internal_dust_prop_scratch_buf); } // Look-up rate for H2 formation on dust & (when relevant) grain growth rates diff --git a/src/clib/phys_constants.h b/src/clib/phys_constants.h index 5121d314e..918a52f90 100644 --- a/src/clib/phys_constants.h +++ b/src/clib/phys_constants.h @@ -109,36 +109,4 @@ #define ev2erg_grflt GRFLOAT_C(1.60217653e-12) #define sigma_sb_grflt GRFLOAT_C(5.670373e-5) -/************************************************/ - -/* dust constants (taken from dust_const.def) */ - -/************************************************/ - -/* TODO: After we finish transcribe calc_grain_size_increment_1d to C++, we - * should remove these constants and instead use the values stored by - * `GrainSpeciesInfoEntry::bulk_density_cgs` - * -> to be clear, the values within GrainSpeciesInfoEntry::bulk_density_cgs - * are hardcoded based on the values currently held by these constants. - */ - -// these constants are give the intrinsic density of an individual grain for -// each grain species in units of g/cm^3. -// - Equation A1 of Chiaki & Wise 2019 represents these quantities using the -// zeta_i variable. Equation 2 of Chiaki+15 denotes the variable as s_i - -#define sSiM 2.34118e0 -#define sFeM 7.95995e0 -#define sMg2SiO4 3.22133e0 -#define sMgSiO3 3.20185e0 -#define sFe3O4 5.25096e0 -#define sAC 2.27949e0 -#define sSiO2D 2.66235e0 -#define sMgO 3.58157e0 -#define sFeS 4.87265e0 -#define sAl2O3 4.01610e0 -#define sreforg 1.5e0 -#define svolorg 1.0e0 -#define sH2Oice 0.92e0 - #endif From 6bbcda781a4230ee4ef63ce256f23cb644c0966e Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 22:09:46 -0500 Subject: [PATCH 083/111] grain_size_incr: a step towards aggregating allocations --- .../calc_grain_size_increment_1d.hpp | 94 +++++++++++++------ 1 file changed, 63 insertions(+), 31 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index e43860156..b3ff9fb90 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -74,12 +74,14 @@ inline void calc_grain_size_increment_1d( grackle::impl::InternalDustPropBuf internal_dust_prop_buf ) { + const int n_pathways = inject_pathway_props->n_pathways; + const int n_log10Tdust_vals = static_cast( + inject_pathway_props->log10Tdust_interp_props.dimension[0]); + const int n_opac_poly_coef = inject_pathway_props->n_opac_poly_coef; + // NOTE: gr_N and gr_Size are historical names // -> they are pretty uninformative and should be changed! - int gr_N[2] = { - inject_pathway_props->n_opac_poly_coef, - static_cast(inject_pathway_props->log10Tdust_interp_props.dimension[0]) - }; + int gr_N[2] = {n_opac_poly_coef, n_log10Tdust_vals}; int gr_Size = gr_N[0] * gr_N[1]; @@ -136,19 +138,23 @@ inline void calc_grain_size_increment_1d( std::vector SN_i(inject_pathway_props->n_pathways); std::vector SN_metal_data_(my_fields->grid_dimension[0] * inject_pathway_props->n_pathways); grackle::impl::View SN_metal(SN_metal_data_.data(), my_fields->grid_dimension[0], inject_pathway_props->n_pathways); - std::vector SN_fSiM(inject_pathway_props->n_pathways); - std::vector SN_fFeM(inject_pathway_props->n_pathways); - std::vector SN_fMg2SiO4(inject_pathway_props->n_pathways); - std::vector SN_fMgSiO3(inject_pathway_props->n_pathways); - std::vector SN_fFe3O4(inject_pathway_props->n_pathways); - std::vector SN_fAC(inject_pathway_props->n_pathways); - std::vector SN_fSiO2D(inject_pathway_props->n_pathways); - std::vector SN_fMgO(inject_pathway_props->n_pathways); - std::vector SN_fFeS(inject_pathway_props->n_pathways); - std::vector SN_fAl2O3(inject_pathway_props->n_pathways); - std::vector SN_freforg(inject_pathway_props->n_pathways); - std::vector SN_fvolorg(inject_pathway_props->n_pathways); - std::vector SN_fH2Oice(inject_pathway_props->n_pathways); + + GrainMetalInjectPathways reduced_inject_paths = new_GrainMetalInjectPathways( + n_pathways, n_log10Tdust_vals, n_opac_poly_coef); + + double* SN_fSiM = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust]; + double* SN_fFeM = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust]; + double* SN_fMg2SiO4 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust]; + double* SN_fMgSiO3 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust]; + double* SN_fFe3O4 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust]; + double* SN_fAC = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust]; + double* SN_fSiO2D = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust]; + double* SN_fMgO = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust]; + double* SN_fFeS = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust]; + double* SN_fAl2O3 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust]; + double* SN_freforg = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust]; + double* SN_fvolorg = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust]; + double* SN_fH2Oice = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust]; std::vector SN_r0SiM_data_(3 * inject_pathway_props->n_pathways); grackle::impl::View SN_r0SiM(SN_r0SiM_data_.data(), 3, inject_pathway_props->n_pathways); std::vector SN_r0FeM_data_(3 * inject_pathway_props->n_pathways); @@ -320,7 +326,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), SN_fMgSiO3.data(), SN_r0MgSiO3.data(), + &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], + SN_r0MgSiO3.data(), &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() ); @@ -329,7 +337,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->AC_dust_density, SN_metal.data(), SN_fAC.data(), SN_r0AC.data(), + &nSN, my_fields->AC_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust], + SN_r0AC.data(), &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() ); @@ -340,7 +350,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->SiM_dust_density, SN_metal.data(), SN_fSiM.data(), SN_r0SiM.data(), + &nSN, my_fields->SiM_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust], + SN_r0SiM.data(), &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() ); @@ -349,7 +361,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->FeM_dust_density, SN_metal.data(), SN_fFeM.data(), SN_r0FeM.data(), + &nSN, my_fields->FeM_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust], + SN_r0FeM.data(), &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() ); @@ -358,7 +372,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), SN_fMg2SiO4.data(), SN_r0Mg2SiO4.data(), + &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], + SN_r0Mg2SiO4.data(), &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() ); @@ -367,7 +383,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), SN_fFe3O4.data(), SN_r0Fe3O4.data(), + &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], + SN_r0Fe3O4.data(), &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() ); @@ -376,7 +394,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->SiO2_dust_density, SN_metal.data(), SN_fSiO2D.data(), SN_r0SiO2D.data(), + &nSN, my_fields->SiO2_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust], + SN_r0SiO2D.data(), &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() ); @@ -385,7 +405,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->MgO_dust_density, SN_metal.data(), SN_fMgO.data(), SN_r0MgO.data(), + &nSN, my_fields->MgO_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust], + SN_r0MgO.data(), &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() ); @@ -394,7 +416,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->FeS_dust_density, SN_metal.data(), SN_fFeS.data(), SN_r0FeS.data(), + &nSN, my_fields->FeS_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust], + SN_r0FeS.data(), &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() ); @@ -403,7 +427,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), SN_fAl2O3.data(), SN_r0Al2O3.data(), + &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], + SN_r0Al2O3.data(), &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() ); @@ -414,7 +440,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->ref_org_dust_density, SN_metal.data(), SN_freforg.data(), SN_r0reforg.data(), + &nSN, my_fields->ref_org_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust], + SN_r0reforg.data(), &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() ); @@ -423,7 +451,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->vol_org_dust_density, SN_metal.data(), SN_fvolorg.data(), SN_r0volorg.data(), + &nSN, my_fields->vol_org_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust], + SN_r0volorg.data(), &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() ); @@ -432,7 +462,9 @@ inline void calc_grain_size_increment_1d( FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), SN_fH2Oice.data(), SN_r0H2Oice.data(), + &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], + SN_r0H2Oice.data(), &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() ); @@ -490,7 +522,7 @@ inline void calc_grain_size_increment_1d( } } - return; + drop_GrainMetalInjectPathways(&reduced_inject_paths); } } // namespace grackle::impl From db4bb63d98a829fb1746a702c82f9db9b7ced9f4 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 22:20:06 -0500 Subject: [PATCH 084/111] grain_size_incr: another step towards aggregating allocations --- .../calc_grain_size_increment_1d.hpp | 65 ++++++++----------- 1 file changed, 26 insertions(+), 39 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index b3ff9fb90..45c08a17b 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -155,32 +155,19 @@ inline void calc_grain_size_increment_1d( double* SN_freforg = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust]; double* SN_fvolorg = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust]; double* SN_fH2Oice = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust]; - std::vector SN_r0SiM_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0SiM(SN_r0SiM_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0FeM_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0FeM(SN_r0FeM_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0Mg2SiO4_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0Mg2SiO4(SN_r0Mg2SiO4_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0MgSiO3_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0MgSiO3(SN_r0MgSiO3_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0Fe3O4_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0Fe3O4(SN_r0Fe3O4_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0AC_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0AC(SN_r0AC_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0SiO2D_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0SiO2D(SN_r0SiO2D_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0MgO_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0MgO(SN_r0MgO_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0FeS_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0FeS(SN_r0FeS_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0Al2O3_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0Al2O3(SN_r0Al2O3_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0reforg_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0reforg(SN_r0reforg_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0volorg_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0volorg(SN_r0volorg_data_.data(), 3, inject_pathway_props->n_pathways); - std::vector SN_r0H2Oice_data_(3 * inject_pathway_props->n_pathways); - grackle::impl::View SN_r0H2Oice(SN_r0H2Oice_data_.data(), 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0SiM(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiM_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0FeM(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeM_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0Mg2SiO4(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0MgSiO3(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0Fe3O4(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0AC(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::AC_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0SiO2D(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiO2_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0MgO(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgO_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0FeS(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeS_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0Al2O3(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Al2O3_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0reforg(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0volorg(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], 3, inject_pathway_props->n_pathways); + grackle::impl::View SN_r0H2Oice(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], 3, inject_pathway_props->n_pathways); std::vector SN_kpSiM_data_(gr_Size * inject_pathway_props->n_pathways); grackle::impl::View SN_kpSiM(SN_kpSiM_data_.data(), gr_Size, inject_pathway_props->n_pathways); std::vector SN_kpFeM_data_(gr_Size * inject_pathway_props->n_pathways); @@ -328,7 +315,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], - SN_r0MgSiO3.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() ); @@ -339,7 +326,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->AC_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust], - SN_r0AC.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::AC_dust], &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() ); @@ -352,7 +339,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->SiM_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust], - SN_r0SiM.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiM_dust], &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() ); @@ -363,7 +350,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->FeM_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust], - SN_r0FeM.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeM_dust], &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() ); @@ -374,7 +361,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], - SN_r0Mg2SiO4.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() ); @@ -385,7 +372,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], - SN_r0Fe3O4.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() ); @@ -396,7 +383,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->SiO2_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust], - SN_r0SiO2D.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiO2_dust], &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() ); @@ -407,7 +394,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->MgO_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust], - SN_r0MgO.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgO_dust], &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() ); @@ -418,7 +405,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->FeS_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust], - SN_r0FeS.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeS_dust], &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() ); @@ -429,7 +416,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], - SN_r0Al2O3.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Al2O3_dust], &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() ); @@ -442,7 +429,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->ref_org_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust], - SN_r0reforg.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() ); @@ -453,7 +440,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->vol_org_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust], - SN_r0volorg.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() ); @@ -464,7 +451,7 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], - SN_r0H2Oice.data(), + reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() ); From 9bfe7c161bc40be1b95dd3a3bf83159a90e1619b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 22:38:45 -0500 Subject: [PATCH 085/111] grain_size_incr: a 3rd step towards aggregating allocations --- .../calc_grain_size_increment_1d.hpp | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 45c08a17b..312d3ab21 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -168,32 +168,19 @@ inline void calc_grain_size_increment_1d( grackle::impl::View SN_r0reforg(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], 3, inject_pathway_props->n_pathways); grackle::impl::View SN_r0volorg(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], 3, inject_pathway_props->n_pathways); grackle::impl::View SN_r0H2Oice(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], 3, inject_pathway_props->n_pathways); - std::vector SN_kpSiM_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpSiM(SN_kpSiM_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpFeM_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFeM(SN_kpFeM_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpMg2SiO4_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMg2SiO4(SN_kpMg2SiO4_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpMgSiO3_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMgSiO3(SN_kpMgSiO3_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpFe3O4_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFe3O4(SN_kpFe3O4_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpAC_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpAC(SN_kpAC_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpSiO2D_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpSiO2D(SN_kpSiO2D_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpMgO_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMgO(SN_kpMgO_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpFeS_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFeS(SN_kpFeS_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpAl2O3_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpAl2O3(SN_kpAl2O3_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpreforg_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpreforg(SN_kpreforg_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpvolorg_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpvolorg(SN_kpvolorg_data_.data(), gr_Size, inject_pathway_props->n_pathways); - std::vector SN_kpH2Oice_data_(gr_Size * inject_pathway_props->n_pathways); - grackle::impl::View SN_kpH2Oice(SN_kpH2Oice_data_.data(), gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpSiM(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFeM(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMg2SiO4(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMgSiO3(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFe3O4(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpAC(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpSiO2D(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpMgO(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpFeS(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpAl2O3(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpreforg(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpvolorg(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], gr_Size, inject_pathway_props->n_pathways); + grackle::impl::View SN_kpH2Oice(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], gr_Size, inject_pathway_props->n_pathways); // local int i, idx; @@ -317,7 +304,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgSiO3.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust] ); // ! write(*,*) 'AC' @@ -328,7 +316,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::AC_dust], &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAC.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::AC_dust] ); } @@ -341,7 +330,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiM_dust], &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiM.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust] ); // ! write(*,*) 'FeM' @@ -352,7 +342,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeM_dust], &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeM.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust] ); // ! write(*,*) 'Mg2SiO4' @@ -363,7 +354,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMg2SiO4.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust] ); // ! write(*,*) 'Fe3O4' @@ -374,7 +366,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFe3O4.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust] ); // ! write(*,*) 'SiO2D' @@ -385,7 +378,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiO2_dust], &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpSiO2D.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust] ); // ! write(*,*) 'MgO' @@ -396,7 +390,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgO_dust], &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpMgO.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust] ); // ! write(*,*) 'FeS' @@ -407,7 +402,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeS_dust], &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpFeS.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust] ); // ! write(*,*) 'Al2O3' @@ -418,7 +414,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Al2O3_dust], &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpAl2O3.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust] ); } @@ -431,7 +428,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpreforg.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust] ); // ! write(*,*) 'volorg' @@ -442,7 +440,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpvolorg.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust] ); // ! write(*,*) 'H2Oice' @@ -453,7 +452,8 @@ inline void calc_grain_size_increment_1d( reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], SN_kpH2Oice.data() + gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust] ); } From 2cc450bc0111d2fe30d4a41de7a3e00f1bc67590 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 23:00:08 -0500 Subject: [PATCH 086/111] grain_size_incr: more massaging --- .../calc_grain_size_increment_1d.hpp | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 312d3ab21..80b66bba3 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -29,6 +29,7 @@ #include "inject_model/inject_path_field_pack.hpp" #include "LUT.hpp" #include "utils-cpp.hpp" +#include "utils-field.hpp" namespace grackle::impl { @@ -90,6 +91,8 @@ inline void calc_grain_size_increment_1d( my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); + grackle::impl::SpeciesLUTFieldAdaptor field_data_adaptor{*my_fields}; + // table grackle::impl::View SN0_r0SiM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], 3, inject_pathway_props->n_pathways); grackle::impl::View SN0_r0FeM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], 3, inject_pathway_props->n_pathways); @@ -303,7 +306,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], - &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], alMgSiO3.data(), + &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust] ); @@ -315,7 +318,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->AC_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::AC_dust], - &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], alAC.data(), + &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::AC_dust] ); @@ -329,7 +332,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->SiM_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiM_dust], - &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], alSiM.data(), + &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust] ); @@ -341,7 +344,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->FeM_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeM_dust], - &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], alFeM.data(), + &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust] ); @@ -353,7 +356,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], - &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], alMg2SiO4.data(), + &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust] ); @@ -365,7 +368,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], - &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], alFe3O4.data(), + &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust] ); @@ -377,7 +380,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->SiO2_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiO2_dust], - &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], alSiO2D.data(), + &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust] ); @@ -389,7 +392,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->MgO_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgO_dust], - &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], alMgO.data(), + &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust] ); @@ -401,7 +404,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->FeS_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeS_dust], - &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], alFeS.data(), + &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust] ); @@ -413,7 +416,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Al2O3_dust], - &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], alAl2O3.data(), + &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust] ); @@ -427,7 +430,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->ref_org_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], - &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], alreforg.data(), + &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust] ); @@ -439,7 +442,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->vol_org_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], - &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], alvolorg.data(), + &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust] ); @@ -451,7 +454,7 @@ inline void calc_grain_size_increment_1d( &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], - &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], alH2Oice.data(), + &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust] ); From 17df793550ee2d4055d84e787a57df431c54c3f5 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 23:12:32 -0500 Subject: [PATCH 087/111] grain_size_incr: fold all calls to actually compute increment into for-loop --- .../calc_grain_size_increment_1d.hpp | 189 +++--------------- src/clib/fortran_func_decls.h | 2 +- 2 files changed, 24 insertions(+), 167 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 80b66bba3..d3a5232c9 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -291,173 +291,30 @@ inline void calc_grain_size_increment_1d( } } - double bulk_densities[OnlyGrainSpLUT::NUM_ENTRIES]; + // actually calculate the size increment and subsequent quantities for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { - bulk_densities[grsp_i] = grain_species_info->species_info[grsp_i].bulk_density_cgs; - } - - // ! calculate size increment - - if (my_chemistry->dust_species > 0) { - // ! write(*,*) 'MgSiO3' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->MgSiO3_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], - &bulk_densities[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust] - ); - - // ! write(*,*) 'AC' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->AC_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::AC_dust], - &bulk_densities[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::AC_dust] - ); - } - - if (my_chemistry->dust_species > 1) { - // ! write(*,*) 'SiM' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->SiM_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiM_dust], - &bulk_densities[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust] - ); - - // ! write(*,*) 'FeM' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->FeM_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeM_dust], - &bulk_densities[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust] - ); - - // ! write(*,*) 'Mg2SiO4' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->Mg2SiO4_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], - &bulk_densities[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust] - ); - - // ! write(*,*) 'Fe3O4' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->Fe3O4_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], - &bulk_densities[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust] - ); - - // ! write(*,*) 'SiO2D' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->SiO2_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiO2_dust], - &bulk_densities[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust] - ); - - // ! write(*,*) 'MgO' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->MgO_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgO_dust], - &bulk_densities[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust] - ); - - // ! write(*,*) 'FeS' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->FeS_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeS_dust], - &bulk_densities[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust] - ); - - // ! write(*,*) 'Al2O3' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->Al2O3_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Al2O3_dust], - &bulk_densities[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust] - ); - } - - if (my_chemistry->dust_species > 2) { - // ! write(*,*) 'reforg' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->ref_org_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], - &bulk_densities[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust] - ); - - // ! write(*,*) 'volorg' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->vol_org_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], - &bulk_densities[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust] - ); - - // ! write(*,*) 'H2Oice' - FORTRAN_NAME(calc_grain_size_increment_species_1d)( - &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, - &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, my_fields->H2O_ice_dust_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust], - reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], - &bulk_densities[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust], internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], - gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust] - ); + const GrainSpeciesInfoEntry& cur_grsp_info = + grain_species_info->species_info[grsp_i]; + double bulk_density = cur_grsp_info.bulk_density_cgs; + + const gr_float* grsp_density = + field_data_adaptor.get_ptr_dynamic(cur_grsp_info.species_idx); + + FORTRAN_NAME(calc_grain_size_increment_species_1d)( + &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, + &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], + &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, + &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, + &nSN, grsp_density, SN_metal.data(), + reduced_inject_paths.grain_yields.data[grsp_i], + reduced_inject_paths.size_moments.data[grsp_i], + &bulk_density, + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[grsp_i], + internal_dust_prop_buf.grain_dyntab_kappa.data[grsp_i], + gr_N, &gr_Size, + &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], + inject_pathway_props->log10Tdust_interp_props.parameters[0], + reduced_inject_paths.opacity_coef_table.data[grsp_i]); } for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { diff --git a/src/clib/fortran_func_decls.h b/src/clib/fortran_func_decls.h index 4c0a14e87..75705410a 100644 --- a/src/clib/fortran_func_decls.h +++ b/src/clib/fortran_func_decls.h @@ -50,7 +50,7 @@ void FORTRAN_NAME(calc_all_tdust_gasgr_1d_g)( void FORTRAN_NAME(calc_grain_size_increment_species_1d)( const int* igrgr, const gr_mask_type* itmask, const int* SN0_N, int* in, int* jn, int* kn, int* is, int* ie, int* j, int* k, double* dom, gr_float* d_data_ptr, int* nSN, - gr_float* dsp_data_ptr, gr_float* SN_metal_data_ptr, double* SN_fsp, + const gr_float* dsp_data_ptr, gr_float* SN_metal_data_ptr, double* SN_fsp, double* SN_r0sp_data_ptr, double* ssp, double* sgsp, double* alsp_data_ptr, const int* gr_N, const int* gr_Size, const double* gr_dT, const double* gr_Td, double* SN_kp0sp_data_ptr From 0588e021e3dcb79b3d778c430d25a8eb9d5da659 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 23:38:02 -0500 Subject: [PATCH 088/111] incremental commit --- .../calc_grain_size_increment_1d.hpp | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index d3a5232c9..3f4fa0f7f 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -226,7 +226,7 @@ inline void calc_grain_size_increment_1d( - + /* for (iSN = 1; iSN<=(nSN); iSN++) { iSN0 = SN_i[iSN-1]; if ( my_chemistry->dust_species > 0 ) { @@ -290,9 +290,43 @@ inline void calc_grain_size_increment_1d( } } } + */ + + std::vector repacked_yields(n_pathways); + + std::vector repacked_size_moments_data_(n_pathways * 3); + grackle::impl::View repacked_size_moments( + repacked_size_moments_data_.data(), 3, n_pathways); + + std::vector repacked_opac_table_data_(n_pathways * gr_Size); + grackle::impl::View repacked_opac_table( + repacked_opac_table_data_.data(), gr_Size, n_pathways); - // actually calculate the size increment and subsequent quantities for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { + + // here, we repack the injection pathway for the current grain species + double* cur_yields = SN_fMgSiO3; + grackle::impl::View& cur_size_moments = SN_r0MgSiO3; + grackle::impl::View& cur_opac_table = SN_kpMgSiO3; + + grackle::impl::View orig_size_moments( + inject_pathway_props->size_moments.data[grsp_i], 3, n_pathways); + grackle::impl::View orig_opac_table( + inject_pathway_props->opacity_coef_table.data[grsp_i], gr_Size, + n_pathways); + + for (iSN = 1; iSN<=(nSN); iSN++) { + iSN0 = SN_i[iSN-1]; + repacked_yields[iSN-1] = inject_pathway_props->grain_yields.data[grsp_i][iSN0-1]; + for (idx = 1; idx<=(3); idx++) { + repacked_size_moments(idx-1,iSN-1) = orig_size_moments(idx-1,iSN0-1); + } + for (idx = 1; idx<=(gr_Size); idx++) { + repacked_opac_table(idx-1,iSN-1) = orig_opac_table(idx-1,iSN0-1); + } + } + + // actually calculate the size increment and subsequent quantities const GrainSpeciesInfoEntry& cur_grsp_info = grain_species_info->species_info[grsp_i]; double bulk_density = cur_grsp_info.bulk_density_cgs; @@ -306,15 +340,19 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, grsp_density, SN_metal.data(), - reduced_inject_paths.grain_yields.data[grsp_i], - reduced_inject_paths.size_moments.data[grsp_i], + repacked_yields.data(), + //reduced_inject_paths.grain_yields.data[grsp_i], + repacked_size_moments.data(), + //reduced_inject_paths.size_moments.data[grsp_i], &bulk_density, internal_dust_prop_buf.grain_sigma_per_gas_mass.data[grsp_i], internal_dust_prop_buf.grain_dyntab_kappa.data[grsp_i], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - reduced_inject_paths.opacity_coef_table.data[grsp_i]); + //reduced_inject_paths.opacity_coef_table.data[grsp_i], + repacked_opac_table.data() + ); } for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { From c5b2cfd54b5c741ad382ecfa1fa5d5a40c24a654 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 23:41:43 -0500 Subject: [PATCH 089/111] another step --- .../calc_grain_size_increment_1d.hpp | 119 +----------------- 1 file changed, 2 insertions(+), 117 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 3f4fa0f7f..14db36021 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -142,49 +142,6 @@ inline void calc_grain_size_increment_1d( std::vector SN_metal_data_(my_fields->grid_dimension[0] * inject_pathway_props->n_pathways); grackle::impl::View SN_metal(SN_metal_data_.data(), my_fields->grid_dimension[0], inject_pathway_props->n_pathways); - GrainMetalInjectPathways reduced_inject_paths = new_GrainMetalInjectPathways( - n_pathways, n_log10Tdust_vals, n_opac_poly_coef); - - double* SN_fSiM = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiM_dust]; - double* SN_fFeM = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeM_dust]; - double* SN_fMg2SiO4 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust]; - double* SN_fMgSiO3 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust]; - double* SN_fFe3O4 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust]; - double* SN_fAC = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::AC_dust]; - double* SN_fSiO2D = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::SiO2_dust]; - double* SN_fMgO = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::MgO_dust]; - double* SN_fFeS = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::FeS_dust]; - double* SN_fAl2O3 = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::Al2O3_dust]; - double* SN_freforg = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::ref_org_dust]; - double* SN_fvolorg = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::vol_org_dust]; - double* SN_fH2Oice = reduced_inject_paths.grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust]; - grackle::impl::View SN_r0SiM(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiM_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0FeM(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeM_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0Mg2SiO4(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0MgSiO3(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0Fe3O4(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0AC(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::AC_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0SiO2D(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::SiO2_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0MgO(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::MgO_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0FeS(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::FeS_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0Al2O3(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::Al2O3_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0reforg(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::ref_org_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0volorg(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::vol_org_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_r0H2Oice(reduced_inject_paths.size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpSiM(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFeM(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMg2SiO4(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMgSiO3(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFe3O4(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpAC(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpSiO2D(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpMgO(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpFeS(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpAl2O3(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpreforg(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpvolorg(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN_kpH2Oice(reduced_inject_paths.opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], gr_Size, inject_pathway_props->n_pathways); - // local int i, idx; @@ -224,74 +181,7 @@ inline void calc_grain_size_increment_1d( } } - - - /* - for (iSN = 1; iSN<=(nSN); iSN++) { - iSN0 = SN_i[iSN-1]; - if ( my_chemistry->dust_species > 0 ) { - SN_fMgSiO3 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgSiO3_dust] [iSN0-1]; - SN_fAC [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::AC_dust] [iSN0-1]; - - for (idx = 1; idx<=(3); idx++) { - SN_r0MgSiO3 (idx-1,iSN-1) = SN0_r0MgSiO3 (idx-1,iSN0-1); - SN_r0AC (idx-1,iSN-1) = SN0_r0AC (idx-1,iSN0-1); - } - for (idx = 1; idx<=(gr_Size); idx++) { - SN_kpMgSiO3 (idx-1,iSN-1) = SN0_kpMgSiO3 (idx-1,iSN0-1); - SN_kpAC (idx-1,iSN-1) = SN0_kpAC (idx-1,iSN0-1); - } - } - if ( my_chemistry->dust_species > 1 ) { - SN_fSiM [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiM_dust] [iSN0-1]; - SN_fFeM [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeM_dust] [iSN0-1]; - SN_fMg2SiO4 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Mg2SiO4_dust] [iSN0-1]; - SN_fFe3O4 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Fe3O4_dust] [iSN0-1]; - SN_fSiO2D [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::SiO2_dust] [iSN0-1]; - SN_fMgO [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::MgO_dust] [iSN0-1]; - SN_fFeS [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::FeS_dust] [iSN0-1]; - SN_fAl2O3 [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::Al2O3_dust] [iSN0-1]; - - for (idx = 1; idx<=(3); idx++) { - SN_r0SiM (idx-1,iSN-1) = SN0_r0SiM (idx-1,iSN0-1); - SN_r0FeM (idx-1,iSN-1) = SN0_r0FeM (idx-1,iSN0-1); - SN_r0Mg2SiO4 (idx-1,iSN-1) = SN0_r0Mg2SiO4 (idx-1,iSN0-1); - SN_r0Fe3O4 (idx-1,iSN-1) = SN0_r0Fe3O4 (idx-1,iSN0-1); - SN_r0SiO2D (idx-1,iSN-1) = SN0_r0SiO2D (idx-1,iSN0-1); - SN_r0MgO (idx-1,iSN-1) = SN0_r0MgO (idx-1,iSN0-1); - SN_r0FeS (idx-1,iSN-1) = SN0_r0FeS (idx-1,iSN0-1); - SN_r0Al2O3 (idx-1,iSN-1) = SN0_r0Al2O3 (idx-1,iSN0-1); - } - for (idx = 1; idx<=(gr_Size); idx++) { - SN_kpSiM (idx-1,iSN-1) = SN0_kpSiM (idx-1,iSN0-1); - SN_kpFeM (idx-1,iSN-1) = SN0_kpFeM (idx-1,iSN0-1); - SN_kpMg2SiO4 (idx-1,iSN-1) = SN0_kpMg2SiO4 (idx-1,iSN0-1); - SN_kpFe3O4 (idx-1,iSN-1) = SN0_kpFe3O4 (idx-1,iSN0-1); - SN_kpSiO2D (idx-1,iSN-1) = SN0_kpSiO2D (idx-1,iSN0-1); - SN_kpMgO (idx-1,iSN-1) = SN0_kpMgO (idx-1,iSN0-1); - SN_kpFeS (idx-1,iSN-1) = SN0_kpFeS (idx-1,iSN0-1); - SN_kpAl2O3 (idx-1,iSN-1) = SN0_kpAl2O3 (idx-1,iSN0-1); - } - } - if ( my_chemistry->dust_species > 2 ) { - SN_freforg [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::ref_org_dust] [iSN0-1]; - SN_fvolorg [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::vol_org_dust] [iSN0-1]; - SN_fH2Oice [iSN-1] = inject_pathway_props->grain_yields.data[OnlyGrainSpLUT::H2O_ice_dust] [iSN0-1]; - - for (idx = 1; idx<=(3); idx++) { - SN_r0reforg (idx-1,iSN-1) = SN0_r0reforg (idx-1,iSN0-1); - SN_r0volorg (idx-1,iSN-1) = SN0_r0volorg (idx-1,iSN0-1); - SN_r0H2Oice (idx-1,iSN-1) = SN0_r0H2Oice (idx-1,iSN0-1); - } - for (idx = 1; idx<=(gr_Size); idx++) { - SN_kpreforg (idx-1,iSN-1) = SN0_kpreforg (idx-1,iSN0-1); - SN_kpvolorg (idx-1,iSN-1) = SN0_kpvolorg (idx-1,iSN0-1); - SN_kpH2Oice (idx-1,iSN-1) = SN0_kpH2Oice (idx-1,iSN0-1); - } - } - } - */ - + // allocate some buffers std::vector repacked_yields(n_pathways); std::vector repacked_size_moments_data_(n_pathways * 3); @@ -302,13 +192,10 @@ inline void calc_grain_size_increment_1d( grackle::impl::View repacked_opac_table( repacked_opac_table_data_.data(), gr_Size, n_pathways); + // loop over grain species for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { // here, we repack the injection pathway for the current grain species - double* cur_yields = SN_fMgSiO3; - grackle::impl::View& cur_size_moments = SN_r0MgSiO3; - grackle::impl::View& cur_opac_table = SN_kpMgSiO3; - grackle::impl::View orig_size_moments( inject_pathway_props->size_moments.data[grsp_i], 3, n_pathways); grackle::impl::View orig_opac_table( @@ -406,8 +293,6 @@ inline void calc_grain_size_increment_1d( } } - - drop_GrainMetalInjectPathways(&reduced_inject_paths); } } // namespace grackle::impl From 08fbb8eb75014c5c6b92cac0ca92514fa88ea749 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 10 Dec 2025 23:58:40 -0500 Subject: [PATCH 090/111] some extra changes --- .../calc_grain_size_increment_1d.hpp | 65 +++++-------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 14db36021..5dc15fef3 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -93,49 +93,6 @@ inline void calc_grain_size_increment_1d( grackle::impl::SpeciesLUTFieldAdaptor field_data_adaptor{*my_fields}; - // table - grackle::impl::View SN0_r0SiM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiM_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0FeM(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeM_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0Mg2SiO4(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Mg2SiO4_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0MgSiO3(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgSiO3_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0Fe3O4(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Fe3O4_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0AC(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::AC_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0SiO2D(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::SiO2_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0MgO(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::MgO_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0FeS(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::FeS_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0Al2O3(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::Al2O3_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0reforg(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::ref_org_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0volorg(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::vol_org_dust], 3, inject_pathway_props->n_pathways); - grackle::impl::View SN0_r0H2Oice(inject_pathway_props->size_moments.data[OnlyGrainSpLUT::H2O_ice_dust], 3, inject_pathway_props->n_pathways); - // opacity table - grackle::impl::View SN0_kpSiM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiM_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpFeM(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeM_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpMg2SiO4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpMgSiO3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgSiO3_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpFe3O4(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Fe3O4_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpAC(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::AC_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpSiO2D(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::SiO2_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpMgO(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::MgO_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpFeS(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::FeS_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpAl2O3(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::Al2O3_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpreforg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::ref_org_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpvolorg(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::vol_org_dust], gr_Size, inject_pathway_props->n_pathways); - grackle::impl::View SN0_kpH2Oice(inject_pathway_props->opacity_coef_table.data[OnlyGrainSpLUT::H2O_ice_dust], gr_Size, inject_pathway_props->n_pathways); - // out - grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alMgSiO3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alFe3O4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alAC(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alSiO2D(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alMgO(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alFeS(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alAl2O3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alreforg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alvolorg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[2-1], my_fields->grid_dimension[0]); // array int iSN, iSN0; std::vector SN_i(inject_pathway_props->n_pathways); @@ -213,7 +170,7 @@ inline void calc_grain_size_increment_1d( } } - // actually calculate the size increment and subsequent quantities + // now, actually calculate the size increment and subsequent quantities const GrainSpeciesInfoEntry& cur_grsp_info = grain_species_info->species_info[grsp_i]; double bulk_density = cur_grsp_info.bulk_density_cgs; @@ -228,20 +185,34 @@ inline void calc_grain_size_increment_1d( &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &nSN, grsp_density, SN_metal.data(), repacked_yields.data(), - //reduced_inject_paths.grain_yields.data[grsp_i], repacked_size_moments.data(), - //reduced_inject_paths.size_moments.data[grsp_i], &bulk_density, internal_dust_prop_buf.grain_sigma_per_gas_mass.data[grsp_i], internal_dust_prop_buf.grain_dyntab_kappa.data[grsp_i], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], inject_pathway_props->log10Tdust_interp_props.parameters[0], - //reduced_inject_paths.opacity_coef_table.data[grsp_i], repacked_opac_table.data() ); } + + // out + grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alMgSiO3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alFe3O4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alAC(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alSiO2D(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alMgO(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alFeS(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alAl2O3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alreforg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alvolorg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[2-1], my_fields->grid_dimension[0]); + grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[2-1], my_fields->grid_dimension[0]); + for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { if ( itmask[i-1] != MASK_FALSE ) { From 2708a54c96ed3c7a998cd4b420cc34d9ae91e0a9 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 00:00:51 -0500 Subject: [PATCH 091/111] grain_size_incr: cleanup indexing 1/3 --- .../calc_grain_size_increment_1d.hpp | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 5dc15fef3..e5ed14bbe 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -132,8 +132,8 @@ inline void calc_grain_size_increment_1d( nSN++; SN_i[nSN-1] = count + 1; - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - SN_metal(i-1,nSN-1) = inj_path_metal_dens(i-1,idx_range.jp1-1,idx_range.kp1-1); + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + SN_metal(i,nSN-1) = inj_path_metal_dens(i,idx_range.j,idx_range.k); } } } @@ -162,11 +162,11 @@ inline void calc_grain_size_increment_1d( for (iSN = 1; iSN<=(nSN); iSN++) { iSN0 = SN_i[iSN-1]; repacked_yields[iSN-1] = inject_pathway_props->grain_yields.data[grsp_i][iSN0-1]; - for (idx = 1; idx<=(3); idx++) { - repacked_size_moments(idx-1,iSN-1) = orig_size_moments(idx-1,iSN0-1); + for (idx = 0; idx < 3; idx++) { + repacked_size_moments(idx,iSN-1) = orig_size_moments(idx,iSN0-1); } - for (idx = 1; idx<=(gr_Size); idx++) { - repacked_opac_table(idx-1,iSN-1) = orig_opac_table(idx-1,iSN0-1); + for (idx = 0; idx < gr_Size; idx++) { + repacked_opac_table(idx,iSN-1) = orig_opac_table(idx,iSN0-1); } } @@ -198,67 +198,67 @@ inline void calc_grain_size_increment_1d( // out - grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alMgSiO3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alFe3O4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alAC(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alSiO2D(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alMgO(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alFeS(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alAl2O3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alreforg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alvolorg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[2-1], my_fields->grid_dimension[0]); - grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[2-1], my_fields->grid_dimension[0]); - - for (i = idx_range.i_start + 1; i<=(idx_range.i_end + 1); i++) { - if ( itmask[i-1] != MASK_FALSE ) { + grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alMgSiO3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alFe3O4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alAC(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alSiO2D(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alMgO(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alFeS(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alAl2O3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alreforg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alvolorg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[1], my_fields->grid_dimension[0]); + + for (i = idx_range.i_start; i < idx_range.i_stop; i++) { + if ( itmask[i] != MASK_FALSE ) { if (my_chemistry->dust_species > 0) { - internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] = internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust] [i-1]; + internal_dust_prop_buf.sigma_per_gas_mass_tot [i] = internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust] [i]; } if (my_chemistry->dust_species > 1) { - internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] = internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust] [i-1]; + internal_dust_prop_buf.sigma_per_gas_mass_tot [i] = internal_dust_prop_buf.sigma_per_gas_mass_tot [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust] [i]; } if (my_chemistry->dust_species > 2) { - internal_dust_prop_buf.sigma_per_gas_mass_tot [i-1] = internal_dust_prop_buf.sigma_per_gas_mass_tot[i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust] [i-1] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust] [i-1]; + internal_dust_prop_buf.sigma_per_gas_mass_tot [i] = internal_dust_prop_buf.sigma_per_gas_mass_tot[i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust] [i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust] [i]; } - for (idx = 1; idx<=(gr_N [ 2-1 ]); idx++) { + for (idx = 0; idx < gr_N[1]; idx++) { if (my_chemistry->dust_species > 0) { - altot(idx-1,i-1) = alMgSiO3 (idx-1,i-1) - + alAC (idx-1,i-1); + altot(idx,i) = alMgSiO3 (idx,i) + + alAC (idx,i); } if (my_chemistry->dust_species > 1) { - altot(idx-1,i-1) = altot (idx-1,i-1) - + alSiM (idx-1,i-1) - + alFeM (idx-1,i-1) - + alMg2SiO4 (idx-1,i-1) - + alFe3O4 (idx-1,i-1) - + alSiO2D (idx-1,i-1) - + alMgO (idx-1,i-1) - + alFeS (idx-1,i-1) - + alAl2O3 (idx-1,i-1); + altot(idx,i) = altot (idx,i) + + alSiM (idx,i) + + alFeM (idx,i) + + alMg2SiO4 (idx,i) + + alFe3O4 (idx,i) + + alSiO2D (idx,i) + + alMgO (idx,i) + + alFeS (idx,i) + + alAl2O3 (idx,i); } if (my_chemistry->dust_species > 2) { - altot(idx-1,i-1) = altot (idx-1,i-1) - + alreforg (idx-1,i-1) - + alvolorg (idx-1,i-1) - + alH2Oice (idx-1,i-1); + altot(idx,i) = altot (idx,i) + + alreforg (idx,i) + + alvolorg (idx,i) + + alH2Oice (idx,i); } } From 8d60001af6b4cda16742233242d00e79d077262c Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 00:06:10 -0500 Subject: [PATCH 092/111] grain_size_incr: cleanup indexing 2/3 --- .../calc_grain_size_increment_1d.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index e5ed14bbe..415a396c0 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -129,12 +129,11 @@ inline void calc_grain_size_increment_1d( } if (max_ratio > 0.01) { - nSN++; - - SN_i[nSN-1] = count + 1; + SN_i[nSN] = count; for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - SN_metal(i,nSN-1) = inj_path_metal_dens(i,idx_range.j,idx_range.k); + SN_metal(i,nSN) = inj_path_metal_dens(i,idx_range.j,idx_range.k); } + nSN++; } } @@ -159,14 +158,14 @@ inline void calc_grain_size_increment_1d( inject_pathway_props->opacity_coef_table.data[grsp_i], gr_Size, n_pathways); - for (iSN = 1; iSN<=(nSN); iSN++) { - iSN0 = SN_i[iSN-1]; - repacked_yields[iSN-1] = inject_pathway_props->grain_yields.data[grsp_i][iSN0-1]; + for (iSN = 0; iSNgrain_yields.data[grsp_i][iSN0]; for (idx = 0; idx < 3; idx++) { - repacked_size_moments(idx,iSN-1) = orig_size_moments(idx,iSN0-1); + repacked_size_moments(idx,iSN) = orig_size_moments(idx,iSN0); } for (idx = 0; idx < gr_Size; idx++) { - repacked_opac_table(idx,iSN-1) = orig_opac_table(idx,iSN0-1); + repacked_opac_table(idx,iSN) = orig_opac_table(idx,iSN0); } } From f2e36fcc1f2dd15e67ab5b017d5705ec08f8019f Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 00:06:22 -0500 Subject: [PATCH 093/111] grain_size_incr: cleanup indexing 3/3 --- .../calc_grain_size_increment_1d.hpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 415a396c0..16d2d0bd0 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -94,14 +94,10 @@ inline void calc_grain_size_increment_1d( grackle::impl::SpeciesLUTFieldAdaptor field_data_adaptor{*my_fields}; // array - int iSN, iSN0; std::vector SN_i(inject_pathway_props->n_pathways); std::vector SN_metal_data_(my_fields->grid_dimension[0] * inject_pathway_props->n_pathways); grackle::impl::View SN_metal(SN_metal_data_.data(), my_fields->grid_dimension[0], inject_pathway_props->n_pathways); - // local - int i, idx; - InjectPathFieldPack inject_path_metal_densities = setup_InjectPathFieldPack( my_chemistry, my_fields); @@ -158,13 +154,13 @@ inline void calc_grain_size_increment_1d( inject_pathway_props->opacity_coef_table.data[grsp_i], gr_Size, n_pathways); - for (iSN = 0; iSNgrain_yields.data[grsp_i][iSN0]; - for (idx = 0; idx < 3; idx++) { + for (int idx = 0; idx < 3; idx++) { repacked_size_moments(idx,iSN) = orig_size_moments(idx,iSN0); } - for (idx = 0; idx < gr_Size; idx++) { + for (int idx = 0; idx < gr_Size; idx++) { repacked_opac_table(idx,iSN) = orig_opac_table(idx,iSN0); } } @@ -196,7 +192,9 @@ inline void calc_grain_size_increment_1d( } - // out + // todo: clean this up so that we don't need to explicitly mention grain + // species names + // -> doing this will probably require an update to the gold standard grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[1], my_fields->grid_dimension[0]); grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[1], my_fields->grid_dimension[0]); grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[1], my_fields->grid_dimension[0]); @@ -212,7 +210,7 @@ inline void calc_grain_size_increment_1d( grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[1], my_fields->grid_dimension[0]); grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[1], my_fields->grid_dimension[0]); - for (i = idx_range.i_start; i < idx_range.i_stop; i++) { + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { if ( itmask[i] != MASK_FALSE ) { if (my_chemistry->dust_species > 0) { @@ -237,7 +235,7 @@ inline void calc_grain_size_increment_1d( + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust] [i]; } - for (idx = 0; idx < gr_N[1]; idx++) { + for (int idx = 0; idx < gr_N[1]; idx++) { if (my_chemistry->dust_species > 0) { altot(idx,i) = alMgSiO3 (idx,i) + alAC (idx,i); From 989b14a6eae94a7b1c63fe77935ad368ce46a3a1 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 09:17:14 -0500 Subject: [PATCH 094/111] add a bunch of commentary --- .../calc_grain_size_increment_1d.hpp | 124 ++++++++++++------ 1 file changed, 83 insertions(+), 41 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 16d2d0bd0..718cf7728 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -85,51 +85,90 @@ inline void calc_grain_size_increment_1d( int gr_N[2] = {n_opac_poly_coef, n_log10Tdust_vals}; int gr_Size = gr_N[0] * gr_N[1]; + // Step 1: Identify the set of pathways for which the max ratio b/t the + // pathway's metal density and the total metal density exceeds a threshold. + // + // -> the max ratio is taken along idx_range + // -> we repack the selected metal densities into a temporary buffer + // + // TODO: refactor calc_grain_size_increment_species_1d to directly accept the + // list of selected injection pathway indices so that we can skip the process + // of repacking. + // -> repacking is mostly done for historical reasons (i.e. this logic was + // originally written in a Fortran dialect that didn't use pointers) + // + // TODO: for bitwise reproducibility, we should really be doing the same + // threshold checking within calc_grain_size_increment_species_1d. + // -> We want to ensure that a Grackle calculation **NEVER** gives + // different results whether it process a bunch of zones or one zone at + // a time. + // -> yes, for a low enough threshold, there won't be a physically meaningful + // difference in the results, but we don't want Grackle to give slightly + // different numbers based on how its called for a few reasons: + // 1. It can be EXTREMELY frustrating for someone trying to debug an error + // in a simulation code. + // 2. It can be annoying for constructing automated Grackle tests + // 3. Slight differences in a calculation can be a fantasitc heuristic for + // discovering memory errors and other bugs. But, that requires our + // logic to provide bitwise reproducible results. + + constexpr gr_float threshold = 0.01; + constexpr int max_num_pathways = inj_model_input::N_Injection_Pathways; + + // to be filled with the indices of selected injection pathways + int selected_inj_path_idx_l[max_num_pathways]; + + // to be updated with the number of selected injection pathways + int n_selected_inj_paths = 0; + + // to be filled with the metal densities for the selected injection paths + std::vector repacked_inj_path_metal_densities( + my_fields->grid_dimension[0] * n_pathways); + + // do the work + { + grackle::impl::View SN_metal( + repacked_inj_path_metal_densities.data(), my_fields->grid_dimension[0], + inject_pathway_props->n_pathways); + + grackle::impl::View metal( + const_cast(my_fields->metal_density), + my_fields->grid_dimension[0], my_fields->grid_dimension[1], + my_fields->grid_dimension[2]); - grackle::impl::View metal( - const_cast(my_fields->metal_density), - my_fields->grid_dimension[0], my_fields->grid_dimension[1], - my_fields->grid_dimension[2]); - - grackle::impl::SpeciesLUTFieldAdaptor field_data_adaptor{*my_fields}; - - // array - std::vector SN_i(inject_pathway_props->n_pathways); - std::vector SN_metal_data_(my_fields->grid_dimension[0] * inject_pathway_props->n_pathways); - grackle::impl::View SN_metal(SN_metal_data_.data(), my_fields->grid_dimension[0], inject_pathway_props->n_pathways); - - InjectPathFieldPack inject_path_metal_densities = setup_InjectPathFieldPack( - my_chemistry, my_fields); + InjectPathFieldPack inject_path_metal_densities = setup_InjectPathFieldPack( + my_chemistry, my_fields); - int start = inject_path_metal_densities.start_idx; - int stop = inject_path_metal_densities.stop_idx; + int start = inject_path_metal_densities.start_idx; + int stop = inject_path_metal_densities.stop_idx; - // make arrays - int nSN = 0; - for (int count = start; count < stop; count++) { - // when my_chemistry->multi_metals == 0, inj_path_metal_dens wraps - // the same pointer as `metal` + // make arrays + for (int count = start; count < stop; count++) { + // when my_chemistry->multi_metals == 0, inj_path_metal_dens wraps + // the same pointer as `metal` - grackle::impl::View inj_path_metal_dens( - inject_path_metal_densities.fields[count], - my_fields->grid_dimension[0], my_fields->grid_dimension[1], - my_fields->grid_dimension[2]); + grackle::impl::View inj_path_metal_dens( + inject_path_metal_densities.fields[count], + my_fields->grid_dimension[0], my_fields->grid_dimension[1], + my_fields->grid_dimension[2]); - // calculate the max ratio between inj_path_metal_dens and metal - gr_float max_ratio = std::numeric_limits::lowest(); - for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - gr_float cur_ratio = ( - inj_path_metal_dens(i, idx_range.j, idx_range.k) / - metal(i, idx_range.j, idx_range.k)); - max_ratio = std::fmax(cur_ratio, max_ratio); - } - - if (max_ratio > 0.01) { - SN_i[nSN] = count; + // calculate the max ratio between inj_path_metal_dens and metal + gr_float max_ratio = std::numeric_limits::lowest(); for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - SN_metal(i,nSN) = inj_path_metal_dens(i,idx_range.j,idx_range.k); + gr_float cur_ratio = ( + inj_path_metal_dens(i, idx_range.j, idx_range.k) / + metal(i, idx_range.j, idx_range.k)); + max_ratio = std::fmax(cur_ratio, max_ratio); + } + + if (max_ratio > threshold) { + selected_inj_path_idx_l[n_selected_inj_paths] = count; + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + SN_metal(i,n_selected_inj_paths) = + inj_path_metal_dens(i,idx_range.j,idx_range.k); + } + n_selected_inj_paths++; } - nSN++; } } @@ -144,6 +183,8 @@ inline void calc_grain_size_increment_1d( grackle::impl::View repacked_opac_table( repacked_opac_table_data_.data(), gr_Size, n_pathways); + grackle::impl::SpeciesLUTFieldAdaptor field_data_adaptor{*my_fields}; + // loop over grain species for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { @@ -154,8 +195,8 @@ inline void calc_grain_size_increment_1d( inject_pathway_props->opacity_coef_table.data[grsp_i], gr_Size, n_pathways); - for (int iSN = 0; iSN < nSN; iSN++) { - int iSN0 = SN_i[iSN]; + for (int iSN = 0; iSN < n_selected_inj_paths; iSN++) { + int iSN0 = selected_inj_path_idx_l[iSN]; repacked_yields[iSN] = inject_pathway_props->grain_yields.data[grsp_i][iSN0]; for (int idx = 0; idx < 3; idx++) { repacked_size_moments(idx,iSN) = orig_size_moments(idx,iSN0); @@ -178,7 +219,8 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[0], &my_fields->grid_dimension[1], &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, - &nSN, grsp_density, SN_metal.data(), + &n_selected_inj_paths, grsp_density, + repacked_inj_path_metal_densities.data(), repacked_yields.data(), repacked_size_moments.data(), &bulk_density, From 2fe019cb6c3f22fcd096dba5af55f6baacb4ed18 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 09:23:05 -0500 Subject: [PATCH 095/111] add a little more commentary --- .../calc_grain_size_increment_1d.hpp | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 718cf7728..c3505d501 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -80,11 +80,6 @@ inline void calc_grain_size_increment_1d( inject_pathway_props->log10Tdust_interp_props.dimension[0]); const int n_opac_poly_coef = inject_pathway_props->n_opac_poly_coef; - // NOTE: gr_N and gr_Size are historical names - // -> they are pretty uninformative and should be changed! - int gr_N[2] = {n_opac_poly_coef, n_log10Tdust_vals}; - int gr_Size = gr_N[0] * gr_N[1]; - // Step 1: Identify the set of pathways for which the max ratio b/t the // pathway's metal density and the total metal density exceeds a threshold. // @@ -172,7 +167,13 @@ inline void calc_grain_size_increment_1d( } } - // allocate some buffers + // Step 2: Compute the output quantities for each individual species + + // NOTE: gr_N and gr_Size are historical names + // -> they are pretty uninformative and should be changed! + int gr_N[2] = {n_opac_poly_coef, n_log10Tdust_vals}; + int gr_Size = gr_N[0] * gr_N[1]; + std::vector repacked_yields(n_pathways); std::vector repacked_size_moments_data_(n_pathways * 3); @@ -188,7 +189,7 @@ inline void calc_grain_size_increment_1d( // loop over grain species for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { - // here, we repack the injection pathway for the current grain species + // repack the selected injection pathways for the current grain species grackle::impl::View orig_size_moments( inject_pathway_props->size_moments.data[grsp_i], 3, n_pathways); grackle::impl::View orig_opac_table( @@ -197,7 +198,8 @@ inline void calc_grain_size_increment_1d( for (int iSN = 0; iSN < n_selected_inj_paths; iSN++) { int iSN0 = selected_inj_path_idx_l[iSN]; - repacked_yields[iSN] = inject_pathway_props->grain_yields.data[grsp_i][iSN0]; + repacked_yields[iSN] = + inject_pathway_props->grain_yields.data[grsp_i][iSN0]; for (int idx = 0; idx < 3; idx++) { repacked_size_moments(idx,iSN) = orig_size_moments(idx,iSN0); } @@ -210,7 +212,6 @@ inline void calc_grain_size_increment_1d( const GrainSpeciesInfoEntry& cur_grsp_info = grain_species_info->species_info[grsp_i]; double bulk_density = cur_grsp_info.bulk_density_cgs; - const gr_float* grsp_density = field_data_adaptor.get_ptr_dynamic(cur_grsp_info.species_idx); @@ -233,9 +234,13 @@ inline void calc_grain_size_increment_1d( ); } + // step 3: calculate the total cross-section and the total opacity table + // (i.e. that include contributions from all grain species) + + // todo: can we skip this when my_chemistry->use_multiple_dust_temperatures + // is not 0? - // todo: clean this up so that we don't need to explicitly mention grain - // species names + // todo: clean up to avoid explicitly mention grain species names // -> doing this will probably require an update to the gold standard grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[1], my_fields->grid_dimension[0]); grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[1], my_fields->grid_dimension[0]); From ba2009b986cf5d80e0e4d60d3dba5ebf01cfd6de Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 09:23:24 -0500 Subject: [PATCH 096/111] apply clang-format --- src/clib/cool1d_multi_g.cpp | 4 +- .../calc_grain_size_increment_1d.hpp | 203 ++++++++++-------- src/clib/lookup_cool_rates1d.hpp | 9 +- 3 files changed, 123 insertions(+), 93 deletions(-) diff --git a/src/clib/cool1d_multi_g.cpp b/src/clib/cool1d_multi_g.cpp index d3d10bc83..5201681f7 100644 --- a/src/clib/cool1d_multi_g.cpp +++ b/src/clib/cool1d_multi_g.cpp @@ -1108,8 +1108,8 @@ void grackle::impl::cool1d_multi_g( grackle::impl::calc_grain_size_increment_1d( dom, idx_range, itmask_metal, my_chemistry, my_rates->opaque_storage->grain_species_info, - my_rates->opaque_storage->inject_pathway_props, - my_fields, internal_dust_prop_buf); + my_rates->opaque_storage->inject_pathway_props, my_fields, + internal_dust_prop_buf); } // Calculate dust to gas ratio AND interstellar radiation field diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index c3505d501..5f45aaecf 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -67,14 +67,12 @@ namespace grackle::impl { /// @param[in,out] internal_dust_prop_buf Holds dust-specific information that /// gets updated by this function inline void calc_grain_size_increment_1d( - double dom, IndexRange idx_range, const gr_mask_type* itmask, - const chemistry_data* my_chemistry, - const GrainSpeciesInfo* grain_species_info, - const GrainMetalInjectPathways* inject_pathway_props, - grackle_field_data* my_fields, - grackle::impl::InternalDustPropBuf internal_dust_prop_buf -) -{ + double dom, IndexRange idx_range, const gr_mask_type* itmask, + const chemistry_data* my_chemistry, + const GrainSpeciesInfo* grain_species_info, + const GrainMetalInjectPathways* inject_pathway_props, + grackle_field_data* my_fields, + grackle::impl::InternalDustPropBuf internal_dust_prop_buf) { const int n_pathways = inject_pathway_props->n_pathways; const int n_log10Tdust_vals = static_cast( inject_pathway_props->log10Tdust_interp_props.dimension[0]); @@ -131,8 +129,8 @@ inline void calc_grain_size_increment_1d( my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); - InjectPathFieldPack inject_path_metal_densities = setup_InjectPathFieldPack( - my_chemistry, my_fields); + InjectPathFieldPack inject_path_metal_densities = + setup_InjectPathFieldPack(my_chemistry, my_fields); int start = inject_path_metal_densities.start_idx; int stop = inject_path_metal_densities.stop_idx; @@ -150,17 +148,16 @@ inline void calc_grain_size_increment_1d( // calculate the max ratio between inj_path_metal_dens and metal gr_float max_ratio = std::numeric_limits::lowest(); for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - gr_float cur_ratio = ( - inj_path_metal_dens(i, idx_range.j, idx_range.k) / - metal(i, idx_range.j, idx_range.k)); + gr_float cur_ratio = (inj_path_metal_dens(i, idx_range.j, idx_range.k) / + metal(i, idx_range.j, idx_range.k)); max_ratio = std::fmax(cur_ratio, max_ratio); } if (max_ratio > threshold) { - selected_inj_path_idx_l[n_selected_inj_paths] = count; + selected_inj_path_idx_l[n_selected_inj_paths] = count; for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - SN_metal(i,n_selected_inj_paths) = - inj_path_metal_dens(i,idx_range.j,idx_range.k); + SN_metal(i, n_selected_inj_paths) = + inj_path_metal_dens(i, idx_range.j, idx_range.k); } n_selected_inj_paths++; } @@ -188,7 +185,6 @@ inline void calc_grain_size_increment_1d( // loop over grain species for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { - // repack the selected injection pathways for the current grain species grackle::impl::View orig_size_moments( inject_pathway_props->size_moments.data[grsp_i], 3, n_pathways); @@ -199,21 +195,21 @@ inline void calc_grain_size_increment_1d( for (int iSN = 0; iSN < n_selected_inj_paths; iSN++) { int iSN0 = selected_inj_path_idx_l[iSN]; repacked_yields[iSN] = - inject_pathway_props->grain_yields.data[grsp_i][iSN0]; + inject_pathway_props->grain_yields.data[grsp_i][iSN0]; for (int idx = 0; idx < 3; idx++) { - repacked_size_moments(idx,iSN) = orig_size_moments(idx,iSN0); + repacked_size_moments(idx, iSN) = orig_size_moments(idx, iSN0); } for (int idx = 0; idx < gr_Size; idx++) { - repacked_opac_table(idx,iSN) = orig_opac_table(idx,iSN0); + repacked_opac_table(idx, iSN) = orig_opac_table(idx, iSN0); } } // now, actually calculate the size increment and subsequent quantities const GrainSpeciesInfoEntry& cur_grsp_info = - grain_species_info->species_info[grsp_i]; + grain_species_info->species_info[grsp_i]; double bulk_density = cur_grsp_info.bulk_density_cgs; const gr_float* grsp_density = - field_data_adaptor.get_ptr_dynamic(cur_grsp_info.species_idx); + field_data_adaptor.get_ptr_dynamic(cur_grsp_info.species_idx); FORTRAN_NAME(calc_grain_size_increment_species_1d)( &my_chemistry->grain_growth, itmask, &inject_pathway_props->n_pathways, @@ -221,17 +217,13 @@ inline void calc_grain_size_increment_1d( &my_fields->grid_dimension[2], &idx_range.i_start, &idx_range.i_end, &idx_range.jp1, &idx_range.kp1, &dom, my_fields->density, &n_selected_inj_paths, grsp_density, - repacked_inj_path_metal_densities.data(), - repacked_yields.data(), - repacked_size_moments.data(), - &bulk_density, + repacked_inj_path_metal_densities.data(), repacked_yields.data(), + repacked_size_moments.data(), &bulk_density, internal_dust_prop_buf.grain_sigma_per_gas_mass.data[grsp_i], - internal_dust_prop_buf.grain_dyntab_kappa.data[grsp_i], - gr_N, &gr_Size, + internal_dust_prop_buf.grain_dyntab_kappa.data[grsp_i], gr_N, &gr_Size, &inject_pathway_props->log10Tdust_interp_props.parameter_spacing[0], - inject_pathway_props->log10Tdust_interp_props.parameters[0], - repacked_opac_table.data() - ); + inject_pathway_props->log10Tdust_interp_props.parameters[0], + repacked_opac_table.data()); } // step 3: calculate the total cross-section and the total opacity table @@ -242,75 +234,114 @@ inline void calc_grain_size_increment_1d( // todo: clean up to avoid explicitly mention grain species names // -> doing this will probably require an update to the gold standard - grackle::impl::View alSiM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alFeM(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alMg2SiO4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Mg2SiO4_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alMgSiO3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgSiO3_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alFe3O4(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Fe3O4_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alAC(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alSiO2D(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alMgO(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alFeS(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alAl2O3(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::Al2O3_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alreforg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::ref_org_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alvolorg(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::vol_org_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alH2Oice(internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::H2O_ice_dust], gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alSiM( + internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alFeM( + internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alMg2SiO4( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::Mg2SiO4_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alMgSiO3( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::MgSiO3_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alFe3O4( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::Fe3O4_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alAC( + internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alSiO2D( + internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alMgO( + internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alFeS( + internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alAl2O3( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::Al2O3_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alreforg( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::ref_org_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alvolorg( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::vol_org_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View alH2Oice( + internal_dust_prop_buf.grain_dyntab_kappa + .data[OnlyGrainSpLUT::H2O_ice_dust], + gr_N[1], my_fields->grid_dimension[0]); + grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, + gr_N[1], my_fields->grid_dimension[0]); for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - if ( itmask[i] != MASK_FALSE ) { - - if (my_chemistry->dust_species > 0) { - internal_dust_prop_buf.sigma_per_gas_mass_tot [i] = internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgSiO3_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::AC_dust] [i]; + if (itmask[i] != MASK_FALSE) { + if (my_chemistry->dust_species > 0) { + internal_dust_prop_buf.sigma_per_gas_mass_tot[i] = + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::MgSiO3_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::AC_dust][i]; } - if (my_chemistry->dust_species > 1) { - internal_dust_prop_buf.sigma_per_gas_mass_tot [i] = internal_dust_prop_buf.sigma_per_gas_mass_tot [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiM_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeM_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Mg2SiO4_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Fe3O4_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::SiO2_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::MgO_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::FeS_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::Al2O3_dust] [i]; + if (my_chemistry->dust_species > 1) { + internal_dust_prop_buf.sigma_per_gas_mass_tot[i] = + internal_dust_prop_buf.sigma_per_gas_mass_tot[i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::SiM_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::FeM_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::Mg2SiO4_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::Fe3O4_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::SiO2_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::MgO_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::FeS_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::Al2O3_dust][i]; } - if (my_chemistry->dust_species > 2) { - internal_dust_prop_buf.sigma_per_gas_mass_tot [i] = internal_dust_prop_buf.sigma_per_gas_mass_tot[i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::ref_org_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::vol_org_dust] [i] - + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[OnlyGrainSpLUT::H2O_ice_dust] [i]; + if (my_chemistry->dust_species > 2) { + internal_dust_prop_buf.sigma_per_gas_mass_tot[i] = + internal_dust_prop_buf.sigma_per_gas_mass_tot[i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::ref_org_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::vol_org_dust][i] + + internal_dust_prop_buf.grain_sigma_per_gas_mass + .data[OnlyGrainSpLUT::H2O_ice_dust][i]; } - + for (int idx = 0; idx < gr_N[1]; idx++) { - if (my_chemistry->dust_species > 0) { - altot(idx,i) = alMgSiO3 (idx,i) - + alAC (idx,i); + if (my_chemistry->dust_species > 0) { + altot(idx, i) = alMgSiO3(idx, i) + alAC(idx, i); } - if (my_chemistry->dust_species > 1) { - altot(idx,i) = altot (idx,i) - + alSiM (idx,i) - + alFeM (idx,i) - + alMg2SiO4 (idx,i) - + alFe3O4 (idx,i) - + alSiO2D (idx,i) - + alMgO (idx,i) - + alFeS (idx,i) - + alAl2O3 (idx,i); + if (my_chemistry->dust_species > 1) { + altot(idx, i) = altot(idx, i) + alSiM(idx, i) + alFeM(idx, i) + + alMg2SiO4(idx, i) + alFe3O4(idx, i) + + alSiO2D(idx, i) + alMgO(idx, i) + alFeS(idx, i) + + alAl2O3(idx, i); } - if (my_chemistry->dust_species > 2) { - altot(idx,i) = altot (idx,i) - + alreforg (idx,i) - + alvolorg (idx,i) - + alH2Oice (idx,i); + if (my_chemistry->dust_species > 2) { + altot(idx, i) = altot(idx, i) + alreforg(idx, i) + alvolorg(idx, i) + + alH2Oice(idx, i); } } - } } } } // namespace grackle::impl - #endif // CALC_GRAIN_SIZE_INCREMENT_1D_HPP diff --git a/src/clib/lookup_cool_rates1d.hpp b/src/clib/lookup_cool_rates1d.hpp index 3f4b20028..a989b70fb 100644 --- a/src/clib/lookup_cool_rates1d.hpp +++ b/src/clib/lookup_cool_rates1d.hpp @@ -810,11 +810,10 @@ inline void lookup_cool_rates1d( // Compute grain size increment if ((anydust != MASK_FALSE) && (my_chemistry->dust_species > 0)) { - calc_grain_size_increment_1d( - dom, idx_range, itmask_metal, my_chemistry, - my_rates->opaque_storage->grain_species_info, - my_rates->opaque_storage->inject_pathway_props, - my_fields, internal_dust_prop_scratch_buf); + calc_grain_size_increment_1d(dom, idx_range, itmask_metal, my_chemistry, + my_rates->opaque_storage->grain_species_info, + my_rates->opaque_storage->inject_pathway_props, + my_fields, internal_dust_prop_scratch_buf); } // Look-up rate for H2 formation on dust & (when relevant) grain growth rates From 1671ee3657c184341126cf8c236865750f0f5f08 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 11:11:21 -0500 Subject: [PATCH 097/111] Refactor last part of calc_grain_size_increment_1d I was expecting this to cause gold-standard drift (but that doesn't seem to be the case) --- .../calc_grain_size_increment_1d.hpp | 128 ++++-------------- 1 file changed, 28 insertions(+), 100 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 5f45aaecf..238a2f304 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -232,110 +232,38 @@ inline void calc_grain_size_increment_1d( // todo: can we skip this when my_chemistry->use_multiple_dust_temperatures // is not 0? - // todo: clean up to avoid explicitly mention grain species names - // -> doing this will probably require an update to the gold standard - grackle::impl::View alSiM( - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiM_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alFeM( - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeM_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alMg2SiO4( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::Mg2SiO4_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alMgSiO3( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::MgSiO3_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alFe3O4( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::Fe3O4_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alAC( - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::AC_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alSiO2D( - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::SiO2_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alMgO( - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::MgO_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alFeS( - internal_dust_prop_buf.grain_dyntab_kappa.data[OnlyGrainSpLUT::FeS_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alAl2O3( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::Al2O3_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alreforg( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::ref_org_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alvolorg( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::vol_org_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View alH2Oice( - internal_dust_prop_buf.grain_dyntab_kappa - .data[OnlyGrainSpLUT::H2O_ice_dust], - gr_N[1], my_fields->grid_dimension[0]); - grackle::impl::View altot(internal_dust_prop_buf.dyntab_kappa_tot, - gr_N[1], my_fields->grid_dimension[0]); + double* sigma_tot = internal_dust_prop_buf.sigma_per_gas_mass_tot; + View kappa_tab_tot(internal_dust_prop_buf.dyntab_kappa_tot, + n_log10Tdust_vals, my_fields->grid_dimension[0]); + // zero-out the current value for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { - if (itmask[i] != MASK_FALSE) { - if (my_chemistry->dust_species > 0) { - internal_dust_prop_buf.sigma_per_gas_mass_tot[i] = - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::MgSiO3_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::AC_dust][i]; - } - if (my_chemistry->dust_species > 1) { - internal_dust_prop_buf.sigma_per_gas_mass_tot[i] = - internal_dust_prop_buf.sigma_per_gas_mass_tot[i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::SiM_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::FeM_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::Mg2SiO4_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::Fe3O4_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::SiO2_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::MgO_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::FeS_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::Al2O3_dust][i]; - } - if (my_chemistry->dust_species > 2) { - internal_dust_prop_buf.sigma_per_gas_mass_tot[i] = - internal_dust_prop_buf.sigma_per_gas_mass_tot[i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::ref_org_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::vol_org_dust][i] + - internal_dust_prop_buf.grain_sigma_per_gas_mass - .data[OnlyGrainSpLUT::H2O_ice_dust][i]; + sigma_tot[i] = 0.0; + } + + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + for (int idx = 0; idx < n_log10Tdust_vals; idx++) { + kappa_tab_tot(idx, i) = 0.0; + } + } + + // todo: get rid of the itmask check (it shouldn't be necessary here) + for (int grsp_i = 0; grsp_i < grain_species_info->n_species; grsp_i++) { + const double* cur_grsp_sigma = + internal_dust_prop_buf.grain_sigma_per_gas_mass.data[grsp_i]; + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + if (itmask[i] != MASK_FALSE) { + sigma_tot[i] += cur_grsp_sigma[i]; } + } - for (int idx = 0; idx < gr_N[1]; idx++) { - if (my_chemistry->dust_species > 0) { - altot(idx, i) = alMgSiO3(idx, i) + alAC(idx, i); - } - if (my_chemistry->dust_species > 1) { - altot(idx, i) = altot(idx, i) + alSiM(idx, i) + alFeM(idx, i) + - alMg2SiO4(idx, i) + alFe3O4(idx, i) + - alSiO2D(idx, i) + alMgO(idx, i) + alFeS(idx, i) + - alAl2O3(idx, i); - } - if (my_chemistry->dust_species > 2) { - altot(idx, i) = altot(idx, i) + alreforg(idx, i) + alvolorg(idx, i) + - alH2Oice(idx, i); + const double* tmp = internal_dust_prop_buf.grain_dyntab_kappa.data[grsp_i]; + View cur_grsp_kappa_tab(tmp, n_log10Tdust_vals, + my_fields->grid_dimension[0]); + for (int i = idx_range.i_start; i < idx_range.i_stop; i++) { + if (itmask[i] != MASK_FALSE) { + for (int idx = 0; idx < n_log10Tdust_vals; idx++) { + kappa_tab_tot(idx, i) += cur_grsp_kappa_tab(idx, i); } } } From c2b7da0c7835f9bbdf9c718cfcde600b86220e73 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Thu, 11 Dec 2025 12:02:08 -0500 Subject: [PATCH 098/111] Only load needed injection pathway data Previously, if we used metal chemistry, we loaded all injection pathway data. Now we just load what we need. Relatedly, when we index into an array and each member corresponds to a distinct injection pathway, index 0 is now always valid. For context, when my_chemistry->multi_metals is 0, we would historically need to access the relvant data at the index specified by my_chemistry->metal_abundances. --- .../calc_grain_size_increment_1d.hpp | 5 +- .../inject_model/inject_path_field_pack.hpp | 52 +++++++---------- src/clib/inject_model/load_data.cpp | 56 +++++++++++++------ src/clib/make_consistent.cpp | 14 ++--- 4 files changed, 67 insertions(+), 60 deletions(-) diff --git a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp index 238a2f304..a0a1976e5 100644 --- a/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp +++ b/src/clib/dust/multi_grain_species/calc_grain_size_increment_1d.hpp @@ -132,11 +132,8 @@ inline void calc_grain_size_increment_1d( InjectPathFieldPack inject_path_metal_densities = setup_InjectPathFieldPack(my_chemistry, my_fields); - int start = inject_path_metal_densities.start_idx; - int stop = inject_path_metal_densities.stop_idx; - // make arrays - for (int count = start; count < stop; count++) { + for (int count = 0; count < n_pathways; count++) { // when my_chemistry->multi_metals == 0, inj_path_metal_dens wraps // the same pointer as `metal` diff --git a/src/clib/inject_model/inject_path_field_pack.hpp b/src/clib/inject_model/inject_path_field_pack.hpp index 0dd2526fd..4992045db 100644 --- a/src/clib/inject_model/inject_path_field_pack.hpp +++ b/src/clib/inject_model/inject_path_field_pack.hpp @@ -21,13 +21,9 @@ namespace grackle::impl { /// /// I have some ideas that will let us dispose of this type in the near future. struct InjectPathFieldPack { - /// Specifies the bounds for a for-loop that you would use to iterate over - /// all relevant injection model density fields that are present in fields - /// - /// @todo - /// Some changes are required before we can safely assume that start_idx is - /// always 0 - int start_idx, stop_idx; + /// Specifies the number of injection pathways that should have data in + /// the fields member. + int n_fields; /// holds pointers to the various injection model density fields const gr_float* fields[inj_model_input::N_Injection_Pathways]; @@ -37,38 +33,32 @@ struct InjectPathFieldPack { inline InjectPathFieldPack setup_InjectPathFieldPack( const chemistry_data* my_chem, const grackle_field_data* my_fields) { if ((my_chem->metal_chemistry > 0) && (my_chem->multi_metals == 1)) { - return InjectPathFieldPack{ - /* start_idx = */ 0, - /* stop_idx = */ inj_model_input::N_Injection_Pathways, - /* fields = */ - { - my_fields->local_ISM_metal_density, - my_fields->ccsn13_metal_density, - my_fields->ccsn20_metal_density, - my_fields->ccsn25_metal_density, - my_fields->ccsn30_metal_density, - my_fields->fsn13_metal_density, - my_fields->fsn15_metal_density, - my_fields->fsn50_metal_density, - my_fields->fsn80_metal_density, - my_fields->pisn170_metal_density, - my_fields->pisn200_metal_density, - my_fields->y19_metal_density, - }}; + return InjectPathFieldPack{inj_model_input::N_Injection_Pathways, + { + my_fields->local_ISM_metal_density, + my_fields->ccsn13_metal_density, + my_fields->ccsn20_metal_density, + my_fields->ccsn25_metal_density, + my_fields->ccsn30_metal_density, + my_fields->fsn13_metal_density, + my_fields->fsn15_metal_density, + my_fields->fsn50_metal_density, + my_fields->fsn80_metal_density, + my_fields->pisn170_metal_density, + my_fields->pisn200_metal_density, + my_fields->y19_metal_density, + }}; } InjectPathFieldPack out; + out.n_fields = 0; for (int i = 0; i < inj_model_input::N_Injection_Pathways; i++) { out.fields[i] = nullptr; } if ((my_chem->metal_chemistry > 0) && (my_chem->multi_metals == 0)) { - out.start_idx = my_chem->metal_abundances; - out.stop_idx = out.start_idx + 1; - out.fields[my_chem->metal_abundances] = my_fields->metal_density; - } else { - out.start_idx = 0; - out.stop_idx = out.start_idx; + out.n_fields = 1; + out.fields[0] = my_fields->metal_density; } return out; diff --git a/src/clib/inject_model/load_data.cpp b/src/clib/inject_model/load_data.cpp index ed3af2408..b39768da7 100644 --- a/src/clib/inject_model/load_data.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -81,11 +81,6 @@ struct SetupCallbackCtx { /// maps the names of known injection pathways to a unique index /// - /// The callback function reports an error if an injection is encountered - /// that has a name that isn't included in this map. Furthermore, data is - /// organized within GrainMetalInjectPathways according to the order of keys - /// in this map. - /// /// @par Why This Is Needed /// For some background context: /// - to make use of the injection pathway information, Grackle requires @@ -100,8 +95,12 @@ struct SetupCallbackCtx { /// Before any functionality involving injection pathways is included in a /// public release of Grackle, the plan is to stop hard-coding the names of /// injection pathway density fields, and to load in injection pathway data - /// from HDF5 files. At that point, we'll need to tweak the callback function - /// to load in data for models with arbitrary names. + /// from HDF5 files. + /// - At that point, we'll need to tweak the callback function to load in + /// data for models with arbitrary names. + /// - I suspect that we'll want to adopt a policy for ensuring that the order + /// of models is well-defined (to make results bitwise reproducible). In + /// that scenario, we might use this to enforce an alphanumberic ordering const grackle::impl::FrozenKeyIdxBiMap* inj_path_names; /// maps the names of the grain species for which data will be loaded to the @@ -135,8 +134,7 @@ extern "C" int setup_yield_table_callback( int pathway_idx = static_cast( FrozenKeyIdxBiMap_idx_from_key(my_ctx->inj_path_names, name)); if (pathway_idx == static_cast(bimap::invalid_val)) { - return GrPrintAndReturnErr("`%s` is an unexpected injection pathway name", - name); + return GR_SUCCESS; } // load the object that we update with the data we read @@ -263,15 +261,41 @@ int grackle::impl::load_inject_path_data(const chemistry_data* my_chemistry, return GR_SUCCESS; } - // construct a mapping of all known models - // -> in the future, we are going to move away from this hardcoded approach - // -> since the strings are statically allocates, the map won't make copies - // of the strings - constexpr int n_pathways = - static_cast(sizeof(known_inj_path_names) / sizeof(char*)); + // an upper bound on the number of allowed injection pathways + int max_n_pathways = grackle::impl::inj_model_input::N_Injection_Pathways; + + // get the list of injection pathways + // -> currently this requires us to look at the my_chemistry->multi_metals + // and my_chemstry->metal_abundances variables. + // -> when we move away from hardcoded names and start loading from HDF5, + // we'll remove these variables + const char* const* inj_path_name_l = nullptr; + int n_pathways = 0; + bool valid_metal_abundances = + ((0 <= my_chemistry->metal_abundances) && + (my_chemistry->metal_abundances < max_n_pathways)); + + if ((my_chemistry->multi_metals == 0) && !valid_metal_abundances) { + return GrPrintAndReturnErr( + "the metal_abundances parameter must not be negative or exceed %d", + max_n_pathways - 1); + } else if (my_chemistry->multi_metals == 0) { + inj_path_name_l = known_inj_path_names + my_chemistry->metal_abundances; + n_pathways = 1; + } else if (my_chemistry->multi_metals == 1) { + inj_path_name_l = known_inj_path_names; + n_pathways = max_n_pathways; + } else { + return GrPrintAndReturnErr("the multi_metals parameter isn't 0 or 1"); + } + // construct a mapping of the injection pathway names + // -> right now, since the strings are statically allocated, we use + // BiMapMode::REFS_KEYDATA to instruct the map to avoid making copies. + // -> In the future, when model names are dynamically specified by an HDF5 + // file, we'll need to use BiMapMode::COPIES_KEYDATA. FrozenKeyIdxBiMap inj_path_names = new_FrozenKeyIdxBiMap( - known_inj_path_names, n_pathways, BiMapMode::REFS_KEYDATA); + inj_path_name_l, n_pathways, BiMapMode::REFS_KEYDATA); if (!FrozenKeyIdxBiMap_is_ok(&inj_path_names)) { return GrPrintAndReturnErr( "there was a problem building the map of model names"); diff --git a/src/clib/make_consistent.cpp b/src/clib/make_consistent.cpp index 8d520497e..10fa44741 100644 --- a/src/clib/make_consistent.cpp +++ b/src/clib/make_consistent.cpp @@ -215,8 +215,8 @@ void make_consistent( // total metal density that corresponds to an injection pathway grackle::impl::View SN_metal_arr[inj_model_input::N_Injection_Pathways]; - // declare variables used to hold bounds for iterating over SN_metal_arr - int inj_path_idx_start, inj_path_idx_stop; + + int n_pathways = 0; // construct view of each specified injection pathway metal density field if (my_chemistry->metal_chemistry > 0) { @@ -226,17 +226,13 @@ void make_consistent( // my_fields->metal_density is **NOT** mutated by this function. InjectPathFieldPack p = setup_InjectPathFieldPack(my_chemistry, my_fields); - inj_path_idx_start = p.start_idx; - inj_path_idx_stop = p.stop_idx; + n_pathways = inject_pathway_props->n_pathways; - for (int iSN = inj_path_idx_start; iSN < inj_path_idx_stop; iSN++) { + for (int iSN = 0; iSN < n_pathways; iSN++) { SN_metal_arr[iSN] = grackle::impl::View( p.fields[iSN], my_fields->grid_dimension[0], my_fields->grid_dimension[1], my_fields->grid_dimension[2]); } - } else { - inj_path_idx_start = 0; - inj_path_idx_stop = 0; } std::vector Ct(my_fields->grid_dimension[0]); @@ -353,7 +349,7 @@ void make_consistent( Sg[i] = 0.; Fet[i] = 0.; Feg[i] = 0.; - for (int iSN = inj_path_idx_start; iSN < inj_path_idx_stop; iSN++) { + for (int iSN = 0; iSN < n_pathways; iSN++) { gr_float cur_val = SN_metal_arr[iSN](i, j, k); Ct[i] = Ct[i] + total_metal_yields.C[iSN] * cur_val; From dbb6b5d3fcb99042fe6c7de8d2c05ba9077ef954 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 12 Dec 2025 12:10:19 -0500 Subject: [PATCH 099/111] move FrozenKeyIdxBiMap to support subdirectory --- src/clib/CMakeLists.txt | 2 +- src/clib/{utils => support}/FrozenKeyIdxBiMap.hpp | 0 tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/clib/{utils => support}/FrozenKeyIdxBiMap.hpp (100%) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index f865f97e7..e5c57b16b 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -124,8 +124,8 @@ add_library(Grackle_Grackle scale_fields.cpp scale_fields.hpp solve_rate_cool_g-cpp.cpp solve_rate_cool_g-cpp.h step_rate_newton_raphson.hpp + support/FrozenKeyIdxBiMap.hpp time_deriv_0d.hpp - utils/FrozenKeyIdxBiMap.hpp utils-cpp.cpp utils-cpp.hpp utils-field.hpp fortran_func_wrappers.hpp diff --git a/src/clib/utils/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp similarity index 100% rename from src/clib/utils/FrozenKeyIdxBiMap.hpp rename to src/clib/support/FrozenKeyIdxBiMap.hpp diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 61e45cf60..a928829ab 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -14,7 +14,7 @@ #include #include -#include "utils/FrozenKeyIdxBiMap.hpp" +#include "support/FrozenKeyIdxBiMap.hpp" #include "grackle.h" class FrozenKeyIdxBiMapConstructorSuite From b9261c3a6a8c47e46655fecbec3db3539265bf42 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 12 Dec 2025 12:16:45 -0500 Subject: [PATCH 100/111] fixing some paths --- src/clib/dust/grain_species_info.cpp | 2 +- src/clib/dust/grain_species_info.hpp | 2 +- tests/unit/test_grain_species_info.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/clib/dust/grain_species_info.cpp b/src/clib/dust/grain_species_info.cpp index d82aa4340..38a9d59cc 100644 --- a/src/clib/dust/grain_species_info.cpp +++ b/src/clib/dust/grain_species_info.cpp @@ -15,7 +15,7 @@ #include "LUT.hpp" #include "grain_species_info.hpp" -#include "../utils/FrozenKeyIdxBiMap.hpp" +#include "../support/FrozenKeyIdxBiMap.hpp" // The following logic effectively does 2 (related things): // 1. it serves as a human-readable registry of all known grain species and diff --git a/src/clib/dust/grain_species_info.hpp b/src/clib/dust/grain_species_info.hpp index bddafc11d..e64a59b06 100644 --- a/src/clib/dust/grain_species_info.hpp +++ b/src/clib/dust/grain_species_info.hpp @@ -13,7 +13,7 @@ #ifndef GRAIN_SPECIES_INFO_HPP #define GRAIN_SPECIES_INFO_HPP -#include "../utils/FrozenKeyIdxBiMap.hpp" +#include "../support/FrozenKeyIdxBiMap.hpp" namespace grackle::impl { diff --git a/tests/unit/test_grain_species_info.cpp b/tests/unit/test_grain_species_info.cpp index b941d55a0..dcefec082 100644 --- a/tests/unit/test_grain_species_info.cpp +++ b/tests/unit/test_grain_species_info.cpp @@ -17,7 +17,7 @@ #include "LUT.hpp" #include "dust/grain_species_info.hpp" -#include "utils/FrozenKeyIdxBiMap.hpp" +#include "support/FrozenKeyIdxBiMap.hpp" namespace { // stuff in an anonymous namespace is local to this file From 99027dcc66f6d5b259ca1f22c540cb9f1798784e Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 12 Dec 2025 12:26:19 -0500 Subject: [PATCH 101/111] fix a header inclusion path --- src/clib/inject_model/load_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clib/inject_model/load_data.cpp b/src/clib/inject_model/load_data.cpp index ca13dc6ce..c4925d77d 100644 --- a/src/clib/inject_model/load_data.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -18,7 +18,7 @@ #include "../LUT.hpp" #include "../opaque_storage.hpp" #include "../status_reporting.h" // GrPrintAndReturnErr -#include "../utils/FrozenKeyIdxBiMap.hpp" +#include "../support/FrozenKeyIdxBiMap.hpp" namespace { // stuff inside an anonymous namespace is local to this file From c287fa655680394bcea1fd52fd512f8b84ed73fc Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 5 Jan 2026 15:10:36 -0500 Subject: [PATCH 102/111] Add support for a map with 0 entries Also made a few assorted fixes --- src/clib/support/FrozenKeyIdxBiMap.hpp | 58 +++++++++++++------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index a9537a5c0..e9ddebada 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -22,8 +22,8 @@ /// constructor And copy assignement methods OR adopt reference counting). /// //===----------------------------------------------------------------------===// -#ifndef UTILS_FROZENKEYIDXBIMAP_HPP -#define UTILS_FROZENKEYIDXBIMAP_HPP +#ifndef SUPPORT_FROZENKEYIDXBIMAP_HPP +#define SUPPORT_FROZENKEYIDXBIMAP_HPP #include #include @@ -54,9 +54,9 @@ namespace grackle::impl { enum class BiMapMode { REFS_KEYDATA = 0, COPIES_KEYDATA = 1 }; -/// @brief This is a bidirectional map (bimap). It is specialized to map `n` -/// unique string keys to unique indexes with values of `0` through `n-1` and -/// vice versa. The ordering of keys is set at initialization and frozen. +/// This is a bidirectional map (bimap). It is specialized to map @c n +/// unique string keys to unique indexes with values of @c 0` through @c (n-1) +/// and vice versa. The ordering of keys is set at initialization and frozen. /// /// This is primarily intended to be used in the implementation of Maps of /// arrays (where the values could be part of a single contiguous array or are @@ -76,21 +76,21 @@ enum class BiMapMode { REFS_KEYDATA = 0, COPIES_KEYDATA = 1 }; /// (where we directly embed the string in the hash-table-rows), this will /// probably be a quite a bit faster /// -/// Replacement in PR #270 -/// ====================== +/// @par Replacement in PR #270 /// The current implementation is extremely oversimplified and inefficient! It /// doesn't even use a hash table. The purpose is to create a simple abstract /// data structure for which the implementation will be dramatically improved /// by PR #270 (but the interface won't be touched at all). /// +/// @par /// The PR with the improved version, also updates this docstring with a /// detailed explanation of design decisions (like why the contents /// are "frozen") and highlights a number of potential improvements. /// -/// > [!note] -/// > The contents of this struct should be considered an implementation -/// > detail! Always prefer the associated functions (they are defined in such -/// > a way that they should be inlined +/// @note +/// The contents of this struct should be considered an implementation +/// detail! Always prefer the associated functions (they are defined in such +/// a way that they should be inlined) struct FrozenKeyIdxBiMap { // don't forget to update FrozenKeyIdxBiMap_clone when changing members @@ -111,16 +111,16 @@ struct FrozenKeyIdxBiMap { /// @param[in] mode specifies handling of keys. This will be passed on to any /// clones that are made. /// -/// > [!note] -/// > If this function returns `bimap`, then the caller should invoke -/// > `FrozenKeyIdxBiMap_is_ok(&bimap)` to test whether there was an error. -/// > This is pretty ugly/clunky, but its the only practical way to achieve -/// > comparable behavior to other internal datatypes (ideally, we would make -/// > this a simple C++ class instead) +/// @note +/// If this function returns \c bimap, then the caller should invoke +/// \c FrozenKeyIdxBiMap_is_ok(&bimap) to test whether there was an error. +/// This is pretty ugly/clunky, but it's the only practical way to achieve +/// comparable behavior to other internal datatypes (ideally, we would make +/// this a simple C++ class instead) inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], int key_count, BiMapMode mode) { // this will be returned if there is an error - FrozenKeyIdxBiMap erroneous_obj{0, nullptr, BiMapMode::REFS_KEYDATA}; + FrozenKeyIdxBiMap erroneous_obj{-1, nullptr, BiMapMode::REFS_KEYDATA}; // check the specified keys long long max_keys = static_cast(bimap::invalid_val) - 1LL; @@ -183,8 +183,8 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], } /// returns whether new_FrozenKeyIdxBiMap constructed a valid object -inline bool FrozenKeyIdxBiMap_is_ok(FrozenKeyIdxBiMap* ptr) { - return (ptr->length > 0); +inline bool FrozenKeyIdxBiMap_is_ok(const FrozenKeyIdxBiMap* ptr) { + return (ptr->length != -1); } /// Destroys the specified FrozenKeyIdxBiMap @@ -199,16 +199,16 @@ inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { } } -/// Makes a clone of the specified FrozenKeyIdxBiMap (the clone inherites the +/// Makes a clone of the specified FrozenKeyIdxBiMap (the clone inherits the /// original BiMapMode). /// -/// > [!note] -/// > If this function returns `bimap`, then the caller should invoke -/// > `FrozenKeyIdxBiMap_is_ok(&bimap)` to test whether there was an error. -/// > This is pretty ugly/clunky, but its the only practical way to achieve -/// > comparable behavior to other internal datatypes (ideally, we would make -/// > this a simple C++ class instead) -FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { +/// @note +/// If this function returns \c bimap, then the caller should invoke +/// \c FrozenKeyIdxBiMap_is_ok(&bimap) to test whether there was an error. +/// This is pretty ugly/clunky, but it's the only practical way to achieve +/// comparable behavior to other internal datatypes (ideally, we would make +/// this a simple C++ class instead) +inline FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { return new_FrozenKeyIdxBiMap(ptr->keys, ptr->length, ptr->mode); }; @@ -246,4 +246,4 @@ inline const char* FrozenKeyIdxBiMap_key_from_idx(const FrozenKeyIdxBiMap* map, } // namespace grackle::impl -#endif // UTILS_FROZENKEYIDXBIMAP_HPP +#endif // SUPPORT_FROZENKEYIDXBIMAP_HPP From 0a8c9db350050ff50614c9b44cf8ff0b52c40fa2 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 5 Jan 2026 16:22:23 -0500 Subject: [PATCH 103/111] added a nice example illustrating how FrozenKeyIdxBiMap works --- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index a928829ab..60af40833 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -17,6 +17,66 @@ #include "support/FrozenKeyIdxBiMap.hpp" #include "grackle.h" +// this top test was introduced to provide a more concrete example +// of how we might use FrozenKeyIdxBiMap + +TEST(FrozenKeyIdxBiMap, FullExample) { + // THE SCENARIO: we have a list of unique ordered strings + // + // We are going build a FrozenKeyIdxBiMap instance from the following list. + // The resulting object is a bidirectional map that can both: + // 1. map a string to its index (at the time of construction) in the list. + // - example: "HII" is mapped to 2 + // - example: "O2II" is mapped to 33 + // 2. perform the reverse mapping (i.e. index -> string) + // - example: 2 is mapped to "HII" + // - example: 33 is mapped to "O2II" + // + // It's worth emphasizing that the mapping is frozen when its constructed & + // contents can't be changed (even if you reorder the original) + const char* keys[34] = { + "e", "HI", "HII", "HeI", "HeII", "HeIII", "HM", "H2I", "H2II", + "DI", "DII", "HDI", "DM", "HDII", "HeHII", "CI", "CII", "CO", + "CO2", "OI", "OH", "H2O", "O2", "SiI", "SiOI", "SiO2I", "CH", + "CH2", "COII", "OII", "OHII", "H2OII", "H3OII", "O2II"}; + + namespace grimpl = grackle::impl; + + // PART 1: build a FrozenKeyIdxBiMap from this list + // the 3rd argument tells the string to make copies of each string + grimpl::FrozenKeyIdxBiMap m = grimpl::new_FrozenKeyIdxBiMap( + keys, 34, grimpl::BiMapMode::COPIES_KEYDATA); + + // before we use it, we should confirm the constructor succeeded + if (!grimpl::FrozenKeyIdxBiMap_is_ok(&m)) { + FAIL() << "creation of the m failed unexpectedly"; + } + + // PART 2: let's show some examples of lookups from names + + // Equivalent Python/idiomatic C++: `2 == m["HII"]` + EXPECT_EQ(2, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "HII")); + // Equivalent Python/idiomatic C++: `33 == m["O2II"]` + EXPECT_EQ(33, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "O2II")); + + // Behavior is well-defined when a key isn't known + int invalid = grimpl::bimap::invalid_val; + EXPECT_EQ(invalid, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "NotAKey")); + + // PART 3: let's show the reverse of the previous lookups + EXPECT_STREQ("HII", grimpl::FrozenKeyIdxBiMap_key_from_idx(&m, 2)); + EXPECT_STREQ("O2II", grimpl::FrozenKeyIdxBiMap_key_from_idx(&m, 33)); + + // Behavior is again well-defined when passing an invalid index + EXPECT_EQ(nullptr, grimpl::FrozenKeyIdxBiMap_key_from_idx(&m, 131)); + + // PART 4: We can also query the length + EXPECT_EQ(34, grimpl::FrozenKeyIdxBiMap_size(&m)); + + // Finally, to cleanup we will deallocate data tracked internally by `m` + grimpl::drop_FrozenKeyIdxBiMap(&m); +} + class FrozenKeyIdxBiMapConstructorSuite : public testing::TestWithParam { // You can implement all the usual fixture class members here. From 967a3e6abc4011e698f05422eb2aea0b2e5ab284 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Mon, 5 Jan 2026 16:53:20 -0500 Subject: [PATCH 104/111] more rigorously tested empty bimaps and fixed bugs --- src/clib/support/FrozenKeyIdxBiMap.hpp | 4 ++ tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 54 +++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index e9ddebada..9798d66bb 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -122,6 +122,10 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], // this will be returned if there is an error FrozenKeyIdxBiMap erroneous_obj{-1, nullptr, BiMapMode::REFS_KEYDATA}; + if (keys == nullptr && key_count == 0) { + return FrozenKeyIdxBiMap{0, nullptr, mode}; + } + // check the specified keys long long max_keys = static_cast(bimap::invalid_val) - 1LL; if (key_count < 1 || static_cast(key_count) > max_keys) { diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 60af40833..07345e38c 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -77,6 +77,49 @@ TEST(FrozenKeyIdxBiMap, FullExample) { grimpl::drop_FrozenKeyIdxBiMap(&m); } +// validate basic operations for an empty bimap +TEST(FrozenKeyIdxBiMap, EmptyBasicOps) { + grackle::impl::FrozenKeyIdxBiMap m = grackle::impl::new_FrozenKeyIdxBiMap( + nullptr, 0, grackle::impl::BiMapMode::COPIES_KEYDATA); + ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&m)) + << "construction of a FrozenKeyIdxBiMap unexpectedly failed"; + + EXPECT_EQ(0, grackle::impl::FrozenKeyIdxBiMap_size(&m)) + << "an empty mapping should have a size of 0"; + + EXPECT_EQ(grackle::impl::bimap::invalid_val, + grackle::impl::FrozenKeyIdxBiMap_idx_from_key(&m, "NotAKey")) + << "key lookup should always fail for an empty mapping"; + + EXPECT_EQ(nullptr, grackle::impl::FrozenKeyIdxBiMap_key_from_idx(&m, 0)) + << "index lookup should always fail for an empty mapping"; + + grackle::impl::drop_FrozenKeyIdxBiMap(&m); +} + +// validate behavior of clone for an empty bimap +TEST(FrozenKeyIdxBiMap, EmptyClone) { + // make the original + grackle::impl::FrozenKeyIdxBiMap m = grackle::impl::new_FrozenKeyIdxBiMap( + nullptr, 0, grackle::impl::BiMapMode::COPIES_KEYDATA); + ASSERT_TRUE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&m)) + << "construction of a FrozenKeyIdxBiMap unexpectedly failed"; + + // make the clone + grackle::impl::FrozenKeyIdxBiMap m_clone = + grackle::impl::FrozenKeyIdxBiMap_clone(&m); + + bool success = grackle::impl::FrozenKeyIdxBiMap_is_ok(&m_clone); + + grackle::impl::drop_FrozenKeyIdxBiMap(&m); // drop the original + + if (success) { + grackle::impl::drop_FrozenKeyIdxBiMap(&m_clone); + } else { + FAIL() << "cloning an empty mapping failed!"; + } +} + class FrozenKeyIdxBiMapConstructorSuite : public testing::TestWithParam { // You can implement all the usual fixture class members here. @@ -123,9 +166,16 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, 0LenKey) { ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } -TEST_P(FrozenKeyIdxBiMapConstructorSuite, NoKeys) { +TEST_P(FrozenKeyIdxBiMapConstructorSuite, NullptrWithPosCount) { + grackle::impl::FrozenKeyIdxBiMap tmp = + grackle::impl::new_FrozenKeyIdxBiMap(nullptr, 1, GetParam()); + ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); +} + +TEST_P(FrozenKeyIdxBiMapConstructorSuite, NotNull0KeyCount) { + const char* keys[] = {"denisty", "internal_energy"}; grackle::impl::FrozenKeyIdxBiMap tmp = - grackle::impl::new_FrozenKeyIdxBiMap(nullptr, 0, GetParam()); + grackle::impl::new_FrozenKeyIdxBiMap(keys, 0, GetParam()); ASSERT_FALSE(grackle::impl::FrozenKeyIdxBiMap_is_ok(&tmp)); } From f515c268628b524a61d06c29e1e44becfbe29312 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 6 Jan 2026 15:39:23 -0500 Subject: [PATCH 105/111] a bunch of assorted changes --- src/clib/support/FrozenKeyIdxBiMap.hpp | 199 +++++++++++++++++-------- 1 file changed, 138 insertions(+), 61 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index 9798d66bb..b00c0d0e0 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -12,14 +12,8 @@ /// bookkeeping. /// /// The underlying implementation of this type is *highly* suboptimal (it's -/// simplistic at the cost of speed). PR #270 introduce a replacement that -/// maintains almost the exact same API (the new_FrozenKeyIdxBiMap, -/// FrozenKeyIdxBiMap_clone, and drop_FrozenKeyIdxBiMap functions will need to -/// be tweaked) -/// -/// If we decide to more fully embrace C++, it would make a LOT of sense to -/// convert this to a full-blown class (we would probably delete the copy -/// constructor And copy assignement methods OR adopt reference counting). +/// simplistic at the cost of speed). PR #484 introduce a drop-in replacement +/// the API won't change that is much faster /// //===----------------------------------------------------------------------===// #ifndef SUPPORT_FROZENKEYIDXBIMAP_HPP @@ -33,7 +27,7 @@ #include "grackle.h" #include "status_reporting.h" -// the motivation for these constants are provided in PR #270 (they are related +// the motivation for these constants are provided in PR #484 (they are related // to some optimizations in the FrozenKeyIdxBiMap implementation) namespace grackle::impl::bimap { /// specifies an invalid value of the map (we state that you can't store the @@ -45,42 +39,61 @@ inline constexpr std::uint16_t invalid_val = inline constexpr std::uint16_t keylen_max = 29; } // namespace grackle::impl::bimap -// these are just here for to make it easier for us to adopt changes from PR -// #270 (then we can delete these macros) -#define STRU16MAP_INVALID_VAL grackle::impl::bimap::invalid_val -#define STRU16MAP_KEYLEN_MAX grackle::impl::bimap::keylen_max - namespace grackle::impl { -enum class BiMapMode { REFS_KEYDATA = 0, COPIES_KEYDATA = 1 }; - -/// This is a bidirectional map (bimap). It is specialized to map @c n -/// unique string keys to unique indexes with values of @c 0` through @c (n-1) -/// and vice versa. The ordering of keys is set at initialization and frozen. -/// -/// This is primarily intended to be used in the implementation of Maps of -/// arrays (where the values could be part of a single contiguous array or are -/// individual arrays), but this but may be broadly useful for other -/// applications. -/// -/// This operates in 2 modes: -/// 1. @ref BiMapMode::REFS_KEYDATA This is the default, where we operate -/// under the assumption that the allocations holding the string characters -/// outlive the bimap. In this mode the bimap is intended to hold -/// string-literals. (which are live for the entirety of a program). This -/// minimizes memory usage. -/// 2. @ref BiMapMode::COPIES_KEYDATA Under this mode, the bimap copies the -/// data of all keys. This is useful for testing purposes. In the long-term, -/// if we allow dynamic extension of chemistry networks, it will also be -/// useful. If we are implement the optimizations described down below -/// (where we directly embed the string in the hash-table-rows), this will -/// probably be a quite a bit faster -/// -/// @par Replacement in PR #270 +// the following doxygen comment block logically groups every all parts of +// the (internal) API for Grackle's (internal) FrozenKeyIdxBiMap. It's useful +// when generating a doxygen webpage + +/// @defgroup bimap-grp FrozenKeyIdxBiMap Data Type +/// +/// FrozenKeyIdxBiMap provides specialized mapping functionality for internal +/// use within Grackle. The functionality is useful as a building-block for +/// runtime lookup-tables and other data types with map-like interface. +/// +/// The data type was implemented in a C-style. The FrozenKeyIdxBiMap struct +/// should be treated as an opaque type that is operated upon by a set of +/// associated functions. More idiomatic C++ (or languages like Rust & Swift), +/// the associated functions would be attached to the struct as methods +/** @{*/ + +/// describes the operating modes of @ref FrozenKeyIdxBiMap +enum class BiMapMode { + /// The preferred default mode, where the creation of a BiMap involves making + /// copies of each key (cleaning up a BiMap will deallocate the copies) + /// + /// In general, this is much safer, and it will be @b very useful in the + /// longer-term if we allow dynamic extension of chemistry networks. If we + /// adopt the embedded-key optimization (discussed in the FrozenKeyIdxBiMap), + /// this mode will probably be significantly faster. + COPIES_KEYDATA = 1, + /// This mode aims to reduce memory usage by having the BiMap reference + /// external keys. In other words, the BiMap won't attempt to manage + /// allocations holding each character in a string. + /// + /// @warning + /// For safety this should @b ONLY be used when all keys are immutable + /// string-literals (i.e. when the strings are valid for program's duration) + REFS_KEYDATA = 0, +}; + +/// @brief A bidirectional map (bimap), specialized to map @c n unique string +/// keys to unique indexes with values of @c 0 through @c (n-1) and +/// vice versa. The ordering & values of keys are set at creation and frozen. +/// +/// This type is useful in a number of scenarios. For example, it can be used +/// to implement a type representing a Map of arrays (where the values could +/// be part of a single contiguous array or are individual arrays). +/// +/// This type operates in 2 modes: @ref BiMapMode::COPIES_KEYDATA and +/// @ref BiMapMode::REFS_KEYDATA. Their docstrings provide more context. When +/// in doubt, prefer the former mode. +/// +/// @par Replacement in PR #484 /// The current implementation is extremely oversimplified and inefficient! It /// doesn't even use a hash table. The purpose is to create a simple abstract /// data structure for which the implementation will be dramatically improved -/// by PR #270 (but the interface won't be touched at all). +/// by PR #484 (but the interface won't be touched at all). /// /// @par /// The PR with the improved version, also updates this docstring with a @@ -98,8 +111,7 @@ struct FrozenKeyIdxBiMap { int length; /// array of keys const char** keys; - /// indicates whether the map "owns" the memory holding the characters in - /// each key or just references it + /// specifies ownership of keys, @see BiMapMode BiMapMode mode; }; @@ -112,11 +124,11 @@ struct FrozenKeyIdxBiMap { /// clones that are made. /// /// @note -/// If this function returns \c bimap, then the caller should invoke -/// \c FrozenKeyIdxBiMap_is_ok(&bimap) to test whether there was an error. -/// This is pretty ugly/clunky, but it's the only practical way to achieve -/// comparable behavior to other internal datatypes (ideally, we would make -/// this a simple C++ class instead) +/// Callers should pass the returned value to @ref FrozenKeyIdxBiMap_is_ok +/// to check whether there was an error during creation. This is pretty +/// ugly/clunky, but it's the only practical way to achieve comparable behavior +/// to other internal data types. The best alternatives involve things like +/// std::optional or converting this type to a simple C++ class. inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], int key_count, BiMapMode mode) { // this will be returned if there is an error @@ -186,12 +198,41 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], /* mode = */ mode}; } -/// returns whether new_FrozenKeyIdxBiMap constructed a valid object +/// checks whether a creational function produced a valid bimap +/// +/// @param[in] ptr Points to the object being checked +/// @return true if the value is ok or false if the value is invalid +/// +/// @important +/// The interface of @ref FrozenKeyIdxBiMap sets values in a very particular +/// way to signal that FrozenKeyIdxBiMap is in an invalid state. This function +/// @b ONLY checks for that particular signature. inline bool FrozenKeyIdxBiMap_is_ok(const FrozenKeyIdxBiMap* ptr) { return (ptr->length != -1); } -/// Destroys the specified FrozenKeyIdxBiMap +/// Destroys the internal data tracked by an instance +/// +/// @param[in] ptr A non-null pointer to a valid bimap instance +/// +/// @warning +/// As with any C datatype, care is required to avoid issues with internal +/// dangling pointers. YOU SHOULD ONLY CALL THIS ONCE for a given instance +/// (and only if the instance was properly by the interface) +/// - while some efforts are made to reduce the possiblity of issues, some +/// things just can't be avoided (especially when it comes to shallow copies) +/// - here's a problematic example: +/// @code{.cpp} +/// FrozenKeyIdxBiMap bimap = new_FrozenKeyIdxBiMap( /**/ ); +/// // (the FrozenKeyIdxBiMap_is_ok check is elided for brevity) +/// +/// // you should generally avoid shallow copies (if possible) +/// FrozenKeyIdxBiMap shallow_cpy = bimap; +/// +/// // problems arise below (if we swap order, the 2nd call is still bad) +/// drop_FrozenKeyIdxBiMap(&shallow_cpy); // <- this is OK +/// drop_FrozenKeyIdxBiMap(&bimap); // <- this is BAD +/// @endcode inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { if (ptr->mode == BiMapMode::COPIES_KEYDATA) { for (int i = 0; i < ptr->length; i++) { @@ -203,21 +244,31 @@ inline void drop_FrozenKeyIdxBiMap(FrozenKeyIdxBiMap* ptr) { } } -/// Makes a clone of the specified FrozenKeyIdxBiMap (the clone inherits the -/// original BiMapMode). +/// Makes a clone of the specified FrozenKeyIdxBiMap +/// +/// The clone inherits the original's BiMapMode value. If it held +/// BiMapMode::COPIES_KEYDATA, then fresh copies of the strings are made /// /// @note -/// If this function returns \c bimap, then the caller should invoke -/// \c FrozenKeyIdxBiMap_is_ok(&bimap) to test whether there was an error. -/// This is pretty ugly/clunky, but it's the only practical way to achieve -/// comparable behavior to other internal datatypes (ideally, we would make -/// this a simple C++ class instead) +/// Callers should pass the returned value to @ref FrozenKeyIdxBiMap_is_ok +/// to check whether there was an error during creation. This is pretty +/// ugly/clunky, but it's the only practical way to achieve comparable behavior +/// to other internal data types. The best alternatives involve things like +/// std::optional or converting this type to a simple C++ class. inline FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { return new_FrozenKeyIdxBiMap(ptr->keys, ptr->length, ptr->mode); }; -/// returns the value associated with the key or (if the key can't be found) -/// @ref grackle::impl::bimap::invalid_val +/// lookup the value associated with the key +/// +/// This is the analog to calling `map[key]` in python. In practice, the +/// semantics are more similar to calling `map.get(key,invalid_val)` +/// +/// @param[in] map A pointer to a valid bimap +/// @param[in] key A null-terminated string +/// +/// @return the key's associated value or, if the key can't be found, +/// @ref grackle::impl::bimap::invalid_val inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( const FrozenKeyIdxBiMap* map, const char* key) { GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); @@ -229,17 +280,41 @@ inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( return bimap::invalid_val; } -/// checks if the map contains a key -inline int FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, - const char* key) { +/// returns whether the map contains the key +/// +/// @param[in] map A pointer to a valid bimap +/// @param[in] key A null-terminated string +inline bool FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, + const char* key) { return FrozenKeyIdxBiMap_idx_from_key(map, key) != bimap::invalid_val; } +/// return the number of keys in the map +/// +/// @param[in] map A pointer to a valid bimap inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) { return map->length; } /// Return the ith key (this is effectively a reverse lookup) +/// +/// For some context, if this function returns a string `s` for some index `i`, +/// then a call to @ref FrozenKeyIdxBiMap_idx_from_key that passes `s` will +/// return `i` +/// +/// This is intended for use in situations where you briefly need the string +/// (i.e. and you plan to stop using the pointer before or at the same time as +/// the @p map is destroyed). In more detail: +/// - If the @p map was constructed in @ref BiMapMode::COPIES_KEYDATA mode, +/// returned strings have the same lifetime as @p map (i.e. they are +/// deallocated when the contents of @p map are deallocated). +/// - Otherwise, the returned string's allocation is externally managed. But, +/// any scenario where the allocation doesn't live at least as long as @p map, +/// is ill-formed +/// +/// @param[in] map A pointer to a valid bimap +/// @param[in] i The returned index +/// @return The pointer to the appropriate key inline const char* FrozenKeyIdxBiMap_key_from_idx(const FrozenKeyIdxBiMap* map, std::uint16_t i) { if (i >= map->length) { @@ -248,6 +323,8 @@ inline const char* FrozenKeyIdxBiMap_key_from_idx(const FrozenKeyIdxBiMap* map, return map->keys[i]; // this can't be a nullptr } +/** @}*/ // end of group + } // namespace grackle::impl #endif // SUPPORT_FROZENKEYIDXBIMAP_HPP From 8f66736e47f0eb306fd7f270fc3d507067d02ad1 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Tue, 6 Jan 2026 22:18:01 -0500 Subject: [PATCH 106/111] rename grackle::impl::{bimap->bimap_detail} & capitalize constant names Both changes essentially affected 2 constants, which prior to this commit were known as `keylen_max` & `invalid_val`. The 2 contained constants are really just implementation details that users of the inferface for `FrozenKeyIdxBiMap` shouldn't need to know anything about --- src/clib/support/FrozenKeyIdxBiMap.hpp | 28 +++++++++++----------- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 20 ++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index b00c0d0e0..cb07d752c 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -27,19 +27,18 @@ #include "grackle.h" #include "status_reporting.h" +namespace grackle::impl { + // the motivation for these constants are provided in PR #484 (they are related // to some optimizations in the FrozenKeyIdxBiMap implementation) -namespace grackle::impl::bimap { +namespace bimap_detail { /// specifies an invalid value of the map (we state that you can't store the /// maximum u16 value) -inline constexpr std::uint16_t invalid_val = - std::numeric_limits::max(); +inline constexpr uint16_t INVALID_VAL = std::numeric_limits::max(); /// specifies maximum allowed length of a key (excluding the null character). -inline constexpr std::uint16_t keylen_max = 29; -} // namespace grackle::impl::bimap - -namespace grackle::impl { +inline constexpr uint16_t KEYLEN_MAX = 29; +} // namespace bimap_detail // the following doxygen comment block logically groups every all parts of // the (internal) API for Grackle's (internal) FrozenKeyIdxBiMap. It's useful @@ -139,7 +138,7 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], } // check the specified keys - long long max_keys = static_cast(bimap::invalid_val) - 1LL; + long long max_keys = static_cast(bimap_detail::INVALID_VAL) - 1LL; if (key_count < 1 || static_cast(key_count) > max_keys) { GrPrintErrMsg("key_count must be positive and cannot exceed %lld", max_keys); @@ -151,11 +150,12 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], for (int i = 0; i < key_count; i++) { GR_INTERNAL_REQUIRE(keys[i] != nullptr, "Can't specify a nullptr key"); std::size_t n_chrs_without_nul = std::strlen(keys[i]); - if (n_chrs_without_nul == 0 || n_chrs_without_nul > bimap::keylen_max) { + if (n_chrs_without_nul == 0 || + n_chrs_without_nul > bimap_detail::KEYLEN_MAX) { GrPrintErrMsg( "calling strlen on \"%s\", the key @ index %d, yields 0 or a length " "exceeding %d", - keys[i], i, bimap::keylen_max); + keys[i], i, bimap_detail::KEYLEN_MAX); return erroneous_obj; } // check uniqueness @@ -262,13 +262,13 @@ inline FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { /// lookup the value associated with the key /// /// This is the analog to calling `map[key]` in python. In practice, the -/// semantics are more similar to calling `map.get(key,invalid_val)` +/// semantics are more similar to calling `map.get(key,INVALID_VAL)` /// /// @param[in] map A pointer to a valid bimap /// @param[in] key A null-terminated string /// /// @return the key's associated value or, if the key can't be found, -/// @ref grackle::impl::bimap::invalid_val +/// @ref grackle::impl::bimap_detail::INVALID_VAL inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( const FrozenKeyIdxBiMap* map, const char* key) { GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); @@ -277,7 +277,7 @@ inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( return static_cast(i); } } - return bimap::invalid_val; + return bimap_detail::INVALID_VAL; } /// returns whether the map contains the key @@ -286,7 +286,7 @@ inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( /// @param[in] key A null-terminated string inline bool FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, const char* key) { - return FrozenKeyIdxBiMap_idx_from_key(map, key) != bimap::invalid_val; + return FrozenKeyIdxBiMap_idx_from_key(map, key) != bimap_detail::INVALID_VAL; } /// return the number of keys in the map diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 07345e38c..87ee9d8a6 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -60,7 +60,7 @@ TEST(FrozenKeyIdxBiMap, FullExample) { EXPECT_EQ(33, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "O2II")); // Behavior is well-defined when a key isn't known - int invalid = grimpl::bimap::invalid_val; + int invalid = grimpl::bimap_detail::INVALID_VAL; EXPECT_EQ(invalid, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "NotAKey")); // PART 3: let's show the reverse of the previous lookups @@ -87,7 +87,7 @@ TEST(FrozenKeyIdxBiMap, EmptyBasicOps) { EXPECT_EQ(0, grackle::impl::FrozenKeyIdxBiMap_size(&m)) << "an empty mapping should have a size of 0"; - EXPECT_EQ(grackle::impl::bimap::invalid_val, + EXPECT_EQ(grackle::impl::bimap_detail::INVALID_VAL, grackle::impl::FrozenKeyIdxBiMap_idx_from_key(&m, "NotAKey")) << "key lookup should always fail for an empty mapping"; @@ -139,7 +139,7 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, Simple) { TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { const char* first_key = "density"; - std::string long_key(grackle::impl::bimap::keylen_max, 'A'); + std::string long_key(grackle::impl::bimap_detail::KEYLEN_MAX, 'A'); const char* keys[2] = {first_key, long_key.data()}; grackle::impl::FrozenKeyIdxBiMap tmp = @@ -151,7 +151,7 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, LongKey) { TEST_P(FrozenKeyIdxBiMapConstructorSuite, TooLongKey) { const char* first_key = "density"; - std::string long_key(grackle::impl::bimap::keylen_max + 1, 'A'); + std::string long_key(grackle::impl::bimap_detail::KEYLEN_MAX + 1, 'A'); const char* keys[2] = {first_key, long_key.data()}; grackle::impl::FrozenKeyIdxBiMap tmp = @@ -259,22 +259,22 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), - grackle::impl::bimap::invalid_val); + grackle::impl::bimap_detail::INVALID_VAL); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), - grackle::impl::bimap::invalid_val); + grackle::impl::bimap_detail::INVALID_VAL); - std::string key(grackle::impl::bimap::keylen_max + 1, 'A'); + std::string key(grackle::impl::bimap_detail::KEYLEN_MAX + 1, 'A'); EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, key.data()), - grackle::impl::bimap::invalid_val); + grackle::impl::bimap_detail::INVALID_VAL); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 3), nullptr); EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx( - bimap_p, grackle::impl::bimap::invalid_val), + bimap_p, grackle::impl::bimap_detail::INVALID_VAL), nullptr); } @@ -311,7 +311,7 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "internal_energy"), 0); EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "notAKey"), - grackle::impl::bimap::invalid_val); + grackle::impl::bimap_detail::INVALID_VAL); EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 3), nullptr); EXPECT_EQ( From c30a4d376963c495f5dd3c35f25be54e1a14f11b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 7 Jan 2026 09:31:45 -0500 Subject: [PATCH 107/111] intermediate commit --- src/clib/support/FrozenKeyIdxBiMap.hpp | 43 +++++++---- tests/unit/CMakeLists.txt | 2 +- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 84 ++++++++++++++-------- 3 files changed, 84 insertions(+), 45 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index cb07d752c..60a3f52ab 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -259,25 +259,38 @@ inline FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { return new_FrozenKeyIdxBiMap(ptr->keys, ptr->length, ptr->mode); }; +namespace bimap { + +/// holds the result of a call to @ref FrozenKeyIdxBiMap_get +/// +/// @note This C-style approximation of std::optional +struct AccessRslt { + /// Indicates whether the value member is valid + bool has_value; + /// the loaded value (if has_value is false then this holds garbage) + uint16_t value; +}; + +} + /// lookup the value associated with the key /// -/// This is the analog to calling `map[key]` in python. In practice, the -/// semantics are more similar to calling `map.get(key,INVALID_VAL)` +/// This is the analog to calling `map[key]` in python. /// /// @param[in] map A pointer to a valid bimap /// @param[in] key A null-terminated string /// -/// @return the key's associated value or, if the key can't be found, -/// @ref grackle::impl::bimap_detail::INVALID_VAL -inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( +/// @return An instance of @ref bimap::AccessRslt that encodes the value (if +/// the key is present) +inline bimap::AccessRslt FrozenKeyIdxBiMap_get( const FrozenKeyIdxBiMap* map, const char* key) { GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); for (int i = 0; i < map->length; i++) { if (std::strcmp(map->keys[i], key) == 0) { - return static_cast(i); + return bimap::AccessRslt{true, static_cast(i)}; } } - return bimap_detail::INVALID_VAL; + return bimap::AccessRslt{false, 0}; } /// returns whether the map contains the key @@ -286,7 +299,7 @@ inline std::uint16_t FrozenKeyIdxBiMap_idx_from_key( /// @param[in] key A null-terminated string inline bool FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, const char* key) { - return FrozenKeyIdxBiMap_idx_from_key(map, key) != bimap_detail::INVALID_VAL; + return FrozenKeyIdxBiMap_get(map, key).has_value; } /// return the number of keys in the map @@ -296,10 +309,10 @@ inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) { return map->length; } -/// Return the ith key (this is effectively a reverse lookup) +/// Return the key associated with the specified value /// /// For some context, if this function returns a string `s` for some index `i`, -/// then a call to @ref FrozenKeyIdxBiMap_idx_from_key that passes `s` will +/// then a call to @ref FrozenKeyIdxBiMap_get that passes `s` will /// return `i` /// /// This is intended for use in situations where you briefly need the string @@ -313,14 +326,14 @@ inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) { /// is ill-formed /// /// @param[in] map A pointer to a valid bimap -/// @param[in] i The returned index +/// @param[in] idx The index to check /// @return The pointer to the appropriate key -inline const char* FrozenKeyIdxBiMap_key_from_idx(const FrozenKeyIdxBiMap* map, - std::uint16_t i) { - if (i >= map->length) { +inline const char* FrozenKeyIdxBiMap_inverse_get(const FrozenKeyIdxBiMap* map, + uint16_t idx) { + if (idx >= map->length) { return nullptr; } - return map->keys[i]; // this can't be a nullptr + return map->keys[idx]; // this can't be a nullptr } /** @}*/ // end of group diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index d09e1c7c4..8c2e2bcf6 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -49,7 +49,7 @@ target_compile_definitions(grtest_utils # start declaring targets for tests # --------------------------------- add_executable(testFrozenKeyIdxBiMap test_unit_FrozenKeyIdxBiMap.cpp) -target_link_libraries(testFrozenKeyIdxBiMap testdeps) +target_link_libraries(testFrozenKeyIdxBiMap testdeps GTest::gmock) gtest_discover_tests(testFrozenKeyIdxBiMap) add_executable(runInterpolationTests test_unit_interpolators_g.cpp) diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 87ee9d8a6..00ff7615e 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -10,13 +10,32 @@ /// //===----------------------------------------------------------------------===// +#include #include #include #include +#include #include "support/FrozenKeyIdxBiMap.hpp" #include "grackle.h" +using ::testing::Field; +using ::testing::FieldsAre; + +namespace grimpl = grackle::impl; +namespace bimap = grackle::impl::bimap; + +// teach GoogleTest how to print grackle::impl::bimap::AccessRslt +namespace grackle::impl::bimap { +void PrintTo(const AccessRslt& access_rslt, std::ostream* os) { + if (!access_rslt.has_value) { + *os << "AccessRslt{.has_value=false}"; + } else { + *os << "AccessRslt{.has_value=true, .value=" << access_rslt.value << "}"; + } +} +} // namespace grackle::impl::bimap + // this top test was introduced to provide a more concrete example // of how we might use FrozenKeyIdxBiMap @@ -53,22 +72,26 @@ TEST(FrozenKeyIdxBiMap, FullExample) { } // PART 2: let's show some examples of lookups from names + // -> for context, grimpl::FrozenKeyIdxBiMap_get returns a bimap::AccessRslt, + // which holds {bool has_value; uint16_t value;} // Equivalent Python/idiomatic C++: `2 == m["HII"]` - EXPECT_EQ(2, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "HII")); + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "HII"), + ::FieldsAre(/*has_value=*/true, /*value=*/2)); // Equivalent Python/idiomatic C++: `33 == m["O2II"]` - EXPECT_EQ(33, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "O2II")); + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "O2II"), + ::FieldsAre(/*has_value=*/true, /*value=*/33)); // Behavior is well-defined when a key isn't known - int invalid = grimpl::bimap_detail::INVALID_VAL; - EXPECT_EQ(invalid, grimpl::FrozenKeyIdxBiMap_idx_from_key(&m, "NotAKey")); + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "NotAKey"), + ::Field("has_value", &bimap::AccessRslt::has_value, false)); // PART 3: let's show the reverse of the previous lookups - EXPECT_STREQ("HII", grimpl::FrozenKeyIdxBiMap_key_from_idx(&m, 2)); - EXPECT_STREQ("O2II", grimpl::FrozenKeyIdxBiMap_key_from_idx(&m, 33)); + EXPECT_STREQ("HII", grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 2)); + EXPECT_STREQ("O2II", grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 33)); // Behavior is again well-defined when passing an invalid index - EXPECT_EQ(nullptr, grimpl::FrozenKeyIdxBiMap_key_from_idx(&m, 131)); + EXPECT_EQ(nullptr, grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 131)); // PART 4: We can also query the length EXPECT_EQ(34, grimpl::FrozenKeyIdxBiMap_size(&m)); @@ -87,11 +110,11 @@ TEST(FrozenKeyIdxBiMap, EmptyBasicOps) { EXPECT_EQ(0, grackle::impl::FrozenKeyIdxBiMap_size(&m)) << "an empty mapping should have a size of 0"; - EXPECT_EQ(grackle::impl::bimap_detail::INVALID_VAL, - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(&m, "NotAKey")) + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "NotAKey"), + ::Field("has_value", &bimap::AccessRslt::has_value, false)) << "key lookup should always fail for an empty mapping"; - EXPECT_EQ(nullptr, grackle::impl::FrozenKeyIdxBiMap_key_from_idx(&m, 0)) + EXPECT_EQ(nullptr, grackle::impl::FrozenKeyIdxBiMap_inverse_get(&m, 0)) << "index lookup should always fail for an empty mapping"; grackle::impl::drop_FrozenKeyIdxBiMap(&m); @@ -180,7 +203,7 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, NotNull0KeyCount) { } INSTANTIATE_TEST_SUITE_P( - , /* <- leaving Instantiation name empty */ + , // <- leaving Instantiation name empty FrozenKeyIdxBiMapConstructorSuite, testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, grackle::impl::BiMapMode::COPIES_KEYDATA), @@ -238,7 +261,7 @@ class FrozenKeyIdxBiMapGeneralSuite bool ReusesOriginalKeyPtrs(const grackle::impl::FrozenKeyIdxBiMap* p) const { for (int i = 0; i < 3; i++) { const char* orig_key_ptr = ordered_keys[i].c_str(); - if (grackle::impl::FrozenKeyIdxBiMap_key_from_idx(p, i) != orig_key_ptr) { + if (grackle::impl::FrozenKeyIdxBiMap_inverse_get(p, i) != orig_key_ptr) { return false; } } @@ -246,47 +269,48 @@ class FrozenKeyIdxBiMapGeneralSuite } }; +/* TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "density"), + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "density"), 1); EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "internal_energy"), + grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "internal_energy"), 0); EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "metal_density"), + grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "metal_density"), 2); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, "notAKey"), + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "notAKey"), grackle::impl::bimap_detail::INVALID_VAL); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, ""), + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, ""), grackle::impl::bimap_detail::INVALID_VAL); std::string key(grackle::impl::bimap_detail::KEYLEN_MAX + 1, 'A'); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(bimap_p, key.data()), + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, key.data()), grackle::impl::bimap_detail::INVALID_VAL); } - +*/ TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 3), nullptr); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx( + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 3), nullptr); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get( bimap_p, grackle::impl::bimap_detail::INVALID_VAL), nullptr); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 2)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 2)), std::string("metal_density")); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 1)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 1)), std::string("density")); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(bimap_p, 0)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 0)), std::string("internal_energy")); // check whether the bimap is using pointers to the keys used during init @@ -297,6 +321,7 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { } } +/* TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { grackle::impl::FrozenKeyIdxBiMap clone = grackle::impl::FrozenKeyIdxBiMap_clone(bimap_p); @@ -308,14 +333,14 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { bimap_p = nullptr; EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "internal_energy"), + grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "internal_energy"), 0); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_idx_from_key(clone_p, "notAKey"), + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "notAKey"), grackle::impl::bimap_detail::INVALID_VAL); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 3), nullptr); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 3), nullptr); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_key_from_idx(clone_p, 1)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 1)), std::string("density")); // check whether the clone is using pointers to the keys used during init @@ -328,9 +353,10 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { // finally, cleanup the clone grackle::impl::drop_FrozenKeyIdxBiMap(clone_p); } +*/ INSTANTIATE_TEST_SUITE_P( - , /* <- leaving Instantiation name empty */ + , // <- leaving Instantiation name empty FrozenKeyIdxBiMapGeneralSuite, testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, grackle::impl::BiMapMode::COPIES_KEYDATA), From 13b956f418c8e0607dc95f83605073a1ff827241 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 7 Jan 2026 13:03:42 -0500 Subject: [PATCH 108/111] shift to using AccessRslt --- src/clib/support/FrozenKeyIdxBiMap.hpp | 6 +- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 117 +++++++++++---------- 2 files changed, 65 insertions(+), 58 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index 60a3f52ab..37dbbb8d4 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -271,7 +271,7 @@ struct AccessRslt { uint16_t value; }; -} +} // namespace bimap /// lookup the value associated with the key /// @@ -282,8 +282,8 @@ struct AccessRslt { /// /// @return An instance of @ref bimap::AccessRslt that encodes the value (if /// the key is present) -inline bimap::AccessRslt FrozenKeyIdxBiMap_get( - const FrozenKeyIdxBiMap* map, const char* key) { +inline bimap::AccessRslt FrozenKeyIdxBiMap_get(const FrozenKeyIdxBiMap* map, + const char* key) { GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); for (int i = 0; i < map->length; i++) { if (std::strcmp(map->keys[i], key) == 0) { diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 00ff7615e..240a7fdf2 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -10,7 +10,7 @@ /// //===----------------------------------------------------------------------===// -#include +#include // needed to teach googletest how to print #include #include @@ -19,22 +19,42 @@ #include "support/FrozenKeyIdxBiMap.hpp" #include "grackle.h" -using ::testing::Field; -using ::testing::FieldsAre; +// teach GoogleTest how to print grackle::impl::bimap::AccessRslt for more +// informative errors (otherwise it just shows the memory's raw byte values) +namespace grackle::impl::bimap { +void PrintTo(const AccessRslt& ar, std::ostream* os) { + std::string tmp = (ar.has_value) ? std::to_string(ar.value) : ""; + *os << "{has_value=" << ar.has_value << ", value=" << tmp << '}'; +} +} // namespace grackle::impl::bimap -namespace grimpl = grackle::impl; -namespace bimap = grackle::impl::bimap; +std::string prep_descr(std::string descr, bool negation) { + return ((negation) ? "isn't " : "is ") + descr; +} -// teach GoogleTest how to print grackle::impl::bimap::AccessRslt -namespace grackle::impl::bimap { -void PrintTo(const AccessRslt& access_rslt, std::ostream* os) { - if (!access_rslt.has_value) { - *os << "AccessRslt{.has_value=false}"; - } else { - *os << "AccessRslt{.has_value=true, .value=" << access_rslt.value << "}"; +// the following defines a custom matcher for checking whether the has_value +// member of an AccessRslt instance is false. Use via +// EXPECT_THAT(arg, EmptyAccessRslt) +MATCHER(EmptyAccessRslt, prep_descr("an empty AccessRslt", negation)) { + if (!arg.has_value) { + return true; + } + *result_listener << "holds the " << arg.value << " value"; + return false; +} + +// the following defines a custom matcher for checking whether the has_value +// member of an AccessRslt instance is true +// EXPECT_THAT(arg, AccessRsltHolding(value)) +MATCHER_P(AccessRsltHolds, v, + prep_descr("an AccessRslt holding " + std::to_string(v), negation)) { + if (!arg.has_value) { + *result_listener << "is empty"; + } else if (arg.value != v) { + *result_listener << " holds the value, " << v; } + return arg.has_value && arg.value == v; } -} // namespace grackle::impl::bimap // this top test was introduced to provide a more concrete example // of how we might use FrozenKeyIdxBiMap @@ -72,19 +92,16 @@ TEST(FrozenKeyIdxBiMap, FullExample) { } // PART 2: let's show some examples of lookups from names - // -> for context, grimpl::FrozenKeyIdxBiMap_get returns a bimap::AccessRslt, - // which holds {bool has_value; uint16_t value;} - // Equivalent Python/idiomatic C++: `2 == m["HII"]` + // Equivalent Python: `2 == m["HII"]` EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "HII"), - ::FieldsAre(/*has_value=*/true, /*value=*/2)); + AccessRsltHolds(2)); // aka AccessRslt{has_value=true, value=2} + // Equivalent Python/idiomatic C++: `33 == m["O2II"]` - EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "O2II"), - ::FieldsAre(/*has_value=*/true, /*value=*/33)); + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "O2II"), AccessRsltHolds(33)); - // Behavior is well-defined when a key isn't known - EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "NotAKey"), - ::Field("has_value", &bimap::AccessRslt::has_value, false)); + // for unknown key, returns AccessRslt{has_value=false, value=} + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "Dummy"), EmptyAccessRslt()); // PART 3: let's show the reverse of the previous lookups EXPECT_STREQ("HII", grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 2)); @@ -110,8 +127,8 @@ TEST(FrozenKeyIdxBiMap, EmptyBasicOps) { EXPECT_EQ(0, grackle::impl::FrozenKeyIdxBiMap_size(&m)) << "an empty mapping should have a size of 0"; - EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "NotAKey"), - ::Field("has_value", &bimap::AccessRslt::has_value, false)) + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(&m, "key"), + EmptyAccessRslt()) << "key lookup should always fail for an empty mapping"; EXPECT_EQ(nullptr, grackle::impl::FrozenKeyIdxBiMap_inverse_get(&m, 0)) @@ -203,7 +220,7 @@ TEST_P(FrozenKeyIdxBiMapConstructorSuite, NotNull0KeyCount) { } INSTANTIATE_TEST_SUITE_P( - , // <- leaving Instantiation name empty + , // <- leaving Instantiation name empty FrozenKeyIdxBiMapConstructorSuite, testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, grackle::impl::BiMapMode::COPIES_KEYDATA), @@ -269,37 +286,31 @@ class FrozenKeyIdxBiMapGeneralSuite } }; -/* TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "density"), - 1); - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "internal_energy"), - 0); - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "metal_density"), - 2); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "density"), + AccessRsltHolds(1)); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "internal_energy"), + AccessRsltHolds(0)); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "metal_density"), + AccessRsltHolds(2)); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "notAKey"), - grackle::impl::bimap_detail::INVALID_VAL); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "notAKey"), + EmptyAccessRslt()); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, ""), - grackle::impl::bimap_detail::INVALID_VAL); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, ""), + EmptyAccessRslt()); std::string key(grackle::impl::bimap_detail::KEYLEN_MAX + 1, 'A'); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, key.data()), - grackle::impl::bimap_detail::INVALID_VAL); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, key.data()), + EmptyAccessRslt()); } -*/ + TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 3), nullptr); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get( - bimap_p, grackle::impl::bimap_detail::INVALID_VAL), - nullptr); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { @@ -321,7 +332,6 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { } } -/* TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { grackle::impl::FrozenKeyIdxBiMap clone = grackle::impl::FrozenKeyIdxBiMap_clone(bimap_p); @@ -332,16 +342,14 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); bimap_p = nullptr; - EXPECT_EQ( - grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "internal_energy"), - 0); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "notAKey"), - grackle::impl::bimap_detail::INVALID_VAL); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "internal_energy"), + AccessRsltHolds(0)); + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "notAKey"), + EmptyAccessRslt()); EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 3), nullptr); - EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 1)), - std::string("density")); + EXPECT_STREQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 1), + "density"); // check whether the clone is using pointers to the keys used during init if (GetParam() == grackle::impl::BiMapMode::REFS_KEYDATA) { @@ -353,10 +361,9 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { // finally, cleanup the clone grackle::impl::drop_FrozenKeyIdxBiMap(clone_p); } -*/ INSTANTIATE_TEST_SUITE_P( - , // <- leaving Instantiation name empty + , // <- leaving Instantiation name empty FrozenKeyIdxBiMapGeneralSuite, testing::Values(grackle::impl::BiMapMode::REFS_KEYDATA, grackle::impl::BiMapMode::COPIES_KEYDATA), From 76b91eb3fe9a65fe1e15e791e81b5a85668f3b64 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 7 Jan 2026 13:06:27 -0500 Subject: [PATCH 109/111] some slight renaming --- src/clib/support/FrozenKeyIdxBiMap.hpp | 14 +++---- tests/unit/test_unit_FrozenKeyIdxBiMap.cpp | 46 +++++++++++----------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index 37dbbb8d4..40ebcfdc8 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -261,7 +261,7 @@ inline FrozenKeyIdxBiMap FrozenKeyIdxBiMap_clone(const FrozenKeyIdxBiMap* ptr) { namespace bimap { -/// holds the result of a call to @ref FrozenKeyIdxBiMap_get +/// holds the result of a call to @ref FrozenKeyIdxBiMap_find /// /// @note This C-style approximation of std::optional struct AccessRslt { @@ -282,8 +282,8 @@ struct AccessRslt { /// /// @return An instance of @ref bimap::AccessRslt that encodes the value (if /// the key is present) -inline bimap::AccessRslt FrozenKeyIdxBiMap_get(const FrozenKeyIdxBiMap* map, - const char* key) { +inline bimap::AccessRslt FrozenKeyIdxBiMap_find(const FrozenKeyIdxBiMap* map, + const char* key) { GR_INTERNAL_REQUIRE(key != nullptr, "A nullptr key is forbidden"); for (int i = 0; i < map->length; i++) { if (std::strcmp(map->keys[i], key) == 0) { @@ -299,7 +299,7 @@ inline bimap::AccessRslt FrozenKeyIdxBiMap_get(const FrozenKeyIdxBiMap* map, /// @param[in] key A null-terminated string inline bool FrozenKeyIdxBiMap_contains(const FrozenKeyIdxBiMap* map, const char* key) { - return FrozenKeyIdxBiMap_get(map, key).has_value; + return FrozenKeyIdxBiMap_find(map, key).has_value; } /// return the number of keys in the map @@ -312,7 +312,7 @@ inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) { /// Return the key associated with the specified value /// /// For some context, if this function returns a string `s` for some index `i`, -/// then a call to @ref FrozenKeyIdxBiMap_get that passes `s` will +/// then a call to @ref FrozenKeyIdxBiMap_find that passes `s` will /// return `i` /// /// This is intended for use in situations where you briefly need the string @@ -328,8 +328,8 @@ inline int FrozenKeyIdxBiMap_size(const FrozenKeyIdxBiMap* map) { /// @param[in] map A pointer to a valid bimap /// @param[in] idx The index to check /// @return The pointer to the appropriate key -inline const char* FrozenKeyIdxBiMap_inverse_get(const FrozenKeyIdxBiMap* map, - uint16_t idx) { +inline const char* FrozenKeyIdxBiMap_inverse_find(const FrozenKeyIdxBiMap* map, + uint16_t idx) { if (idx >= map->length) { return nullptr; } diff --git a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp index 240a7fdf2..148c3270e 100644 --- a/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp +++ b/tests/unit/test_unit_FrozenKeyIdxBiMap.cpp @@ -94,21 +94,21 @@ TEST(FrozenKeyIdxBiMap, FullExample) { // PART 2: let's show some examples of lookups from names // Equivalent Python: `2 == m["HII"]` - EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "HII"), + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_find(&m, "HII"), AccessRsltHolds(2)); // aka AccessRslt{has_value=true, value=2} // Equivalent Python/idiomatic C++: `33 == m["O2II"]` - EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "O2II"), AccessRsltHolds(33)); + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_find(&m, "O2II"), AccessRsltHolds(33)); // for unknown key, returns AccessRslt{has_value=false, value=} - EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_get(&m, "Dummy"), EmptyAccessRslt()); + EXPECT_THAT(grimpl::FrozenKeyIdxBiMap_find(&m, "Dummy"), EmptyAccessRslt()); // PART 3: let's show the reverse of the previous lookups - EXPECT_STREQ("HII", grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 2)); - EXPECT_STREQ("O2II", grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 33)); + EXPECT_STREQ("HII", grimpl::FrozenKeyIdxBiMap_inverse_find(&m, 2)); + EXPECT_STREQ("O2II", grimpl::FrozenKeyIdxBiMap_inverse_find(&m, 33)); // Behavior is again well-defined when passing an invalid index - EXPECT_EQ(nullptr, grimpl::FrozenKeyIdxBiMap_inverse_get(&m, 131)); + EXPECT_EQ(nullptr, grimpl::FrozenKeyIdxBiMap_inverse_find(&m, 131)); // PART 4: We can also query the length EXPECT_EQ(34, grimpl::FrozenKeyIdxBiMap_size(&m)); @@ -127,11 +127,11 @@ TEST(FrozenKeyIdxBiMap, EmptyBasicOps) { EXPECT_EQ(0, grackle::impl::FrozenKeyIdxBiMap_size(&m)) << "an empty mapping should have a size of 0"; - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(&m, "key"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(&m, "key"), EmptyAccessRslt()) << "key lookup should always fail for an empty mapping"; - EXPECT_EQ(nullptr, grackle::impl::FrozenKeyIdxBiMap_inverse_get(&m, 0)) + EXPECT_EQ(nullptr, grackle::impl::FrozenKeyIdxBiMap_inverse_find(&m, 0)) << "index lookup should always fail for an empty mapping"; grackle::impl::drop_FrozenKeyIdxBiMap(&m); @@ -278,7 +278,7 @@ class FrozenKeyIdxBiMapGeneralSuite bool ReusesOriginalKeyPtrs(const grackle::impl::FrozenKeyIdxBiMap* p) const { for (int i = 0; i < 3; i++) { const char* orig_key_ptr = ordered_keys[i].c_str(); - if (grackle::impl::FrozenKeyIdxBiMap_inverse_get(p, i) != orig_key_ptr) { + if (grackle::impl::FrozenKeyIdxBiMap_inverse_find(p, i) != orig_key_ptr) { return false; } } @@ -287,41 +287,41 @@ class FrozenKeyIdxBiMapGeneralSuite }; TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyContainedKey) { - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "density"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(bimap_p, "density"), AccessRsltHolds(1)); - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "internal_energy"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(bimap_p, "internal_energy"), AccessRsltHolds(0)); - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "metal_density"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(bimap_p, "metal_density"), AccessRsltHolds(2)); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentKey) { - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, "notAKey"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(bimap_p, "notAKey"), EmptyAccessRslt()); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, IdxFromKeyAbsentIrregularKeys) { - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, ""), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(bimap_p, ""), EmptyAccessRslt()); std::string key(grackle::impl::bimap_detail::KEYLEN_MAX + 1, 'A'); - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(bimap_p, key.data()), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(bimap_p, key.data()), EmptyAccessRslt()); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxInvalidIdx) { - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 3), nullptr); + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_find(bimap_p, 3), nullptr); } TEST_P(FrozenKeyIdxBiMapGeneralSuite, KeyFromIdxValidIdx) { EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 2)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_find(bimap_p, 2)), std::string("metal_density")); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 1)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_find(bimap_p, 1)), std::string("density")); EXPECT_EQ( - std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_get(bimap_p, 0)), + std::string(grackle::impl::FrozenKeyIdxBiMap_inverse_find(bimap_p, 0)), std::string("internal_energy")); // check whether the bimap is using pointers to the keys used during init @@ -342,13 +342,13 @@ TEST_P(FrozenKeyIdxBiMapGeneralSuite, Clone) { grackle::impl::drop_FrozenKeyIdxBiMap(bimap_p); bimap_p = nullptr; - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "internal_energy"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(clone_p, "internal_energy"), AccessRsltHolds(0)); - EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_get(clone_p, "notAKey"), + EXPECT_THAT(grackle::impl::FrozenKeyIdxBiMap_find(clone_p, "notAKey"), EmptyAccessRslt()); - EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 3), nullptr); - EXPECT_STREQ(grackle::impl::FrozenKeyIdxBiMap_inverse_get(clone_p, 1), + EXPECT_EQ(grackle::impl::FrozenKeyIdxBiMap_inverse_find(clone_p, 3), nullptr); + EXPECT_STREQ(grackle::impl::FrozenKeyIdxBiMap_inverse_find(clone_p, 1), "density"); // check whether the clone is using pointers to the keys used during init From 37915539c82787db981f3954faf3467a8088546b Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 7 Jan 2026 13:13:22 -0500 Subject: [PATCH 110/111] some final cleanup --- src/clib/support/FrozenKeyIdxBiMap.hpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/clib/support/FrozenKeyIdxBiMap.hpp b/src/clib/support/FrozenKeyIdxBiMap.hpp index 40ebcfdc8..97f2e0c94 100644 --- a/src/clib/support/FrozenKeyIdxBiMap.hpp +++ b/src/clib/support/FrozenKeyIdxBiMap.hpp @@ -29,13 +29,9 @@ namespace grackle::impl { -// the motivation for these constants are provided in PR #484 (they are related +// the motivation for this constant is provided in PR #484 (its related // to some optimizations in the FrozenKeyIdxBiMap implementation) namespace bimap_detail { -/// specifies an invalid value of the map (we state that you can't store the -/// maximum u16 value) -inline constexpr uint16_t INVALID_VAL = std::numeric_limits::max(); - /// specifies maximum allowed length of a key (excluding the null character). inline constexpr uint16_t KEYLEN_MAX = 29; } // namespace bimap_detail @@ -128,7 +124,7 @@ struct FrozenKeyIdxBiMap { /// ugly/clunky, but it's the only practical way to achieve comparable behavior /// to other internal data types. The best alternatives involve things like /// std::optional or converting this type to a simple C++ class. -inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], +inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* const keys[], int key_count, BiMapMode mode) { // this will be returned if there is an error FrozenKeyIdxBiMap erroneous_obj{-1, nullptr, BiMapMode::REFS_KEYDATA}; @@ -138,10 +134,9 @@ inline FrozenKeyIdxBiMap new_FrozenKeyIdxBiMap(const char* keys[], } // check the specified keys - long long max_keys = static_cast(bimap_detail::INVALID_VAL) - 1LL; - if (key_count < 1 || static_cast(key_count) > max_keys) { - GrPrintErrMsg("key_count must be positive and cannot exceed %lld", - max_keys); + int max_keys = static_cast(std::numeric_limits::max()); + if (key_count < 1 || key_count > max_keys) { + GrPrintErrMsg("key_count must be positive & can't exceed %d", max_keys); return erroneous_obj; } else if (keys == nullptr) { GrPrintErrMsg("keys must not be a nullptr"); @@ -263,7 +258,9 @@ namespace bimap { /// holds the result of a call to @ref FrozenKeyIdxBiMap_find /// -/// @note This C-style approximation of std::optional +/// @note +/// This is a C-style approximation of std::optional. Additionally, +/// the choice to make value a uint16_t is motivated by PR #484 struct AccessRslt { /// Indicates whether the value member is valid bool has_value; From 21768cbea32f95b56247f904522e2f5ad02815b0 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Wed, 7 Jan 2026 13:35:56 -0500 Subject: [PATCH 111/111] apply clang-format --- src/clib/inject_model/load_data.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clib/inject_model/load_data.cpp b/src/clib/inject_model/load_data.cpp index f1b75fdec..a64cda182 100644 --- a/src/clib/inject_model/load_data.cpp +++ b/src/clib/inject_model/load_data.cpp @@ -162,8 +162,8 @@ extern "C" int setup_yield_table_callback( const inj_input::GrainSpeciesYieldProps& yield_info = input->initial_grain_props[yield_idx]; - bimap::AccessRslt maybe_grain_idx = FrozenKeyIdxBiMap_find( - my_ctx->grain_species_names, yield_info.name); + bimap::AccessRslt maybe_grain_idx = + FrozenKeyIdxBiMap_find(my_ctx->grain_species_names, yield_info.name); if (!maybe_grain_idx.has_value) { continue; }