newtonmethod.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_NEWTON_METHOD_HH
28#define EWOMS_NEWTON_METHOD_HH
29
30#include <dune/common/classname.hh>
31#include <dune/common/parallel/mpihelper.hh>
32
33#include <dune/istl/istlexception.hh>
34
35#include <opm/common/Exceptions.hpp>
36
37#include <opm/material/densead/Math.hpp>
38
40
44
47
49
50#include <algorithm>
51#include <cmath>
52#include <cstddef>
53#include <exception>
54#include <iostream>
55#include <sstream>
56#include <string>
57
58#include <unistd.h>
59
60namespace Opm {
61
62// forward declaration of classes
63template <class TypeTag>
64class NewtonMethod;
65
66}
67
68namespace Opm::Properties {
69
70namespace TTag {
71
74struct NewtonMethod {};
75
76} // namespace TTag
77
78// set default values for the properties
79template<class TypeTag>
80struct NewtonMethod<TypeTag, TTag::NewtonMethod>
82
83template<class TypeTag>
86
87} // namespace Opm::Properties
88
89namespace Opm {
90
98template <class TypeTag>
100{
106
115
116 using Communicator = typename Dune::MPIHelper::MPICommunicator;
117 using CollectiveCommunication = typename Dune::Communication<typename Dune::MPIHelper::MPICommunicator>;
118
119public:
120 explicit NewtonMethod(Simulator& simulator)
121 : simulator_(simulator)
122 , endIterMsgStream_(std::ostringstream::out)
123 , error_(1e100)
124 , lastError_(1e100)
125 , linearSolver_(simulator)
126 , comm_(Dune::MPIHelper::getCommunicator())
127 , convergenceWriter_(asImp_())
128 {
129 params_.read();
130 }
131
135 static void registerParameters()
136 {
137 LinearSolverBackend::registerParameters();
139 }
140
148 {}
149
154 bool converged() const
155 { return error_ <= tolerance(); }
156
160 Problem& problem()
161 { return simulator_.problem(); }
162
166 const Problem& problem() const
167 { return simulator_.problem(); }
168
172 Model& model()
173 { return simulator_.model(); }
174
178 const Model& model() const
179 { return simulator_.model(); }
180
185 Scalar tolerance() const
186 { return params_.tolerance_; }
187
192 void setTolerance(Scalar value)
193 { params_.tolerance_ = value; }
194
202 void applyUpdate(SolutionVector& nextSolution,
203 const SolutionVector& currentSolution,
204 const GlobalEqVector& solutionUpdate,
205 const GlobalEqVector& currentResidual)
206 {
207 asImp_().update_(nextSolution, currentSolution, solutionUpdate, currentResidual);
208 }
209
216 bool apply()
217 {
218 const bool istty = isatty(fileno(stdout));
219
220 // Clear the current line using an ansi escape
221 // sequence. For an explanation see
222 // http://en.wikipedia.org/wiki/ANSI_escape_code
223 const char* clearRemainingLine = "\n";
224 if (istty) {
225 static const char ansiClear[] = { 0x1b, '[', 'K', '\r', 0 };
226 clearRemainingLine = ansiClear;
227 }
228
229 // make sure all timers are prestine
234
235 SolutionVector& nextSolution = model().solution(/*historyIdx=*/0);
236 SolutionVector currentSolution(nextSolution);
237 GlobalEqVector solutionUpdate(nextSolution.size());
238
239 Linearizer& linearizer = model().linearizer();
240
241 TimerGuard prePostProcessTimerGuard(prePostProcessTimer_);
242
243 // tell the implementation that we begin solving
245 asImp_().begin_(nextSolution);
247
248 try {
249 TimerGuard innerPrePostProcessTimerGuard(prePostProcessTimer_);
250 TimerGuard linearizeTimerGuard(linearizeTimer_);
251 TimerGuard updateTimerGuard(updateTimer_);
252 TimerGuard solveTimerGuard(solveTimer_);
253
254 // execute the method as long as the implementation thinks
255 // that we should do another iteration
256 while (asImp_().proceed_()) {
257 // linearize the problem at the current solution
258
259 // notify the implementation that we're about to start
260 // a new iteration
262 asImp_().beginIteration_();
264
265 // make the current solution to the old one
266 currentSolution = nextSolution;
267
268 if (asImp_().verbose_()) {
269 std::cout << "Linearize: r(x^k) = dS/dt + div F - q; M = grad r"
270 << clearRemainingLine
271 << std::flush;
272 }
273
274 // do the actual linearization
276 asImp_().linearizeDomain_();
277 asImp_().linearizeAuxiliaryEquations_();
279
281 auto& residual = linearizer.residual();
282 const auto& jacobian = linearizer.jacobian();
283 linearSolver_.prepare(jacobian, residual);
284 linearSolver_.setResidual(residual);
285 linearSolver_.getResidual(residual);
287
288 // The preSolve_() method usually computes the errors, but it can do
289 // something else in addition. TODO: should its costs be counted to
290 // the linearization or to the update?
292 asImp_().preSolve_(currentSolution, residual);
294
295 if (!asImp_().proceed_()) {
296 if (asImp_().verbose_() && istty) {
297 std::cout << clearRemainingLine << std::flush;
298 }
299
300 // tell the implementation that we're done with this iteration
302 asImp_().endIteration_(nextSolution, currentSolution);
304
305 break;
306 }
307
308 // solve the resulting linear equation system
309 if (asImp_().verbose_()) {
310 std::cout << "Solve: M deltax^k = r"
311 << clearRemainingLine
312 << std::flush;
313 }
314
316 // solve A x = b, where b is the residual, A is its Jacobian and x is the
317 // update of the solution
318 linearSolver_.setMatrix(jacobian);
319 solutionUpdate = 0.0;
320 const bool conv = linearSolver_.solve(solutionUpdate);
322
323 if (!conv) {
325 if (asImp_().verbose_()) {
326 std::cout << "Newton: Linear solver did not converge\n" << std::flush;
327 }
328
330 asImp_().failed_();
332
333 return false;
334 }
335
336 // update the solution
337 if (asImp_().verbose_()) {
338 std::cout << "Update: x^(k+1) = x^k - deltax^k"
339 << clearRemainingLine
340 << std::flush;
341 }
342
343 // update the current solution (i.e. uOld) with the delta
344 // (i.e. u). The result is stored in u
346 asImp_().postSolve_(currentSolution,
347 residual,
348 solutionUpdate);
349 asImp_().update_(nextSolution, currentSolution, solutionUpdate, residual);
351
352 if (asImp_().verbose_() && istty) {
353 // make sure that the line currently holding the cursor is prestine
354 std::cout << clearRemainingLine
355 << std::flush;
356 }
357
358 // tell the implementation that we're done with this iteration
360 asImp_().endIteration_(nextSolution, currentSolution);
362 }
363 }
364 catch (const Dune::Exception& e)
365 {
366 if (asImp_().verbose_()) {
367 std::cout << "Newton method caught exception: \""
368 << e.what() << "\"\n" << std::flush;
369 }
370
372 asImp_().failed_();
374
375 return false;
376 }
377 catch (const NumericalProblem& e)
378 {
379 if (asImp_().verbose_()) {
380 std::cout << "Newton method caught exception: \""
381 << e.what() << "\"\n" << std::flush;
382 }
383
385 asImp_().failed_();
387
388 return false;
389 }
390
391 // clear current line on terminal
392 if (asImp_().verbose_() && istty) {
393 std::cout << clearRemainingLine
394 << std::flush;
395 }
396
397 // tell the implementation that we're done
399 asImp_().end_();
401
402 // print the timing summary of the time step
403 if (asImp_().verbose_()) {
404 Scalar elapsedTot =
408 std::cout << "Linearization/solve/update time: "
410 << 100 * linearizeTimer_.realTimeElapsed() / elapsedTot << "%)/"
411 << solveTimer_.realTimeElapsed() << "("
412 << 100 * solveTimer_.realTimeElapsed() / elapsedTot << "%)/"
413 << updateTimer_.realTimeElapsed() << "("
414 << 100 * updateTimer_.realTimeElapsed() / elapsedTot << "%)"
415 << "\n" << std::flush;
416 }
417
418
419 // if we're not converged, tell the implementation that we've failed
420 if (!asImp_().converged()) {
422 asImp_().failed_();
424 return false;
425 }
426
427 // if we converged, tell the implementation that we've succeeded
429 asImp_().succeeded_();
431
432 return true;
433 }
434
443 Scalar suggestTimeStepSize(Scalar oldDt) const
444 {
445 // be aggressive reducing the time-step size but
446 // conservative when increasing it. the rationale is
447 // that we want to avoid failing in the next time
448 // integration which would be quite expensive
449 const int nit = problem().iterationContext().iteration();
450 if (lastSolveFailed_ || nit > params_.targetIterations_) {
451 const int overshoot = lastSolveFailed_ ? params_.targetIterations_ : nit - params_.targetIterations_;
452 Scalar percent = Scalar(overshoot) / params_.targetIterations_;
453 Scalar nextDt = std::max(problem().minTimeStepSize(),
454 oldDt / (Scalar{1.0} + percent));
455 return nextDt;
456 }
457
458 Scalar percent = Scalar(params_.targetIterations_ - nit) / params_.targetIterations_;
459 Scalar nextDt = std::max(problem().minTimeStepSize(),
460 oldDt*(Scalar{1.0} + percent / Scalar{1.2}));
461 return nextDt;
462 }
463
468 std::ostringstream& endIterMsg()
469 { return endIterMsgStream_; }
470
476 { linearSolver_.eraseMatrix(); }
477
481 LinearSolverBackend& linearSolver()
482 { return linearSolver_; }
483
487 const LinearSolverBackend& linearSolver() const
488 { return linearSolver_; }
489
491 { return prePostProcessTimer_; }
492
493 const Timer& linearizeTimer() const
494 { return linearizeTimer_; }
495
496 const Timer& solveTimer() const
497 { return solveTimer_; }
498
499 const Timer& updateTimer() const
500 { return updateTimer_; }
501
502protected:
506 bool verbose_() const
507 { return params_.verbose_ && (comm_.rank() == 0); }
508
515 void begin_(const SolutionVector&)
516 {
517 lastSolveFailed_ = false;
518
519 problem().resetIterationForNewTimestep();
520
521 if (params_.writeConvergence_) {
522 convergenceWriter_.beginTimeStep();
523 }
524 }
525
530 {
531 // start with a clean message stream
532 endIterMsgStream_.str("");
533 const auto& comm = simulator_.gridView().comm();
534 bool succeeded = true;
535 try {
536 problem().beginIteration();
537 }
538 catch (const std::exception& e) {
539 succeeded = false;
540
541 std::cout << "rank " << simulator_.gridView().comm().rank()
542 << " caught an exception while pre-processing the problem:" << e.what()
543 << "\n" << std::flush;
544 }
545
546 succeeded = comm.min(succeeded);
547
548 if (!succeeded) {
549 throw NumericalProblem("pre processing of the problem failed");
550 }
551
553 }
554
560 { model().linearizer().linearizeDomain(); }
561
563 {
564 model().linearizer().linearizeAuxiliaryEquations();
565 model().linearizer().finalize();
566 }
567
568 void preSolve_(const SolutionVector&,
569 const GlobalEqVector& currentResidual)
570 {
571 const auto& constraintsMap = model().linearizer().constraintsMap();
573 Scalar newtonMaxError = params_.maxError_;
574
575 // calculate the error as the maximum weighted tolerance of
576 // the solution's residual
577 error_ = 0;
578 for (unsigned dofIdx = 0; dofIdx < currentResidual.size(); ++dofIdx) {
579 // do not consider auxiliary DOFs for the error
580 if (dofIdx >= model().numGridDof() || model().dofTotalVolume(dofIdx) <= 0.0) {
581 continue;
582 }
583
584 // also do not consider DOFs which are constraint
585 if (enableConstraints_()) {
586 if (constraintsMap.count(dofIdx) > 0) {
587 continue;
588 }
589 }
590
591 const auto& r = currentResidual[dofIdx];
592 for (unsigned eqIdx = 0; eqIdx < r.size(); ++eqIdx) {
593 error_ = max(std::abs(r[eqIdx] * model().eqWeight(dofIdx, eqIdx)), error_);
594 }
595 }
596
597 // take the other processes into account
598 error_ = comm_.max(error_);
599
600 // make sure that the error never grows beyond the maximum
601 // allowed one
602 if (error_ > newtonMaxError) {
603 throw NumericalProblem("Newton: Error " + std::to_string(double(error_)) +
604 " is larger than maximum allowed error of " +
605 std::to_string(double(newtonMaxError)));
606 }
607 }
608
621 void postSolve_(const SolutionVector&,
622 const GlobalEqVector&,
623 GlobalEqVector& solutionUpdate)
624 {
625 // loop over the auxiliary modules and ask them to post process the solution
626 // vector.
627 const auto& comm = simulator_.gridView().comm();
628 for (unsigned i = 0; i < simulator_.model().numAuxiliaryModules(); ++i) {
629 bool succeeded = true;
630 try {
631 simulator_.model().auxiliaryModule(i)->postSolve(solutionUpdate);
632 }
633 catch (const std::exception& e) {
634 succeeded = false;
635
636 std::cout << "rank " << simulator_.gridView().comm().rank()
637 << " caught an exception while post processing an auxiliary module:" << e.what()
638 << "\n" << std::flush;
639 }
640
641 succeeded = comm.min(succeeded);
642
643 if (!succeeded) {
644 throw NumericalProblem("post processing of an auxilary equation failed");
645 }
646 }
647 }
648
663 void update_(SolutionVector& nextSolution,
664 const SolutionVector& currentSolution,
665 const GlobalEqVector& solutionUpdate,
666 const GlobalEqVector& currentResidual)
667 {
668 const auto& constraintsMap = model().linearizer().constraintsMap();
669
670 // first, write out the current solution to make convergence
671 // analysis possible
672 asImp_().writeConvergence_(currentSolution, solutionUpdate);
673
674 // make sure not to swallow non-finite values at this point
675 if (!std::isfinite(solutionUpdate.one_norm())) {
676 throw NumericalProblem("Non-finite update!");
677 }
678
679 std::size_t numGridDof = model().numGridDof();
680 for (unsigned dofIdx = 0; dofIdx < numGridDof; ++dofIdx) {
681 if (enableConstraints_()) {
682 if (constraintsMap.count(dofIdx) > 0) {
683 const auto& constraints = constraintsMap.at(dofIdx);
684 asImp_().updateConstraintDof_(dofIdx,
685 nextSolution[dofIdx],
686 constraints);
687 }
688 else {
689 asImp_().updatePrimaryVariables_(dofIdx,
690 nextSolution[dofIdx],
691 currentSolution[dofIdx],
692 solutionUpdate[dofIdx],
693 currentResidual[dofIdx]);
694 }
695 }
696 else {
697 asImp_().updatePrimaryVariables_(dofIdx,
698 nextSolution[dofIdx],
699 currentSolution[dofIdx],
700 solutionUpdate[dofIdx],
701 currentResidual[dofIdx]);
702 }
703 }
704
705 // update the DOFs of the auxiliary equations
706 std::size_t numDof = model().numTotalDof();
707 for (std::size_t dofIdx = numGridDof; dofIdx < numDof; ++dofIdx) {
708 nextSolution[dofIdx] = currentSolution[dofIdx];
709 nextSolution[dofIdx] -= solutionUpdate[dofIdx];
710 }
711 }
712
716 void updateConstraintDof_(unsigned,
717 PrimaryVariables& nextValue,
718 const Constraints& constraints)
719 { nextValue = constraints; }
720
725 PrimaryVariables& nextValue,
726 const PrimaryVariables& currentValue,
727 const EqVector& update,
728 const EqVector&)
729 {
730 nextValue = currentValue;
731 nextValue -= update;
732 }
733
740 void writeConvergence_(const SolutionVector& currentSolution,
741 const GlobalEqVector& solutionUpdate)
742 {
743 if (params_.writeConvergence_) {
744 convergenceWriter_.beginIteration();
745 convergenceWriter_.writeFields(currentSolution, solutionUpdate);
746 convergenceWriter_.endIteration();
747 }
748 }
749
756 void endIteration_(const SolutionVector&,
757 const SolutionVector&)
758 {
759 problem().advanceIteration();
760
761 const auto& comm = simulator_.gridView().comm();
762 bool succeeded = true;
763 try {
764 problem().endIteration();
765 }
766 catch (const std::exception& e) {
767 succeeded = false;
768
769 std::cout << "rank " << simulator_.gridView().comm().rank()
770 << " caught an exception while letting the problem post-process:" << e.what()
771 << "\n" << std::flush;
772 }
773
774 succeeded = comm.min(succeeded);
775
776 if (!succeeded) {
777 throw NumericalProblem("post processing of the problem failed");
778 }
779
780 if (asImp_().verbose_()) {
781 std::cout << "Newton iteration " << problem().iterationContext().iteration() << ""
782 << " error: " << error_
783 << endIterMsg().str() << "\n" << std::flush;
784 }
785 }
786
790 bool proceed_() const
791 {
792 if (problem().iterationContext().iteration() < 1) {
793 return true; // we always do at least one full iteration
794 }
795 else if (asImp_().converged()) {
796 // we are below the specified tolerance, so we don't have to
797 // do more iterations
798 return false;
799 }
800 else if (problem().iterationContext().iteration() >= params_.maxIterations_) {
801 // we have exceeded the allowed number of steps. If the
802 // error was reduced by a factor of at least 4,
803 // in the last iterations we proceed even if we are above
804 // the maximum number of steps
805 return error_ * 4.0 < lastError_;
806 }
807
808 return true;
809 }
810
815 void end_()
816 {
817 if (params_.writeConvergence_) {
818 convergenceWriter_.endTimeStep();
819 }
820 }
821
827 void failed_()
828 { lastSolveFailed_ = true; }
829
836 {}
837
838 static bool enableConstraints_()
839 { return getPropValue<TypeTag, Properties::EnableConstraints>(); }
840
841 Simulator& simulator_;
842
847
848 std::ostringstream endIterMsgStream_;
849
850 Scalar error_;
853
854 // Flags that the last solve failed, triggering a timestep reduction.
855 bool lastSolveFailed_ = false;
856 // the linear solver
857 LinearSolverBackend linearSolver_;
858
859 // the collective communication used by the simulation (i.e. fake
860 // or MPI)
861 CollectiveCommunication comm_;
862
863 // the object which writes the convergence behaviour of the Newton
864 // method to disk
865 ConvergenceWriter convergenceWriter_;
866
867private:
868 Implementation& asImp_()
869 { return *static_cast<Implementation *>(this); }
870
871 const Implementation& asImp_() const
872 { return *static_cast<const Implementation *>(this); }
873};
874
875} // namespace Opm
876
877#endif
The multi-dimensional Newton method.
Definition: newtonmethod.hh:100
bool verbose_() const
Returns true if the Newton method ought to be chatty.
Definition: newtonmethod.hh:506
Timer linearizeTimer_
Definition: newtonmethod.hh:844
void end_()
Indicates that we're done solving the non-linear system of equations.
Definition: newtonmethod.hh:815
const Timer & updateTimer() const
Definition: newtonmethod.hh:499
const Timer & linearizeTimer() const
Definition: newtonmethod.hh:493
Timer solveTimer_
Definition: newtonmethod.hh:845
const Timer & solveTimer() const
Definition: newtonmethod.hh:496
bool proceed_() const
Returns true iff another Newton iteration should be done.
Definition: newtonmethod.hh:790
static bool enableConstraints_()
Definition: newtonmethod.hh:838
const LinearSolverBackend & linearSolver() const
Returns the linear solver backend object for external use.
Definition: newtonmethod.hh:487
void updatePrimaryVariables_(unsigned, PrimaryVariables &nextValue, const PrimaryVariables &currentValue, const EqVector &update, const EqVector &)
Update a single primary variables object.
Definition: newtonmethod.hh:724
void setTolerance(Scalar value)
Set the current tolerance at which the Newton method considers itself to be converged.
Definition: newtonmethod.hh:192
std::ostringstream & endIterMsg()
Message that should be printed for the user after the end of an iteration.
Definition: newtonmethod.hh:468
static void registerParameters()
Register all run-time parameters for the Newton method.
Definition: newtonmethod.hh:135
Timer prePostProcessTimer_
Definition: newtonmethod.hh:843
void postSolve_(const SolutionVector &, const GlobalEqVector &, GlobalEqVector &solutionUpdate)
Update the error of the solution given the previous iteration.
Definition: newtonmethod.hh:621
const Timer & prePostProcessTimer() const
Definition: newtonmethod.hh:490
Scalar lastError_
Definition: newtonmethod.hh:851
bool apply()
Run the Newton method.
Definition: newtonmethod.hh:216
void writeConvergence_(const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate)
Write the convergence behaviour of the newton method to disk.
Definition: newtonmethod.hh:740
Scalar error_
Definition: newtonmethod.hh:850
bool lastSolveFailed_
Definition: newtonmethod.hh:855
void begin_(const SolutionVector &)
Called before the Newton method is applied to an non-linear system of equations.
Definition: newtonmethod.hh:515
void failed_()
Called if the Newton method broke down.
Definition: newtonmethod.hh:827
void update_(SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
Update the current solution with a delta vector.
Definition: newtonmethod.hh:663
void preSolve_(const SolutionVector &, const GlobalEqVector &currentResidual)
Definition: newtonmethod.hh:568
Timer updateTimer_
Definition: newtonmethod.hh:846
const Model & model() const
Returns a reference to the numeric model.
Definition: newtonmethod.hh:178
LinearSolverBackend linearSolver_
Definition: newtonmethod.hh:857
void succeeded_()
Called if the Newton method was successful.
Definition: newtonmethod.hh:835
Scalar tolerance() const
Return the current tolerance at which the Newton method considers itself to be converged.
Definition: newtonmethod.hh:185
LinearSolverBackend & linearSolver()
Returns the linear solver backend object for external use.
Definition: newtonmethod.hh:481
void linearizeDomain_()
Linearize the global non-linear system of equations associated with the spatial domain.
Definition: newtonmethod.hh:559
const Problem & problem() const
Returns a reference to the object describing the current physical problem.
Definition: newtonmethod.hh:166
Scalar suggestTimeStepSize(Scalar oldDt) const
Suggest a new time-step size based on the old time-step size.
Definition: newtonmethod.hh:443
bool converged() const
Returns true if the error of the solution is below the tolerance.
Definition: newtonmethod.hh:154
CollectiveCommunication comm_
Definition: newtonmethod.hh:861
Problem & problem()
Returns a reference to the object describing the current physical problem.
Definition: newtonmethod.hh:160
NewtonMethodParams< Scalar > params_
Definition: newtonmethod.hh:852
void eraseMatrix()
Causes the solve() method to discared the structure of the linear system of equations the next time i...
Definition: newtonmethod.hh:475
void applyUpdate(SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
Public wrapper for applying a Newton update to a solution vector.
Definition: newtonmethod.hh:202
void updateConstraintDof_(unsigned, PrimaryVariables &nextValue, const Constraints &constraints)
Update the primary variables for a degree of freedom which is constraint.
Definition: newtonmethod.hh:716
std::ostringstream endIterMsgStream_
Definition: newtonmethod.hh:848
ConvergenceWriter convergenceWriter_
Definition: newtonmethod.hh:865
NewtonMethod(Simulator &simulator)
Definition: newtonmethod.hh:120
void finishInit()
Finialize the construction of the object.
Definition: newtonmethod.hh:147
void linearizeAuxiliaryEquations_()
Definition: newtonmethod.hh:562
Model & model()
Returns a reference to the numeric model.
Definition: newtonmethod.hh:172
Simulator & simulator_
Definition: newtonmethod.hh:841
void beginIteration_()
Indicates the beginning of a Newton iteration.
Definition: newtonmethod.hh:529
void endIteration_(const SolutionVector &, const SolutionVector &)
Indicates that one Newton iteration was finished.
Definition: newtonmethod.hh:756
A convergence writer for the Newton method which does nothing.
Definition: nullconvergencewriter.hh:51
A simple class which makes sure that a timer gets stopped if an exception is thrown.
Definition: timerguard.hh:42
Provides an encapsulation to measure the system time.
Definition: timer.hpp:46
void start()
Start counting the time resources used by the simulation.
void halt()
Stop the measurement reset all timing values.
double realTimeElapsed() const
Return the real time [s] elapsed during the periods the timer was active since the last reset.
double stop()
Stop counting the time resources.
Declare the properties used by the infrastructure code of the finite volume discretizations.
Declares the properties required by the black oil model.
Definition: fvbaseprimaryvariables.hh:161
Definition: blackoilmodel.hh:75
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
std::string to_string(const ConvergenceReport::ReservoirFailure::Type t)
Struct holding the parameters for NewtonMethod.
Definition: newtonmethodparams.hpp:71
static void registerParameters()
Registers the parameters in parameter system.
Specifies the type of the class which writes out the Newton convergence.
Definition: newtonmethodproperties.hh:40
Specifies the type of the actual Newton method.
Definition: newtonmethodproperties.hh:32
Definition: newtonmethod.hh:74