NonlinearSystemCompositional.hpp
Go to the documentation of this file.
1/*
2 Copyright 2026, SINTEF Digital
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 OPM_NONLINEAR_SYSTEM_COMPOSITIONAL_HEADER_INCLUDED
21#define OPM_NONLINEAR_SYSTEM_COMPOSITIONAL_HEADER_INCLUDED
22
23#include <dune/common/fvector.hh>
24#include <dune/istl/bvector.hh>
25
28
32
33#include <flowexperimental/comp/wells/CompWellModel.hpp>
34
35#include <filesystem>
36#include <vector>
37
38namespace Opm {
39
40template <class TypeTag>
42{
43public:
46 using Grid = typename ParentType::Grid;
48 using Indices = typename ParentType::Indices;
49 using Scalar = typename ParentType::Scalar;
53
54 static constexpr int numEq = Indices::numEq;
55
56 using VectorBlockType = Dune::FieldVector<Scalar, numEq>;
57 using BVector = Dune::BlockVector<VectorBlockType>;
58
61 CompWellModel<TypeTag>& wellModel,
62 bool terminalOutput);
63
65
67 int minIter,
68 int maxIter,
69 const SimulatorTimerInterface& timer) override;
70
71 template <class NonlinearSolverType>
73 NonlinearSolverType& nonlinearSolver);
74
75 template <class NonlinearSolverType>
77 NonlinearSolverType& nonlinearSolver);
78
79 Scalar relativeChange() const;
80
82 { return this->simulator_.model().newtonMethod().linearSolver().iterations(); }
83
85
86 bool hasNlddSolver() const
87 { return false; }
88
90 {
91 static const SimulatorReport emptyReport{};
92 return emptyReport;
93 }
94
95 const std::vector<SimulatorReport>& domainAccumulatedReports() const
96 {
97 static const std::vector<SimulatorReport> emptyReports{};
98 return emptyReports;
99 }
100
101 void writeNonlinearIterationsPerCell(const std::filesystem::path&) const {}
102
103 template<class T>
104 std::vector<std::vector<Scalar>> computeFluidInPlace(const T&, const std::vector<int>& fipnum) const
105 { return computeFluidInPlace(fipnum); }
106
107 std::vector<std::vector<Scalar>> computeFluidInPlace(const std::vector<int>&) const
108 { return {}; }
109
110 void writePartitions(const std::filesystem::path&) const {}
111
112private:
113 std::vector<Scalar> reservoirResidualMetrics() const;
114
115 double linear_solve_setup_time_ = 0.0;
116};
117
118} // namespace Opm
119
121
122#endif // OPM_NONLINEAR_SYSTEM_COMPOSITIONAL_HEADER_INCLUDED
Definition: ComponentName.hpp:34
Definition: NonlinearSystemCompositional.hpp:42
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: NonlinearSystemCompositional.hpp:51
SimulatorReportSingle nonlinearIteration(const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinearSolver)
Definition: NonlinearSystemCompositional_impl.hpp:151
SimulatorReportSingle prepareStep(const SimulatorTimerInterface &timer)
Definition: NonlinearSystemCompositional_impl.hpp:53
SimulatorReportSingle nonlinearIterationNewton(const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinearSolver)
Definition: NonlinearSystemCompositional_impl.hpp:171
static constexpr int numEq
Definition: NonlinearSystemCompositional.hpp:54
void initialLinearization(SimulatorReportSingle &report, int minIter, int maxIter, const SimulatorTimerInterface &timer) override
Definition: NonlinearSystemCompositional_impl.hpp:88
const SimulatorReport & localAccumulatedReports() const
Definition: NonlinearSystemCompositional.hpp:89
void solveJacobianSystem(BVector &x)
Definition: NonlinearSystemCompositional_impl.hpp:280
NonlinearSystemCompositional(Simulator &simulator, const ModelParameters &param, CompWellModel< TypeTag > &wellModel, bool terminalOutput)
Definition: NonlinearSystemCompositional_impl.hpp:41
Dune::BlockVector< VectorBlockType > BVector
Definition: NonlinearSystemCompositional.hpp:57
int linearIterationsLastSolve() const
Definition: NonlinearSystemCompositional.hpp:81
void writePartitions(const std::filesystem::path &) const
Definition: NonlinearSystemCompositional.hpp:110
bool hasNlddSolver() const
Definition: NonlinearSystemCompositional.hpp:86
void writeNonlinearIterationsPerCell(const std::filesystem::path &) const
Definition: NonlinearSystemCompositional.hpp:101
Dune::FieldVector< Scalar, numEq > VectorBlockType
Definition: NonlinearSystemCompositional.hpp:56
std::vector< std::vector< Scalar > > computeFluidInPlace(const T &, const std::vector< int > &fipnum) const
Definition: NonlinearSystemCompositional.hpp:104
Scalar relativeChange() const
Definition: NonlinearSystemCompositional_impl.hpp:251
std::vector< std::vector< Scalar > > computeFluidInPlace(const std::vector< int > &) const
Definition: NonlinearSystemCompositional.hpp:107
const std::vector< SimulatorReport > & domainAccumulatedReports() const
Definition: NonlinearSystemCompositional.hpp:95
Definition: NonlinearSystem.hpp:44
const Simulator & simulator() const
Definition: NonlinearSystem.hpp:63
WellModel & wellModel()
Definition: NonlinearSystem.hpp:87
const ModelParameters & param() const
Definition: NonlinearSystem.hpp:84
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: NonlinearSystem.hpp:49
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: NonlinearSystem.hpp:51
GetPropType< TypeTag, Properties::Grid > Grid
Definition: NonlinearSystem.hpp:48
Simulator & simulator_
Definition: NonlinearSystem.hpp:163
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: NonlinearSystem.hpp:47
GetPropType< TypeTag, Properties::Indices > Indices
Definition: NonlinearSystem.hpp:50
::Opm::ComponentName< FluidSystem, Indices > ComponentName
Definition: NonlinearSystem.hpp:55
Interface class for SimulatorTimer objects, to be improved.
Definition: SimulatorTimerInterface.hpp:34
Definition: blackoilbioeffectsmodules.hh:45
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
Solver parameters for the NonlinearSystemBlackOilReservoir.
Definition: BlackoilModelParameters.hpp:201
Definition: SimulatorReport.hpp:122
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34