10 #include "gtest/gtest.h" 17 {
"H2O",
"Ca++",
"HCO3-",
"H+",
">(s)FeOH",
"Fe++",
"CH4(aq)",
"O2(aq)",
">(w)FeOH"},
18 {
"Calcite",
"Fe(OH)3(ppd)"},
28 TEST(GeochemistryUnitConverterTest, exceptions)
34 FAIL() <<
"Missing expected exception.";
36 catch (
const std::exception & e)
38 std::string msg(e.what());
41 "GeochemistryUnitConverter: bad_name is not a basis, equilibrium or kinetic species") !=
43 <<
"Failed with unexpected error message: " << msg;
50 FAIL() <<
"Missing expected exception.";
52 catch (
const std::exception & e)
54 std::string msg(e.what());
55 ASSERT_TRUE(msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species Ca++ because " 56 "it is not a mineral") != std::string::npos)
57 <<
"Failed with unexpected error message: " << msg;
64 FAIL() <<
"Missing expected exception.";
66 catch (
const std::exception & e)
68 std::string msg(e.what());
70 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species CO3-- because " 71 "it is not a mineral") != std::string::npos)
72 <<
"Failed with unexpected error message: " << msg;
79 FAIL() <<
"Missing expected exception.";
81 catch (
const std::exception & e)
83 std::string msg(e.what());
85 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species CH4(g) because " 86 "it is not a mineral") != std::string::npos)
87 <<
"Failed with unexpected error message: " << msg;
94 FAIL() <<
"Missing expected exception.";
96 catch (
const std::exception & e)
98 std::string msg(e.what());
100 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species (O-phth)-- because " 101 "it is not a mineral") != std::string::npos)
102 <<
"Failed with unexpected error message: " << msg;
109 FAIL() <<
"Missing expected exception.";
111 catch (
const std::exception & e)
113 std::string msg(e.what());
115 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species >(s)FeO- because " 116 "it is not a mineral") != std::string::npos)
117 <<
"Failed with unexpected error message: " << msg;
139 11.0 * 40.08 / 1.0E3,
143 11.0 * 61.0171 * 1.0E3,
147 11.0 * 1.0079 * 1.0E6,
152 11.0 * 72.8543 * 1E-3,
162 11.0 * 44.0098 * 1E3,
167 11.0 * 100.0892 * 1E6,
174 11.0 * 106.8689 * 1E6,
184 11.0 * 88.8537 * 1E3,
188 11.0 * 164.1172 * 1E6,
192 11.0 * 71.8464 * 1E6,
240 11.0 * 72.8543 * 1E-3,
254 11.0 * 44.0098 * 1E3,
261 11.0 * 100.0892 * 1E6,
268 11.0 * 106.8689 * 1E6,
282 11.0 * 88.8537 * 1E3,
TEST(GeochemistryUnitConverterTest, exceptions)
const PertinentGeochemicalSystem model(db, {"H2O", "Ca++", "HCO3-", "H+", ">(s)FeOH", "Fe++", "CH4(aq)", "O2(aq)", ">(w)FeOH"}, {"Calcite", "Fe(OH)3(ppd)"}, {"CH4(g)"}, {"Something"}, {"(O-phth)--"}, {">(s)FeO-"}, "O2(aq)", "e-")
Real toMoles(Real quantity, const GeochemistryUnit unit, const std::string &species_name, const ModelGeochemicalDatabase &mgd)
Calculates the amount of moles corresponding to "quantity" "unit"s of species name, OR calculates the molality corresponding to "quantity" "unit"s of species name, whichever is appropriate.
const ModelGeochemicalDatabase mgd
Real fromMoles(Real moles, const GeochemistryUnit unit, const std::string &species_name, const ModelGeochemicalDatabase &mgd)
Calculates the amount of "unit"s of species_name in 1 mole, OR in 1 molal, whichever is appropriate...
const GeochemicalDatabaseReader db("database/moose_testdb.json", true, true, false)
const ModelGeochemicalDatabase & modelGeochemicalDatabase() const
Return a reference to the ModelGeochemicalDatabase structure.
Constructs and stores a minimal amount of information that is pertinent to the user-defined geochemic...
Data structure to hold all relevant information from the database file.
Class for reading geochemical reactions from a MOOSE geochemical database.