24#ifndef DUMUX_COMMON_PDESOLVER_HH
25#define DUMUX_COMMON_PDESOLVER_HH
30#include <dune/common/hybridutilities.hh>
31#include <dune/common/std/type_traits.hh>
37template <
class FirstRow,
class ... Args>
44template<
class Assembler>
47template<
class Assembler>
48inline constexpr bool exportsVariables = Dune::Std::is_detected_v<AssemblerVariablesType, Assembler>;
54template<
class Assembler>
70template<
class A,
class LS>
73 using Scalar =
typename A::Scalar;
122 {
return *assembler_; }
128 {
return *assembler_; }
134 {
return *linearSolver_; }
142 {
return *linearSolver_; }
147 template <
class FirstRow,
class ... Args>
150 bool matrixHasCorrectSize =
true;
151 using namespace Dune::Hybrid;
154 const auto& row = matrix[i];
155 const auto numRowsLeftMostBlock = row[Dune::index_constant<0>{}].N();
156 forEach(row, [&](
const auto& subBlock)
158 if (subBlock.N() != numRowsLeftMostBlock)
159 matrixHasCorrectSize =
false;
162 return matrixHasCorrectSize;
166 std::shared_ptr<Assembler> assembler_;
167 std::shared_ptr<LinearSolver> linearSolver_;
constexpr bool exportsVariables
Definition: common/pdesolver.hh:48
typename Assembler::Variables AssemblerVariablesType
Definition: common/pdesolver.hh:45
typename VariablesChooser< Assembler >::Type AssemblerVariables
Definition: common/pdesolver.hh:55
Definition: common/pdesolver.hh:36
Definition: common/pdesolver.hh:38
Definition: common/pdesolver.hh:50
AssemblerVariablesType< A > Type
Definition: common/pdesolver.hh:51
typename A::ResidualType Type
Definition: common/pdesolver.hh:52
A high-level interface for a PDESolver.
Definition: common/pdesolver.hh:72
LS LinearSolver
Definition: common/pdesolver.hh:79
Detail::AssemblerVariables< Assembler > Variables
export the type of variables that represent a numerical solution
Definition: common/pdesolver.hh:82
virtual void solve(Variables &vars, TimeLoop &timeLoop)
Solve the given PDE system with time step control.
Definition: common/pdesolver.hh:112
A Assembler
export the assembler and linear solver types
Definition: common/pdesolver.hh:78
bool checkSizesOfSubMatrices(const Dune::MultiTypeBlockMatrix< FirstRow, Args... > &matrix) const
Helper function to assure the MultiTypeBlockMatrix's sub-blocks have the correct sizes.
Definition: common/pdesolver.hh:148
const LinearSolver & linearSolver() const
Access the linear solver.
Definition: common/pdesolver.hh:133
virtual void solve(Variables &vars)=0
Solve the given PDE system (usually assemble + solve linear system + update)
Assembler & assembler()
Access the assembler.
Definition: common/pdesolver.hh:127
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:121
PDESolver(std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver)
Constructor.
Definition: common/pdesolver.hh:89
LinearSolver & linearSolver()
Access the linear solver.
Definition: common/pdesolver.hh:141
virtual ~PDESolver()=default
Manages the handling of time dependent problems.
Definition: common/timeloop.hh:69
Manages the handling of time dependent problems.