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>
51 using SolutionVector =
typename Assembler::SolutionVector;
54 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
55 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
56 using Scalar =
typename GridVariables::Scalar;
59 using CellCenterResidualValue =
typename LocalResidual::CellCenterResidualValue;
60 using FaceResidualValue =
typename LocalResidual::FaceResidualValue;
62 using GridGeometry =
typename GridVariables::GridGeometry;
63 using FVElementGeometry =
typename GridGeometry::LocalView;
64 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
65 using GridView =
typename GridGeometry::GridView;
66 using Element =
typename GridView::template Codim<0>::Entity;
68 using CouplingManager =
typename Assembler::CouplingManager;
73 static constexpr auto domainId =
typename Dune::index_constant<id>();
74 static constexpr auto cellCenterId = GridGeometry::cellCenterIdx();
75 static constexpr auto faceId = GridGeometry::faceIdx();
80 using ParentType::ParentType;
84 const SolutionVector&
curSol,
104 template<
class JacobianMatrixRow,
class SubRes
idual,
class Gr
idVariablesTuple>
107 this->
asImp_().bindLocalViews();
110 assembleJacobianAndResidualImpl_(
domainId, jacRow, res, gridVariables);
116 template<
class SubRes
idual>
119 this->
asImp_().bindLocalViews();
124 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
125 res[cellCenterGlobalI] = this->
asImp_().assembleCellCenterResidualImpl();
130 res[scvf.dofIndex()] += this->
asImp_().assembleFaceResidualImpl(scvf);
141 if (this->
assembler().isStationaryProblem())
142 DUNE_THROW(Dune::InvalidStateException,
"Using explicit jacobian assembler with stationary local residual");
146 return CellCenterResidualValue(0.0);
159 const ElementFaceVariables& elemFaceVars)
const
163 if (!this->
assembler().isStationaryProblem())
167 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
168 const auto& scvI = this->
fvGeometry().scv(cellCenterGlobalI);
220 if (this->
assembler().isStationaryProblem())
221 DUNE_THROW(Dune::InvalidStateException,
"Using explicit jacobian assembler with stationary local residual");
225 return FaceResidualValue(0.0);
239 const ElementVolumeVariables& elemVolVars,
240 const ElementFaceVariables& elemFaceVars)
const
244 if (!this->
assembler().isStationaryProblem())
248 this->
fvGeometry(), scvf, elemVolVars, elemFaceVars,
274 const ElementVolumeVariables& elemVolVars,
275 const ElementFaceVariables& elemFaceVars)
const
296 {
return curElemFaceVars_; }
300 {
return prevElemFaceVars_; }
304 {
return curElemFaceVars_; }
308 {
return prevElemFaceVars_; }
311 {
return couplingManager_; }
316 template<
class JacobianMatrixRow,
class SubRes
idual,
class Gr
idVariablesTuple>
317 auto assembleJacobianAndResidualImpl_(Dune::index_constant<cellCenterId>, JacobianMatrixRow& jacRow, SubResidual& res, GridVariablesTuple& gridVariables)
319 auto& gridVariablesI = *std::get<domainId>(gridVariables);
320 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
321 const auto residual = this->
asImp_().assembleCellCenterJacobianAndResidualImpl(jacRow[
domainId], gridVariablesI);
322 res[cellCenterGlobalI] = residual;
326 using namespace Dune::Hybrid;
328 forEach(otherDomainIds, [&](
auto&& domainJ)
330 this->
asImp_().assembleJacobianCellCenterCoupling(domainJ, jacRow[domainJ], residual, gridVariablesI);
334 incorporateDirichletCells_(jacRow);
338 template<
class JacobianMatrixRow,
class SubRes
idual,
class Gr
idVariablesTuple>
339 void assembleJacobianAndResidualImpl_(Dune::index_constant<faceId>, JacobianMatrixRow& jacRow, SubResidual& res, GridVariablesTuple& gridVariables)
341 auto& gridVariablesI = *std::get<domainId>(gridVariables);
342 const auto residual = this->
asImp_().assembleFaceJacobianAndResidualImpl(jacRow[
domainId], gridVariablesI);
345 res[scvf.dofIndex()] += residual[scvf.localFaceIdx()];
348 using namespace Dune::Hybrid;
350 forEach(otherDomainIds, [&](
auto&& domainJ)
352 this->
asImp_().assembleJacobianFaceCoupling(domainJ, jacRow[domainJ], residual, gridVariablesI);
357 template<
class JacobianMatrixRow>
358 void incorporateDirichletCells_(JacobianMatrixRow& jacRow)
360 const auto cellCenterGlobalI =
problem().gridGeometry().elementMapper().index(this->
element());
368 using namespace Dune::Hybrid;
369 forEach(integralRange(Dune::Hybrid::size(jacRow)), [&,
domainId =
domainId](
auto&& i)
371 auto& ccRowI = jacRow[i][cellCenterGlobalI];
372 for (
auto col = ccRowI.begin(); col != ccRowI.end(); ++col)
374 ccRowI[col.index()][eqIdx] = 0.0;
376 if ((i == domainId) && (col.index() == cellCenterGlobalI))
377 ccRowI[col.index()][eqIdx][eqIdx] = 1.0;
384 ElementFaceVariables curElemFaceVars_;
385 ElementFaceVariables prevElemFaceVars_;
386 CouplingManager& couplingManager_;
399template<std::
size_t id,
class TypeTag,
class Assembler,
class Implementation>
403 static constexpr auto domainId = Dune::index_constant<id>();
405 using ParentType::ParentType;
424 if (!this->
assembler().isStationaryProblem())
443template<std::
size_t id,
class TypeTag,
class Assembler, DiffMethod DM = DiffMethod::numeric,
bool implicit = true>
466template<std::
size_t id,
class TypeTag,
class Assembler>
469 SubDomainStaggeredLocalAssembler<id, TypeTag, Assembler, DiffMethod::numeric, true> >
475 using CellCenterResidualValue =
typename LocalResidual::CellCenterResidualValue;
476 using FaceResidualValue =
typename LocalResidual::FaceResidualValue;
480 using FaceVariables =
typename ElementFaceVariables::FaceVariables;
482 using FVElementGeometry =
typename GridGeometry::LocalView;
483 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
490 static constexpr int maxNeighbors = 4*(2*ModelTraits::dim());
491 static constexpr auto domainI = Dune::index_constant<id>();
492 static constexpr auto cellCenterId = GridGeometry::cellCenterIdx();
493 static constexpr auto faceId = GridGeometry::faceIdx();
495 static constexpr auto numEq = ModelTraits::numEq();
496 static constexpr auto numEqCellCenter = CellCenterPrimaryVariables::dimension;
497 static constexpr auto numEqFace = FacePrimaryVariables::dimension;
504 return this->evalLocalResidualForCellCenter();
509 return this->evalLocalResidualForFace(scvf);
518 template<
class JacobianMatrixDiagBlock,
class Gr
idVariables>
521 assert(domainI == cellCenterId);
524 const auto& element = this->element();
525 const auto& fvGeometry = this->fvGeometry();
526 auto&& curElemVolVars = this->curElemVolVars();
527 const auto& gridGeometry = this->problem().gridGeometry();
528 const auto& curSol = this->curSol()[domainI];
530 const auto cellCenterGlobalI = gridGeometry.elementMapper().index(element);
531 const auto origResidual = this->evalLocalResidualForCellCenter();
538 auto evaluateCellCenterDerivatives = [&](
const std::size_t globalJ)
541 auto&& scvJ = fvGeometry.scv(globalJ);
542 const auto elementJ = fvGeometry.gridGeometry().element(globalJ);
543 auto& curVolVars = this->getVolVarAccess(gridVariables.curGridVolVars(), curElemVolVars, scvJ);
544 const auto origVolVars(curVolVars);
546 for (
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
548 CellCenterPrimaryVariables cellCenterPriVars = curSol[globalJ];
549 using PrimaryVariables =
typename VolumeVariables::PrimaryVariables;
550 PrimaryVariables priVars = makePriVarsFromCellCenterPriVars<PrimaryVariables>(cellCenterPriVars);
552 constexpr auto offset = numEq - numEqCellCenter;
554 auto evalResidual = [&](Scalar priVar)
557 priVars[pvIdx + offset] = priVar;
558 auto elemSol = elementSolution<FVElementGeometry>(std::move(priVars));
559 curVolVars.update(elemSol, this->problem(), elementJ, scvJ);
562 cellCenterPriVars[pvIdx] = priVar;
563 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, cellCenterPriVars, pvIdx);
566 return this->evalLocalResidualForCellCenter();
570 CellCenterResidualValue partialDeriv(0.0);
573 const auto& paramGroup = this->problem().paramGroup();
574 static const int numDiffMethod = getParamFromGroup<int>(paramGroup,
"Assembly.NumericDifferenceMethod");
575 static const auto eps = this->couplingManager().numericEpsilon(domainI, paramGroup);
577 eps(priVars[pvIdx + offset], pvIdx), numDiffMethod);
580 updateGlobalJacobian_(A, cellCenterGlobalI, globalJ, pvIdx, partialDeriv);
583 curVolVars = origVolVars;
586 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, curSol[globalJ], pvIdx);
591 const auto& connectivityMap = gridGeometry.connectivityMap();
594 evaluateCellCenterDerivatives(cellCenterGlobalI);
597 for (
const auto& globalJ : connectivityMap(cellCenterId, cellCenterId, cellCenterGlobalI))
598 evaluateCellCenterDerivatives(globalJ);
609 template<
class JacobianMatrixDiagBlock,
class Gr
idVariables>
612 assert(domainI == faceId);
615 const auto& problem = this->problem();
616 const auto& element = this->element();
617 const auto& fvGeometry = this->fvGeometry();
618 const auto& gridGeometry = this->problem().gridGeometry();
619 const auto& curSol = this->curSol()[domainI];
622 FaceSolutionVector origResiduals;
623 origResiduals.resize(fvGeometry.numScvf());
627 for (
auto&& scvf : scvfs(fvGeometry))
628 origResiduals[scvf.localFaceIdx()] = this->evalLocalResidualForFace(scvf);
637 for (
auto&& scvf : scvfs(fvGeometry))
640 const auto faceGlobalI = scvf.dofIndex();
643 const auto origFaceSolution = FaceSolution(scvf, curSol, gridGeometry);
646 auto evaluateFaceDerivatives = [&](
const std::size_t globalJ)
649 auto& faceVars = getFaceVarAccess_(gridVariables.curGridFaceVars(), this->curElemFaceVars(), scvf);
650 const auto origFaceVars = faceVars;
652 for (
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
654 auto faceSolution = origFaceSolution;
656 auto evalResidual = [&](Scalar priVar)
659 faceSolution[globalJ][pvIdx] = priVar;
660 faceVars.update(faceSolution, problem, element, fvGeometry, scvf);
663 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, faceSolution[globalJ], pvIdx);
666 return this->evalLocalResidualForFace(scvf);
670 FaceResidualValue partialDeriv(0.0);
671 const auto& paramGroup = problem.paramGroup();
672 static const int numDiffMethod = getParamFromGroup<int>(paramGroup,
"Assembly.NumericDifferenceMethod");
673 static const auto eps = this->couplingManager().numericEpsilon(domainI, paramGroup);
675 eps(faceSolution[globalJ][pvIdx], pvIdx), numDiffMethod);
678 updateGlobalJacobian_(A, faceGlobalI, globalJ, pvIdx, partialDeriv);
681 faceVars = origFaceVars;
684 this->couplingManager().updateCouplingContext(domainI, *
this, domainI, globalJ, origFaceSolution[globalJ], pvIdx);
689 evaluateFaceDerivatives(scvf.dofIndex());
692 const auto& connectivityMap = gridGeometry.connectivityMap();
695 for (
const auto& globalJ : connectivityMap(faceId, faceId, scvf.index()))
696 evaluateFaceDerivatives(globalJ);
699 return origResiduals;
706 template<
class JacobianBlock,
class Gr
idVariables>
708 const CellCenterResidualValue& origResidual, GridVariables& gridVariables)
715 const auto& element = this->element();
716 const auto& fvGeometry = this->fvGeometry();
717 const auto& gridGeometry = this->problem().gridGeometry();
718 const auto& curSol = this->curSol()[domainJ];
720 const auto cellCenterGlobalI = gridGeometry.elementMapper().index(element);
722 for (
const auto& scvfJ : scvfs(fvGeometry))
724 const auto globalJ = scvfJ.dofIndex();
727 auto& faceVars = getFaceVarAccess_(gridVariables.curGridFaceVars(), this->curElemFaceVars(), scvfJ);
728 const auto origFaceVars(faceVars);
730 for (
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
732 auto facePriVars = curSol[globalJ];
734 auto evalResidual = [&](Scalar priVar)
737 facePriVars[pvIdx] = priVar;
738 faceVars.updateOwnFaceOnly(facePriVars);
741 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, facePriVars, pvIdx);
744 return this->evalLocalResidualForCellCenter();
748 CellCenterResidualValue partialDeriv(0.0);
751 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
752 static const int numDiffMethod = getParamFromGroup<int>(paramGroup,
"Assembly.NumericDifferenceMethod");
753 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
755 epsCoupl(facePriVars[pvIdx], pvIdx), numDiffMethod);
758 updateGlobalJacobian_(A, cellCenterGlobalI, globalJ, pvIdx, partialDeriv);
761 faceVars = origFaceVars;
764 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, curSol[globalJ], pvIdx);
769 template<std::
size_t otherId,
class JacobianBlock,
class Gr
idVariables>
771 const CellCenterResidualValue& res, GridVariables& gridVariables)
778 const auto& element = this->element();
781 const auto& stencil = this->couplingManager().couplingStencil(domainI, element, domainJ);
786 for (
const auto globalJ : stencil)
788 const auto origResidual = this->couplingManager().evalCouplingResidual(domainI, *
this, domainJ, globalJ);
789 const auto& curSol = this->curSol()[domainJ];
790 const auto origPriVarsJ = curSol[globalJ];
792 for (
int pvIdx = 0; pvIdx < JacobianBlock::block_type::cols; ++pvIdx)
794 auto evalCouplingResidual = [&](Scalar priVar)
796 auto deflectedPriVarsJ = origPriVarsJ;
797 deflectedPriVarsJ[pvIdx] = priVar;
798 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, deflectedPriVarsJ, pvIdx);
799 return this->couplingManager().evalCouplingResidual(domainI, *
this, domainJ, globalJ);
803 CellCenterResidualValue partialDeriv(0.0);
806 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
807 static const int numDiffMethod = getParamFromGroup<int>(paramGroup,
"Assembly.NumericDifferenceMethod");
808 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
810 epsCoupl(origPriVarsJ[pvIdx], pvIdx), numDiffMethod);
813 const auto cellCenterGlobalI = this->problem().gridGeometry().elementMapper().index(element);
814 updateGlobalJacobian_(A, cellCenterGlobalI, globalJ, pvIdx, partialDeriv);
817 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, origPriVarsJ, pvIdx);
826 template<
class JacobianBlock,
class ElementRes
idualVector,
class Gr
idVariables>
835 const auto& problem = this->problem();
836 const auto& fvGeometry = this->fvGeometry();
837 const auto& gridGeometry = this->problem().gridGeometry();
838 const auto& connectivityMap = gridGeometry.connectivityMap();
839 const auto& curSol = this->curSol()[domainJ];
842 for (
auto&& scvf : scvfs(fvGeometry))
845 const auto faceGlobalI = scvf.dofIndex();
848 for (
const auto& globalJ : connectivityMap(faceId, cellCenterId, scvf.index()))
851 auto&& scvJ = fvGeometry.scv(globalJ);
852 const auto elementJ = fvGeometry.gridGeometry().element(globalJ);
853 auto& curVolVars = this->getVolVarAccess(gridVariables.curGridVolVars(), this->curElemVolVars(), scvJ);
854 const auto origVolVars(curVolVars);
855 const auto origCellCenterPriVars = curSol[globalJ];
857 for (
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
859 using PrimaryVariables =
typename VolumeVariables::PrimaryVariables;
860 PrimaryVariables priVars = makePriVarsFromCellCenterPriVars<PrimaryVariables>(origCellCenterPriVars);
862 constexpr auto offset = PrimaryVariables::dimension - CellCenterPrimaryVariables::dimension;
864 auto evalResidual = [&](Scalar priVar)
867 priVars[pvIdx + offset] = priVar;
868 auto elemSol = elementSolution<FVElementGeometry>(std::move(priVars));
869 curVolVars.update(elemSol, problem, elementJ, scvJ);
872 auto deflectedCellCenterPriVars = origCellCenterPriVars;
873 deflectedCellCenterPriVars[pvIdx] = priVar;
874 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, deflectedCellCenterPriVars, pvIdx);
877 return this->evalLocalResidualForFace(scvf);
881 FaceResidualValue partialDeriv(0.0);
882 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
883 static const int numDiffMethod = getParamFromGroup<int>(paramGroup,
"Assembly.NumericDifferenceMethod");
884 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
886 epsCoupl(priVars[pvIdx + offset], pvIdx), numDiffMethod);
889 updateGlobalJacobian_(A, faceGlobalI, globalJ, pvIdx, partialDeriv);
892 curVolVars = origVolVars;
895 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, origCellCenterPriVars, pvIdx);
901 template<std::
size_t otherId,
class JacobianBlock,
class ElementRes
idualVector,
class Gr
idVariables>
910 const auto& fvGeometry = this->fvGeometry();
911 const auto& curSol = this->curSol()[domainJ];
914 for (
auto&& scvf : scvfs(fvGeometry))
917 const auto faceGlobalI = scvf.dofIndex();
920 const auto& stencil = this->couplingManager().couplingStencil(domainI, scvf, domainJ);
926 for (
const auto& globalJ : stencil)
928 const auto origPriVarsJ = curSol[globalJ];
929 const auto origResidual = this->couplingManager().evalCouplingResidual(domainI, scvf, *
this, domainJ, globalJ);
931 for (
int pvIdx = 0; pvIdx < JacobianBlock::block_type::cols; ++pvIdx)
933 auto evalCouplingResidual = [&](Scalar priVar)
935 auto deflectedPriVars = origPriVarsJ;
936 deflectedPriVars[pvIdx] = priVar;
937 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, deflectedPriVars, pvIdx);
938 return this->couplingManager().evalCouplingResidual(domainI, scvf, *
this, domainJ, globalJ);
942 FaceResidualValue partialDeriv(0.0);
943 const auto& paramGroup = this->assembler().problem(domainJ).paramGroup();
944 static const int numDiffMethod = getParamFromGroup<int>(paramGroup,
"Assembly.NumericDifferenceMethod");
945 static const auto epsCoupl = this->couplingManager().numericEpsilon(domainJ, paramGroup);
947 epsCoupl(origPriVarsJ[pvIdx], pvIdx), numDiffMethod);
950 updateGlobalJacobian_(A, faceGlobalI, globalJ, pvIdx, partialDeriv);
953 this->couplingManager().updateCouplingContext(domainI, *
this, domainJ, globalJ, origPriVarsJ, pvIdx);
959 template<
class JacobianMatrixDiagBlock,
class Gr
idVariables>
961 JacobianMatrixDiagBlock& A, GridVariables& gridVariables)
969 template<
class SubMatrix,
class CCOrFacePrimaryVariables>
974 const CCOrFacePrimaryVariables& partialDeriv)
976 for (
int eqIdx = 0; eqIdx < partialDeriv.size(); eqIdx++)
984 assert(eqIdx < matrix[globalI][globalJ].size());
985 assert(pvIdx < matrix[globalI][globalJ][eqIdx].size());
986 matrix[globalI][globalJ][eqIdx][pvIdx] += partialDeriv[eqIdx];
992 FaceVariables& getFaceVarAccess_(GridFaceVariables& gridFaceVariables, ElementFaceVariables& elemFaceVars,
const SubControlVolumeFace& scvf)
995 return gridFaceVariables.faceVars(scvf.index());
997 return elemFaceVars[scvf];
A base class for all local assemblers.
Definition: fvlocalassemblerbase.hh:36
ElementVolumeVariables & curElemVolVars()
The current element volume variables.
Definition: fvlocalassemblerbase.hh:253
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition: fvlocalassemblerbase.hh:56
ElementBoundaryTypes & elemBcTypes()
The element's boundary types.
Definition: fvlocalassemblerbase.hh:269
Implementation & asImp_()
Definition: fvlocalassemblerbase.hh:297
ElementVolumeVariables & prevElemVolVars()
The element volume variables of the provious time step.
Definition: fvlocalassemblerbase.hh:257
FVElementGeometry & fvGeometry()
The global finite volume geometry.
Definition: fvlocalassemblerbase.hh:249
const Assembler & assembler() const
The assembler.
Definition: fvlocalassemblerbase.hh:233
ElementFluxVariablesCache & elemFluxVarsCache()
The element flux variables cache.
Definition: fvlocalassemblerbase.hh:261
bool elementIsGhost() const
Returns if element is a ghost entity.
Definition: fvlocalassemblerbase.hh:241
LocalResidual & localResidual()
The local residual for the current element.
Definition: fvlocalassemblerbase.hh:265
static constexpr bool isImplicit()
Returns true if the assembler considers implicit assembly.
Definition: fvlocalassemblerbase.hh:101
const Element & element() const
The current element.
Definition: fvlocalassemblerbase.hh:237
const SolutionVector & curSol() const
The current solution.
Definition: 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:470
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:827
void assembleJacobianFaceCoupling(Dune::index_constant< otherId > domainJ, JacobianBlock &A, const ElementResidualVector &res, GridVariables &gridVariables)
Definition: subdomainstaggeredlocalassembler.hh:902
FaceResidualValue assembleFaceResidualImpl(const SubControlVolumeFace &scvf)
Definition: subdomainstaggeredlocalassembler.hh:507
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:519
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:707
CellCenterResidualValue assembleCellCenterResidualImpl()
Definition: subdomainstaggeredlocalassembler.hh:502
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:970
void evalAdditionalDerivatives(const std::vector< std::size_t > &additionalDofDependencies, JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
Definition: subdomainstaggeredlocalassembler.hh:960
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:610
void assembleJacobianCellCenterCoupling(Dune::index_constant< otherId > domainJ, JacobianBlock &A, const CellCenterResidualValue &res, GridVariables &gridVariables)
Definition: subdomainstaggeredlocalassembler.hh:770
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:217
const ElementFaceVariables & curElemFaceVars() const
The current element volume variables.
Definition: subdomainstaggeredlocalassembler.hh:303
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:273
ElementFaceVariables & prevElemFaceVars()
The element volume variables of the provious time step.
Definition: subdomainstaggeredlocalassembler.hh:299
static constexpr auto domainId
Definition: subdomainstaggeredlocalassembler.hh:73
const Problem & problem() const
Definition: subdomainstaggeredlocalassembler.hh:291
SubDomainStaggeredLocalAssemblerBase(const Assembler &assembler, const Element &element, const SolutionVector &curSol, CouplingManager &couplingManager)
Definition: subdomainstaggeredlocalassembler.hh:82
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:260
CellCenterResidualValue evalLocalFluxAndSourceResidualForCellCenter() const
Convenience function to evaluate the flux and source terms (i.e, the terms without a time derivative)...
Definition: subdomainstaggeredlocalassembler.hh:184
static constexpr auto faceId
Definition: subdomainstaggeredlocalassembler.hh:75
static constexpr auto faceOffset
Definition: subdomainstaggeredlocalassembler.hh:78
FaceResidualValue evalLocalResidualForFace(const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars) const
Evaluates the complete local residual for the current face.
Definition: subdomainstaggeredlocalassembler.hh:238
static constexpr auto numEqCellCenter
Definition: subdomainstaggeredlocalassembler.hh:77
const ElementFaceVariables & prevElemFaceVars() const
The element volume variables of the provious time step.
Definition: subdomainstaggeredlocalassembler.hh:307
CellCenterResidualValue evalLocalResidualForCellCenter() const
Convenience function to evaluate the complete local residual for the current element....
Definition: subdomainstaggeredlocalassembler.hh:138
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:286
CouplingManager & couplingManager()
Definition: subdomainstaggeredlocalassembler.hh:310
static constexpr auto cellCenterId
Definition: subdomainstaggeredlocalassembler.hh:74
CellCenterResidualValue evalLocalResidualForCellCenter(const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars) const
Evaluates the complete local residual for the current cell center.
Definition: subdomainstaggeredlocalassembler.hh:158
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:105
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:197
CellCenterResidualValue evalLocalStorageResidualForCellCenter() const
Convenience function to evaluate storage term (i.e, the term with a time derivative) of the local res...
Definition: subdomainstaggeredlocalassembler.hh:207
void assembleResidual(SubResidual &res)
Assemble the residual only.
Definition: subdomainstaggeredlocalassembler.hh:117
ElementFaceVariables & curElemFaceVars()
The current element volume variables.
Definition: subdomainstaggeredlocalassembler.hh:295
The staggered multidomain local assembler.
Definition: subdomainstaggeredlocalassembler.hh:444
A base class for all implicit multidomain local assemblers (staggered)
Definition: subdomainstaggeredlocalassembler.hh:401
void bindLocalViews()
Definition: subdomainstaggeredlocalassembler.hh:407
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
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:267
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:59
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.