opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
convergencecriterion.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
*/
27
#ifndef EWOMS_ISTL_CONVERGENCE_CRITERION_HH
28
#define EWOMS_ISTL_CONVERGENCE_CRITERION_HH
29
30
#include <dune/common/version.hh>
31
#include <dune/common/fvector.hh>
32
33
#include <cmath>
34
#include <iostream>
35
#include <iomanip>
36
37
namespace
Opm
{
38
namespace
Linear {
39
43
49
54
template
<
class
Vector>
55
class
ConvergenceCriterion
56
{
58
using
real_type =
typename
Dune::FieldTraits<typename Vector::field_type>::real_type;
59
60
using
Scalar = real_type;
61
62
public
:
69
virtual
~ConvergenceCriterion
()
70
{}
71
85
virtual
void
setInitial
(
const
Vector& curSol,
const
Vector& curResid) = 0;
86
103
virtual
void
update
(
const
Vector& curSol,
const
Vector& changeIndicator,
const
Vector& curResid) = 0;
104
109
virtual
bool
converged
()
const
= 0;
110
115
virtual
bool
failed
()
const
116
{
return
false
; }
117
123
virtual
Scalar
accuracy
()
const
= 0;
124
135
virtual
void
printInitial
(std::ostream& = std::cout)
const
136
{}
137
146
virtual
void
print
(Scalar, std::ostream& = std::cout)
const
147
{}
148
};
149
151
152
}}
// end namespace Linear, Opm
153
154
#endif
Opm::Linear::ConvergenceCriterion
Base class for all convergence criteria which only defines an virtual API.
Definition
convergencecriterion.hh:56
Opm::Linear::ConvergenceCriterion::setInitial
virtual void setInitial(const Vector &curSol, const Vector &curResid)=0
Set the initial solution of the linear system of equations.
Opm::Linear::ConvergenceCriterion::update
virtual void update(const Vector &curSol, const Vector &changeIndicator, const Vector &curResid)=0
Update the internal members of the convergence criterion with the current solution.
Opm::Linear::ConvergenceCriterion::accuracy
virtual Scalar accuracy() const =0
Returns the accuracy of the solution at the last update.
Opm::Linear::ConvergenceCriterion::failed
virtual bool failed() const
Returns true if the convergence criterion cannot be met anymore because the solver has broken down.
Definition
convergencecriterion.hh:115
Opm::Linear::ConvergenceCriterion::~ConvergenceCriterion
virtual ~ConvergenceCriterion()
Destructor.
Definition
convergencecriterion.hh:69
Opm::Linear::ConvergenceCriterion::converged
virtual bool converged() const =0
Returns true if and only if the convergence criterion is met.
Opm::Linear::ConvergenceCriterion::printInitial
virtual void printInitial(std::ostream &=std::cout) const
Prints the initial information about the convergence behaviour.
Definition
convergencecriterion.hh:135
Opm::Linear::ConvergenceCriterion::print
virtual void print(Scalar, std::ostream &=std::cout) const
Prints the information about the convergence behaviour for the current iteration.
Definition
convergencecriterion.hh:146
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
opm
simulators
linalg
convergencecriterion.hh
Generated by
1.17.0