My Project
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
23
#include <
opm/models/utils/propertysystem.hh
>
24
25
#include <exception>
26
#include <iostream>
27
#include <map>
28
#include <memory>
29
#include <string>
30
#include <vector>
31
32
namespace
Opm::Pybind
33
{
34
template
<
class
TypeTag>
35
class
PyFluidState
{
36
using
Simulator =
GetPropType<TypeTag, Opm::Properties::Simulator>
;
37
using
Problem =
GetPropType<TypeTag, Opm::Properties::Problem>
;
38
using
Model =
GetPropType<TypeTag, Opm::Properties::Model>
;
39
using
ElementContext =
GetPropType<TypeTag, Opm::Properties::ElementContext>
;
40
using
FluidSystem =
GetPropType<TypeTag, Opm::Properties::FluidSystem>
;
41
using
Indices =
GetPropType<TypeTag, Opm::Properties::Indices>
;
42
using
GridView =
GetPropType<TypeTag, Opm::Properties::GridView>
;
43
using
PrimaryVariables =
GetPropType<TypeTag, Properties::PrimaryVariables>
;
44
45
enum class
VariableType {
46
// Primary variables: Sw, Sg, po, pg, Rs, Rv
47
Sw, Sg, So, pw, pg, po, Rs, Rv, rho_w, rho_g, rho_o, T
48
};
49
public
:
50
PyFluidState
(Simulator* simulator);
51
std::vector<double> getFluidStateVariable(
const
std::string &name)
const
;
52
std::vector<int> getPrimaryVarMeaning(
const
std::string &
variable
)
const
;
53
std::map<std::string, int> getPrimaryVarMeaningMap(
const
std::string &
variable
)
const
;
54
std::vector<double> getPrimaryVariable(
const
std::string &
idx_name
)
const
;
55
void
setPrimaryVariable(
const
std::string &
idx_name
,
const
double
*data, std::size_t size);
56
57
private
:
58
std::size_t getPrimaryVarIndex_(
const
std::string &
idx_name
)
const
;
59
int
getVariableMeaning_(PrimaryVariables &
primary_vars
,
const
std::string &
variable
)
const
;
60
VariableType getVariableType_(
const
std::string &name)
const
;
61
template
<
class
Flu
id
State>
double
getVariableValue_(
62
FluidState &fs, VariableType
var_type
,
const
std::string &name)
const
;
63
void
variableNotFoundError_(
const
std::string &name)
const
;
64
65
Simulator* simulator_;
66
};
67
}
68
#include "PyFluidState_impl.hpp"
69
70
#endif
// OPM_PY_FLUID_STATE_HEADER_INCLUDED
71
Opm::Pybind::PyFluidState
Definition
PyFluidState.hpp:35
Opm::getPropValue
constexpr auto getPropValue()
get the value data member of a property
Definition
propertysystem.hh:242
Opm::GetPropType
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:235
propertysystem.hh
The Opm property system, traits with inheritance.
opm
simulators
flow
python
PyFluidState.hpp
Generated by
1.9.8