File: test_thresholdpressure.cpp

package info (click to toggle)
opm-simulators 2025.10%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 21,552 kB
  • sloc: cpp: 193,037; sh: 1,807; python: 1,704; lisp: 1,108; makefile: 31; awk: 10
file content (60 lines) | stat: -rw-r--r-- 2,222 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#if HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H

#include <opm/input/eclipse/Parser/Parser.hpp>
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>

#include <opm/grid/UnstructuredGrid.h>
#include <opm/core/grid/cornerpoint_grid.h>
#include <opm/grid/GridManager.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/simulators/thresholdPressures.hpp> // Note: the GridHelpers must be included before this (to make overloads available)


static DeckPtr createDeckSimConfig() {
    const std::string& inputStr = "RUNSPEC\n"
                                  "EQLOPTS\n"
                                  "THPRES /\n "
                                  "DIMENS\n"
                                  "10 3 4 /\n"
                                  "\n"
                                  "GRID\n"
                                  "REGIONS\n"
                                  "EQLNUM\n"
                                  "10*1 10*2 100*3 /\n "
                                  "\n"

                                  "SOLUTION\n"
                                  "THPRES\n"
                                  "1 2 12.0/\n"
                                  "1 3 5.0/\n"
                                  "2 3 7.0/\n"
                                  "/\n"
                                  "\n";


    ParserPtr parser(new Parser());
    return parser->parseString(inputStr, ParseContext()) ;
}

/*
  The main purpose of this is to get the code in
  thresholdPressures.hpp to compile; it currently has no users in the
  opm-core codebase.
*/

BOOST_AUTO_TEST_CASE(CreateSimulationConfig) {
    ParseContext parseContext;
    typedef UnstructuredGrid  Grid;
    DeckPtr deck = createDeckSimConfig();
    EclipseState state(*deck, parseContext);
    EclipseGridConstPtr eclipseGrid = state.getInputGrid();
    std::vector<double> porv = eclipseState->getDoubleGridProperty("PORV")->getData();
    GridManager vanguard( eclipseState->getInputGrid(), porv );
    const Grid& grid = *(vanguard.c_grid());

    std::vector<double> threshold_pressures = thresholdPressures(parseContext, eclipseState, grid);
    BOOST_CHECK( threshold_pressures.size() > 0 );
}