diff --git a/framework/src/utils/Units.C b/framework/src/utils/Units.C index 7d347855d1ea..3465be008576 100644 --- a/framework/src/utils/Units.C +++ b/framework/src/utils/Units.C @@ -90,6 +90,12 @@ const std::vector> MooseUnits::_unit_table = {{MooseUnits::BaseUnit::KILOGRAM, 1}, {MooseUnits::BaseUnit::METER, 2}, {MooseUnits::BaseUnit::SECOND, -2}}}}, // Joule + {"cal", + {4.184, + 0, + {{MooseUnits::BaseUnit::KILOGRAM, 1}, + {MooseUnits::BaseUnit::METER, 2}, + {MooseUnits::BaseUnit::SECOND, -2}}}}, // Calorie {"W", {1, 0, diff --git a/unit/src/UnitsTest.C b/unit/src/UnitsTest.C index 6b64ca0169e9..4e67bca9418a 100644 --- a/unit/src/UnitsTest.C +++ b/unit/src/UnitsTest.C @@ -32,6 +32,7 @@ TEST(Units, numbers) EXPECT_DOUBLE_EQ(Real(MooseUnits("m/0.1^3") / MooseUnits("km")), 1.0); EXPECT_DOUBLE_EQ(Real(MooseUnits("m/1e-3") / MooseUnits("km")), 1.0); EXPECT_DOUBLE_EQ(Real(MooseUnits("1234.567")), 1234.567); + EXPECT_DOUBLE_EQ(Real(MooseUnits("20*80")), 1600); } TEST(Units, si_prefixes) @@ -55,6 +56,9 @@ TEST(Units, parse) {"m^3", "m^3"}, {"N*m", "m^2*kg*s^-2"}, {"mm", "0.001 m"}, + {"5m * 1/6s", "0.833333 m*s^-1"}, + {"5m/(6s)", "0.833333 m*s^-1"}, + {"cal", "4.184 m^2*kg*s^-2"}, {"kg/(m*s^2)", "m^-1*kg*s^-2"}, {"kg/(m*s)^2", "m^-2*kg*s^-2"}, {"eV/at", "1.60218e-19 m^2*kg*s^-2*at^-1"},