27#ifndef DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
28#define DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
31#include <dune/common/hybridutilities.hh>
45template <
class MDTraits>
48 template<std::
size_t id>
49 using SubDomainGridGeometry =
typename MDTraits::template SubDomain<id>::GridGeometry;
51 using GridGeometryTuple =
typename MDTraits::template TupleOfSharedPtrConst<SubDomainGridGeometry>;
53 using SolutionVector =
typename MDTraits::SolutionVector;
55 template<std::
size_t id>
56 using SubDomainSolutionVector =
typename MDTraits::template SubDomain<id>::SolutionVector;
58 template<std::
size_t id>
61 using ConvergenceWriterPtrTuple =
typename MDTraits::template TupleOfSharedPtr<SubDomainNewtonConvergenceWriter>;
70 const std::string& name =
"newton_convergence")
71 : gridGeometryTuple_(std::move(gridGeometryTuple))
73 using namespace Dune::Hybrid;
74 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
77 elementAt(convergenceWriterPtrTuple_,
id) = std::make_shared<ConvWriter>(*elementAt(gridGeometryTuple,
id), name +
"_domain_" + std::to_string(
id));
84 using namespace Dune::Hybrid;
85 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
87 elementAt(convergenceWriterPtrTuple_,
id)->resize();
93 void reset(std::size_t newId = 0UL)
95 using namespace Dune::Hybrid;
96 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
98 elementAt(convergenceWriterPtrTuple_,
id)->reset(newId);
102 void write(
const SolutionVector& uLastIter,
103 const SolutionVector& deltaU,
104 const SolutionVector& residual)
override
106 using namespace Dune::Hybrid;
107 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
109 constexpr auto i = std::decay_t<
decltype(id)>{};
110 elementAt(convergenceWriterPtrTuple_,
id)->write(uLastIter[i], deltaU[i], residual[i]);
115 GridGeometryTuple gridGeometryTuple_;
116 ConvergenceWriterPtrTuple convergenceWriterPtrTuple_;
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Writes the intermediate solutions for every Newton iteration.
Definition: multidomain/newtonconvergencewriter.hh:47
void reset(std::size_t newId=0UL)
Definition: multidomain/newtonconvergencewriter.hh:93
void resize()
Resizes the output fields. This has to be called whenever the grid changes.
Definition: multidomain/newtonconvergencewriter.hh:82
void write(const SolutionVector &uLastIter, const SolutionVector &deltaU, const SolutionVector &residual) override
Definition: multidomain/newtonconvergencewriter.hh:102
MultiDomainNewtonConvergenceWriter(GridGeometryTuple gridGeometryTuple, const std::string &name="newton_convergence")
Constructor.
Definition: multidomain/newtonconvergencewriter.hh:69
Definition: nonlinear/newtonconvergencewriter.hh:39
Writes the intermediate solutions for every Newton iteration.
Definition: nonlinear/newtonconvergencewriter.hh:55
This class provides the infrastructure to write the convergence behaviour of the newton method into a...