26#ifndef DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
27#define DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
30#include <dune/common/hybridutilities.hh>
43template <
class MDTraits>
46 template<std::
size_t id>
47 using SubDomainGridGeometry =
typename MDTraits::template SubDomain<id>::GridGeometry;
49 using GridGeometryTuple =
typename MDTraits::template TupleOfSharedPtrConst<SubDomainGridGeometry>;
51 using SolutionVector =
typename MDTraits::SolutionVector;
53 template<std::
size_t id>
54 using SubDomainSolutionVector =
typename MDTraits::template SubDomain<id>::SolutionVector;
56 template<std::
size_t id>
59 using ConvergenceWriterPtrTuple =
typename MDTraits::template TupleOfSharedPtr<SubDomainNewtonConvergenceWriter>;
68 const std::string& name =
"newton_convergence")
69 : gridGeometryTuple_(gridGeometryTuple)
71 using namespace Dune::Hybrid;
72 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
75 elementAt(convergenceWriterPtrTuple_,
id) = std::make_shared<ConvWriter>(*elementAt(gridGeometryTuple,
id), name +
"_domain_" + std::to_string(
id));
82 using namespace Dune::Hybrid;
83 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
85 elementAt(convergenceWriterPtrTuple_,
id)->resize();
91 void reset(std::size_t newId = 0UL)
93 using namespace Dune::Hybrid;
94 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
96 elementAt(convergenceWriterPtrTuple_,
id)->reset(newId);
100 void write(
const SolutionVector& uLastIter,
101 const SolutionVector& deltaU,
102 const SolutionVector& residual)
override
104 using namespace Dune::Hybrid;
105 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
107 constexpr auto i = std::decay_t<
decltype(id)>{};
108 elementAt(convergenceWriterPtrTuple_,
id)->write(uLastIter[i], deltaU[i], residual[i]);
113 GridGeometryTuple gridGeometryTuple_;
114 ConvergenceWriterPtrTuple convergenceWriterPtrTuple_;
Writes the intermediate solutions for every Newton iteration.
Definition: multidomain/newtonconvergencewriter.hh:45
void reset(std::size_t newId=0UL)
Definition: multidomain/newtonconvergencewriter.hh:91
MultiDomainNewtonConvergenceWriter(GridGeometryTuple &&gridGeometryTuple, const std::string &name="newton_convergence")
Constructor.
Definition: multidomain/newtonconvergencewriter.hh:67
void resize()
Resizes the output fields. This has to be called whenever the grid changes.
Definition: multidomain/newtonconvergencewriter.hh:80
void write(const SolutionVector &uLastIter, const SolutionVector &deltaU, const SolutionVector &residual) override
Definition: multidomain/newtonconvergencewriter.hh:100
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...