diff --git a/src/reactions/exampleSystems/BulkGeneric.hpp b/src/reactions/exampleSystems/BulkGeneric.hpp index 77547ce..7f1eedd 100644 --- a/src/reactions/exampleSystems/BulkGeneric.hpp +++ b/src/reactions/exampleSystems/BulkGeneric.hpp @@ -45,7 +45,7 @@ namespace bulkGeneric // um1Constants }; -using simpleKineticTestType = reactionsSystems::MixedReactionsParameters< double, int, int, 5, 2, 0 >; +using simpleKineticTestType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 5, 2, 0 >; constexpr simpleKineticTestType @@ -68,7 +68,7 @@ simpleKineticTestRateParams = 0 }; -using simpleTestType = reactionsSystems::MixedReactionsParameters< double, int, int, 5, 2, 2 >; +using simpleTestType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 5, 2, 2 >; constexpr simpleTestType diff --git a/src/reactions/exampleSystems/ChainGeneric.hpp b/src/reactions/exampleSystems/ChainGeneric.hpp index 8b0acd8..196246f 100644 --- a/src/reactions/exampleSystems/ChainGeneric.hpp +++ b/src/reactions/exampleSystems/ChainGeneric.hpp @@ -19,7 +19,7 @@ namespace ChainGeneric { // *****UNCRUSTIFY-OFF****** - using serialAllKineticType = reactionsSystems::MixedReactionsParameters< double, int, int, 3, 3, 0 >; + using serialAllKineticType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 3, 3, 0 >; constexpr serialAllKineticType serialAllKineticParams = { diff --git a/src/reactions/exampleSystems/MoMasBenchmark.hpp b/src/reactions/exampleSystems/MoMasBenchmark.hpp index c0c8f06..3a871b4 100644 --- a/src/reactions/exampleSystems/MoMasBenchmark.hpp +++ b/src/reactions/exampleSystems/MoMasBenchmark.hpp @@ -19,8 +19,8 @@ namespace MoMasBenchmark { // *****UNCRUSTIFY-OFF****** - using easyCaseType = reactionsSystems::MixedReactionsParameters< double, int, int, 12, 7, 7 >; - using mediumCaseType = reactionsSystems::MixedReactionsParameters< double, int, int, 14, 10, 9 >; + using easyCaseType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 12, 7, 7 >; + using mediumCaseType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 14, 10, 9 >; constexpr easyCaseType easyCaseParams = { diff --git a/src/reactions/geochemistry/Carbonate.hpp b/src/reactions/geochemistry/Carbonate.hpp index 52ae3ab..50d8b05 100644 --- a/src/reactions/geochemistry/Carbonate.hpp +++ b/src/reactions/geochemistry/Carbonate.hpp @@ -24,7 +24,7 @@ namespace geochemistry namespace carbonate { -constexpr CArrayWrapper stoichMatrix = +constexpr CArrayWrapper stoichMatrix = { // OH- CO2 CO3-2 CaHCO3+ CaSO4 CaCl+ CaCl2 MgSO4 NaSO4- CaCO3 H+ HCO3- Ca+2 SO4-2 Cl- Mg+2 Na+ { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0 }, // OH- + H+ = H2O { 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, // CO2 + H2O = H+ + HCO3- @@ -38,7 +38,7 @@ constexpr CArrayWrapper stoichMatrix = { 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, 1, 0, 0, 0, 0 } // CaCO3(s) + H+ = Ca+2 + HCO3- (kinetic) }; -constexpr CArrayWrapper stoichMatrixNosolid = +constexpr CArrayWrapper stoichMatrixNosolid = { // OH- CO2 CO3-2 CaHCO3+ CaSO4 CaCl+ CaCl2 MgSO4 NaSO4- H+ HCO3- Ca+2 SO4-2 Cl- Mg+2 Na+ { -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0 }, // OH- + H+ = H2O { 0, -1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, // CO2 + H2O = H+ + HCO3- @@ -109,9 +109,9 @@ constexpr CArrayWrapper mobileSpeciesFlag = } -using carbonateSystemAllKineticType = reactionsSystems::MixedReactionsParameters< double, int, int, 17, 10, 0 >; -using carbonateSystemAllEquilibriumType = reactionsSystems::MixedReactionsParameters< double, int, int, 17, 10, 10 >; -using carbonateSystemType = reactionsSystems::MixedReactionsParameters< double, int, int, 16, 10, 9 >; +using carbonateSystemAllKineticType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 17, 10, 0 >; +using carbonateSystemAllEquilibriumType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 17, 10, 10 >; +using carbonateSystemType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 16, 10, 9 >; constexpr carbonateSystemAllKineticType carbonateSystemAllKinetic( carbonate::stoichMatrix, carbonate::equilibriumConstants, carbonate::forwardRates, carbonate::reverseRates, carbonate::mobileSpeciesFlag, 0 ); constexpr carbonateSystemAllEquilibriumType carbonateSystemAllEquilibrium( carbonate::stoichMatrix, carbonate::equilibriumConstants, carbonate::forwardRates, carbonate::reverseRates, carbonate::mobileSpeciesFlag ); diff --git a/src/reactions/geochemistry/Forge.hpp b/src/reactions/geochemistry/Forge.hpp index 276577c..e599389 100644 --- a/src/reactions/geochemistry/Forge.hpp +++ b/src/reactions/geochemistry/Forge.hpp @@ -25,7 +25,7 @@ namespace forge // Stoichiometric matrix [13 reactions × 23 species] // Columns 0–12: secondary species (must be -1 on diagonal) // Columns 13–22: primary species -constexpr CArrayWrapper< double, 19, 26 > soichMatrix = +constexpr CArrayWrapper< signed char, 19, 26 > soichMatrix = {// CaCO₃ CaHCO₃⁺ CaSO₄ CaCl⁺ CaCl₂ MgHCO₃⁺ MgCO₃ MgCl⁺ CO₂(aq) HSO₄⁻ KHSO₄ HSiO₃⁻ NaHSilO₃ NaCl KCl KSO₄⁻ | H⁺ Ca²⁺ Mg²⁺ Na⁺ K⁺ Al³⁺ HCO₃⁻ SO₄²⁻ Cl⁻ SiO₂(aq) { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, // CaCO₃(aq) + H⁺ ⇌ Ca²⁺ + HCO₃⁻ { 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, // CaHCO₃⁺ ⇌ Ca²⁺ + HCO₃⁻ @@ -144,7 +144,7 @@ constexpr CArrayWrapper< int, 19 > mobileSpeciesFlag = } -using forgeSystemType = reactionsSystems::MixedReactionsParameters< double, int, int, 26, 19, 16 >; +using forgeSystemType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 26, 19, 16 >; constexpr forgeSystemType forgeSystem( forge::soichMatrix, forge::equilibriumConstants, forge::fwRateConstant, forge::reverseRateConstant, forge::mobileSpeciesFlag ); diff --git a/src/reactions/geochemistry/Ultramafics.hpp b/src/reactions/geochemistry/Ultramafics.hpp index d69d517..d993536 100644 --- a/src/reactions/geochemistry/Ultramafics.hpp +++ b/src/reactions/geochemistry/Ultramafics.hpp @@ -25,7 +25,7 @@ namespace geochemistry namespace ultramafics { -constexpr CArrayWrapper stoichMatrix = +constexpr CArrayWrapper stoichMatrix = { // OH- CO2(aq) CO3-- Mg2OH+++ Mg4(OH)++++ MgOH+ Mg2CO3++ MgCO3(aq) MgHCO3+ Mg(H3SiO4)2 MgH2SiO4 MgH3SiO4+ H2SiO4-- H3SiO4- H4(H2SiO4)---- H6(H2SiO4)-- Mg2SiO4 MgCO3 SiO2 Mg3Si2O5(OH)4 Mg(OH)2 H+ HCO3- Mg++ SiO2(aq) { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0 }, // OH- + H+ = H2O { 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }, // CO2(aq) + H2O = HCO3- + H+ @@ -153,9 +153,9 @@ constexpr CArrayWrapper mobileSpeciesFlag = }; } - using ultramaficSystemAllKineticType = reactionsSystems::MixedReactionsParameters< double, int, int, 25, 21, 0 >; - using ultramaficSystemAllEquilibriumType = reactionsSystems::MixedReactionsParameters< double, int, int, 25, 21, 21 >; - using ultramaficSystemType = reactionsSystems::MixedReactionsParameters< double, int, int, 25, 21, 16 >; + using ultramaficSystemAllKineticType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 25, 21, 0 >; + using ultramaficSystemAllEquilibriumType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 25, 21, 21 >; + using ultramaficSystemType = reactionsSystems::MixedReactionsParameters< double, int, signed char, 25, 21, 16 >; constexpr ultramaficSystemAllKineticType ultramaficSystemAllKinetic( ultramafics::stoichMatrix, ultramafics::equilibriumConstants, ultramafics::forwardRates, ultramafics::reverseRates, ultramafics::mobileSpeciesFlag ); constexpr ultramaficSystemAllEquilibriumType ultramaficSystemAllEquilibrium( ultramafics::stoichMatrix, ultramafics::equilibriumConstants, ultramafics::forwardRates, ultramafics::reverseRates, ultramafics::mobileSpeciesFlag ); diff --git a/src/reactions/reactionsSystems/Parameters.hpp b/src/reactions/reactionsSystems/Parameters.hpp index 54cddaa..3532481 100644 --- a/src/reactions/reactionsSystems/Parameters.hpp +++ b/src/reactions/reactionsSystems/Parameters.hpp @@ -53,7 +53,7 @@ struct EquilibriumReactionsParameters HPCREACT_HOST_DEVICE constexpr - EquilibriumReactionsParameters( CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix, + EquilibriumReactionsParameters( CArrayWrapper< IndexType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix, CArrayWrapper< RealType, NUM_REACTIONS > equilibriumConstant, CArrayWrapper< IntType, NUM_REACTIONS > mobileSecondarySpeciesFlag ): m_stoichiometricMatrix( stoichiometricMatrix ), @@ -62,11 +62,11 @@ struct EquilibriumReactionsParameters {} - HPCREACT_HOST_DEVICE RealType stoichiometricMatrix( IndexType const r, int const i ) const { return m_stoichiometricMatrix[r][i]; } + HPCREACT_HOST_DEVICE IndexType stoichiometricMatrix( IndexType const r, int const i ) const { return m_stoichiometricMatrix[r][i]; } HPCREACT_HOST_DEVICE RealType equilibriumConstant( IndexType const r ) const { return m_equilibriumConstant[r]; } HPCREACT_HOST_DEVICE IntType mobileSecondarySpeciesFlag( IndexType const r ) const { return m_mobileSecondarySpeciesFlag[r]; } - CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > m_stoichiometricMatrix; + CArrayWrapper< IndexType, NUM_REACTIONS, NUM_SPECIES > m_stoichiometricMatrix; CArrayWrapper< RealType, NUM_REACTIONS > m_equilibriumConstant; CArrayWrapper< IntType, NUM_REACTIONS > m_mobileSecondarySpeciesFlag; }; @@ -87,7 +87,7 @@ struct KineticReactionsParameters HPCREACT_HOST_DEVICE static constexpr IndexType numReactions() { return NUM_REACTIONS; } HPCREACT_HOST_DEVICE - constexpr KineticReactionsParameters( CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix, + constexpr KineticReactionsParameters( CArrayWrapper< IndexType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix, CArrayWrapper< RealType, NUM_REACTIONS > const & rateConstantForward, CArrayWrapper< RealType, NUM_REACTIONS > const & rateConstantReverse, CArrayWrapper< RealType, NUM_REACTIONS > const & equilibriumConstant, @@ -100,14 +100,14 @@ struct KineticReactionsParameters {} - HPCREACT_HOST_DEVICE RealType stoichiometricMatrix( IndexType const r, int const i ) const { return m_stoichiometricMatrix[r][i]; } + HPCREACT_HOST_DEVICE IndexType stoichiometricMatrix( IndexType const r, int const i ) const { return m_stoichiometricMatrix[r][i]; } HPCREACT_HOST_DEVICE RealType rateConstantForward( IndexType const r ) const { return m_rateConstantForward[r]; } HPCREACT_HOST_DEVICE RealType rateConstantReverse( IndexType const r ) const { return m_rateConstantReverse[r]; } HPCREACT_HOST_DEVICE RealType equilibriumConstant( IndexType const r ) const { return m_rateConstantForward[r] / m_rateConstantReverse[r]; } HPCREACT_HOST_DEVICE IntType reactionRatesUpdateOption() const { return m_reactionRatesUpdateOption; } - CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > m_stoichiometricMatrix; + CArrayWrapper< IndexType, NUM_REACTIONS, NUM_SPECIES > m_stoichiometricMatrix; CArrayWrapper< RealType, NUM_REACTIONS > m_rateConstantForward; CArrayWrapper< RealType, NUM_REACTIONS > m_rateConstantReverse; CArrayWrapper< RealType, NUM_REACTIONS > m_equilibiriumConstant; @@ -131,7 +131,7 @@ struct MixedReactionsParameters constexpr MixedReactionsParameters() = default; - constexpr MixedReactionsParameters( CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix, + constexpr MixedReactionsParameters( CArrayWrapper< IndexType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix, CArrayWrapper< RealType, NUM_REACTIONS > const & equilibriumConstant, CArrayWrapper< RealType, NUM_REACTIONS > const & rateConstantForward, CArrayWrapper< RealType, NUM_REACTIONS > const & rateConstantReverse, @@ -162,7 +162,7 @@ struct MixedReactionsParameters EquilibriumReactionsParameters< RealType, IntType, IndexType, numSpecies(), numEquilibriumReactions() > equilibriumReactionsParameters() const { - CArrayWrapper< RealType, numEquilibriumReactions(), numSpecies() > eqMatrix{}; + CArrayWrapper< IndexType, numEquilibriumReactions(), numSpecies() > eqMatrix{}; CArrayWrapper< RealType, numEquilibriumReactions() > eqConstants{}; CArrayWrapper< IntType, numEquilibriumReactions() > mobileSpeciesFlags{}; @@ -184,7 +184,7 @@ struct MixedReactionsParameters KineticReactionsParameters< RealType, IntType, IndexType, numSpecies(), numKineticReactions() > kineticReactionsParameters() const { - CArrayWrapper< RealType, numKineticReactions(), numSpecies() > kineticMatrix{}; + CArrayWrapper< IndexType, numKineticReactions(), numSpecies() > kineticMatrix{}; CArrayWrapper< RealType, numKineticReactions() > rateConstantForward{}; CArrayWrapper< RealType, numKineticReactions() > rateConstantReverse{}; CArrayWrapper< RealType, numKineticReactions() > equilibriumConstant{}; @@ -239,12 +239,12 @@ struct MixedReactionsParameters } } - HPCREACT_HOST_DEVICE RealType stoichiometricMatrix( IndexType const r, int const i ) const { return m_stoichiometricMatrix[r][i]; } + HPCREACT_HOST_DEVICE IndexType stoichiometricMatrix( IndexType const r, int const i ) const { return m_stoichiometricMatrix[r][i]; } HPCREACT_HOST_DEVICE RealType equilibriumConstant( IndexType const r ) const { return m_equilibriumConstant[r]; } HPCREACT_HOST_DEVICE RealType rateConstantForward( IndexType const r ) const { return m_rateConstantForward[r]; } HPCREACT_HOST_DEVICE RealType rateConstantReverse( IndexType const r ) const { return m_rateConstantReverse[r]; } - CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > m_stoichiometricMatrix; + CArrayWrapper< IndexType, NUM_REACTIONS, NUM_SPECIES > m_stoichiometricMatrix; CArrayWrapper< RealType, NUM_REACTIONS > m_equilibriumConstant; CArrayWrapper< RealType, NUM_REACTIONS > m_rateConstantForward; CArrayWrapper< RealType, NUM_REACTIONS > m_rateConstantReverse;