diff --git a/include/open_atmos/mechanism_configuration/validation.hpp b/include/open_atmos/mechanism_configuration/validation.hpp index 65e42c8..0569dcb 100644 --- a/include/open_atmos/mechanism_configuration/validation.hpp +++ b/include/open_atmos/mechanism_configuration/validation.hpp @@ -85,6 +85,10 @@ namespace open_atmos const std::string gas_phase_products = "gas-phase products"; const std::string aerosol_phase = "aerosol phase"; + // Photolysis + const std::string Photolysis_key = "PHOTOLYSIS"; + const std::string scaling_factor = "scaling factor"; + } keys; struct Configuration @@ -149,6 +153,12 @@ namespace open_atmos const std::vector optional_keys{ keys.name, keys.reaction_probability }; } surface; + struct Photolysis + { + const std::vector required_keys{ keys.reactants, keys.products, keys.type, keys.gas_phase }; + const std::vector optional_keys{ keys.name, keys.scaling_factor }; + } photolysis; + struct Mechanism { const std::vector required_keys{}; diff --git a/include/open_atmos/types.hpp b/include/open_atmos/types.hpp index 96ab861..ac0b738 100644 --- a/include/open_atmos/types.hpp +++ b/include/open_atmos/types.hpp @@ -152,6 +152,22 @@ namespace open_atmos std::unordered_map unknown_properties; }; + struct Photolysis + { + /// @brief Scaling factor to apply to user-provided rate constants + double scaling_factor_{ 1.0 }; + /// @brief A list of reactants + std::vector reactants; + /// @brief A list of products + std::vector products; + /// @brief An identifier, optional, uniqueness not enforced + std::string name; + /// @brief An identifier indicating which gas phase this reaction takes place in + std::string gas_phase; + /// @brief Unknown properties, prefixed with two underscores (__) + std::unordered_map unknown_properties; + }; + struct Reactions { std::vector arrhenius; @@ -159,6 +175,7 @@ namespace open_atmos std::vector branched; std::vector tunneling; std::vector surface; + std::vector photolysis; }; struct Mechanism diff --git a/src/parser.cpp b/src/parser.cpp index 73ed7eb..80cee5a 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -306,7 +306,7 @@ namespace open_atmos return { status, component }; } - std::pair ParseArrhenius(const json& object, const std::vector existing_species) + std::pair ParseArrhenius(const json& object, const std::vector& existing_species, const std::vector existing_phases) { ConfigParseStatus status = ConfigParseStatus::Success; types::Arrhenius arrhenius; @@ -398,7 +398,15 @@ namespace open_atmos status = ConfigParseStatus::ReactionRequiresUnknownSpecies; } - arrhenius.gas_phase = object[validation::keys.gas_phase].get(); + std::string gas_phase = object[validation::keys.gas_phase].get(); + auto it = + std::find_if(existing_phases.begin(), existing_phases.end(), [&gas_phase](const auto& phase) { return phase.name == gas_phase; }); + if (status == ConfigParseStatus::Success && it == existing_phases.end()) + { + status = ConfigParseStatus::UnknownPhase; + } + + arrhenius.gas_phase = gas_phase; arrhenius.products = products; arrhenius.reactants = reactants; arrhenius.unknown_properties = unknown_properties; @@ -407,7 +415,7 @@ namespace open_atmos return { status, arrhenius }; } - std::pair ParseTroe(const json& object, const std::vector existing_species) + std::pair ParseTroe(const json& object, const std::vector& existing_species, const std::vector existing_phases) { ConfigParseStatus status = ConfigParseStatus::Success; types::Troe troe; @@ -501,7 +509,16 @@ namespace open_atmos status = ConfigParseStatus::ReactionRequiresUnknownSpecies; } - troe.gas_phase = object[validation::keys.gas_phase].get(); + + std::string gas_phase = object[validation::keys.gas_phase].get(); + auto it = + std::find_if(existing_phases.begin(), existing_phases.end(), [&gas_phase](const auto& phase) { return phase.name == gas_phase; }); + if (status == ConfigParseStatus::Success && it == existing_phases.end()) + { + status = ConfigParseStatus::UnknownPhase; + } + + troe.gas_phase = gas_phase; troe.products = products; troe.reactants = reactants; troe.unknown_properties = unknown_properties; @@ -510,7 +527,7 @@ namespace open_atmos return { status, troe }; } - std::pair ParseBranched(const json& object, const std::vector existing_species) + std::pair ParseBranched(const json& object, const std::vector& existing_species, const std::vector existing_phases) { ConfigParseStatus status = ConfigParseStatus::Success; types::Branched branched; @@ -592,7 +609,15 @@ namespace open_atmos status = ConfigParseStatus::ReactionRequiresUnknownSpecies; } - branched.gas_phase = object[validation::keys.gas_phase].get(); + std::string gas_phase = object[validation::keys.gas_phase].get(); + auto it = + std::find_if(existing_phases.begin(), existing_phases.end(), [&gas_phase](const auto& phase) { return phase.name == gas_phase; }); + if (status == ConfigParseStatus::Success && it == existing_phases.end()) + { + status = ConfigParseStatus::UnknownPhase; + } + + branched.gas_phase = gas_phase; branched.nitrate_products = nitrate_products; branched.alkoxy_products = alkoxy_products; branched.reactants = reactants; @@ -602,7 +627,7 @@ namespace open_atmos return { status, branched }; } - std::pair ParseTunneling(const json& object, const std::vector existing_species) + std::pair ParseTunneling(const json& object, const std::vector& existing_species, const std::vector existing_phases) { ConfigParseStatus status = ConfigParseStatus::Success; types::Tunneling tunneling; @@ -676,7 +701,15 @@ namespace open_atmos status = ConfigParseStatus::ReactionRequiresUnknownSpecies; } - tunneling.gas_phase = object[validation::keys.gas_phase].get(); + std::string gas_phase = object[validation::keys.gas_phase].get(); + auto it = + std::find_if(existing_phases.begin(), existing_phases.end(), [&gas_phase](const auto& phase) { return phase.name == gas_phase; }); + if (status == ConfigParseStatus::Success && it == existing_phases.end()) + { + status = ConfigParseStatus::UnknownPhase; + } + + tunneling.gas_phase = gas_phase; tunneling.products = products; tunneling.reactants = reactants; tunneling.unknown_properties = unknown_properties; @@ -686,7 +719,7 @@ namespace open_atmos } std::pair - ParseSurface(const json& object, const std::vector existing_species, const std::vector existing_phases) + ParseSurface(const json& object, const std::vector& existing_species, const std::vector existing_phases) { ConfigParseStatus status = ConfigParseStatus::Success; types::Surface surface; @@ -762,8 +795,91 @@ namespace open_atmos return { status, surface }; } + std::pair ParsePhotolysis(const json& object, const std::vector existing_species, const std::vector existing_phases) + { + ConfigParseStatus status = ConfigParseStatus::Success; + types::Photolysis photolysis; + + status = ValidateSchema(object, validation::photolysis.required_keys, validation::photolysis.optional_keys); + if (status == ConfigParseStatus::Success) + { + std::vector products{}; + for (const auto& reactant : object[validation::keys.products]) + { + auto product_parse = ParseReactionComponent(reactant); + status = product_parse.first; + if (status != ConfigParseStatus::Success) + { + break; + } + products.push_back(product_parse.second); + } + + std::vector reactants{}; + for (const auto& reactant : object[validation::keys.reactants]) + { + auto reactant_parse = ParseReactionComponent(reactant); + status = reactant_parse.first; + if (status != ConfigParseStatus::Success) + { + break; + } + reactants.push_back(reactant_parse.second); + } + + if (object.contains(validation::keys.scaling_factor)) + { + photolysis.scaling_factor_ = object[validation::keys.scaling_factor].get(); + } + + if (object.contains(validation::keys.name)) + { + photolysis.name = object[validation::keys.name].get(); + } + + auto comments = GetComments(object, validation::photolysis.required_keys, validation::photolysis.optional_keys); + + std::unordered_map unknown_properties; + for (const auto& key : comments) + { + std::string val = object[key].dump(); + unknown_properties[key] = val; + } + + std::vector requested_species; + for (const auto& spec : products) + { + requested_species.push_back(spec.species_name); + } + for (const auto& spec : reactants) + { + requested_species.push_back(spec.species_name); + } + + if (status == ConfigParseStatus::Success && RequiresUnknownSpecies(requested_species, existing_species)) + { + status = ConfigParseStatus::ReactionRequiresUnknownSpecies; + } + + std::string gas_phase = object[validation::keys.gas_phase].get(); + auto it = + std::find_if(existing_phases.begin(), existing_phases.end(), [&gas_phase](const auto& phase) { return phase.name == gas_phase; }); + if (status == ConfigParseStatus::Success && it == existing_phases.end()) + { + status = ConfigParseStatus::UnknownPhase; + } + + photolysis.gas_phase = gas_phase; + photolysis.products = products; + photolysis.reactants = reactants; + photolysis.unknown_properties = unknown_properties; + } + + return { status, photolysis }; + } + std::pair - ParseReactions(const json& objects, const std::vector existing_species, const std::vector existing_phases) + ParseReactions(const json& objects, const std::vector& existing_species, const std::vector& existing_phases) { ConfigParseStatus status = ConfigParseStatus::Success; types::Reactions reactions; @@ -773,7 +889,7 @@ namespace open_atmos std::string type = object[validation::keys.type].get(); if (type == validation::keys.Arrhenius_key) { - auto arrhenius_parse = ParseArrhenius(object, existing_species); + auto arrhenius_parse = ParseArrhenius(object, existing_species, existing_phases); status = arrhenius_parse.first; if (status != ConfigParseStatus::Success) { @@ -783,7 +899,7 @@ namespace open_atmos } else if (type == validation::keys.Troe_key) { - auto troe_parse = ParseTroe(object, existing_species); + auto troe_parse = ParseTroe(object, existing_species, existing_phases); status = troe_parse.first; if (status != ConfigParseStatus::Success) { @@ -793,7 +909,7 @@ namespace open_atmos } else if (type == validation::keys.Branched_key) { - auto branched_parse = ParseBranched(object, existing_species); + auto branched_parse = ParseBranched(object, existing_species, existing_phases); status = branched_parse.first; if (status != ConfigParseStatus::Success) { @@ -803,7 +919,7 @@ namespace open_atmos } else if (type == validation::keys.Tunneling_key) { - auto tunneling_parse = ParseTunneling(object, existing_species); + auto tunneling_parse = ParseTunneling(object, existing_species, existing_phases); status = tunneling_parse.first; if (status != ConfigParseStatus::Success) { @@ -821,6 +937,16 @@ namespace open_atmos } reactions.surface.push_back(surface_parse.second); } + else if (type == validation::keys.Photolysis_key) + { + auto photolysis_parse = ParsePhotolysis(object, existing_species, existing_phases); + status = photolysis_parse.first; + if (status != ConfigParseStatus::Success) + { + break; + } + reactions.photolysis.push_back(photolysis_parse.second); + } } return { status, reactions }; diff --git a/test/integration/test_json_parser.cpp b/test/integration/test_json_parser.cpp index f700616..939e0a7 100644 --- a/test/integration/test_json_parser.cpp +++ b/test/integration/test_json_parser.cpp @@ -16,6 +16,7 @@ TEST(JsonParser, ParsesFullConfiguration) EXPECT_EQ(mechanism.reactions.branched.size(), 1); EXPECT_EQ(mechanism.reactions.tunneling.size(), 1); EXPECT_EQ(mechanism.reactions.surface.size(), 1); + EXPECT_EQ(mechanism.reactions.photolysis.size(), 1); } TEST(JsonParser, ParserReportsBadFiles) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index fddac35..02e2f77 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -13,6 +13,7 @@ create_standard_test(NAME parse_troe SOURCES test_parse_troe.cpp) create_standard_test(NAME parse_branched SOURCES test_parse_branched.cpp) create_standard_test(NAME parse_tunneling SOURCES test_parse_tunneling.cpp) create_standard_test(NAME parse_surface SOURCES test_parse_surface.cpp) +create_standard_test(NAME parse_photolysis SOURCES test_parse_photolysis.cpp) ################################################################################ # Copy test data diff --git a/test/unit/test_parse_arrhenius.cpp b/test/unit/test_parse_arrhenius.cpp index e26fba1..fd33e03 100644 --- a/test/unit/test_parse_arrhenius.cpp +++ b/test/unit/test_parse_arrhenius.cpp @@ -82,4 +82,11 @@ TEST(JsonParser, ArrheniusDetectsBadReactionComponent) JsonParser parser; auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/arrhenius/bad_reaction_component.json")); EXPECT_EQ(status, ConfigParseStatus::RequiredKeyNotFound); +} + +TEST(JsonParser, ArrheniusDetectsUnknownPhase) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/arrhenius/missing_phase.json")); + EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); } \ No newline at end of file diff --git a/test/unit/test_parse_branched.cpp b/test/unit/test_parse_branched.cpp index 21c0572..a303090 100644 --- a/test/unit/test_parse_branched.cpp +++ b/test/unit/test_parse_branched.cpp @@ -47,4 +47,11 @@ TEST(JsonParser, BranchedDetectsBadReactionComponent) JsonParser parser; auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/branched/bad_reaction_component.json")); EXPECT_EQ(status, ConfigParseStatus::RequiredKeyNotFound); +} + +TEST(JsonParser, BranchedDetectsUnknownPhase) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/branched/missing_phase.json")); + EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); } \ No newline at end of file diff --git a/test/unit/test_parse_photolysis.cpp b/test/unit/test_parse_photolysis.cpp new file mode 100644 index 0000000..1aa88da --- /dev/null +++ b/test/unit/test_parse_photolysis.cpp @@ -0,0 +1,56 @@ +#include + +#include + +using namespace open_atmos::mechanism_configuration; + +TEST(JsonParser, CanParseValidPhotolysisReaction) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/photolysis/valid.json")); + EXPECT_EQ(status, ConfigParseStatus::Success); + + EXPECT_EQ(mechanism.reactions.photolysis.size(), 2); + + EXPECT_EQ(mechanism.reactions.photolysis[0].gas_phase, "gas"); + EXPECT_EQ(mechanism.reactions.photolysis[0].name, "my photolysis"); + EXPECT_EQ(mechanism.reactions.photolysis[0].scaling_factor_, 12.3); + EXPECT_EQ(mechanism.reactions.photolysis[0].reactants.size(), 1); + EXPECT_EQ(mechanism.reactions.photolysis[0].reactants[0].species_name, "B"); + EXPECT_EQ(mechanism.reactions.photolysis[0].reactants[0].coefficient, 1); + EXPECT_EQ(mechanism.reactions.photolysis[0].products.size(), 1); + EXPECT_EQ(mechanism.reactions.photolysis[0].products[0].species_name, "C"); + EXPECT_EQ(mechanism.reactions.photolysis[0].products[0].coefficient, 1); + EXPECT_EQ(mechanism.reactions.photolysis[0].unknown_properties.size(), 1); + EXPECT_EQ(mechanism.reactions.photolysis[0].unknown_properties["__comment"], "\"hi\""); + + EXPECT_EQ(mechanism.reactions.photolysis[1].gas_phase, "gas"); + EXPECT_EQ(mechanism.reactions.photolysis[1].scaling_factor_, 1); + EXPECT_EQ(mechanism.reactions.photolysis[1].reactants.size(), 1); + EXPECT_EQ(mechanism.reactions.photolysis[1].reactants[0].species_name, "B"); + EXPECT_EQ(mechanism.reactions.photolysis[1].reactants[0].coefficient, 1.2); + EXPECT_EQ(mechanism.reactions.photolysis[1].products.size(), 1); + EXPECT_EQ(mechanism.reactions.photolysis[1].products[0].species_name, "C"); + EXPECT_EQ(mechanism.reactions.photolysis[1].products[0].coefficient, 0.2); +} + +TEST(JsonParser, PhotolysisDetectsUnknownSpecies) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/photolysis/unknown_species.json")); + EXPECT_EQ(status, ConfigParseStatus::ReactionRequiresUnknownSpecies); +} + +TEST(JsonParser, PhotolysisDetectsBadReactionComponent) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/photolysis/bad_reaction_component.json")); + EXPECT_EQ(status, ConfigParseStatus::InvalidKey); +} + +TEST(JsonParser, PhotolysisDetectsUnknownPhase) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/photolysis/missing_phase.json")); + EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); +} \ No newline at end of file diff --git a/test/unit/test_parse_surface.cpp b/test/unit/test_parse_surface.cpp index f540ba4..ecd82d5 100644 --- a/test/unit/test_parse_surface.cpp +++ b/test/unit/test_parse_surface.cpp @@ -54,9 +54,16 @@ TEST(JsonParser, SurfaceDetectsBadReactionComponent) EXPECT_EQ(status, ConfigParseStatus::RequiredKeyNotFound); } -TEST(JsonParser, SurfaceDetectsUnknownPhase) +TEST(JsonParser, SurfaceDetectsUnknownAerosolPhase) { JsonParser parser; auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/surface/missing_aerosol_phase.json")); EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); +} + +TEST(JsonParser, SurfaceDetectsUnknownGasPhase) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/surface/missing_gas_phase.json")); + EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); } \ No newline at end of file diff --git a/test/unit/test_parse_troe.cpp b/test/unit/test_parse_troe.cpp index e3c0024..a129d79 100644 --- a/test/unit/test_parse_troe.cpp +++ b/test/unit/test_parse_troe.cpp @@ -65,4 +65,11 @@ TEST(JsonParser, TroeDetectsBadReactionComponent) JsonParser parser; auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/troe/bad_reaction_component.json")); EXPECT_EQ(status, ConfigParseStatus::RequiredKeyNotFound); +} + +TEST(JsonParser, TroeDetectsUnknownPhase) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/troe/missing_phase.json")); + EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); } \ No newline at end of file diff --git a/test/unit/test_parse_tunneling.cpp b/test/unit/test_parse_tunneling.cpp index 86cc7df..8ff84d6 100644 --- a/test/unit/test_parse_tunneling.cpp +++ b/test/unit/test_parse_tunneling.cpp @@ -53,4 +53,11 @@ TEST(JsonParser, TunnelingDetectsBadReactionComponent) JsonParser parser; auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/tunneling/bad_reaction_component.json")); EXPECT_EQ(status, ConfigParseStatus::RequiredKeyNotFound); +} + +TEST(JsonParser, TunnelingDetectsUnknownPhase) +{ + JsonParser parser; + auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/tunneling/missing_phase.json")); + EXPECT_EQ(status, ConfigParseStatus::UnknownPhase); } \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/arrhenius/missing_phase.json b/test/unit/unit_configs/reactions/arrhenius/missing_phase.json new file mode 100644 index 0000000..1bd0485 --- /dev/null +++ b/test/unit/unit_configs/reactions/arrhenius/missing_phase.json @@ -0,0 +1,32 @@ +{ + "version": "1.0.0", + "name": "Missing phase", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ ], + "reactions": [ + { + "type": "ARRHENIUS", + "gas phase": "gas", + "reactants": [ + { + "species name": "A" + } + ], + "products": [ + { + "species name": "C" + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/branched/missing_phase.json b/test/unit/unit_configs/reactions/branched/missing_phase.json new file mode 100644 index 0000000..0c60899 --- /dev/null +++ b/test/unit/unit_configs/reactions/branched/missing_phase.json @@ -0,0 +1,50 @@ +{ + "version": "1.0.0", + "name": "Missing phase", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ ], + "reactions": [ + { + "type": "BRANCHED_NO_RO2", + "gas phase": "gas", + "reactants": [ + { + "species name": "A" + } + ], + "alkoxy products": [ + { + "species name": "B", + "coefficient": 0.2 + }, + { + "species name": "A", + "coefficient": 1.2 + } + ], + "nitrate products": [ + { + "species name": "C", + "coefficient": 1.2, + "__thing": "hi" + } + ], + "X": 1.2e-4, + "Y": 167, + "a0": 0.15, + "n": 9, + "name": "my branched", + "__comment": "thing" + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/photolysis/bad_reaction_component.json b/test/unit/unit_configs/reactions/photolysis/bad_reaction_component.json new file mode 100644 index 0000000..49809a8 --- /dev/null +++ b/test/unit/unit_configs/reactions/photolysis/bad_reaction_component.json @@ -0,0 +1,39 @@ +{ + "version": "1.0.0", + "name": "Bad reaction component", + "species": [ + { + "name": "A" + }, + { + "name": "B" + } + ], + "phases": [ + { + "name": "gas", + "species": [ + "A", + "B" + ] + } + ], + "reactions": [ + { + "type": "PHOTOLYSIS", + "gas phase": "gas", + "reactants": [ + { + "species name": "A", + "Coefficient": 1.2 + } + ], + "products": [ + { + "species name": "B", + "coefficient": 0.2 + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/photolysis/missing_phase.json b/test/unit/unit_configs/reactions/photolysis/missing_phase.json new file mode 100644 index 0000000..f0ba620 --- /dev/null +++ b/test/unit/unit_configs/reactions/photolysis/missing_phase.json @@ -0,0 +1,34 @@ +{ + "version": "1.0.0", + "name": "Missing phase", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ ], + "reactions": [ + { + "type": "PHOTOLYSIS", + "gas phase": "gas", + "reactants": [ + { + "species name": "B", + "coefficient": 1.2 + } + ], + "products": [ + { + "species name": "C", + "coefficient": 0.2 + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/photolysis/unknown_species.json b/test/unit/unit_configs/reactions/photolysis/unknown_species.json new file mode 100644 index 0000000..a60157c --- /dev/null +++ b/test/unit/unit_configs/reactions/photolysis/unknown_species.json @@ -0,0 +1,39 @@ +{ + "version": "1.0.0", + "name": "Unknown species", + "species": [ + { + "name": "A" + }, + { + "name": "B" + } + ], + "phases": [ + { + "name": "gas", + "species": [ + "A", + "B" + ] + } + ], + "reactions": [ + { + "type": "PHOTOLYSIS", + "gas phase": "gas", + "reactants": [ + { + "species name": "B", + "coefficient": 1.2 + } + ], + "products": [ + { + "species name": "C", + "coefficient": 0.2 + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/photolysis/valid.json b/test/unit/unit_configs/reactions/photolysis/valid.json new file mode 100644 index 0000000..3f1c047 --- /dev/null +++ b/test/unit/unit_configs/reactions/photolysis/valid.json @@ -0,0 +1,70 @@ +{ + "version": "1.0.0", + "name": "Valid surface", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ + { + "name": "gas", + "species": [ + "A", + "B", + "C" + ] + }, + { + "name": "surface reacting phase", + "species": [ + "A", + "B", + "C" + ] + } + ], + "reactions": [ + { + "type": "PHOTOLYSIS", + "gas phase": "gas", + "__comment": "hi", + "reactants": [ + { + "species name": "B", + "coefficient": 1 + } + ], + "products": [ + { + "species name": "C", + "coefficient": 1 + } + ], + "name": "my photolysis", + "scaling factor": 12.3 + }, + { + "type": "PHOTOLYSIS", + "gas phase": "gas", + "reactants": [ + { + "species name": "B", + "coefficient": 1.2 + } + ], + "products": [ + { + "species name": "C", + "coefficient": 0.2 + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/surface/missing_gas_phase.json b/test/unit/unit_configs/reactions/surface/missing_gas_phase.json new file mode 100644 index 0000000..6e8bc12 --- /dev/null +++ b/test/unit/unit_configs/reactions/surface/missing_gas_phase.json @@ -0,0 +1,37 @@ +{ + "version": "1.0.0", + "name": "Missing aerosol phase", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ + ], + "reactions": [ + { + "type": "SURFACE", + "gas phase": "gas", + "gas-phase reactant": { + "species name": "A", + "coefficient": 1 + }, + "gas-phase products": [ + { + "species name": "B", + "__optional thing": "hello" + }, + { + "species name": "C" + } + ], + "aerosol phase": "surface reacting phase" + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/troe/missing_phase.json b/test/unit/unit_configs/reactions/troe/missing_phase.json new file mode 100644 index 0000000..237cf2d --- /dev/null +++ b/test/unit/unit_configs/reactions/troe/missing_phase.json @@ -0,0 +1,32 @@ +{ + "version": "1.0.0", + "name": "Missing phase", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ ], + "reactions": [ + { + "type": "TROE", + "gas phase": "gas", + "reactants": [ + { + "species name": "A" + } + ], + "products": [ + { + "species name": "C" + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unit/unit_configs/reactions/tunneling/missing_phase.json b/test/unit/unit_configs/reactions/tunneling/missing_phase.json new file mode 100644 index 0000000..e248af8 --- /dev/null +++ b/test/unit/unit_configs/reactions/tunneling/missing_phase.json @@ -0,0 +1,36 @@ +{ + "version": "1.0.0", + "name": "Missing phase", + "species": [ + { + "name": "A" + }, + { + "name": "B" + }, + { + "name": "C" + } + ], + "phases": [ ], + "reactions": [ + { + "type" : "TUNNELING", + "gas phase": "gas", + "A" : 123.45, + "B" : 1200.0, + "C" : 1.0e8, + "reactants": [ + { + "species name": "B", + "coefficient": 1 + } + ], + "products": [ + { + "species name": "C" + } + ] + } + ] +} \ No newline at end of file