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

Coupling manager for free-flow mass and pore-network models. More...

#include <dumux/multidomain/boundary/freeflowporenetwork/ffmassporenetwork/couplingmanager.hh>

Inheritance diagram for Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >:

Description

template<class MDTraits>
class Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >

Coupling manager for free-flow mass and pore-network models.

Public Types

using SolutionVectorStorage = typename ParentType::SolutionVectorStorage
 
using CouplingStencilType = std::vector< std::size_t >
 default type used for coupling element stencils More...
 
using SolutionVector = typename Traits::SolutionVector
 the type of the solution vector More...
 

Public Member Functions

void init (std::shared_ptr< Problem< freeFlowMassIndex > > freeFlowMassProblem, std::shared_ptr< Problem< poreNetworkIndex > > pnmProblem, std::shared_ptr< CouplingMapper > couplingMapper, SolutionVectorStorage &curSol)
 Methods to be accessed by main. More...
 
template<std::size_t i, class Assembler >
void bindCouplingContext (Dune::index_constant< i > domainI, const Element< i > &element, const Assembler &assembler) const
 Methods to be accessed by the assembly. More...
 
template<std::size_t i, std::size_t j, class LocalAssemblerI >
void updateCouplingContext (Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, std::size_t dofIdxGlobalJ, const PrimaryVariables< j > &priVarsJ, int pvIdxJ)
 Update the coupling context. More...
 
const auto & couplingContext (Dune::index_constant< freeFlowMassIndex > domainI, const FVElementGeometry< freeFlowMassIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMassIndex > scvf) const
 Access the coupling context needed for the Stokes domain. More...
 
const auto & couplingContext (Dune::index_constant< poreNetworkIndex > domainI, const FVElementGeometry< poreNetworkIndex > &fvGeometry, const SubControlVolume< poreNetworkIndex > scv) const
 Access the coupling context needed for the PNM domain. More...
 
template<std::size_t i, std::size_t j>
const CouplingStencil & couplingStencil (Dune::index_constant< i > domainI, const Element< i > &element, Dune::index_constant< j > domainJ) const
 The coupling stencils. More...
 
bool isCoupled (Dune::index_constant< freeFlowMassIndex > domainI, const SubControlVolumeFace< freeFlowMassIndex > &scvf) const
 Returns whether a given scvf is coupled to the other domain. More...
 
bool isCoupled (Dune::index_constant< poreNetworkIndex > domainI, const SubControlVolume< poreNetworkIndex > &scv) const
 If the boundary entity is on a coupling boundary. More...
 
member functions concerning the coupling stencils
void extendJacobianPattern (Dune::index_constant< id > domainI, JacobianPattern &pattern) const
 extend the jacobian pattern of the diagonal block of domain i by those entries that are not already in the uncoupled pattern More...
 

Static Public Attributes

static constexpr auto freeFlowMassIndex = typename MDTraits::template SubDomain<0>::Index()
 
static constexpr auto poreNetworkIndex = typename MDTraits::template SubDomain<1>::Index()
 

member functions concerning variable caching for element residual evaluations

void bindCouplingContext (Dune::index_constant< i > domainI, const Element< i > &elementI, const Assembler &assembler)
 prepares all data and variables that are necessary to evaluate the residual of the element of domain i More...
 
void updateCoupledVariables (Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, UpdatableElementVolVars &elemVolVars, UpdatableFluxVarCache &elemFluxVarsCache)
 update variables of domain i that depend on variables in domain j after the coupling context has been updated More...
 
void updateSolution (const SolutionVector &curSol)
 Updates the entire solution vector, e.g. before assembly or after grid adaption Overload might want to overload function if the solution vector is stored outside this class to make sure updates don't happen more than once. More...
 
decltype(auto) evalCouplingResidual (Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, std::size_t dofIdxGlobalJ) const
 evaluates the element residual of a coupled element of domain i which depends on the variables at the degree of freedom with index dofIdxGlobalJ of domain j More...
 
void evalAdditionalDomainDerivatives (Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, const typename LocalAssemblerI::LocalResidual::ElementResidualVector &origResiduals, JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
 evaluate additional derivatives of the element residual of a domain with respect to dofs in the same domain that are not in the regular stencil (see CouplingManager::extendJacobianPattern) More...
 
decltype(auto) numericEpsilon (Dune::index_constant< i >, const std::string &paramGroup) const
 return the numeric epsilon used for deflecting primary variables of coupled domain i More...
 
void setSubProblems (const std::tuple< std::shared_ptr< SubProblems >... > &problems)
 set the pointers to the sub problems More...
 
void setSubProblem (std::shared_ptr< SubProblem > problem, Dune::index_constant< i > domainIdx)
 set a pointer to one of the sub problems More...
 
const Problem< i > & problem (Dune::index_constant< i > domainIdx) const
 Return a reference to the sub problem. More...
 
void attachSolution (SolutionVectorStorage &curSol)
 Attach a solution vector stored outside of this class. More...
 
SubSolutionVector< i > & curSol (Dune::index_constant< i > domainIdx)
 the solution vector of the subproblem More...
 
const SubSolutionVector< i > & curSol (Dune::index_constant< i > domainIdx) const
 the solution vector of the subproblem More...
 

Member Typedef Documentation

◆ CouplingStencilType

using Dumux::CouplingManager< MDTraits >::CouplingStencilType = std::vector<std::size_t>
inherited

default type used for coupling element stencils

◆ SolutionVector

using Dumux::CouplingManager< MDTraits >::SolutionVector = typename Traits::SolutionVector
inherited

the type of the solution vector

◆ SolutionVectorStorage

template<class MDTraits >
using Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::SolutionVectorStorage = typename ParentType::SolutionVectorStorage

Member Function Documentation

◆ attachSolution()

void Dumux::CouplingManager< MDTraits >::attachSolution ( SolutionVectorStorage curSol)
inlineprotectedinherited

Attach a solution vector stored outside of this class.

Note
The caller has to make sure that curSol stays alive for the lifetime of the coupling manager. Otherwise we have a dangling reference here. Use with care.

◆ bindCouplingContext() [1/2]

template<class MDTraits >
template<std::size_t i, class Assembler >
void Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::bindCouplingContext ( Dune::index_constant< i >  domainI,
const Element< i > &  element,
const Assembler &  assembler 
) const
inline

Methods to be accessed by the assembly.

prepares all data and variables that are necessary to evaluate the residual (called from the local assembler)

◆ bindCouplingContext() [2/2]

void Dumux::CouplingManager< MDTraits >::bindCouplingContext ( Dune::index_constant< i >  domainI,
const Element< i > &  elementI,
const Assembler &  assembler 
)
inlineinherited

prepares all data and variables that are necessary to evaluate the residual of the element of domain i

Parameters
domainIthe domain index of domain i
elementIthe element whose residual we are assemling next
assemblerthe multidomain assembler for access to all data necessary for the assembly of all domains
Note
this concerns all data that is used in the evaluation of the element residual and depends on one of the degrees of freedom returned by CouplingManager::couplingStencil
every coupled element residual depends at least on the solution of another domain, that why we always store a copy of the solution vector in the coupling manager, hence, in case the element residual only depends on primary variables of the other domain this function does nothing
overload this function in case the element residual depends on more than the primary variables of domain j

◆ couplingContext() [1/2]

template<class MDTraits >
const auto & Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::couplingContext ( Dune::index_constant< freeFlowMassIndex domainI,
const FVElementGeometry< freeFlowMassIndex > &  fvGeometry,
const SubControlVolumeFace< freeFlowMassIndex scvf 
) const
inline

Access the coupling context needed for the Stokes domain.

◆ couplingContext() [2/2]

template<class MDTraits >
const auto & Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::couplingContext ( Dune::index_constant< poreNetworkIndex domainI,
const FVElementGeometry< poreNetworkIndex > &  fvGeometry,
const SubControlVolume< poreNetworkIndex scv 
) const
inline

Access the coupling context needed for the PNM domain.

◆ couplingStencil()

template<class MDTraits >
template<std::size_t i, std::size_t j>
const CouplingStencil & Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::couplingStencil ( Dune::index_constant< i >  domainI,
const Element< i > &  element,
Dune::index_constant< j >  domainJ 
) const
inline

The coupling stencils.

The Stokes cell center coupling stencil w.r.t. Darcy DOFs

◆ curSol() [1/2]

SubSolutionVector< i > & Dumux::CouplingManager< MDTraits >::curSol ( Dune::index_constant< i >  domainIdx)
inlineprotectedinherited

the solution vector of the subproblem

Parameters
domainIdxThe domain index
Note
in case of numeric differentiation the solution vector always carries the deflected solution

◆ curSol() [2/2]

const SubSolutionVector< i > & Dumux::CouplingManager< MDTraits >::curSol ( Dune::index_constant< i >  domainIdx) const
inlineprotectedinherited

the solution vector of the subproblem

Parameters
domainIdxThe domain index
Note
in case of numeric differentiation the solution vector always carries the deflected solution

◆ evalAdditionalDomainDerivatives()

void Dumux::CouplingManager< MDTraits >::evalAdditionalDomainDerivatives ( Dune::index_constant< i >  domainI,
const LocalAssemblerI &  localAssemblerI,
const typename LocalAssemblerI::LocalResidual::ElementResidualVector &  origResiduals,
JacobianMatrixDiagBlock &  A,
GridVariables &  gridVariables 
)
inlineinherited

evaluate additional derivatives of the element residual of a domain with respect to dofs in the same domain that are not in the regular stencil (see CouplingManager::extendJacobianPattern)

Note
Such additional dependencies can arise from the coupling, e.g. if a coupling source term depends on a non-local average of a quantity of the same domain

◆ evalCouplingResidual()

decltype(auto) Dumux::CouplingManager< MDTraits >::evalCouplingResidual ( Dune::index_constant< i >  domainI,
const LocalAssemblerI &  localAssemblerI,
Dune::index_constant< j >  domainJ,
std::size_t  dofIdxGlobalJ 
) const
inlineinherited

evaluates the element residual of a coupled element of domain i which depends on the variables at the degree of freedom with index dofIdxGlobalJ of domain j

Parameters
domainIthe domain index of domain i
localAssemblerIthe local assembler assembling the element residual of an element of domain i
domainJthe domain index of domain j
dofIdxGlobalJthe index of the degree of freedom of domain j which has an influence on the element residual of domain i
Note
the element whose residual is to be evaluated can be retrieved from the local assembler as localAssemblerI.element() as well as all up-to-date variables and caches.
the default implementation evaluates the complete element residual if only parts (i.e. only certain scvs, or only certain terms of the residual) of the residual are coupled to dof with index dofIdxGlobalJ the function can be overloaded in the coupling manager
Returns
the element residual

◆ extendJacobianPattern()

void Dumux::CouplingManager< MDTraits >::extendJacobianPattern ( Dune::index_constant< id >  domainI,
JacobianPattern &  pattern 
) const
inlineinherited

extend the jacobian pattern of the diagonal block of domain i by those entries that are not already in the uncoupled pattern

Note
per default we do not add such additional dependencies
Such additional dependencies can arise from the coupling, e.g. if a coupling source term depends on a non-local average of a quantity of the same domain
Warning List:
if you overload this also implement evalAdditionalDomainDerivatives

◆ init()

template<class MDTraits >
void Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::init ( std::shared_ptr< Problem< freeFlowMassIndex > >  freeFlowMassProblem,
std::shared_ptr< Problem< poreNetworkIndex > >  pnmProblem,
std::shared_ptr< CouplingMapper couplingMapper,
SolutionVectorStorage curSol 
)
inline

Methods to be accessed by main.

Initialize the coupling manager

◆ isCoupled() [1/2]

template<class MDTraits >
bool Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::isCoupled ( Dune::index_constant< freeFlowMassIndex domainI,
const SubControlVolumeFace< freeFlowMassIndex > &  scvf 
) const
inline

Returns whether a given scvf is coupled to the other domain.

◆ isCoupled() [2/2]

template<class MDTraits >
bool Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::isCoupled ( Dune::index_constant< poreNetworkIndex domainI,
const SubControlVolume< poreNetworkIndex > &  scv 
) const
inline

If the boundary entity is on a coupling boundary.

Parameters
domainIthe domain index for which to compute the flux
scvthe sub control volume

◆ numericEpsilon()

decltype(auto) Dumux::CouplingManager< MDTraits >::numericEpsilon ( Dune::index_constant< i >  ,
const std::string &  paramGroup 
) const
inlineinherited

return the numeric epsilon used for deflecting primary variables of coupled domain i

◆ problem()

const Problem< i > & Dumux::CouplingManager< MDTraits >::problem ( Dune::index_constant< i >  domainIdx) const
inlineinherited

Return a reference to the sub problem.

Parameters
domainIdxThe domain index We avoid exception handling here because the performance of this function is critical

◆ setSubProblem()

void Dumux::CouplingManager< MDTraits >::setSubProblem ( std::shared_ptr< SubProblem >  problem,
Dune::index_constant< i >  domainIdx 
)
inlineinherited

set a pointer to one of the sub problems

Parameters
problema pointer to the sub problem
domainIdxthe domain index of the sub problem

◆ setSubProblems()

void Dumux::CouplingManager< MDTraits >::setSubProblems ( const std::tuple< std::shared_ptr< SubProblems >... > &  problems)
inlineinherited

set the pointers to the sub problems

Parameters
problemsA tuple of shared pointers to the sub problems

◆ updateCoupledVariables()

void Dumux::CouplingManager< MDTraits >::updateCoupledVariables ( Dune::index_constant< i >  domainI,
const LocalAssemblerI &  localAssemblerI,
UpdatableElementVolVars &  elemVolVars,
UpdatableFluxVarCache &  elemFluxVarsCache 
)
inlineinherited

update variables of domain i that depend on variables in domain j after the coupling context has been updated

Parameters
domainIthe index of domain i
localAssemblerIthe local assembler assembling the element residual of an element of domain i
elemVolVarsthe element volume variables (all volume variables in the element local stencil) to be updated
elemFluxVarsCachethe element flux variable cache (all flux variables in the element local stencil) to be updated
Note
Such variables do not necessarily exist and then this function does nothing (default)
some examples from geomechanics: the porosity of (physical) domain i (porous medium flow) depends on the displacement vector of physical domain j (mechanics) from domaindecomposition: the transmissibilities for fluxes of domain i to domain j depend on the permeability in domain j (which might depend in turn on the primary variables of domain i)

◆ updateCouplingContext()

template<class MDTraits >
template<std::size_t i, std::size_t j, class LocalAssemblerI >
void Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::updateCouplingContext ( Dune::index_constant< i >  domainI,
const LocalAssemblerI &  localAssemblerI,
Dune::index_constant< j >  domainJ,
std::size_t  dofIdxGlobalJ,
const PrimaryVariables< j > &  priVarsJ,
int  pvIdxJ 
)
inline

Update the coupling context.

◆ updateSolution()

void Dumux::CouplingManager< MDTraits >::updateSolution ( const SolutionVector curSol)
inlineinherited

Updates the entire solution vector, e.g. before assembly or after grid adaption Overload might want to overload function if the solution vector is stored outside this class to make sure updates don't happen more than once.

Member Data Documentation

◆ freeFlowMassIndex

template<class MDTraits >
constexpr auto Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::freeFlowMassIndex = typename MDTraits::template SubDomain<0>::Index()
staticconstexpr

◆ poreNetworkIndex

template<class MDTraits >
constexpr auto Dumux::FreeFlowMassPoreNetworkCouplingManager< MDTraits >::poreNetworkIndex = typename MDTraits::template SubDomain<1>::Index()
staticconstexpr

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