3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly > Class Template Reference

A linear system assembler (residual and Jacobian) for finite volume schemes (box, tpfa, mpfa, ...) with multiple domains. More...

#include <dumux/multidomain/fvassembler.hh>

Inheritance diagram for Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >:
Inheritance graph

Description

template<class MDTraits, class CMType, DiffMethod diffMethod, bool useImplicitAssembly = true>
class Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >

A linear system assembler (residual and Jacobian) for finite volume schemes (box, tpfa, mpfa, ...) with multiple domains.

Template Parameters
MDTraitsthe multidimension traits
diffMethodthe differentiation method to residual compute derivatives
useImplicitAssemblyif to use an implicit or explicit time discretization

Public Types

using Traits = MDTraits
 
using Scalar = typename MDTraits::Scalar
 
template<std::size_t id>
using LocalResidual = GetPropType< SubDomainTypeTag< id >, Properties::LocalResidual >
 TODO get rid of this GetPropType. More...
 
template<std::size_t id>
using GridVariables = typename MDTraits::template SubDomain< id >::GridVariables
 
template<std::size_t id>
using GridGeometry = typename MDTraits::template SubDomain< id >::GridGeometry
 
template<std::size_t id>
using FVGridGeometry = GridGeometry< id >
 
template<std::size_t id>
using Problem = typename MDTraits::template SubDomain< id >::Problem
 
using JacobianMatrix = typename MDTraits::JacobianMatrix
 
using SolutionVector = typename MDTraits::SolutionVector
 
using ResidualType = SolutionVector
 
using CouplingManager = CMType
 

Public Member Functions

 MultiDomainFVAssembler (ProblemTuple &&problem, GridGeometryTuple &&gridGeometry, GridVariablesTuple &&gridVariables, std::shared_ptr< CouplingManager > couplingManager)
 The constructor for stationary problems. More...
 
 MultiDomainFVAssembler (ProblemTuple &&problem, GridGeometryTuple &&gridGeometry, GridVariablesTuple &&gridVariables, std::shared_ptr< CouplingManager > couplingManager, std::shared_ptr< const TimeLoop > timeLoop)
 The constructor for instationary problems. More...
 
 MultiDomainFVAssembler (ProblemTuple &&problem, GridGeometryTuple &&gridGeometry, GridVariablesTuple &&gridVariables, std::shared_ptr< CouplingManager > couplingManager, std::shared_ptr< const TimeLoop > timeLoop, const SolutionVector &prevSol)
 The constructor for instationary problems. More...
 
void assembleJacobianAndResidual (const SolutionVector &curSol)
 Assembles the global Jacobian of the residual and the residual for the current solution. More...
 
void assembleResidual (const SolutionVector &curSol)
 compute the residuals using the internal residual More...
 
void assembleResidual (ResidualType &r, const SolutionVector &curSol)
 assemble a residual r More...
 
Scalar residualNorm (const SolutionVector &curSol)
 
void setLinearSystem (std::shared_ptr< JacobianMatrix > A, std::shared_ptr< SolutionVector > r)
 Tells the assembler which jacobian and residual to use. This also resizes the containers to the required sizes and sets the sparsity pattern of the jacobian matrix. More...
 
void setLinearSystem ()
 The version without arguments uses the default constructor to create the jacobian and residual objects in this assembler if you don't need them outside this class. More...
 
void setJacobianBuildMode (JacobianMatrix &jac) const
 Sets the jacobian build mode. More...
 
void setJacobianPattern (JacobianMatrix &jac) const
 Sets the jacobian sparsity pattern. More...
 
void setResidualSize (SolutionVector &res) const
 Resizes the residual. More...
 
void updateGridVariables (const SolutionVector &curSol)
 Updates the grid variables with the given solution. More...
 
void resetTimeStep (const SolutionVector &curSol)
 Resets the grid variables to the last time step. More...
 
template<std::size_t i>
std::size_t numDofs (Dune::index_constant< i > domainId) const
 the number of dof locations of domain i More...
 
template<std::size_t i>
const auto & problem (Dune::index_constant< i > domainId) const
 the problem of domain i More...
 
template<std::size_t i>
const auto & fvGridGeometry (Dune::index_constant< i > domainId) const
 the finite volume grid geometry of domain i More...
 
template<std::size_t i>
const auto & gridGeometry (Dune::index_constant< i > domainId) const
 the finite volume grid geometry of domain i More...
 
template<std::size_t i>
const auto & gridView (Dune::index_constant< i > domainId) const
 the grid view of domain i More...
 
template<std::size_t i>
GridVariables< i > & gridVariables (Dune::index_constant< i > domainId)
 the grid variables of domain i More...
 
template<std::size_t i>
const GridVariables< i > & gridVariables (Dune::index_constant< i > domainId) const
 the grid variables of domain i More...
 
const CouplingManagercouplingManager () const
 the coupling manager More...
 
JacobianMatrixjacobian ()
 the full Jacobian matrix More...
 
SolutionVectorresidual ()
 the full residual vector More...
 
const SolutionVectorprevSol () const
 the solution of the previous time step More...
 
void setTimeManager (std::shared_ptr< const TimeLoop > timeLoop)
 Set time loop for instationary problems. More...
 
void setPreviousSolution (const SolutionVector &u)
 Sets the solution from which to start the time integration. Has to be called prior to assembly for time-dependent problems. More...
 
bool isStationaryProblem () const
 Whether we are assembling a stationary or instationary problem. More...
 
template<std::size_t i>
LocalResidual< i > localResidual (Dune::index_constant< i > domainId) const
 Create a local residual object (used by the local assembler) More...
 

Static Public Member Functions

static constexpr bool isImplicit ()
 Returns true if the assembler considers implicit assembly. More...
 

Protected Attributes

std::shared_ptr< CouplingManagercouplingManager_
 the coupling manager coupling the sub domains More...
 

Member Typedef Documentation

◆ CouplingManager

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::CouplingManager = CMType

◆ FVGridGeometry

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t id>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::FVGridGeometry = GridGeometry<id>

◆ GridGeometry

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t id>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::GridGeometry = typename MDTraits::template SubDomain<id>::GridGeometry

◆ GridVariables

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t id>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::GridVariables = typename MDTraits::template SubDomain<id>::GridVariables

◆ JacobianMatrix

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::JacobianMatrix = typename MDTraits::JacobianMatrix

◆ LocalResidual

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t id>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::LocalResidual = GetPropType<SubDomainTypeTag<id>, Properties::LocalResidual>

TODO get rid of this GetPropType.

◆ Problem

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t id>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::Problem = typename MDTraits::template SubDomain<id>::Problem

◆ ResidualType

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::ResidualType = SolutionVector

◆ Scalar

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::Scalar = typename MDTraits::Scalar

◆ SolutionVector

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::SolutionVector = typename MDTraits::SolutionVector

◆ Traits

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
using Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::Traits = MDTraits

Constructor & Destructor Documentation

◆ MultiDomainFVAssembler() [1/3]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::MultiDomainFVAssembler ( ProblemTuple &&  problem,
GridGeometryTuple &&  gridGeometry,
GridVariablesTuple &&  gridVariables,
std::shared_ptr< CouplingManager couplingManager 
)
inline

The constructor for stationary problems.

Note
the grid variables might be temporarily changed during assembly (if caching is enabled) it is however guaranteed that the state after assembly will be the same as before

◆ MultiDomainFVAssembler() [2/3]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::MultiDomainFVAssembler ( ProblemTuple &&  problem,
GridGeometryTuple &&  gridGeometry,
GridVariablesTuple &&  gridVariables,
std::shared_ptr< CouplingManager couplingManager,
std::shared_ptr< const TimeLoop timeLoop 
)
inline

The constructor for instationary problems.

Note
this constructor is deprecated (use the one receiving the previous solution instead)

◆ MultiDomainFVAssembler() [3/3]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::MultiDomainFVAssembler ( ProblemTuple &&  problem,
GridGeometryTuple &&  gridGeometry,
GridVariablesTuple &&  gridVariables,
std::shared_ptr< CouplingManager couplingManager,
std::shared_ptr< const TimeLoop timeLoop,
const SolutionVector prevSol 
)
inline

The constructor for instationary problems.

Note
the grid variables might be temporarily changed during assembly (if caching is enabled) it is however guaranteed that the state after assembly will be the same as before

Member Function Documentation

◆ assembleJacobianAndResidual()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::assembleJacobianAndResidual ( const SolutionVector curSol)
inline

Assembles the global Jacobian of the residual and the residual for the current solution.

◆ assembleResidual() [1/2]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::assembleResidual ( const SolutionVector curSol)
inline

compute the residuals using the internal residual

◆ assembleResidual() [2/2]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::assembleResidual ( ResidualType r,
const SolutionVector curSol 
)
inline

assemble a residual r

◆ couplingManager()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
const CouplingManager & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::couplingManager ( ) const
inline

the coupling manager

◆ fvGridGeometry()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
const auto & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::fvGridGeometry ( Dune::index_constant< i >  domainId) const
inline

the finite volume grid geometry of domain i

◆ gridGeometry()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
const auto & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::gridGeometry ( Dune::index_constant< i >  domainId) const
inline

the finite volume grid geometry of domain i

◆ gridVariables() [1/2]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
GridVariables< i > & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::gridVariables ( Dune::index_constant< i >  domainId)
inline

the grid variables of domain i

◆ gridVariables() [2/2]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
const GridVariables< i > & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::gridVariables ( Dune::index_constant< i >  domainId) const
inline

the grid variables of domain i

◆ gridView()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
const auto & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::gridView ( Dune::index_constant< i >  domainId) const
inline

the grid view of domain i

◆ isImplicit()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
static constexpr bool Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::isImplicit ( )
inlinestaticconstexpr

Returns true if the assembler considers implicit assembly.

◆ isStationaryProblem()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
bool Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::isStationaryProblem ( ) const
inline

Whether we are assembling a stationary or instationary problem.

◆ jacobian()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
JacobianMatrix & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::jacobian ( )
inline

the full Jacobian matrix

◆ localResidual()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
LocalResidual< i > Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::localResidual ( Dune::index_constant< i >  domainId) const
inline

Create a local residual object (used by the local assembler)

◆ numDofs()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
std::size_t Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::numDofs ( Dune::index_constant< i >  domainId) const
inline

the number of dof locations of domain i

◆ prevSol()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
const SolutionVector & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::prevSol ( ) const
inline

the solution of the previous time step

◆ problem()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
template<std::size_t i>
const auto & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::problem ( Dune::index_constant< i >  domainId) const
inline

the problem of domain i

◆ resetTimeStep()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::resetTimeStep ( const SolutionVector curSol)
inline

Resets the grid variables to the last time step.

◆ residual()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
SolutionVector & Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::residual ( )
inline

the full residual vector

◆ residualNorm()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
Scalar Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::residualNorm ( const SolutionVector curSol)
inline

compute the residual and return it's vector norm TODO: this needs to be adapted in parallel

◆ setJacobianBuildMode()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setJacobianBuildMode ( JacobianMatrix jac) const
inline

Sets the jacobian build mode.

◆ setJacobianPattern()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setJacobianPattern ( JacobianMatrix jac) const
inline

Sets the jacobian sparsity pattern.

◆ setLinearSystem() [1/2]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setLinearSystem ( )
inline

The version without arguments uses the default constructor to create the jacobian and residual objects in this assembler if you don't need them outside this class.

◆ setLinearSystem() [2/2]

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setLinearSystem ( std::shared_ptr< JacobianMatrix A,
std::shared_ptr< SolutionVector r 
)
inline

Tells the assembler which jacobian and residual to use. This also resizes the containers to the required sizes and sets the sparsity pattern of the jacobian matrix.

◆ setPreviousSolution()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setPreviousSolution ( const SolutionVector u)
inline

Sets the solution from which to start the time integration. Has to be called prior to assembly for time-dependent problems.

◆ setResidualSize()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setResidualSize ( SolutionVector res) const
inline

Resizes the residual.

◆ setTimeManager()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::setTimeManager ( std::shared_ptr< const TimeLoop timeLoop)
inline

Set time loop for instationary problems.

Note
calling this turns this into a stationary assembler

◆ updateGridVariables()

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
void Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::updateGridVariables ( const SolutionVector curSol)
inline

Updates the grid variables with the given solution.

Member Data Documentation

◆ couplingManager_

template<class MDTraits , class CMType , DiffMethod diffMethod, bool useImplicitAssembly = true>
std::shared_ptr<CouplingManager> Dumux::MultiDomainFVAssembler< MDTraits, CMType, diffMethod, useImplicitAssembly >::couplingManager_
protected

the coupling manager coupling the sub domains


The documentation for this class was generated from the following file: