fvbasenewtonmethod.hh
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 EWOMS_FV_BASE_NEWTON_METHOD_HH
29#define EWOMS_FV_BASE_NEWTON_METHOD_HH
30
32
35
36namespace Opm {
37
38template <class TypeTag>
39class FvBaseNewtonMethod;
40
41template <class TypeTag>
42class FvBaseNewtonConvergenceWriter;
43} // namespace Opm
44
45namespace Opm::Properties {
46
48// Create new type tags
49namespace TTag {
50struct FvBaseNewtonMethod { using InheritsFrom = std::tuple<NewtonMethod>; };
51} // end namespace TTag
52
54template<class TypeTag, class MyTypeTag>
56
57// set default values
58template<class TypeTag>
61
62template<class TypeTag>
63struct NewtonMethod<TypeTag, TTag::FvBaseNewtonMethod>
65
66template<class TypeTag>
69
70} // namespace Opm::Properties
71
72namespace Opm {
73
82template <class TypeTag>
83class FvBaseNewtonMethod : public NewtonMethod<TypeTag>
84{
87
96
97
98public:
99 FvBaseNewtonMethod(Simulator& simulator)
100 : ParentType(simulator)
101 { }
102
103protected:
104 friend class NewtonMethod<TypeTag>;
105
123 void update_(SolutionVector& nextSolution,
124 const SolutionVector& currentSolution,
125 const GlobalEqVector& solutionUpdate,
126 const GlobalEqVector& currentResidual)
127 {
128 ParentType::update_(nextSolution, currentSolution, solutionUpdate, currentResidual);
129
130 // make sure that the intensive quantities get recalculated at the next
131 // linearization
132 if (model_().storeIntensiveQuantities()) {
133 for (unsigned dofIdx = 0; dofIdx < model_().numGridDof(); ++dofIdx)
134 model_().setIntensiveQuantitiesCacheEntryValidity(dofIdx,
135 /*timeIdx=*/0,
136 /*valid=*/false);
137 }
138 }
139
144 {
145 model_().syncOverlap();
146
148 }
149
153 Model& model_()
154 { return ParentType::model(); }
155
159 const Model& model_() const
160 { return ParentType::model(); }
161
162private:
163 Implementation& asImp_()
164 { return *static_cast<Implementation*>(this); }
165
166 const Implementation& asImp_() const
167 { return *static_cast<const Implementation*>(this); }
168};
169} // namespace Opm
170
171#endif
Writes the intermediate solutions during the Newton scheme for models using a finite volume discretiz...
Definition: fvbasenewtonconvergencewriter.hh:61
A Newton method for models using a finite volume discretization.
Definition: fvbasenewtonmethod.hh:84
void beginIteration_()
Indicates the beginning of a Newton iteration.
Definition: fvbasenewtonmethod.hh:143
FvBaseNewtonMethod(Simulator &simulator)
Definition: fvbasenewtonmethod.hh:99
Model & model_()
Returns a reference to the model.
Definition: fvbasenewtonmethod.hh:153
void update_(SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
Update the current solution with a delta vector.
Definition: fvbasenewtonmethod.hh:123
const Model & model_() const
Returns a reference to the model.
Definition: fvbasenewtonmethod.hh:159
The multi-dimensional Newton method.
Definition: newtonmethod.hh:92
void update_(SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
Update the current solution with a delta vector.
Definition: newtonmethod.hh:665
Model & model()
Returns a reference to the numeric model.
Definition: newtonmethod.hh:182
void beginIteration_()
Indicates the beginning of a Newton iteration.
Definition: newtonmethod.hh:532
Definition: blackoilmodel.hh:72
Definition: blackoilboundaryratevector.hh:37
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:235
The Opm property system, traits with inheritance.
The discretization specific part of he implementing the Newton algorithm.
Definition: fvbasenewtonmethod.hh:55
Specifies the type of the class which writes out the Newton convergence.
Definition: newtonmethodproperties.hh:40
GetPropType< TypeTag, Properties::DiscNewtonMethod > type
Definition: fvbasenewtonmethod.hh:64
Specifies the type of the actual Newton method.
Definition: newtonmethodproperties.hh:32
Definition: fvbasenewtonmethod.hh:50
std::tuple< NewtonMethod > InheritsFrom
Definition: fvbasenewtonmethod.hh:50
a tag to mark properties as undefined
Definition: propertysystem.hh:40