Added tests for OPM-common.

This commit is contained in:
rubenthoms 2020-08-27 13:55:54 +02:00 committed by Magne Sjaastad
parent dd3a3efa19
commit 9742317e98
6 changed files with 3871 additions and 0 deletions

View File

@ -0,0 +1,49 @@
cmake_minimum_required (VERSION 2.8)
project ( opm-parser-tests )
if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
message(STATUS "Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
endif()
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/OpmTestDataDirectory.h.cmake
${CMAKE_BINARY_DIR}/Generated/OpmTestDataDirectory.h
)
include_directories (
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_BINARY_DIR}/Generated
# ${CMAKE_CURRENT_SOURCE_DIR}/../opm-parser
# ${CMAKE_CURRENT_SOURCE_DIR}/../../custom-opm-common/opm-common
# ${ERT_INCLUDE_DIRS}
# ${Boost_INCLUDE_DIRS}
)
set( PROJECT_FILES
opm-parser_UnitTests.cpp
../../gtest/gtest-all.cc
opm-parser-BasicTest.cpp
)
# add the executable
add_executable (${PROJECT_NAME}
${PROJECT_FILES}
)
source_group("" FILES ${PROJECT_FILES})
target_link_libraries ( ${PROJECT_NAME}
custom-opm-common
)
# Add dependency of Shlwapi.lib for Windows platforms
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_libraries(${PROJECT_NAME} Shlwapi)
endif()

View File

@ -0,0 +1,3 @@
// Test data directory used by unit tests
#define TEST_DATA_DIR "${CMAKE_CURRENT_LIST_DIR}/TestData"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
-- This reservoir simulation deck is made available under the Open Database
-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in
-- individual contents of the database are licensed under the Database Contents
-- License: http://opendatacommons.org/licenses/dbcl/1.0/
-- Copyright (C) 2015 Statoil
--
-- Generated by : Prosper 8.01 - License#:4163 - Nov 12 2004 18:40:47
-- Generated on : 08 Sep 05 14:13
-- Input File : Z:\Project\norne6\prod\gap\WI\C1H.OUT
-- Output File : Z:\Project\norne6\prod\gap\WI\C1H.Ecl
--
--
-- Fluid : Water
-- PVT Method : Black Oil
-- Equation Of State :
-- Separator : Single-Stage
-- Emulsions : No
-- Hydrates : Disable Warning
-- Water Viscosity : Use Default Correlation
-- Water Vapour : No Calculations
-- Viscosity Model : Newtonian Fluid
--
-- Flow Type : Tubing
-- Well Type : Water Injector
--
-- Artificial Lift : None
-- Lift Type :
--
-- Predicting : Pressure and Temperature (offshore)
-- Temperature Model : Rough Approximation
-- Range : Full System
--
-- Completion : Cased Hole
-- Gravel Pack : No
--
-- Inflow Type : Single Branch
-- Gas Coning : No
--
-- Company : Statoil
-- Field : Norne
-- Location : Nordland II
-- Well : C-1H
-- Platform : Transocean Prospect
-- Analyst : shlea
-- Date : 22 Mar 99 15:59
--
--
--
-- Surface Equipment Correlation : Dukler Eaton Flannigan
-- Vertical Lift Correlation : Petroleum Experts 2
-- Rate Method : User Selected
-- Rate Type : Liquid Rates
-- First Node : 1 Xmas Tree 392.3 (m)
-- Last Node : 8 Casing 3043 (m)
--
--
-- PROSPER Lift Curves For ECLIPSE Simulator (Water - Water Injector Well) (Units System - METRIC)
VFPINJ
-- Table Datum Depth Rate Type
-- ----- ----------- ---------
12 2718.07 'WAT' /
-- 'WAT' units - SM3/DAY
500.0 1263.2 2026.3 2789.5 3552.6
4315.8 5078.9 5842.1 6605.3 7368.4
8131.6 8894.7 9657.9 10421.1 11184.2
11947.4 12710.5 13473.7 14236.8 15000.0 /
-- 'THP' units - BARSA
21.01 63.24 105.46 147.68 189.90
232.12 274.35 316.57 358.79 401.01 /
1 254.51 253.95 252.27 249.83 246.69
242.88 238.42 233.32 227.59 221.22
214.23 206.62 198.38 189.53 180.06
169.97 159.26 147.95 136.00 123.46
/
2 297.02 296.49 294.82 292.39 289.26
285.47 281.01 275.92 270.20 263.84
256.87 249.28 241.05 232.22 222.76
212.70 202.01 190.71 178.79 166.27
/
3 339.54 339.03 337.37 334.95 331.83
328.05 323.60 318.52 312.82 306.47
299.52 291.94 283.73 274.91 265.47
255.43 244.75 233.48 221.58 209.09
/
4 382.06 381.57 379.93 377.51 374.41
370.63 366.19 361.13 355.44 349.10
342.16 334.60 326.40 317.61 308.18
298.16 287.50 276.26 264.37 251.90
/
5 424.58 424.11 422.48 420.08 416.98
413.22 408.78 403.73 398.06 391.73
384.81 377.26 369.08 360.30 350.89
340.89 330.25 319.03 307.16 294.72
/
6 467.10 466.65 465.03 462.64 459.55
455.80 451.37 446.34 440.68 434.36
427.45 419.93 411.75 403.00 393.60
383.62 373.00 361.80 349.96 337.54
/
7 509.62 509.20 507.59 505.21 502.13
498.39 493.97 488.95 483.30 476.99
470.10 462.59 454.43 445.69 436.31
426.35 415.75 404.57 392.75 380.36
/
8 552.14 551.74 550.15 547.77 544.71
540.98 536.56 531.56 525.92 519.62
512.75 505.26 497.11 488.39 479.02
469.09 458.50 447.35 435.55 423.18
/
9 594.67 594.29 592.70 590.34 587.29
583.57 579.16 574.17 568.55 562.25
555.40 547.92 539.79 531.09 521.74
511.82 501.25 490.13 478.34 466.01
/
10 637.19 636.83 635.26 632.91 629.86
626.16 621.76 616.78 611.17 604.89
598.05 590.59 582.47 573.79 564.45
554.56 544.01 532.91 521.14 508.83
/

View File

@ -0,0 +1,71 @@
#include <string>
#include "gtest/gtest.h"
#include "opm/parser/eclipse/Parser/Parser.hpp"
#include "opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp"
#include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp"
#include "OpmTestDataDirectory.h"
using namespace Opm;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(OpmParserTest, ReadFromFile)
{
ParseContext parseContext;
{
Parser parser;
std::stringstream ss;
ss << TEST_DATA_DIR << "/B1BH.Ecl";
std::string testFile = ss.str();
auto deck = parser.parseFile(testFile);
std::string myKeyword = "VFPPROD";
auto keywordList = deck.getKeywordList(myKeyword);
UnitSystem unitSystem;
for (auto kw : keywordList)
{
auto name = kw->name();
VFPProdTable table(*kw, unitSystem);
std::cout << table.getDatumDepth() << std::endl;
}
}
{
Parser parser;
std::stringstream ss;
ss << TEST_DATA_DIR << "/C1H.Ecl";
std::string testFile = ss.str();
auto deck = parser.parseFile(testFile);
std::string myKeyword = "VFPINJ";
auto keywordList = deck.getKeywordList(myKeyword);
UnitSystem unitSystem;
for (auto kw : keywordList)
{
auto name = kw->name();
VFPInjTable table(*kw, unitSystem);
std::cout << table.getDatumDepth() << std::endl;
}
}
}

View File

@ -0,0 +1,20 @@
#include "gtest/gtest.h"
#include <stdio.h>
#include <iostream>
#include <string>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
char text[5];
std::cin.getline(text, 5);
return result;
}