opm-simulators
Loading...
Searching...
No Matches
PyFluidState.hpp
1/*
2 Copyright 2023 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_PY_FLUID_STATE_HEADER_INCLUDED
21#define OPM_PY_FLUID_STATE_HEADER_INCLUDED
22
27
28#include <cstddef>
29#include <map>
30#include <string>
31#include <vector>
32
33namespace Opm::Pybind {
34
35template <class TypeTag>
36class PyFluidState {
45
46 enum class VariableType {
47 // Primary variables: Sw, Sg, po, pg, Rs, Rv
48 Sw, Sg, So, pw, pg, po, Rs, Rv, rho_w, rho_g, rho_o, T
49 };
50
51public:
52 PyFluidState(Simulator* simulator);
53
54 std::vector<double>
55 getFluidStateVariable(const std::string& name) const;
56
57 std::vector<int>
58 getPrimaryVarMeaning(const std::string& variable) const;
59
60 std::map<std::string, int>
61 getPrimaryVarMeaningMap(const std::string& variable) const;
62
63 std::vector<double>
64 getPrimaryVariable(const std::string &idx_name) const;
65
66 void setPrimaryVariable(const std::string& idx_name,
67 const double* data,
68 std::size_t size);
69
70private:
71 std::size_t getPrimaryVarIndex_(const std::string& idx_name) const;
72
73 int getVariableMeaning_(PrimaryVariables& primary_vars,
74 const std::string& variable) const;
75
76 VariableType getVariableType_(const std::string& name) const;
77
78 template <class FluidState>
79 double getVariableValue_(FluidState& fs,
80 VariableType var_type,
81 const std::string& name) const;
82
83 void variableNotFoundError_(const std::string& name) const;
84
85 Simulator* simulator_{nullptr};
86};
87
88} // namespace Opm::Pybind
89
90#include "PyFluidState_impl.hpp"
91
92#endif // OPM_PY_FLUID_STATE_HEADER_INCLUDED
Defines a type tags and some fundamental properties all models.
Declare the properties used by the infrastructure code of the finite volume discretizations.
Defines the common properties required by the porous medium multi-phase models.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
The Opm property system, traits with inheritance.