opm-simulators
flowexp.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 FLOW_EXP_HPP
29 #define FLOW_EXP_HPP
30 
32 
34 
37 
38 #include <opm/simulators/aquifers/BlackoilAquiferModel.hpp>
39 
42 
43 #include <opm/simulators/linalg/ISTLSolver.hpp>
44 
45 #include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
46 
47 #include <opm/simulators/wells/BlackoilWellModel.hpp>
48 
49 namespace Opm {
50 template <class TypeTag>
52 }
53 
54 namespace Opm::Properties {
55 
56 namespace TTag {
57 
59 {
60  using InheritsFrom = std::tuple<FlowBaseProblemBlackoil, BlackOilModel>;
61 };
62 
63 }
64 
65 // Set the problem class
66 template<class TypeTag>
67 struct Problem<TypeTag, TTag::FlowExpTypeTag> {
69 };
70 
71 // Enable experimental features for flowexp: flowexp is the research simulator of the OPM
72 // project. If you're looking for a more stable "production quality" simulator, consider
73 // using `flow`
74 template<class TypeTag>
75 struct EnableExperiments<TypeTag, TTag::FlowExpTypeTag> {
76  static constexpr bool value = true;
77 };
78 
79 // use flow's well model for now
80 template<class TypeTag>
81 struct WellModel<TypeTag, TTag::FlowExpTypeTag> {
83 };
84 
85 template<class TypeTag>
86 struct NewtonMethod<TypeTag, TTag::FlowExpTypeTag> {
88 };
89 
90 // flow's well model only works with surface volumes
91 template<class TypeTag>
92 struct BlackoilConserveSurfaceVolume<TypeTag, TTag::FlowExpTypeTag> {
93  static constexpr bool value = true;
94 };
95 
96 // the values for the residual are for the whole cell instead of for a cubic meter of the cell
97 template<class TypeTag>
98 struct UseVolumetricResidual<TypeTag, TTag::FlowExpTypeTag> {
99  static constexpr bool value = false;
100 };
101 
102 // by default use flow's aquifer model for now
103 template<class TypeTag>
104 struct AquiferModel<TypeTag, TTag::FlowExpTypeTag> {
106 };
107 
108 // use flow's linear solver backend for now
109 template<class TypeTag>
110 struct LinearSolverSplice<TypeTag, TTag::FlowExpTypeTag> {
111  using type = TTag::FlowIstlSolver;
112 };
113 
114 template<>
115 struct LinearSolverBackend<TTag::FlowExpTypeTag, TTag::FlowIstlSolverParams> {
117 };
118 
119 template<class TypeTag>
120 struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
121  using type = ISTLSolver<TypeTag>;
122 };
123 
124 } // namespace Opm::Properties
125 
126 namespace Opm {
127 
128 template <class TypeTag>
129 class FlowExpProblem : public FlowProblemBlackoil<TypeTag> //, public FvBaseProblem<TypeTag>
130 {
131  using ParentType = FlowProblemBlackoil<TypeTag>;
133 
134 public:
135  void writeOutput(bool verbose = true) override
136  {
137  OPM_TIMEBLOCK(problemWriteOutput);
138  // use the generic code to prepare the output fields and to
139  // write the desired VTK files.
140  if (Parameters::Get<Parameters::EnableWriteAllSolutions>() ||
141  this->simulator().episodeWillBeOver())
142  {
143  // \Note: the SimulatorTimer does not carry any useful information, so PRT file (if it gets output) will contain wrong
144  // timing information.
145  ParentType::writeOutput(verbose);
146  }
147  }
148 
149  static void registerParameters()
150  {
152 
154  Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
155  Parameters::Hide<Parameters::DbhpMaxRel<Scalar>>();
156  Parameters::Hide<Parameters::DwellFractionMax<Scalar>>();
157  Parameters::Hide<Parameters::MaxResidualAllowed<Scalar>>();
158  Parameters::Hide<Parameters::ToleranceMb<Scalar>>();
159  Parameters::Hide<Parameters::ToleranceMbRelaxed<Scalar>>();
160  Parameters::Hide<Parameters::ToleranceCnv<Scalar>>();
161  Parameters::Hide<Parameters::ToleranceCnvRelaxed<Scalar>>();
162  Parameters::Hide<Parameters::ToleranceWells<Scalar>>();
163  Parameters::Hide<Parameters::ToleranceWellControl<Scalar>>();
164  Parameters::Hide<Parameters::MaxWelleqIter>();
165  Parameters::Hide<Parameters::UseMultisegmentWell>();
166  Parameters::Hide<Parameters::TolerancePressureMsWells<Scalar>>();
167  Parameters::Hide<Parameters::MaxPressureChangeMsWells<Scalar>>();
168  Parameters::Hide<Parameters::MaxInnerIterMsWells>();
169  Parameters::Hide<Parameters::MaxNewtonIterationsWithInnerWellIterations>();
170  Parameters::Hide<Parameters::MaxInnerIterWells>();
171  Parameters::Hide<Parameters::MaxWellStatusSwitchInInnerIterWells>();
172  Parameters::Hide<Parameters::MaxWellStatusSwitchForWells>();
173  Parameters::Hide<Parameters::MaxSinglePrecisionDays<Scalar>>();
174  Parameters::Hide<Parameters::MinStrictCnvIter>();
175  Parameters::Hide<Parameters::MinStrictMbIter>();
176  Parameters::Hide<Parameters::SolveWelleqInitially>();
177  Parameters::Hide<Parameters::PreSolveNetwork>();
178  Parameters::Hide<Parameters::UpdateEquationsScaling>();
179  Parameters::Hide<Parameters::UseUpdateStabilization>();
180  Parameters::Hide<Parameters::MatrixAddWellContributions>();
181  Parameters::Hide<Parameters::EnableTerminalOutput>();
182 
183  // if openMP is available, set the default the number of threads per process for the main
184  // simulation to 1 (instead of grabbing everything that is available).
185 #if _OPENMP
186  Parameters::SetDefault<Parameters::ThreadsPerProcess>(2);
187 #endif
188 
189  // By default, flowexp accepts the result of the time integration unconditionally if the
190  // smallest time step size is reached.
191  Parameters::SetDefault<Parameters::ContinueOnConvergenceError>(true);
192 
193  Parameters::SetDefault<Parameters::NewtonMaxIterations>(8);
194  Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-2);
195  Parameters::SetDefault<Parameters::EclNewtonRelaxedTolerance<Scalar>>(1e-1);
196  Parameters::SetDefault<Parameters::EclNewtonRelaxedVolumeFraction<Scalar>>(0.0);
197  Parameters::SetDefault<Parameters::EclNewtonSumTolerance<Scalar>>(1e-5);
198  Parameters::SetDefault<Parameters::EnableTerminalOutput>(false);
199 
200  // currently, flowexp uses the non-multisegment well model by default to avoid
201  // regressions. the --use-multisegment-well=true|false command line parameter is still
202  // available in flowexp, but hidden from view.
203  Parameters::SetDefault<Parameters::UseMultisegmentWell>(false);
204  Parameters::SetDefault<Parameters::MatrixAddWellContributions>(false);
205  }
206 
207  // inherit the constructors
209 };
210 
211 }
212 
213 #endif
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition: FlowProblemBlackoil.hpp:86
A newton solver.
Definition: FlowExpNewtonMethod.hpp:70
Definition: flowexp.hpp:58
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
Definition: FlowBaseProblemProperties.hpp:68
Specifies the type of the actual Newton method.
Definition: fvbaseproblem.hh:54
Class for handling the blackoil well model.
Definition: BlackoilModelProperties.hpp:32
This class solves the fully implicit black-oil system by solving the reduced system (after eliminatin...
Definition: FlowLinearSolverParameters.hpp:40
Class for handling the blackoil aquifer model.
Definition: BlackoilAquiferModel.hpp:49
FlowProblemBlackoil(Simulator &simulator)
Definition: FlowProblemBlackoil.hpp:189
void writeOutput(const bool verbose) override
Write the requested quantities of the current solution into the output files.
Definition: FlowProblemBlackoil.hpp:600
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
Base class for all problems which use a finite volume spatial discretization.
Solver parameters for the NonlinearSystemBlackOilReservoir.
Definition: BlackoilModelParameters.hpp:200
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition: FlowBaseProblemProperties.hpp:98
static void registerParameters()
Registers all available parameters for the problem and the model.
Definition: FlowProblemBlackoil.hpp:175
A newton solver.
Definition: fvbaseproperties.hh:59
Specify if experimental features should be enabled or not.
Definition: fvbaseproperties.hh:256
Enable surface volume scaling.
Definition: blackoilproperties.hh:59
The type of the problem.
Definition: fvbaseproperties.hh:87
The Opm property system, traits with inheritance.
Definition: flowexp.hpp:51
Definition: FlowLinearSolverParameters.hpp:51
Definition: blackoilmodel.hh:75
void writeOutput(bool verbose=true) override
Write the requested quantities of the current solution into the output files.
Definition: flowexp.hpp:135
Provides convenience routines to bring up the simulation at runtime.
The type of the linear solver to be used.
Definition: linalgproperties.hh:38
Definition: ISTLSolver.hpp:70
Specify whether to use volumetric residuals or not.
Definition: fvbaseproperties.hh:252