Go to the documentation of this file.
36#ifndef OPM_SETUPGRIDANDPROPS_HEADER
37#define OPM_SETUPGRIDANDPROPS_HEADER
39#include <opm/common/utility/parameters/ParameterGroup.hpp>
40#include <opm/input/eclipse/Units/Units.hpp>
41#include <opm/grid/CpGrid.hpp>
44#include <opm/input/eclipse/Deck/Deck.hpp>
45#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
46#include <opm/input/eclipse/Parser/Parser.hpp>
48#include <opm/common/utility/platform_dependent/disable_warnings.h>
50#include <opm/common/utility/FileSystem.hpp>
52#include <opm/common/utility/platform_dependent/reenable_warnings.h>
65 bool useJ< ReservoirPropertyCapillary<3> >();
70 template < template < int> class ResProp>
77 std::string fileformat = param.getDefault<std::string>( "fileformat", "cartesian");
78 if (fileformat == "sintef_legacy") {
79 std::string grid_prefix = param.get<std::string>( "grid_prefix");
80 grid.readSintefLegacyFormat(grid_prefix);
81 OPM_MESSAGE( "Warning: We do not yet read legacy reservoir properties. Using defaults.");
82 res_prop.init(grid.size(0));
83 } else if (fileformat == "eclipse") {
84 std::string ecl_file = param.get<std::string>( "filename");
87 auto deck = parser.parseFile(ecl_file);
88 if (param.has( "z_tolerance")) {
89 std::cerr << "****** Warning: z_tolerance parameter is obsolete, use PINCH in deck input instead\n";
91 bool periodic_extension = param.getDefault< bool>( "periodic_extension", false);
92 bool clip_z = param.getDefault< bool>( "clip_z", false);
93 bool turn_normals = param.getDefault< bool>( "turn_normals", false);
95 Opm::EclipseGrid inputGrid( deck);
96 grid.processEclipseFormat(&inputGrid, nullptr, periodic_extension, turn_normals, clip_z, true);
99 if (param.getDefault( "output_ecl", false)) {
100 OPM_THROW(std::runtime_error, "Saving to EGRID files is not yet implemented");
108 double perm_threshold_md = param.getDefault( "perm_threshold_md", 0.0);
109 double perm_threshold = Opm::unit::convert::from(perm_threshold_md, Opm::prefix::milli*Opm::unit::darcy);
110 std::string rock_list = param.getDefault<std::string>( "rock_list", "no_list");
111 std::string* rl_ptr = (rock_list == "no_list") ? 0 : &rock_list;
112 bool use_j = param.getDefault( "use_jfunction_scaling", useJ<ResProp<3> >());
116 sigma = param.getDefault( "sigma", sigma);
117 theta = param.getDefault( "theta", theta);
119 if (param.has( "viscosity1") || param.has( "viscosity2")) {
120 double v1 = param.getDefault( "viscosity1", 0.001);
121 double v2 = param.getDefault( "viscosity2", 0.003);
122 res_prop.setViscosities(v1, v2);
124 res_prop.init( deck, grid.globalCell(), perm_threshold, rl_ptr,
125 use_j, sigma, theta);
126 } else if (fileformat == "cartesian") {
127 std::array<int, 3> dims = {{ param.getDefault< int>( "nx", 1),
128 param.getDefault< int>( "ny", 1),
129 param.getDefault< int>( "nz", 1) }};
130 std::array<double, 3> cellsz = {{ param.getDefault< double>( "dx", 1.0),
131 param.getDefault< double>( "dy", 1.0),
132 param.getDefault< double>( "dz", 1.0) }};
133 grid.createCartesian(dims, cellsz);
134 double default_poro = param.getDefault( "default_poro", 0.2);
135 double default_perm_md = param.getDefault( "default_perm_md", 100.0);
136 double default_perm = Opm::unit::convert::from(default_perm_md, Opm::prefix::milli*Opm::unit::darcy);
137 OPM_MESSAGE( "Warning: For generated cartesian grids, we use uniform reservoir properties.");
138 res_prop.init(grid.size(0), default_poro, default_perm);
140 OPM_THROW(std::runtime_error,
141 "Unknown file format string: " + fileformat);
143 if (param.getDefault( "use_unique_boundary_ids", false)) {
144 grid.setUniqueBoundaryIds( true);
151 template < template < int> class ResProp>
153 bool periodic_extension,
157 double perm_threshold,
158 const std::string& rock_list,
159 bool use_jfunction_scaling,
163 ResProp<3>& res_prop)
165 Opm::EclipseGrid eg( deck);
166 const std::string* rl_ptr = (rock_list == "no_list") ? 0 : &rock_list;
167 grid.processEclipseFormat(&eg, nullptr, periodic_extension, turn_normals, clip_z, true);
168 res_prop.init( deck, grid.globalCell(), perm_threshold, rl_ptr, use_jfunction_scaling, sigma, theta);
170 grid.setUniqueBoundaryIds( true);
auto deck Definition: elasticity_upscale_impl.hpp:590
Definition: ImplicitAssembly.hpp:43
bool useJ() Helper for determining whether we should. Definition: setupGridAndProps.hpp:59
void setupGridAndPropsEclipse(const Opm::Deck &deck, bool periodic_extension, bool turn_normals, bool clip_z, bool unique_bids, double perm_threshold, const std::string &rock_list, bool use_jfunction_scaling, double sigma, double theta, Dune::CpGrid &grid, ResProp< 3 > &res_prop) Definition: setupGridAndProps.hpp:152
void setupGridAndProps(const Opm::ParameterGroup ¶m, Dune::CpGrid &grid, ResProp< 3 > &res_prop) Definition: setupGridAndProps.hpp:71
|