My Project
simulators.hpp
1/*
2 Copyright 2020 Equinor ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_SIMULATORS_HEADER_INCLUDED
21#define OPM_SIMULATORS_HEADER_INCLUDED
22
23#include <opm/simulators/flow/Main.hpp>
24#include <opm/simulators/flow/FlowMainEbos.hpp>
25#include <opm/models/utils/propertysystem.hh>
26#include <pybind11/pybind11.h>
27#include <pybind11/numpy.h>
28
29namespace py = pybind11;
30
31namespace Opm::Pybind {
33{
34private:
35 using TypeTag = Opm::Properties::TTag::EclFlowProblemTpfa;
36 using Simulator = Opm::GetPropType<TypeTag, Opm::Properties::Simulator>;
37
38public:
39 BlackOilSimulator( const std::string &deckFilename);
40 py::array_t<double> getPorosity();
41 int run();
42 void setPorosity(
43 py::array_t<double, py::array::c_style | py::array::forcecast> array);
44 int step();
45 int stepInit();
46 int stepCleanup();
47
48private:
49 const std::string deckFilename_;
50 bool hasRunInit_ = false;
51 bool hasRunCleanup_ = false;
52
53 // This *must* be declared before other pointers
54 // to simulator objects. This in order to deinitialize
55 // MPI at the correct time (ie after the other objects).
56 std::unique_ptr<Opm::Main> main_;
57
58 std::unique_ptr<Opm::FlowMainEbos<TypeTag>> mainEbos_;
59 Simulator *ebosSimulator_;
60 std::unique_ptr<PyMaterialState<TypeTag>> materialState_;
61};
62
63} // namespace Opm::Pybind
64#endif // OPM_SIMULATORS_HEADER_INCLUDED
Definition: simulators.hpp:33