opm-simulators
ScaledSatfuncCheckPoint.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 SCALED_SATFUNC_CHECKPOINT_HPP_INCLUDED
21 #define SCALED_SATFUNC_CHECKPOINT_HPP_INCLUDED
22 
23 #include <opm/simulators/utils/satfunc/SatfuncCheckPointInterface.hpp>
24 #include <opm/simulators/utils/satfunc/UnscaledSatfuncCheckPoint.hpp>
25 
26 #include <cstddef>
27 #include <functional>
28 #include <optional>
29 
30 namespace Opm {
31  class EclipseState;
32  class EclEpsGridProperties;
33 
34  template <typename Scalar>
35  struct EclEpsScalingPointsInfo;
36 } // namespace Opm
37 
38 namespace Opm::Satfunc::PhaseChecks {
39 
44  template <typename Scalar>
46  {
47  public:
50  using LocalToGlobal = std::function<std::size_t(const int)>;
51 
66  const EclipseState* eclipseState,
67  const EclEpsGridProperties* epsGridProps,
68  const LocalToGlobal& localToGlobal)
69  : unscaled_ { unscaled }
70  , eclipseState_ { eclipseState }
71  , epsGridProps_ { epsGridProps }
72  , localToGlobal_ { localToGlobal }
73  {}
74 
81  std::optional<std::size_t> pointID(const int cellIdx) const override
82  {
83  return { this->localToGlobal_(cellIdx) };
84  }
85 
91  void populateCheckPoint(const int cellIdx,
92  EclEpsScalingPointsInfo<Scalar>& endPoints) const override;
93 
94  private:
98 
101  const EclipseState* eclipseState_{nullptr};
102 
104  const EclEpsGridProperties* epsGridProps_{nullptr};
105 
108  LocalToGlobal localToGlobal_{};
109  };
110 
111 } // namespace Opm::Satfunc::PhaseChecks
112 
113 #endif // SCALED_SATFUNC_CHECKPOINT_HPP_INCLUDED
std::function< std::size_t(const int)> LocalToGlobal
Callback for translating active cell index to globally unique point ID.
Definition: ScaledSatfuncCheckPoint.hpp:50
ScaledSatfuncCheckPoint(const UnscaledSatfuncCheckPoint< Scalar > &unscaled, const EclipseState *eclipseState, const EclEpsGridProperties *epsGridProps, const LocalToGlobal &localToGlobal)
Constructor.
Definition: ScaledSatfuncCheckPoint.hpp:65
Callback protocol for single saturation function consistency check point.
Definition: SatfuncCheckPointInterface.hpp:39
std::optional< std::size_t > pointID(const int cellIdx) const override
Compute global unique, i.e., across all MPI ranks, ID of this check for a particular cell index...
Definition: ScaledSatfuncCheckPoint.hpp:81
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: SatfuncCheckPointInterface.hpp:28
Callbacks for defining the scaled saturation function consistency check point of a single active grid...
Definition: ScaledSatfuncCheckPoint.hpp:45
void populateCheckPoint(const int cellIdx, EclEpsScalingPointsInfo< Scalar > &endPoints) const override
Populate check point values for a particular cell.
Definition: ScaledSatfuncCheckPoint.cpp:35
Callbacks for defining the consistency check point of a single region.
Definition: SatfuncConsistencyCheckManager.hpp:47