Commit 67ca3baa authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[md][couplingmanager] Store prevSol in base coupling manager and check for assembly

parent fd2985e8
......@@ -41,7 +41,7 @@ namespace Dumux {
* \ingroup MultiDomain
* \brief The interface of the coupling manager for multi domain problems
*/
template<class Traits>
template<class Traits, bool implicitAssembly = true>
class CouplingManager
{
template<std::size_t id> using SubDomainTypeTag = typename Traits::template SubDomain<id>::TypeTag;
......@@ -60,6 +60,12 @@ public:
//! the type of the solution vector
using SolutionVector = typename Traits::SolutionVector;
/*!
* \brief Returns true if the coupling manager considers implicit assembly.
*/
static constexpr bool useImplicitAssembly()
{ return implicitAssembly; }
/*!
* \name member functions concerning the coupling stencils
*/
......@@ -186,6 +192,12 @@ public:
void updateSolution(const SolutionVector& curSol)
{ curSol_ = curSol; }
/*!
* \brief Sets a pointer to the previous solution vector
*/
void setPrevSol(const SolutionVector& prevSol)
{ prevSol_ = &prevSol; }
// \}
/*!
......@@ -285,6 +297,17 @@ protected:
const SolutionVector& curSol() const
{ return curSol_; }
/*!
* \brief the previous solution vector of the coupled problem
*/
const SolutionVector& prevSol() const
{
if (prevSol_)
return *prevSol_;
else
DUNE_THROW(Dune::InvalidStateException, "The prevSol pointer was not set. Use setPrevSol() before calling this function");
}
private:
/*!
* \brief the solution vector of the coupled problem
......@@ -292,6 +315,11 @@ private:
*/
SolutionVector curSol_;
/*!
* \brief a pointer to the solution vector of the previous time step of the coupled problem
*/
const SolutionVector* prevSol_;
/*!
* \brief A tuple of std::weak_ptrs to the sub problems
* \note these are weak pointers and not shared pointers to break the cyclic dependency between coupling manager and problems
......
......@@ -129,6 +129,8 @@ private:
template<std::size_t id>
using SubDomainAssembler = typename SubDomainAssemblerType<FVGridGeometry<id>::discMethod, id>::type;
static_assert(isImplicit() == CouplingManager::useImplicitAssembly(), "The FVAssembler and the CouplingManager need to be set for the same type of assembly (implicit/explicit)");
public:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment