ResInsight/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp

85 lines
2.6 KiB
C++
Raw Normal View History

2017-06-06 07:57:32 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
2017-06-13 08:22:12 -05:00
#include "RiaEclipseUnitTools.h"
2017-06-08 03:39:36 -05:00
2017-06-06 07:57:32 -05:00
#include "cafAppEnum.h"
2017-06-08 03:39:36 -05:00
#include "cvfAssert.h"
2017-06-14 06:43:02 -05:00
#include <cmath>
2017-06-06 07:57:32 -05:00
namespace caf
{
template<>
2017-06-13 08:22:12 -05:00
void RiaEclipseUnitTools::UnitSystemType::setUp()
2017-06-06 07:57:32 -05:00
{
2017-06-13 08:22:12 -05:00
addItem(RiaEclipseUnitTools::UNITS_METRIC, "UNITS_METRIC", "Metric");
addItem(RiaEclipseUnitTools::UNITS_FIELD, "UNITS_FIELD", "Field");
addItem(RiaEclipseUnitTools::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown");
2017-06-06 07:57:32 -05:00
2017-06-13 08:22:12 -05:00
setDefault(RiaEclipseUnitTools::UNITS_METRIC);
2017-06-06 07:57:32 -05:00
}
}
2017-06-08 03:39:36 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-13 08:22:12 -05:00
double RiaEclipseUnitTools::darcysConstant(UnitSystem unitSystem)
2017-06-08 03:39:36 -05:00
{
// See "Cartesian transmissibility calculations" in the "Eclipse Technical Description"
// CDARCY Darcys constant
// = 0.00852702 (E300); 0.008527 (ECLIPSE 100) (METRIC)
// = 0.00112712 (E300); 0.001127 (ECLIPSE 100) (FIELD)
// = 3.6 (LAB)
// = 0.00864 (PVT - M)
switch (unitSystem)
{
case UNITS_FIELD:
return 0.001127;
case UNITS_METRIC:
return 0.008527;
default:
CVF_ASSERT(false);
return 0.0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaEclipseUnitTools::convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit)
{
if (fromUnit == toUnit) return Kw;
else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD)
{
return meterToFeet(Kw);
}
else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD)
{
return feetToMeter(Kw);
}
CVF_ASSERT(false);
return HUGE_VAL;
}