directionalmobility.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 Copyright 2022 Equinor ASA.
5
6 This file is part of the Open Porous Media project (OPM).
7
8 OPM is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 OPM is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with OPM. If not, see <http://www.gnu.org/licenses/>.
20*/
26#ifndef OPM_MODELS_DIRECTIONAL_MOBILITY_HH
27#define OPM_MODELS_DIRECTIONAL_MOBILITY_HH
28
32
33#include <opm/common/ErrorMacros.hpp>
34#include <opm/common/utility/gpuDecorators.hpp>
35
36#include <array>
37#include <stdexcept>
38#include <utility>
39
40namespace Opm {
41
42template <class TypeTag>
44{
45 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
47
48public:
49 using array_type = std::array<Evaluation,numPhases>;
50
52
54 const array_type& mY,
55 const array_type& mZ)
56 : mobility_{mX, mY, mZ}
57 {}
58
59 OPM_HOST_DEVICE const array_type& getArray(unsigned index) const
60 {
61 if (index > 2) {
62 OPM_THROW(std::runtime_error, "Unexpected mobility array index");
63 }
64 return mobility_[index];
65 }
66
67 OPM_HOST_DEVICE array_type& getArray(unsigned index)
68 {
69 return const_cast<array_type&>(std::as_const(*this).getArray(index));
70 }
71
72private:
73 std::array<array_type,3> mobility_{};
74};
75
76} // namespace Opm
77
78#endif
Definition: directionalmobility.hh:44
OPM_HOST_DEVICE array_type & getArray(unsigned index)
Definition: directionalmobility.hh:67
OPM_HOST_DEVICE const array_type & getArray(unsigned index) const
Definition: directionalmobility.hh:59
DirectionalMobility(const array_type &mX, const array_type &mY, const array_type &mZ)
Definition: directionalmobility.hh:53
std::array< Evaluation, numPhases > array_type
Definition: directionalmobility.hh:49
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.
Definition: blackoilbioeffectsmodules.hh:45
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.