opm-common
EclMaterialLawInitParams.hpp
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  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 2 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  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
28 #ifndef OPM_ECL_MATERIAL_LAW_INIT_PARAMS_HPP
29 #define OPM_ECL_MATERIAL_LAW_INIT_PARAMS_HPP
30 
33 
34 #include <cstddef>
35 #include <functional>
36 #include <string>
37 #include <vector>
38 
39 namespace Opm {
40  class EclipseState;
41  class FieldPropsManager;
42 }
43 
44 namespace Opm::EclMaterialLaw {
45 
46 template<class Traits> class HystParams;
47 template<class Traits> class Manager;
48 
49 template<class Traits>
51 {
52  using Scalar = typename Traits::Scalar;
53 
54 public:
55  InitParams(const Manager<Traits>& parent,
56  const EclipseState& eclState,
57  std::size_t numCompressedElems);
58 
59  using LookupFunction = std::function<unsigned(unsigned)>;
60  using IntLookupFunction = std::function<std::vector<int>(const FieldPropsManager&,
61  const std::string&, bool)>;
62  using MaterialLawParams = typename Manager<Traits>::MaterialLawParams;
63 
64  // Function argument 'fieldPropIntOnLeadAssigner' needed to lookup
65  // field properties of cells on the leaf grid view for CpGrid with local grid refinement.
66  // Function argument 'lookupIdxOnLevelZeroAssigner' is added to lookup, for each
67  // leaf gridview cell with index 'elemIdx', its 'lookupIdx'
68  // (index of the parent/equivalent cell on level zero).
69  void run(const IntLookupFunction& fieldPropIntOnLeafAssigner,
70  const LookupFunction& lookupIdxOnLevelZeroAssigner);
71 
72  typename Manager<Traits>::Params params_;
73 
74 private:
75  // Function argument 'fieldPropIntOnLeadAssigner' needed to lookup
76  // field properties of cells on the leaf grid view for CpGrid with local grid refinement.
77  void copySatnumArrays_(const IntLookupFunction& fieldPropIntOnLeafAssigner);
78 
79  // Function argument 'fieldPropIntOnLeadAssigner' needed to lookup
80  // field properties of cells on the leaf grid view for CpGrid with local grid refinement.
81  void copyIntArray_(std::vector<int>& dest,
82  const std::string& keyword,
83  const IntLookupFunction& fieldPropIntOnLeafAssigner) const;
84 
85  unsigned imbRegion_(const std::vector<int>& array, unsigned elemIdx) const;
86 
87  void initArrays_(std::vector<const std::vector<int>*>& satnumArray,
88  std::vector<const std::vector<int>*>& imbnumArray,
89  std::vector<std::vector<MaterialLawParams>*>& mlpArray);
90 
91  void initMaterialLawParamVectors_();
92 
93  void initOilWaterScaledEpsInfo_();
94 
95  // Function argument 'fieldProptOnLeadAssigner' needed to lookup
96  // field properties of cells on the leaf grid view for CpGrid with local grid refinement.
97  void initSatnumRegionArray_(const IntLookupFunction& fieldPropIntOnLeafAssigner);
98 
99  void initThreePhaseParams_(HystParams<Traits>& hystParams,
100  MaterialLawParams& materialParams,
101  unsigned satRegionIdx,
102  unsigned elemIdx);
103 
104  void readEffectiveParameters_();
105 
106  void readUnscaledEpsPointsVectors_();
107 
108  template <class Container>
109  void readUnscaledEpsPoints_(Container& dest,
110  const EclEpsConfig& config,
111  EclTwoPhaseSystemType system_type);
112 
113  unsigned satRegion_(const std::vector<int>& array, unsigned elemIdx) const;
114 
115  const Manager<Traits>& parent_;
116  const EclipseState& eclState_;
117  std::size_t numCompressedElems_;
118 
119  std::unique_ptr<EclEpsGridProperties> epsImbGridProperties_; // imbibition
120  EclEpsGridProperties epsGridProperties_; // drainage
121 };
122 
123 } // namespace Opm::EclMaterialLaw
124 
125 #endif
EclTwoPhaseSystemType
Specified which fluids are involved in a given twophase material law for endpoint scaling...
Definition: EclEpsConfig.hpp:40
Definition: EclMaterialLawHystParams.hpp:47
Definition: EclMaterialLawHystParams.cpp:28
Definition: FieldPropsManager.hpp:42
Collects all grid properties which are relevant for end point scaling.
Definition: EclEpsGridProperties.hpp:44
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Specifies the configuration used by the endpoint scaling code.
Definition: EclEpsConfig.hpp:53
Definition: EclipseState.hpp:66
Definition: EclMaterialLawInitParams.hpp:50