15#ifndef DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
16#define DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
19#include <dune/common/hybridutilities.hh>
33template <
class MDTraits>
36 template<std::
size_t id>
37 using SubDomainGridGeometry =
typename MDTraits::template SubDomain<id>::GridGeometry;
39 using GridGeometryTuple =
typename MDTraits::template TupleOfSharedPtrConst<SubDomainGridGeometry>;
41 using SolutionVector =
typename MDTraits::SolutionVector;
42 using ResidualVector =
typename MDTraits::ResidualVector;
44 template<std::
size_t id>
45 using SubDomainSolutionVector =
typename MDTraits::template SubDomain<id>::SolutionVector;
46 template<std::
size_t id>
47 using SubDomainResidualVector =
typename MDTraits::template SubDomain<id>::ResidualVector;
49 template<std::
size_t id>
52 using ConvergenceWriterPtrTuple =
typename MDTraits::template TupleOfSharedPtr<SubDomainNewtonConvergenceWriter>;
61 const std::string& name =
"newton_convergence")
62 : gridGeometryTuple_(std::move(gridGeometryTuple))
64 using namespace Dune::Hybrid;
65 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
68 elementAt(convergenceWriterPtrTuple_,
id) = std::make_shared<ConvWriter>(*elementAt(gridGeometryTuple,
id), name +
"_domain_" + std::to_string(
id));
75 using namespace Dune::Hybrid;
76 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
78 elementAt(convergenceWriterPtrTuple_,
id)->resize();
84 void reset(std::size_t newId = 0UL)
86 using namespace Dune::Hybrid;
87 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
89 elementAt(convergenceWriterPtrTuple_,
id)->reset(newId);
93 void write(
const SolutionVector& uLastIter,
94 const ResidualVector& deltaU,
95 const ResidualVector& residual)
override
97 using namespace Dune::Hybrid;
98 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
100 constexpr auto i = std::decay_t<
decltype(id)>{};
101 elementAt(convergenceWriterPtrTuple_,
id)->write(uLastIter[i], deltaU[i], residual[i]);
106 GridGeometryTuple gridGeometryTuple_;
107 ConvergenceWriterPtrTuple convergenceWriterPtrTuple_;
Writes the intermediate solutions for every Newton iteration.
Definition: multidomain/newtonconvergencewriter.hh:35
void reset(std::size_t newId=0UL)
Definition: multidomain/newtonconvergencewriter.hh:84
void resize()
Resizes the output fields. This has to be called whenever the grid changes.
Definition: multidomain/newtonconvergencewriter.hh:73
void write(const SolutionVector &uLastIter, const ResidualVector &deltaU, const ResidualVector &residual) override
Definition: multidomain/newtonconvergencewriter.hh:93
MultiDomainNewtonConvergenceWriter(GridGeometryTuple gridGeometryTuple, const std::string &name="newton_convergence")
Constructor.
Definition: multidomain/newtonconvergencewriter.hh:60
Writes the intermediate solutions for every Newton iteration.
Definition: nonlinear/newtonconvergencewriter.hh:43
This class provides the infrastructure to write the convergence behaviour of the newton method into a...
Definition: nonlinear/newtonconvergencewriter.hh:27