25 #ifndef BLACK_OIL_MODEL_TPSA_HPP 26 #define BLACK_OIL_MODEL_TPSA_HPP 28 #include <opm/common/ErrorMacros.hpp> 29 #include <opm/common/OpmLog/OpmLog.hpp> 31 #include <opm/simulators/flow/BlackoilModel.hpp> 36 #include <fmt/format.h> 44 template <
class TypeTag>
66 const bool terminal_output)
81 template <
class NonlinearSolverType>
83 NonlinearSolverType& nonlinear_solver)
86 const auto& problem = this->simulator_.problem();
87 if (problem.fixedStressScheme()) {
90 else if (problem.laggedScheme()) {
94 std::string msg =
"Unknown Flow-TPSA coupling scheme!";
96 throw std::runtime_error(msg);
109 template <
class NonlinearSolverType>
111 NonlinearSolverType& nonlinear_solver)
114 const auto& [minSeqIter, maxSeqIter] = this->simulator_.problem().fixedStressParameters();
118 if (seqIter_ >= maxSeqIter) {
120 std::string msg = fmt::format(
"TPSA: Fixed-stress scheme reached max iterations (={})!", maxSeqIter);
121 OpmLog::warning(msg);
124 reportFlow.converged =
true;
132 this->simulator_.problem().geoMechModel().prepareTPSA();
141 const auto iteration = this->simulator_.problem().iterationContext().iteration();
142 if (reportFlow.converged && iteration >= this->param_.newton_min_iter_) {
151 && this->simulator_.problem().geoMechModel().newtonMethod().numLinearizations() == 1
152 && seqIter_ >= minSeqIter) {
154 std::string msg = fmt::format(
"TPSA: Fixed-stress scheme converged in {} iterations", seqIter_);
163 else if (!tpsaConv) {
167 throw std::runtime_error(
"TPSA: Fixed stress scheme update failed!");
171 reportFlow.converged =
false;
186 template <
class NonlinearSolverType>
188 NonlinearSolverType& nonlinear_solver)
194 const auto iteration = this->simulator_.problem().iterationContext().iteration();
195 if (reportFlow.converged && iteration >= this->param_.newton_min_iter_) {
197 this->simulator_.problem().geoMechModel().prepareTPSA();
204 throw std::runtime_error(
"TPSA: Lagged scheme update failed!");
221 return this->simulator_.problem().geoMechModel().newtonMethod().apply();
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
Class for handling the blackoil well model.
Definition: BlackoilModelProperties.hpp:32
const ModelParameters & param() const
Returns const reference to model parameters.
Definition: BlackoilModel.hpp:329
bool solveTpsaEquations()
Solve TPSA geomechanics equations.
Definition: BlackoilModelTPSA.hpp:218
SimulatorReportSingle nonlinearIteration(const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
Called once per nonlinear iteration.
Definition: BlackoilModel_impl.hpp:245
SimulatorReportSingle nonlinearIteration(const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
Perform a nonlinear iteration updating Flow and TPSA geomechanics.
Definition: BlackoilModelTPSA.hpp:82
SimulatorReportSingle nonlinearIterationLaggedTPSA(const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
Perform a nonlinear iteration updating Flow and TPSA geomechanics in a lagged scheme.
Definition: BlackoilModelTPSA.hpp:187
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:193
Black oil model for coupling Flow simulations with TPSA geomechanics.
Definition: BlackoilModelTPSA.hpp:45
BlackoilModelTPSA(Simulator &simulator, const ModelParameters ¶m, BlackoilWellModel< TypeTag > &well_model, const bool terminal_output)
Constructor.
Definition: BlackoilModelTPSA.hpp:63
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:33
Interface class for SimulatorTimer objects, to be improved.
Definition: SimulatorTimerInterface.hpp:33
SimulatorReportSingle nonlinearIterationFixedStressTPSA(const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
Perform a nonlinear iteration updating Flow and TPSA geomechanics in a fixed-stress, iterative loop.
Definition: BlackoilModelTPSA.hpp:110
A model implementation for three-phase black oil.
Definition: BlackoilModel.hpp:60