15#ifndef DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
16#define DUMUX_MULTIDOMAIN_NEWTON_CONVERGENCE_WRITER_HH
19#include <dune/common/hybridutilities.hh>
31template <
class MDTraits>
34 template<std::
size_t id>
35 using SubDomainGridGeometry =
typename MDTraits::template SubDomain<id>::GridGeometry;
37 using GridGeometryPtrTuple =
typename MDTraits::template TupleOfSharedPtrConst<SubDomainGridGeometry>;
39 using SolutionVector =
typename MDTraits::SolutionVector;
40 using ResidualVector =
typename MDTraits::ResidualVector;
42 template<std::
size_t id>
43 using SubDomainSolutionVector =
typename MDTraits::template SubDomain<id>::SolutionVector;
44 template<std::
size_t id>
45 using SubDomainResidualVector =
typename MDTraits::template SubDomain<id>::ResidualVector;
47 template<std::
size_t id>
50 using ConvergenceWriterPtrTuple =
typename MDTraits::template TupleOfSharedPtr<SubDomainNewtonConvergenceWriter>;
59 const std::string& name =
"newton_convergence")
60 : gridGeometryPtrTuple_(std::move(gridGeometryPtrTuple))
62 using namespace Dune::Hybrid;
63 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
66 elementAt(convergenceWriterPtrTuple_,
id) = std::make_shared<ConvWriter>(*elementAt(gridGeometryPtrTuple_,
id), name +
"_domain_" + std::to_string(
id));
73 using namespace Dune::Hybrid;
74 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
76 elementAt(convergenceWriterPtrTuple_,
id)->resize();
82 void reset(std::size_t newId = 0UL)
84 using namespace Dune::Hybrid;
85 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
87 elementAt(convergenceWriterPtrTuple_,
id)->reset(newId);
91 void write(
const SolutionVector& uLastIter,
92 const ResidualVector& deltaU,
93 const ResidualVector& residual)
override
95 using namespace Dune::Hybrid;
96 forEach(std::make_index_sequence<MDTraits::numSubDomains>{}, [&](
auto&& id)
98 constexpr auto i = std::decay_t<
decltype(id)>{};
99 elementAt(convergenceWriterPtrTuple_,
id)->write(uLastIter[i], deltaU[i], residual[i]);
104 GridGeometryPtrTuple gridGeometryPtrTuple_;
105 ConvergenceWriterPtrTuple convergenceWriterPtrTuple_;
Writes the intermediate solutions for every Newton iteration.
Definition: multidomain/newtonconvergencewriter.hh:33
void reset(std::size_t newId=0UL)
Definition: multidomain/newtonconvergencewriter.hh:82
void resize()
Resizes the output fields. This has to be called whenever the grid changes.
Definition: multidomain/newtonconvergencewriter.hh:71
void write(const SolutionVector &uLastIter, const ResidualVector &deltaU, const ResidualVector &residual) override
Definition: multidomain/newtonconvergencewriter.hh:91
MultiDomainNewtonConvergenceWriter(GridGeometryPtrTuple gridGeometryPtrTuple, const std::string &name="newton_convergence")
Constructor.
Definition: multidomain/newtonconvergencewriter.hh:58
Writes the intermediate solutions for every Newton iteration.
Definition: nonlinear/newtonconvergencewriter.hh:46
This class provides the infrastructure to write the convergence behaviour of the newton method into a...
A convergence writer interface Provide an interface that show the minimal requirements a convergence ...
Definition: nonlinear/newtonconvergencewriter.hh:32