opm-simulators
UnscaledSatfuncCheckPoint.hpp
1 /*
2  Copyright 2024 Equinor AS
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 UNSCALED_SATFUNC_CHECKPOINT_HPP_INCLUDED
21 #define UNSCALED_SATFUNC_CHECKPOINT_HPP_INCLUDED
22 
23 #include <opm/simulators/utils/satfunc/SatfuncCheckPointInterface.hpp>
24 
25 #include <cstddef>
26 #include <optional>
27 #include <unordered_set>
28 #include <vector>
29 
30 namespace Opm {
31  template <typename Scalar>
32  struct EclEpsScalingPointsInfo;
33 } // namespace Opm
34 
35 namespace Opm::satfunc {
36  struct RawTableEndPoints;
37  struct RawFunctionValues;
38 } // namespace Opm::satfunc
39 
40 namespace Opm::Satfunc::PhaseChecks {
41 
45  template <typename Scalar>
46  class UnscaledSatfuncCheckPoint : public SatfuncCheckPointInterface<Scalar>
47  {
48  public:
52  {
56  const satfunc::RawTableEndPoints* rtep{nullptr};
57 
61  const satfunc::RawFunctionValues* rfunc{nullptr};
62  };
63 
74  explicit UnscaledSatfuncCheckPoint(const std::vector<int>* region,
75  const int regIdxOffset,
76  const UnscaledEndPoints& unscaledEndPoints)
77  : unscaledEndPoints_ { unscaledEndPoints }
78  , regIdxOffset_ { regIdxOffset }
79  , region_ { region }
80  {}
81 
93  std::optional<std::size_t> pointID(const int cellIdx) const override;
94 
100  void populateCheckPoint(const int cellIdx,
101  EclEpsScalingPointsInfo<Scalar>& endPoints) const override;
102 
103  private:
107  UnscaledEndPoints unscaledEndPoints_;
108 
111  int regIdxOffset_{};
112 
114  const std::vector<int>* region_{nullptr};
115 
117  mutable std::unordered_set<int> seen_{};
118  };
119 
120 } // namespace Opm::Satfunc::PhaseChecks
121 
122 #endif // UNSCALED_SATFUNC_CHECKPOINT_HPP_INCLUDED
std::optional< std::size_t > pointID(const int cellIdx) const override
Compute locally unique, i.e., per MPI rank, ID of this check for a particular cell index...
Definition: UnscaledSatfuncCheckPoint.cpp:38
void populateCheckPoint(const int cellIdx, EclEpsScalingPointsInfo< Scalar > &endPoints) const override
Populate check point values for a particular cell.
Definition: UnscaledSatfuncCheckPoint.cpp:53
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: UnscaledSatfuncCheckPoint.hpp:35
const satfunc::RawTableEndPoints * rtep
Raw table end-points.
Definition: UnscaledSatfuncCheckPoint.hpp:56
Collection of saturation function end-points and function values extracted from tabulated saturation ...
Definition: UnscaledSatfuncCheckPoint.hpp:51
const satfunc::RawFunctionValues * rfunc
Raw saturation function values.
Definition: UnscaledSatfuncCheckPoint.hpp:61
UnscaledSatfuncCheckPoint(const std::vector< int > *region, const int regIdxOffset, const UnscaledEndPoints &unscaledEndPoints)
Constructor.
Definition: UnscaledSatfuncCheckPoint.hpp:74