-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
369 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (C) 2023-2024 National Center for Atmospheric Research, University of Illinois at Urbana-Champaign | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
namespace open_atmos | ||
{ | ||
namespace constants | ||
{ | ||
static constexpr double boltzmann = 1.380649e-23; // J K^{-1} | ||
static constexpr double avogadro = 6.02214076e23; // # mol^{-1} | ||
static constexpr double R = boltzmann * avogadro; // J K^{-1} mol^{-1} | ||
} // namespace constants | ||
} // namespace open_atmos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include <open_atmos/mechanism_configuration/parser.hpp> | ||
|
||
using namespace open_atmos::mechanism_configuration; | ||
|
||
TEST(JsonParser, CanParseValidArrheniusReaction) | ||
{ | ||
JsonParser parser; | ||
auto [status, mechanism] = parser.Parse(std::string("unit_configs/reactions/arrhenius/valid.json")); | ||
|
||
EXPECT_EQ(mechanism.reactions.arrhenius.size(), 2); | ||
|
||
EXPECT_EQ(mechanism.reactions.arrhenius[0].name, "my arrhenius"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].gas_phase, "gas"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].A, 32.1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].B, -2.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].C, 102.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].D, 63.4); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].E, -1.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].reactants.size(), 1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].reactants[0].species_name, "A"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].reactants[0].coefficient, 1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].products.size(), 2); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].products[0].species_name, "B"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].products[0].coefficient, 1.2); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].products[1].species_name, "C"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].products[1].coefficient, 0.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].unknown_properties.size(), 1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[0].unknown_properties["__solver_param"], "0.1"); | ||
|
||
EXPECT_EQ(mechanism.reactions.arrhenius[1].name, "my arrhenius2"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].gas_phase, "gas"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].A, 3.1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].B, -0.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].C, 12.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].D, 6.4); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].E, -0.3); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].reactants.size(), 2); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].reactants[0].species_name, "A"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].reactants[0].coefficient, 2); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].reactants[1].species_name, "B"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].reactants[1].coefficient, 0.1); | ||
|
||
EXPECT_EQ(mechanism.reactions.arrhenius[1].products.size(), 1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].products[0].species_name, "C"); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].products[0].coefficient, 0.5); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].products[0].unknown_properties.size(), 1); | ||
EXPECT_EQ(mechanism.reactions.arrhenius[1].products[0].unknown_properties["__optional thing"], "\"hello\""); | ||
} |
Oops, something went wrong.