3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
common/pdesolver.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_COMMON_PDESOLVER_HH
25#define DUMUX_COMMON_PDESOLVER_HH
26
27#include <memory>
28
30
31namespace Dumux {
32
44template<class Assembler, class LinearSolver>
46{
47 using SolutionVector = typename Assembler::ResidualType;
48 using Scalar = typename Assembler::Scalar;
50
51public:
52 PDESolver(std::shared_ptr<Assembler> assembler,
53 std::shared_ptr<LinearSolver> linearSolver)
54 : assembler_(assembler)
55 , linearSolver_(linearSolver)
56 {}
57
58 virtual ~PDESolver() = default;
59
64 virtual void solve(SolutionVector& sol) = 0;
65
73 virtual void solve(SolutionVector& sol, TimeLoop& timeLoop)
74 {
75 // per default we just forward to the method without time step control
76 solve(sol);
77 }
78
79protected:
83 const Assembler& assembler() const
84 { return *assembler_; }
85
89 Assembler& assembler()
90 { return *assembler_; }
91
96 { return *linearSolver_; }
97
102 { return *linearSolver_; }
103
104private:
105 std::shared_ptr<Assembler> assembler_;
106 std::shared_ptr<LinearSolver> linearSolver_;
107};
108
109} // namespace Dumux
110
111#endif
Manages the handling of time dependent problems.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
A high-level interface for a PDESolver.
Definition: common/pdesolver.hh:46
virtual ~PDESolver()=default
virtual void solve(SolutionVector &sol, TimeLoop &timeLoop)
Solve the given PDE system with time step control.
Definition: common/pdesolver.hh:73
LinearSolver & linearSolver()
Access the linear solver.
Definition: common/pdesolver.hh:101
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:83
const LinearSolver & linearSolver() const
Access the linear solver.
Definition: common/pdesolver.hh:95
virtual void solve(SolutionVector &sol)=0
Solve the given PDE system (usually assemble + solve linear system + update)
Assembler & assembler()
Access the assembler.
Definition: common/pdesolver.hh:89
PDESolver(std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver)
Definition: common/pdesolver.hh:52
Manages the handling of time dependent problems.
Definition: timeloop.hh:65
Base class for linear solvers.
Definition: dumux/linear/solver.hh:37