adding unit PPM
Parts per million (ppm). We are not distinguishing PPM volume or PPM mass, or other forms. Will update when it comes to be necessary.
This commit is contained in:
@@ -83,6 +83,7 @@ namespace Opm {
|
||||
salinity,
|
||||
gas_oil_ratio_rate,
|
||||
moles,
|
||||
ppm,
|
||||
_count // New entries must be added *before* this
|
||||
};
|
||||
|
||||
|
||||
@@ -281,6 +281,7 @@ namespace Opm {
|
||||
constexpr const double SurfaceTension = dyne/(centi*meter);
|
||||
constexpr const double Energy = kilo*joule;
|
||||
constexpr const double Moles = kilo*mol;
|
||||
constexpr const double PPM = 1./mega;
|
||||
}
|
||||
|
||||
|
||||
@@ -313,6 +314,7 @@ namespace Opm {
|
||||
constexpr const double SurfaceTension = dyne/(centi*meter);
|
||||
constexpr const double Energy = btu;
|
||||
constexpr const double Moles = kilo*pound*mol;
|
||||
constexpr const double PPM = 1./mega;
|
||||
|
||||
}
|
||||
|
||||
@@ -346,6 +348,7 @@ namespace Opm {
|
||||
constexpr const double SurfaceTension = dyne/(centi*meter);
|
||||
constexpr const double Energy = joule;
|
||||
constexpr const double Moles = mol;
|
||||
constexpr const double PPM = 1./mega;
|
||||
|
||||
}
|
||||
|
||||
@@ -379,6 +382,7 @@ namespace Opm {
|
||||
constexpr const double SurfaceTension = dyne/(centi*meter);
|
||||
constexpr const double Energy = kilo*joule;
|
||||
constexpr const double Moles = kilo*mol;
|
||||
constexpr const double PPM = 1./mega;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace {
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
};
|
||||
|
||||
static const double to_metric[] = {
|
||||
@@ -137,6 +138,7 @@ namespace {
|
||||
1 / Metric::Salinity,
|
||||
1 / (1 / Metric::Time),
|
||||
1 / Metric::Moles,
|
||||
1 / Metric::PPM,
|
||||
};
|
||||
|
||||
static const double from_metric[] = {
|
||||
@@ -182,6 +184,7 @@ namespace {
|
||||
Metric::Salinity,
|
||||
1 / Metric::Time,
|
||||
Metric::Moles,
|
||||
Metric::PPM,
|
||||
};
|
||||
|
||||
static constexpr const char* metric_names[static_cast<int>(UnitSystem::measure::_count)] = {
|
||||
@@ -227,6 +230,7 @@ namespace {
|
||||
"KG / SM3", /*salinity */
|
||||
"SM3/SM3/DAY",
|
||||
"KG-M",
|
||||
"PPM", /*Parts per million */
|
||||
};
|
||||
|
||||
static_assert(numElems(from_metric_offset) == static_cast<std::size_t>(UnitSystem::measure::_count),
|
||||
@@ -292,6 +296,7 @@ namespace {
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
};
|
||||
|
||||
static const double to_field[] = {
|
||||
@@ -337,6 +342,7 @@ namespace {
|
||||
1 / Field::Salinity,
|
||||
1 / (Field::GasSurfaceVolume / Field::LiquidSurfaceVolume / Field::Time),
|
||||
1 / Field::Moles,
|
||||
1 / Field::PPM,
|
||||
};
|
||||
|
||||
static const double from_field[] = {
|
||||
@@ -382,6 +388,7 @@ namespace {
|
||||
Field::Salinity,
|
||||
Field::GasSurfaceVolume / Field::LiquidSurfaceVolume / Field::Time,
|
||||
Field::Moles,
|
||||
Field::PPM,
|
||||
};
|
||||
|
||||
static constexpr const char* field_names[static_cast<int>(UnitSystem::measure::_count)] = {
|
||||
@@ -427,6 +434,7 @@ namespace {
|
||||
"LB/STB", /*salinity */
|
||||
"MSCF/STB/DAY",
|
||||
"LB-M",
|
||||
"PPM",
|
||||
};
|
||||
|
||||
static_assert(numElems(from_field_offset) == static_cast<std::size_t>(UnitSystem::measure::_count),
|
||||
@@ -492,6 +500,7 @@ namespace {
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
};
|
||||
|
||||
static const double to_lab[] = {
|
||||
@@ -537,6 +546,7 @@ namespace {
|
||||
1 / Lab::Salinity,
|
||||
1 / (Lab::GasDissolutionFactor / Lab::Time),
|
||||
1 / Lab::Moles,
|
||||
1 / Lab::PPM,
|
||||
};
|
||||
|
||||
static const double from_lab[] = {
|
||||
@@ -582,6 +592,7 @@ namespace {
|
||||
Lab::Salinity,
|
||||
Lab::GasDissolutionFactor / Lab::Time,
|
||||
Lab::Moles,
|
||||
Lab::PPM,
|
||||
};
|
||||
|
||||
static constexpr const char* lab_names[static_cast<int>(UnitSystem::measure::_count)] = {
|
||||
@@ -627,6 +638,7 @@ namespace {
|
||||
"G/SCC", /*salinity */
|
||||
"SCC/SCC/HR",
|
||||
"g-M",
|
||||
"PPM",
|
||||
};
|
||||
|
||||
static_assert(numElems(from_lab_offset) == static_cast<std::size_t>(UnitSystem::measure::_count),
|
||||
@@ -692,6 +704,7 @@ namespace {
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
};
|
||||
|
||||
static const double to_pvt_m[] = {
|
||||
@@ -737,6 +750,7 @@ namespace {
|
||||
1 / PVT_M::Salinity,
|
||||
1 / (PVT_M::GasSurfaceVolume / PVT_M::LiquidSurfaceVolume /PVT_M::Time),
|
||||
1 / PVT_M::Moles,
|
||||
1 / PVT_M::PPM,
|
||||
};
|
||||
|
||||
static const double from_pvt_m[] = {
|
||||
@@ -782,6 +796,7 @@ namespace {
|
||||
PVT_M::Salinity,
|
||||
PVT_M::GasSurfaceVolume / PVT_M::LiquidSurfaceVolume /PVT_M::Time,
|
||||
PVT_M::Moles,
|
||||
PVT_M::PPM,
|
||||
};
|
||||
|
||||
static constexpr const char* pvt_m_names[static_cast<int>(UnitSystem::measure::_count)] = {
|
||||
@@ -827,6 +842,7 @@ namespace {
|
||||
"KG/SM3", /*salinity */
|
||||
"SM3/SM3/DAY",
|
||||
"KG-M",
|
||||
"PPM",
|
||||
};
|
||||
|
||||
static_assert(numElems(from_pvt_m_offset) == static_cast<std::size_t>(UnitSystem::measure::_count),
|
||||
@@ -892,6 +908,7 @@ namespace {
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
};
|
||||
|
||||
static const double to_input[] = {
|
||||
@@ -937,6 +954,7 @@ namespace {
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
};
|
||||
|
||||
static const double from_input[] = {
|
||||
@@ -982,6 +1000,7 @@ namespace {
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
};
|
||||
|
||||
static constexpr const char* input_names[static_cast<int>(UnitSystem::measure::_count)] = {
|
||||
@@ -1026,7 +1045,8 @@ namespace {
|
||||
"KG/SM3", /*polymer density */
|
||||
"KG/SM3", /*salinity */
|
||||
"SM3/SM3/DAY",
|
||||
"g-M"
|
||||
"g-M",
|
||||
"PPM"
|
||||
};
|
||||
|
||||
static_assert(numElems(from_input_offset) == static_cast<std::size_t>(UnitSystem::measure::_count),
|
||||
@@ -1092,6 +1112,7 @@ namespace {
|
||||
this->addDimension("Timestep" , 1.0);
|
||||
this->addDimension("SurfaceTension" , 1.0);
|
||||
this->addDimension("Energy", 1.0);
|
||||
this->addDimension("PPM", 1.0);
|
||||
this->addDimension("ContextDependent", 1.0);
|
||||
}
|
||||
|
||||
@@ -1129,6 +1150,7 @@ namespace {
|
||||
this->addDimension("Timestep" , PVT_M::Timestep);
|
||||
this->addDimension("SurfaceTension" , PVT_M::SurfaceTension);
|
||||
this->addDimension("Energy", PVT_M::Energy);
|
||||
this->addDimension("PPM", PVT_M::PPM);
|
||||
this->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
|
||||
@@ -1166,6 +1188,7 @@ namespace {
|
||||
this->addDimension("Timestep", Lab::Timestep);
|
||||
this->addDimension("SurfaceTension" , Lab::SurfaceTension);
|
||||
this->addDimension("Energy", Lab::Energy);
|
||||
this->addDimension("PPM", Lab::PPM);
|
||||
this->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
|
||||
@@ -1204,6 +1227,7 @@ namespace {
|
||||
this->addDimension("Timestep" , Metric::Timestep);
|
||||
this->addDimension("SurfaceTension" , Metric::SurfaceTension);
|
||||
this->addDimension("Energy", Metric::Energy);
|
||||
this->addDimension("PPM", Metric::PPM);
|
||||
this->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
|
||||
@@ -1240,6 +1264,7 @@ namespace {
|
||||
this->addDimension("Timestep", Field::Timestep);
|
||||
this->addDimension("SurfaceTension" , Field::SurfaceTension);
|
||||
this->addDimension("Energy", Field::Energy);
|
||||
this->addDimension("PPM", Field::PPM);
|
||||
this->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
|
||||
}
|
||||
|
||||
|
||||
@@ -308,6 +308,7 @@ BOOST_AUTO_TEST_CASE(METRIC_UNITS)
|
||||
BOOST_CHECK_CLOSE( metric.to_si( Meas::icd_strength, 1.0), 7.46496e+14, 1e-10);
|
||||
BOOST_CHECK_CLOSE( metric.to_si( Meas::gas_oil_ratio_rate, 1.0), 1.1574074074074073e-05, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( metric.to_si( Meas::moles, 1.0), 1000, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( metric.to_si( Meas::ppm, 1.0 ) , 1.0e-6 , 1.0e-10 );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// SI -> METRIC
|
||||
@@ -348,6 +349,7 @@ BOOST_AUTO_TEST_CASE(METRIC_UNITS)
|
||||
BOOST_CHECK_CLOSE( metric.from_si( Meas::icd_strength, 7.46496e+14), 1.0, 1e-10);
|
||||
BOOST_CHECK_CLOSE( metric.from_si( Meas::gas_oil_ratio_rate, 1.0), 86.400e3, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( metric.from_si( Meas::moles, 1), 0.001, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( metric.from_si( Meas::ppm, 1.0 ) , 1.0e6 , 1.0e-10 );
|
||||
|
||||
}
|
||||
|
||||
@@ -398,6 +400,7 @@ BOOST_AUTO_TEST_CASE(FIELD_UNITS)
|
||||
BOOST_CHECK_CLOSE( field.to_si( Meas::icd_strength , 1.0 ) , 6.418842091749854e+16 , 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( field.to_si( Meas::gas_oil_ratio_rate, 1.0), 1.1574074074074073e-05*178.1076066790352, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( field.to_si( Meas::moles, 1.0), 453.59237, 1.0e-5 );
|
||||
BOOST_CHECK_CLOSE( field.to_si( Meas::ppm, 1.0 ) , 1.0e-6 , 1.0e-10 );
|
||||
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@@ -438,6 +441,7 @@ BOOST_AUTO_TEST_CASE(FIELD_UNITS)
|
||||
BOOST_CHECK_CLOSE( field.from_si( Meas::icd_strength , 6.418842091749854e+16 ) , 1.0 , 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( field.from_si( Meas::gas_oil_ratio_rate, 1.0), 86.400e3*5.614583333333335e-03, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( field.from_si( Meas::moles, 1.0), 0.0022046226, 1.0e-5 );
|
||||
BOOST_CHECK_CLOSE( field.from_si( Meas::ppm, 1.0 ) , 1.0e6 , 1.0e-10 );
|
||||
|
||||
}
|
||||
|
||||
@@ -488,6 +492,7 @@ BOOST_AUTO_TEST_CASE(LAB_UNITS)
|
||||
BOOST_CHECK_CLOSE( lab.to_si( Meas::icd_strength , 1.0 ) , 1.313172e+24 , 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( lab.to_si( Meas::gas_oil_ratio_rate, 1.0), 2.777777777777778e-4, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( lab.to_si( Meas::moles, 1), 1, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( lab.to_si( Meas::ppm, 1.0 ) , 1.0e-6 , 1.0e-10 );
|
||||
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@@ -529,6 +534,7 @@ BOOST_AUTO_TEST_CASE(LAB_UNITS)
|
||||
BOOST_CHECK_CLOSE( lab.from_si( Meas::icd_strength , 1.0 ) , 7.615148662932201e-25 , 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( lab.from_si( Meas::gas_oil_ratio_rate, 1.0), 3.6e3, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( lab.from_si( Meas::moles, 1), 1, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( lab.from_si( Meas::ppm, 1.0 ) , 1.0e6 , 1.0e-10 );
|
||||
|
||||
}
|
||||
|
||||
@@ -579,6 +585,7 @@ BOOST_AUTO_TEST_CASE(PVT_M_UNITS)
|
||||
BOOST_CHECK_CLOSE( pvt_m.to_si( Meas::icd_strength , 1.0 ) , 7.56387072e+14 , 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( pvt_m.to_si( Meas::gas_oil_ratio_rate, 1.0), 1.1574074074074073e-05, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( pvt_m.to_si( Meas::moles, 1), 1000, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( pvt_m.to_si( Meas::ppm, 1.0 ) , 1.0e-6 , 1.0e-10 );
|
||||
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@@ -620,6 +627,7 @@ BOOST_AUTO_TEST_CASE(PVT_M_UNITS)
|
||||
BOOST_CHECK_CLOSE( pvt_m.from_si( Meas::icd_strength , 1.0 ) , 1.322074420647951e-15 , 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( pvt_m.from_si( Meas::gas_oil_ratio_rate, 1.0), 86.400e3, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( pvt_m.from_si( Meas::moles, 1), 0.001, 1.0e-10 );
|
||||
BOOST_CHECK_CLOSE( pvt_m.from_si( Meas::ppm, 1), 1.e6, 1.0e-10 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user