opm-simulators
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 
34 
35 namespace Opm {
36 
37 template <class TypeTag>
39 
40 template <class TypeTag>
42 
43 } // namespace Opm
44 
45 namespace Opm::Properties {
46 
48 // Create new type tags
49 namespace TTag {
50 struct FvBaseNewtonMethod { using InheritsFrom = std::tuple<NewtonMethod>; };
51 } // end namespace TTag
52 
54 template<class TypeTag, class MyTypeTag>
55 struct DiscNewtonMethod { using type = UndefinedProperty; };
56 
57 // set default values
58 template<class TypeTag>
59 struct DiscNewtonMethod<TypeTag, TTag::FvBaseNewtonMethod>
61 
62 template<class TypeTag>
63 struct NewtonMethod<TypeTag, TTag::FvBaseNewtonMethod>
65 
66 template<class TypeTag>
69 
70 } // namespace Opm::Properties
71 
72 namespace Opm {
73 
82 template <class TypeTag>
83 class FvBaseNewtonMethod : public NewtonMethod<TypeTag>
84 {
85  using ParentType = NewtonMethod<TypeTag>;
87 
96 
97 public:
98  explicit FvBaseNewtonMethod(Simulator& simulator)
99  : ParentType(simulator)
100  {}
101 
102 protected:
103  friend class NewtonMethod<TypeTag>;
104 
122  void update_(SolutionVector& nextSolution,
123  const SolutionVector& currentSolution,
124  const GlobalEqVector& solutionUpdate,
125  const GlobalEqVector& currentResidual)
126  {
127  ParentType::update_(nextSolution, currentSolution, solutionUpdate, currentResidual);
128 
129  // make sure that the intensive quantities get recalculated at the next
130  // linearization
131  if (model_().storeIntensiveQuantities()) {
132  for (unsigned dofIdx = 0; dofIdx < model_().numGridDof(); ++dofIdx) {
133  model_().setIntensiveQuantitiesCacheEntryValidity(dofIdx,
134  /*timeIdx=*/0,
135  /*valid=*/false);
136  }
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 
162 private:
163  Implementation& asImp_()
164  { return *static_cast<Implementation*>(this); }
165 
166  const Implementation& asImp_() const
167  { return *static_cast<const Implementation*>(this); }
168 };
169 
170 } // namespace Opm
171 
172 #endif
void beginIteration_()
Indicates the beginning of a Newton iteration.
Definition: newtonmethod.hh:514
The multi-dimensional Newton method.
The discretization specific part of he implementing the Newton algorithm.
Definition: blackoilnewtonmethod.hpp:48
The multi-dimensional Newton method.
Definition: newtonmethod.hh:64
const Model & model_() const
Returns a reference to the model.
Definition: fvbasenewtonmethod.hh:159
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
A Newton method for models using a finite volume discretization.
Definition: fvbasenewtonmethod.hh:38
Specifies the type of the actual Newton method.
Definition: fvbaseproblem.hh:54
void beginIteration_()
Indicates the beginning of a Newton iteration.
Definition: fvbasenewtonmethod.hh:143
Model & model()
Returns a reference to the numeric model.
Definition: newtonmethod.hh:172
a tag to mark properties as undefined
Definition: propertysystem.hh:38
Writes the intermediate solutions during the Newton scheme for models using a finite volume discretiz...
Definition: fvbasenewtonconvergencewriter.hh:63
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: fvbasenewtonmethod.hh:50
Specifies the type of the class which writes out the Newton convergence.
Definition: newtonmethodproperties.hh:40
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:122
void update_(SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
Update the current solution with a delta vector.
Definition: newtonmethod.hh:648
The Opm property system, traits with inheritance.
Writes the intermediate solutions during the Newton scheme for models using a finite volume discretiz...
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:83
Definition: blackoilmodel.hh:80