14#ifndef DUMUX_MULTIDOMAIN_STAGGERED_LOCAL_ASSEMBLER_HH
15#define DUMUX_MULTIDOMAIN_STAGGERED_LOCAL_ASSEMBLER_HH
17#include <dune/common/reservedvector.hh>
18#include <dune/common/indices.hh>
19#include <dune/common/hybridutilities.hh>
20#include <dune/grid/common/gridenums.hh>
44template<std::
size_t id,
class TypeTag,
class Assembler,
class Implementation,
bool isImplicit = true>
50 using SolutionVector =
typename Assembler::SolutionVector;
53 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
54 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
55 using Scalar =
typename GridVariables::Scalar;
58 using CellCenterResidualValue =
typename ParentType::LocalResidual::CellCenterResidualValue;
59 using FaceResidualValue =
typename ParentType::LocalResidual::FaceResidualValue;
61 using GridGeometry =
typename GridVariables::GridGeometry;
62 using FVElementGeometry =
typename GridGeometry::LocalView;
63 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
64 using GridView =
typename GridGeometry::GridView;
65 using Element =
typename GridView::template Codim<0>::Entity;
67 using CouplingManager =
typename Assembler::CouplingManager;
72 static constexpr auto domainId =
typename Dune::index_constant<id>();
73 static constexpr auto cellCenterId = GridGeometry::cellCenterIdx();
74 static constexpr auto faceId = GridGeometry::faceIdx();
79 using ParentType::ParentType;
83 const SolutionVector&
curSol,
103 template<
class JacobianMatrixRow,
class SubRes
idual,
class Gr
idVariablesTuple>
106 this->
asImp_().bindLocalViews();
109 assembleJacobianAndResidualImpl_(
domainId, jacRow, res, gridVariables);
115 template<
class SubRes
idual>
118 this->
asImp_().bindLocalViews();
123 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
124 res[cellCenterGlobalI] = this->
asImp_().assembleCellCenterResidualImpl();
129 res[scvf.dofIndex()] += this->
asImp_().assembleFaceResidualImpl(scvf);
140 if (this->
assembler().isStationaryProblem())
141 DUNE_THROW(Dune::InvalidStateException,
"Using explicit jacobian assembler with stationary local residual");
145 return CellCenterResidualValue(0.0);
158 const ElementFaceVariables& elemFaceVars)
const
162 if (!this->
assembler().isStationaryProblem())
166 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
167 const auto& scvI = this->
fvGeometry().scv(cellCenterGlobalI);
219 if (this->
assembler().isStationaryProblem())
220 DUNE_THROW(Dune::InvalidStateException,
"Using explicit jacobian assembler with stationary local residual");
224 return FaceResidualValue(0.0);
238 const ElementVolumeVariables& elemVolVars,
239 const ElementFaceVariables& elemFaceVars)
const
243 if (!this->
assembler().isStationaryProblem())
247 this->
fvGeometry(), scvf, elemVolVars, elemFaceVars,
273 const ElementVolumeVariables& elemVolVars,
274 const ElementFaceVariables& elemFaceVars)
const
295 {
return curElemFaceVars_; }
299 {
return prevElemFaceVars_; }
303 {
return curElemFaceVars_; }
307 {
return prevElemFaceVars_; }
310 {
return couplingManager_; }
315 template<
class JacobianMatrixRow,
class SubRes
idual,
class Gr
idVariablesTuple>
316 auto assembleJacobianAndResidualImpl_(Dune::index_constant<cellCenterId>, JacobianMatrixRow& jacRow, SubResidual& res, GridVariablesTuple& gridVariables)
318 auto& gridVariablesI = *std::get<domainId>(gridVariables);
319 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
320 const auto residual = this->
asImp_().assembleCellCenterJacobianAndResidualImpl(jacRow[
domainId], gridVariablesI);
321 res[cellCenterGlobalI] = residual;
325 using namespace Dune::Hybrid;
327 forEach(otherDomainIds, [&](
auto&& domainJ)
329 this->
asImp_().assembleJacobianCellCenterCoupling(domainJ, jacRow[domainJ], residual, gridVariablesI);
333 incorporateDirichletCells_(jacRow);
337 template<
class JacobianMatrixRow,
class SubRes
idual,
class Gr
idVariablesTuple>
338 void assembleJacobianAndResidualImpl_(Dune::index_constant<faceId>, JacobianMatrixRow& jacRow, SubResidual& res, GridVariablesTuple& gridVariables)
340 auto& gridVariablesI = *std::get<domainId>(gridVariables);
341 const auto residual = this->
asImp_().assembleFaceJacobianAndResidualImpl(jacRow[
domainId], gridVariablesI);
344 res[scvf.dofIndex()] += residual[scvf.localFaceIdx()];
347 using namespace Dune::Hybrid;
349 forEach(otherDomainIds, [&](
auto&& domainJ)
351 this->
asImp_().assembleJacobianFaceCoupling(domainJ, jacRow[domainJ], residual, gridVariablesI);
356 template<
class JacobianMatrixRow>
357 void incorporateDirichletCells_(JacobianMatrixRow& jacRow)
359 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
367 using namespace Dune::Hybrid;
368 forEach(integralRange(Dune::Hybrid::size(jacRow)), [&,
domainId =
domainId](
auto&& i)
370 auto& ccRowI = jacRow[i][cellCenterGlobalI];
371 for (
auto col = ccRowI.begin(); col != ccRowI.end(); ++col)
373 ccRowI[col.index()][eqIdx] = 0.0;
375 if ((i ==
domainId) && (col.index() == cellCenterGlobalI))
376 ccRowI[col.index()][eqIdx][eqIdx] = 1.0;
383 ElementFaceVariables curElemFaceVars_;
384 ElementFaceVariables prevElemFaceVars_;
385 CouplingManager& couplingManager_;
398template<std::
size_t id,
class TypeTag,
class Assembler,
class Implementation>
402 static constexpr auto domainId = Dune::index_constant<id>();
423 if (!this->
assembler().isStationaryProblem())
442template<std::
size_t id,
class TypeTag,
class Assembler, DiffMethod DM = DiffMethod::numeric,
bool implicit = true>
465template<std::
size_t id,
class TypeTag,
class Assembler>
468 SubDomainStaggeredLocalAssembler<id, TypeTag, Assembler, DiffMethod::numeric, true> >
473 using CellCenterResidualValue =
typename ParentType::LocalResidual::CellCenterResidualValue;
474 using FaceResidualValue =
typename ParentType::LocalResidual::FaceResidualValue;
478 using FaceVariables =
typename ElementFaceVariables::FaceVariables;
480 using FVElementGeometry =
typename GridGeometry::LocalView;
481 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
488 static constexpr int maxNeighbors = 4*(2*ModelTraits::dim());
489 static constexpr auto domainI = Dune::index_constant<id>();
490 static constexpr auto cellCenterId = GridGeometry::cellCenterIdx();
491 static constexpr auto faceId = GridGeometry::faceIdx();
493 static constexpr auto numEq = ModelTraits::numEq();
494 static constexpr auto numEqCellCenter = CellCenterPrimaryVariables::dimension;
495 static constexpr auto numEqFace = FacePrimaryVariables::dimension;
502 return this->evalLocalResidualForCellCenter();
507 return this->evalLocalResidualForFace(scvf);
516 template<
class JacobianMatrixDiagBlock,
class Gr
idVariables>
519 assert(domainI == cellCenterId);
522 const auto& element = this->element();
523 const auto& fvGeometry = this->fvGeometry();
524 auto&& curElemVolVars = this->curElemVolVars();
525 const auto& gridGeometry = this->problem().gridGeometry();
526 const auto& curSol = this->curSol()[domainI];
528 const auto cellCenterGlobalI = gridGeometry.elementMapper().index(element);
529 const auto origResidual = this->evalLocalResidualForCellCenter();
536 auto evaluateCellCenterDerivatives = [&](
const std::size_t globalJ)
539 auto&& scvJ = fvGeometry.scv(globalJ);
540 const auto elementJ = fvGeometry.gridGeometry().element(globalJ);
541 auto& curVolVars = this->getVolVarAccess(gridVariables.curGridVolVars(), curElemVolVars, scvJ);
542 const auto origVolVars(curVolVars);
544 for (
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
546 CellCenterPrimaryVariables cellCenterPriVars = curSol[globalJ];
547 using PrimaryVariables =
typename VolumeVariables::PrimaryVariables;
550 constexpr auto offset = numEq - numEqCellCenter;
552 auto evalResidual = [&](Scalar priVar)
555 priVars[pvIdx + offset] = priVar;
557 curVolVars.update(elemSol, this->problem(), elementJ, scvJ);
560 cellCenterPriVars[pvIdx] = priVar;
561 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, cellCenterPriVars, pvIdx);
564 return this->evalLocalResidualForCellCenter();
568 CellCenterResidualValue partialDeriv(0.0);
571 const auto& paramGroup = this->problem().paramGroup();
573 static const auto eps = this->couplingManager().numericEpsilon(domainI, paramGroup);
575 eps(priVars[pvIdx + offset], pvIdx), numDiffMethod);
578 updateGlobalJacobian_(A, cellCenterGlobalI, globalJ, pvIdx, partialDeriv);
581 curVolVars = origVolVars;
584 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, curSol[globalJ], pvIdx);
589 const auto& connectivityMap = gridGeometry.connectivityMap();
592 evaluateCellCenterDerivatives(cellCenterGlobalI);
595 for (
const auto& globalJ : connectivityMap(cellCenterId, cellCenterId, cellCenterGlobalI))
596 evaluateCellCenterDerivatives(globalJ);
607 template<
class JacobianMatrixDiagBlock,
class Gr
idVariables>
610 assert(domainI == faceId);
613 const auto& problem = this->problem();
614 const auto& element = this->element();
615 const auto& fvGeometry = this->fvGeometry();
616 const auto& gridGeometry = this->problem().gridGeometry();
617 const auto& curSol = this->curSol()[domainI];
620 FaceSolutionVector origResiduals;
621 origResiduals.resize(fvGeometry.numScvf());
625 for (
auto&& scvf : scvfs(fvGeometry))
626 origResiduals[scvf.localFaceIdx()] = this->evalLocalResidualForFace(scvf);
635 for (
auto&& scvf : scvfs(fvGeometry))
638 const auto faceGlobalI = scvf.dofIndex();
641 const auto origFaceSolution = FaceSolution(scvf, curSol, gridGeometry);
644 auto evaluateFaceDerivatives = [&](
const std::size_t globalJ)
647 auto& faceVars = getFaceVarAccess_(gridVariables.curGridFaceVars(), this->curElemFaceVars(), scvf);
648 const auto origFaceVars = faceVars;
650 for (
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
652 auto faceSolution = origFaceSolution;
654 auto evalResidual = [&](Scalar priVar)
657 faceSolution[globalJ][pvIdx] = priVar;
658 faceVars.update(faceSolution, problem, element, fvGeometry, scvf);
661 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, faceSolution[globalJ], pvIdx);
664 return this->evalLocalResidualForFace(scvf);
668 FaceResidualValue partialDeriv(0.0);
669 const auto& paramGroup = problem.paramGroup();
671 static const auto eps = this->couplingManager().numericEpsilon(domainI, paramGroup);
673 eps(faceSolution[globalJ][pvIdx], pvIdx), numDiffMethod);
676 updateGlobalJacobian_(A, faceGlobalI, globalJ, pvIdx, partialDeriv);
679 faceVars = origFaceVars;
682 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, origFaceSolution[globalJ], pvIdx);
687 evaluateFaceDerivatives(scvf.dofIndex());
690 const auto& connectivityMap = gridGeometry.connectivityMap();
693 for (
const auto& globalJ : connectivityMap(faceId, faceId, scvf.index()))
694 evaluateFaceDerivatives(globalJ);
697 return origResiduals;
704 template<
class JacobianBlock,
class Gr
idVariables>
706 const CellCenterResidualValue& origResidual, GridVariables& gridVariables)
713 const auto& element = this->element();
714 const auto& fvGeometry = this->fvGeometry();
715 const auto& gridGeometry = this->problem().gridGeometry();
716 const auto& curSol = this->curSol()[domainJ];
718 const auto cellCenterGlobalI = gridGeometry.elementMapper().index(element);
720 for (
const auto& scvfJ : scvfs(fvGeometry))
722 const auto globalJ = scvfJ.dofIndex();
725 auto& faceVars = getFaceVarAccess_(gridVariables.curGridFaceVars(), this->curElemFaceVars(), scvfJ);
726 const auto origFaceVars(faceVars);
728 for (
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
730 auto facePriVars = curSol[globalJ];
732 auto evalResidual = [&](Scalar priVar)
735 facePriVars[pvIdx] = priVar;
736 faceVars.updateOwnFaceOnly(facePriVars);
739 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, facePriVars, pvIdx);
742 return this->evalLocalResidualForCellCenter();
746 CellCenterResidualValue partialDeriv(0.0);
749 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
751 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
753 epsCoupl(facePriVars[pvIdx], pvIdx), numDiffMethod);
756 updateGlobalJacobian_(A, cellCenterGlobalI, globalJ, pvIdx, partialDeriv);
759 faceVars = origFaceVars;
762 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, curSol[globalJ], pvIdx);
767 template<std::
size_t otherId,
class JacobianBlock,
class Gr
idVariables>
769 const CellCenterResidualValue& res, GridVariables& gridVariables)
776 const auto& element = this->element();
779 const auto& stencil = this->couplingManager().couplingStencil(domainI, element, domainJ);
784 for (
const auto globalJ : stencil)
786 const auto origResidual = this->couplingManager().evalCouplingResidual(domainI, *
this, domainJ, globalJ);
787 const auto& curSol = this->curSol()[domainJ];
788 const auto origPriVarsJ = curSol[globalJ];
790 for (
int pvIdx = 0; pvIdx < JacobianBlock::block_type::cols; ++pvIdx)
792 auto evalCouplingResidual = [&](Scalar priVar)
794 auto deflectedPriVarsJ = origPriVarsJ;
795 deflectedPriVarsJ[pvIdx] = priVar;
796 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, deflectedPriVarsJ, pvIdx);
797 return this->couplingManager().evalCouplingResidual(domainI, *
this, domainJ, globalJ);
801 CellCenterResidualValue partialDeriv(0.0);
804 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
806 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
808 epsCoupl(origPriVarsJ[pvIdx], pvIdx), numDiffMethod);
811 const auto cellCenterGlobalI = this->problem().gridGeometry().elementMapper().index(element);
812 updateGlobalJacobian_(A, cellCenterGlobalI, globalJ, pvIdx, partialDeriv);
815 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, origPriVarsJ, pvIdx);
824 template<
class JacobianBlock,
class ElementRes
idualVector,
class Gr
idVariables>
833 const auto& problem = this->problem();
834 const auto& fvGeometry = this->fvGeometry();
835 const auto& gridGeometry = this->problem().gridGeometry();
836 const auto& connectivityMap = gridGeometry.connectivityMap();
837 const auto& curSol = this->curSol()[domainJ];
840 for (
auto&& scvf : scvfs(fvGeometry))
843 const auto faceGlobalI = scvf.dofIndex();
846 for (
const auto& globalJ : connectivityMap(faceId, cellCenterId, scvf.index()))
849 auto&& scvJ = fvGeometry.scv(globalJ);
850 const auto elementJ = fvGeometry.gridGeometry().element(globalJ);
851 auto& curVolVars = this->getVolVarAccess(gridVariables.curGridVolVars(), this->curElemVolVars(), scvJ);
852 const auto origVolVars(curVolVars);
853 const auto origCellCenterPriVars = curSol[globalJ];
855 for (
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
857 using PrimaryVariables =
typename VolumeVariables::PrimaryVariables;
860 constexpr auto offset = PrimaryVariables::dimension - CellCenterPrimaryVariables::dimension;
862 auto evalResidual = [&](Scalar priVar)
865 priVars[pvIdx + offset] = priVar;
867 curVolVars.update(elemSol, problem, elementJ, scvJ);
870 auto deflectedCellCenterPriVars = origCellCenterPriVars;
871 deflectedCellCenterPriVars[pvIdx] = priVar;
872 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, deflectedCellCenterPriVars, pvIdx);
875 return this->evalLocalResidualForFace(scvf);
879 FaceResidualValue partialDeriv(0.0);
880 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
882 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
884 epsCoupl(priVars[pvIdx + offset], pvIdx), numDiffMethod);
887 updateGlobalJacobian_(A, faceGlobalI, globalJ, pvIdx, partialDeriv);
890 curVolVars = origVolVars;
893 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, origCellCenterPriVars, pvIdx);
899 template<std::
size_t otherId,
class JacobianBlock,
class ElementRes
idualVector,
class Gr
idVariables>
908 const auto& fvGeometry = this->fvGeometry();
909 const auto& curSol = this->curSol()[domainJ];
912 for (
auto&& scvf : scvfs(fvGeometry))
915 const auto faceGlobalI = scvf.dofIndex();
918 const auto& stencil = this->couplingManager().couplingStencil(domainI, scvf, domainJ);
924 for (
const auto& globalJ : stencil)
926 const auto origPriVarsJ = curSol[globalJ];
927 const auto origResidual = this->couplingManager().evalCouplingResidual(domainI, scvf, *
this, domainJ, globalJ);
929 for (
int pvIdx = 0; pvIdx < JacobianBlock::block_type::cols; ++pvIdx)
931 auto evalCouplingResidual = [&](Scalar priVar)
933 auto deflectedPriVars = origPriVarsJ;
934 deflectedPriVars[pvIdx] = priVar;
935 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, deflectedPriVars, pvIdx);
936 return this->couplingManager().evalCouplingResidual(domainI, scvf, *
this, domainJ, globalJ);
940 FaceResidualValue partialDeriv(0.0);
941 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
943 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
945 epsCoupl(origPriVarsJ[pvIdx], pvIdx), numDiffMethod);
948 updateGlobalJacobian_(A, faceGlobalI, globalJ, pvIdx, partialDeriv);
951 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, origPriVarsJ, pvIdx);
957 template<
class JacobianMatrixDiagBlock,
class Gr
idVariables>
959 JacobianMatrixDiagBlock& A, GridVariables& gridVariables)
967 template<
class SubMatrix,
class CCOrFacePrimaryVariables>
972 const CCOrFacePrimaryVariables& partialDeriv)
974 for (
int eqIdx = 0; eqIdx < partialDeriv.size(); eqIdx++)
982 assert(eqIdx < matrix[globalI][globalJ].size());
983 assert(pvIdx < matrix[globalI][globalJ][eqIdx].size());
984 matrix[globalI][globalJ][eqIdx][pvIdx] += partialDeriv[eqIdx];
990 FaceVariables& getFaceVarAccess_(GridFaceVariables& gridFaceVariables, ElementFaceVariables& elemFaceVars,
const SubControlVolumeFace& scvf)
993 return gridFaceVariables.faceVars(scvf.index());
995 return elemFaceVars[scvf];
A base class for all local assemblers.
A base class for all local assemblers.
Definition assembly/fvlocalassemblerbase.hh:36
ElementVolumeVariables & curElemVolVars()
Definition assembly/fvlocalassemblerbase.hh:253
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition assembly/fvlocalassemblerbase.hh:56
ElementBoundaryTypes & elemBcTypes()
Definition assembly/fvlocalassemblerbase.hh:269
Implementation & asImp_()
Definition assembly/fvlocalassemblerbase.hh:297
ElementVolumeVariables & prevElemVolVars()
Definition assembly/fvlocalassemblerbase.hh:257
FVElementGeometry & fvGeometry()
Definition assembly/fvlocalassemblerbase.hh:249
const Assembler & assembler() const
Definition assembly/fvlocalassemblerbase.hh:233
ElementFluxVariablesCache & elemFluxVarsCache()
Definition assembly/fvlocalassemblerbase.hh:261
bool elementIsGhost() const
Definition assembly/fvlocalassemblerbase.hh:241
LocalResidual & localResidual()
Definition assembly/fvlocalassemblerbase.hh:265
static constexpr bool isImplicit()
Definition assembly/fvlocalassemblerbase.hh:101
const Element & element() const
Definition assembly/fvlocalassemblerbase.hh:237
const SolutionVector & curSol() const
Definition assembly/fvlocalassemblerbase.hh:245
static void partialDerivative(const Function &function, Scalar x0, FunctionEvalType &derivative, const FunctionEvalType &fx0, const int numericDifferenceMethod=1)
Computes the derivative of a function with respect to a function parameter.
Definition numericdifferentiation.hh:49
Staggered scheme local assembler using numeric differentiation and implicit time discretization.
Definition subdomainstaggeredlocalassembler.hh:469
void assembleJacobianFaceCoupling(Dune::index_constant< cellCenterId > domainJ, JacobianBlock &A, const ElementResidualVector &origResiduals, GridVariables &gridVariables)
Computes the derivatives with respect to the given element and adds them to the global matrix.
Definition subdomainstaggeredlocalassembler.hh:825
void assembleJacobianFaceCoupling(Dune::index_constant< otherId > domainJ, JacobianBlock &A, const ElementResidualVector &res, GridVariables &gridVariables)
Definition subdomainstaggeredlocalassembler.hh:900
FaceResidualValue assembleFaceResidualImpl(const SubControlVolumeFace &scvf)
Definition subdomainstaggeredlocalassembler.hh:505
CellCenterResidualValue assembleCellCenterJacobianAndResidualImpl(JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
Computes the derivatives with respect to the given element and adds them to the global matrix.
Definition subdomainstaggeredlocalassembler.hh:517
void assembleJacobianCellCenterCoupling(Dune::index_constant< faceId > domainJ, JacobianBlock &A, const CellCenterResidualValue &origResidual, GridVariables &gridVariables)
Computes the derivatives with respect to the given element and adds them to the global matrix.
Definition subdomainstaggeredlocalassembler.hh:705
CellCenterResidualValue assembleCellCenterResidualImpl()
Definition subdomainstaggeredlocalassembler.hh:500
static void updateGlobalJacobian_(SubMatrix &matrix, const int globalI, const int globalJ, const int pvIdx, const CCOrFacePrimaryVariables &partialDeriv)
Updates the current global Jacobian matrix with the partial derivatives of all equations in regard to...
Definition subdomainstaggeredlocalassembler.hh:968
void evalAdditionalDerivatives(const std::vector< std::size_t > &additionalDofDependencies, JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
Definition subdomainstaggeredlocalassembler.hh:958
auto assembleFaceJacobianAndResidualImpl(JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
Computes the derivatives with respect to the given element and adds them to the global matrix.
Definition subdomainstaggeredlocalassembler.hh:608
void assembleJacobianCellCenterCoupling(Dune::index_constant< otherId > domainJ, JacobianBlock &A, const CellCenterResidualValue &res, GridVariables &gridVariables)
Definition subdomainstaggeredlocalassembler.hh:768
A base class for all multidomain local assemblers (staggered)
Definition subdomainstaggeredlocalassembler.hh:46
FaceResidualValue evalLocalResidualForFace(const SubControlVolumeFace &scvf) const
Convenience function to evaluate the local residual for the current face. Automatically chooses the t...
Definition subdomainstaggeredlocalassembler.hh:216
const ElementFaceVariables & curElemFaceVars() const
The current element volume variables.
Definition subdomainstaggeredlocalassembler.hh:302
FaceResidualValue evalLocalFluxAndSourceResidualForFace(const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars) const
Evaluates the flux and source terms (i.e, the terms without a time derivative) of the local residual ...
Definition subdomainstaggeredlocalassembler.hh:272
ElementFaceVariables & prevElemFaceVars()
The element volume variables of the provious time step.
Definition subdomainstaggeredlocalassembler.hh:298
static constexpr auto domainId
Definition subdomainstaggeredlocalassembler.hh:72
const Problem & problem() const
Definition subdomainstaggeredlocalassembler.hh:290
SubDomainStaggeredLocalAssemblerBase(const Assembler &assembler, const Element &element, const SolutionVector &curSol, CouplingManager &couplingManager)
Definition subdomainstaggeredlocalassembler.hh:81
FaceResidualValue evalLocalFluxAndSourceResidualForFace(const SubControlVolumeFace &scvf) const
Convenience function to evaluate the flux and source terms (i.e, the terms without a time derivative)...
Definition subdomainstaggeredlocalassembler.hh:259
CellCenterResidualValue evalLocalFluxAndSourceResidualForCellCenter() const
Convenience function to evaluate the flux and source terms (i.e, the terms without a time derivative)...
Definition subdomainstaggeredlocalassembler.hh:183
static constexpr auto faceId
Definition subdomainstaggeredlocalassembler.hh:74
static constexpr auto faceOffset
Definition subdomainstaggeredlocalassembler.hh:77
FaceResidualValue evalLocalResidualForFace(const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars) const
Evaluates the complete local residual for the current face.
Definition subdomainstaggeredlocalassembler.hh:237
static constexpr auto numEqCellCenter
Definition subdomainstaggeredlocalassembler.hh:76
const ElementFaceVariables & prevElemFaceVars() const
The element volume variables of the provious time step.
Definition subdomainstaggeredlocalassembler.hh:306
CellCenterResidualValue evalLocalResidualForCellCenter() const
Convenience function to evaluate the complete local residual for the current element....
Definition subdomainstaggeredlocalassembler.hh:137
FaceResidualValue evalLocalStorageResidualForFace(const SubControlVolumeFace &scvf) const
Convenience function to evaluate storage term (i.e, the term with a time derivative) of the local res...
Definition subdomainstaggeredlocalassembler.hh:285
CouplingManager & couplingManager()
Definition subdomainstaggeredlocalassembler.hh:309
static constexpr auto cellCenterId
Definition subdomainstaggeredlocalassembler.hh:73
CellCenterResidualValue evalLocalResidualForCellCenter(const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars) const
Evaluates the complete local residual for the current cell center.
Definition subdomainstaggeredlocalassembler.hh:157
void assembleJacobianAndResidual(JacobianMatrixRow &jacRow, SubResidual &res, GridVariablesTuple &gridVariables)
Computes the derivatives with respect to the given element and adds them to the global matrix....
Definition subdomainstaggeredlocalassembler.hh:104
CellCenterResidualValue evalLocalFluxAndSourceResidualForCellCenter(const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars) const
Evaluates the flux and source terms (i.e, the terms without a time derivative) of the local residual ...
Definition subdomainstaggeredlocalassembler.hh:196
CellCenterResidualValue evalLocalStorageResidualForCellCenter() const
Convenience function to evaluate storage term (i.e, the term with a time derivative) of the local res...
Definition subdomainstaggeredlocalassembler.hh:206
void assembleResidual(SubResidual &res)
Assemble the residual only.
Definition subdomainstaggeredlocalassembler.hh:116
ElementFaceVariables & curElemFaceVars()
The current element volume variables.
Definition subdomainstaggeredlocalassembler.hh:294
The staggered multidomain local assembler.
Definition subdomainstaggeredlocalassembler.hh:443
A base class for all implicit multidomain local assemblers (staggered)
Definition subdomainstaggeredlocalassembler.hh:400
void bindLocalViews()
Definition subdomainstaggeredlocalassembler.hh:406
Defines all properties used in Dumux.
An enum class to define various differentiation methods available in order to compute the derivatives...
DiffMethod
Differentiation methods in order to compute the derivatives of the residual i.e. the entries in the j...
Definition diffmethod.hh:25
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:26
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::cctpfa||GridGeometry::discMethod==DiscretizationMethods::ccmpfa, CCElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for cell-centered schemes.
Definition cellcentered/elementsolution.hh:101
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:149
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
PrimaryVariables makePriVarsFromCellCenterPriVars(const CellCenterPrimaryVariables &cellCenterPriVars)
Helper function to create a PrimaryVariables object from CellCenterPrimaryVariables.
Definition staggered/elementsolution.hh:29
typename Detail::ConcatSeq< decltype(std::make_index_sequence< e >{}), e+1, decltype(std::make_index_sequence<(n > e) ?(n - e - 1) :0 >{})>::type makeIncompleteIntegerSequence
Definition utility.hh:58
Definition common/pdesolver.hh:24
A class for numeric differentiation.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
A arithmetic block vector type based on DUNE's reserved vector.
The local element solution class for staggered methods.
Utilities for template meta programming.