Skip to content
Snippets Groups Projects
Commit 266db842 authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Timo Koch
Browse files

[freeflow][md] Add coupling jacobian pattern for fcstaggered

parent 1bc99753
No related branches found
No related tags found
1 merge request!2823[freeflow] Add mass/energy model and donea/channel/sincos test with new staggered
......@@ -169,6 +169,51 @@ Dune::MatrixIndexSet getCouplingJacobianPattern(const CouplingManager& couplingM
return pattern;
}
/*!
* \ingroup MultiDomain
* \brief Helper function to generate coupling Jacobian pattern (off-diagonal blocks)
* for the staggered scheme (degrees of freedom on cell centers)
*/
template<bool isImplicit, class CouplingManager, class GridGeometryI, class GridGeometryJ, std::size_t i, std::size_t j,
typename std::enable_if_t<(GridGeometryI::discMethod == DiscretizationMethod::fcstaggered), int> = 0>
Dune::MatrixIndexSet getCouplingJacobianPattern(const CouplingManager& couplingManager,
Dune::index_constant<i> domainI,
const GridGeometryI& gridGeometryI,
Dune::index_constant<j> domainJ,
const GridGeometryJ& gridGeometryJ)
{
Dune::MatrixIndexSet pattern(gridGeometryI.numDofs(), gridGeometryJ.numDofs());
auto fvGeometry = localView(gridGeometryI);
for (const auto& elementI : elements(gridGeometryI.gridView()))
{
fvGeometry.bindElement(elementI);
for (const auto& scv : scvs(fvGeometry))
{
const auto globalI = scv.dofIndex();
const auto& stencil = couplingManager.couplingStencil(domainI, elementI, scv, domainJ);
for (const auto globalJ : stencil)
{
assert(globalJ < gridGeometryJ.numDofs());
pattern.add(globalI, globalJ);
if (gridGeometryI.isPeriodic())
{
if (gridGeometryI.dofOnPeriodicBoundary(globalI))
{
const auto globalIP = gridGeometryI.periodicallyMappedDof(globalI);
if (globalI > globalIP)
pattern.add(globalIP, globalJ);
}
}
}
}
}
return pattern;
}
} // end namespace Dumux
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment