12#ifndef DUMUX_MULTIDOMAIN_FREEFLOW_COUPLING_MANAGER_CVFE_HH
13#define DUMUX_MULTIDOMAIN_FREEFLOW_COUPLING_MANAGER_CVFE_HH
21#include <dune/common/exceptions.hh>
22#include <dune/common/indices.hh>
23#include <dune/common/float_cmp.hh>
24#include <dune/geometry/referenceelements.hh>
28#include <dumux/common/concepts/variables_.hh>
65 template<std::
size_t id>
using SubDomainTypeTag =
typename Traits::template SubDomain<id>::TypeTag;
68 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
69 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
70 template<std::
size_t id>
using ElementSeed =
typename GridView<id>::Grid::template Codim<0>::EntitySeed;
71 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
72 template<std::
size_t id>
using SubControlVolume =
typename FVElementGeometry<id>::SubControlVolume;
73 template<std::
size_t id>
using SubControlVolumeFace =
typename FVElementGeometry<id>::SubControlVolumeFace;
74 template<std::
size_t id>
using GridVariables =
typename Traits::template SubDomain<id>::GridVariables;
75 template<std::
size_t id>
using GridVariablesCache = Concept::GridVariablesCache_t<GridVariables<id>>;
76 template<std::
size_t id>
using ElementVariables =
typename GridVariablesCache<id>::LocalView;
78 template<std::
size_t id>
using Variables = Concept::Variables_t<GridVariables<id>>;
80 using Scalar =
typename Traits::Scalar;
81 using SolutionVector =
typename Traits::SolutionVector;
83 using CouplingStencilType = std::vector<std::size_t>;
85 using GridVariablesTuple =
typename Traits::template TupleOfSharedPtr<GridVariables>;
87 using FluidSystem =
typename Variables<freeFlowMassIndex>::FluidSystem;
89 using GlobalPosition =
typename SubControlVolumeFace<freeFlowMassIndex>::GlobalPosition;
90 using VelocityVector = GlobalPosition;
91 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
93 static_assert(std::is_same_v<VelocityVector, typename SubControlVolumeFace<freeFlowMomentumIndex>::GlobalPosition>);
95 template<
class ElementSolution>
96 struct MomentumCouplingContextNoCaching
98 MomentumCouplingContextNoCaching(ElementSolution&& elemSol)
99 : elemSol_(std::move(elemSol)) {}
101 template<
class Gr
idVarsCache,
class FvElementGeometry,
class SubControlVolume>
102 auto vars(
const GridVarsCache& gridVarsCache,
const FvElementGeometry& fvGeometry,
const SubControlVolume& scv)
const
104 const auto&
problem = gridVarsCache.problem();
105 Variables<freeFlowMassIndex> variables;
106 if constexpr (Concept::FVGridVariables<GridVariables<freeFlowMassIndex>>)
107 variables.update(elemSol_,
problem, fvGeometry.element(), scv);
109 variables.update(elemSol_,
problem, fvGeometry, ipData(fvGeometry, scv));
113 ElementSolution elemSol_;
116 struct MomentumCouplingContextGlobalCaching
118 template<
class Gr
idVarsCache,
class FvElementGeometry,
class SubControlVolume>
119 const auto& vars(
const GridVarsCache& gridVarsCache,
const FvElementGeometry& fvGeometry,
const SubControlVolume& scv)
const
121 if constexpr (
requires { gridVarsCache.volVars(scv); })
122 return gridVarsCache.volVars(scv);
124 return gridVarsCache.variables(scv);
128 using MomentumDiscretizationMethod =
typename GridGeometry<freeFlowMomentumIndex>::DiscretizationMethod;
129 using MassDiscretizationMethod =
typename GridGeometry<freeFlowMassIndex>::DiscretizationMethod;
131 template<std::
size_t id>
using IpData
132 = Dumux::CVFE::InterpolationPointData<typename GridView<id>::template Codim<0>::Entity::Geometry::LocalCoordinate,
133 typename GridView<id>::template Codim<0>::Entity::Geometry::GlobalCoordinate>;
137 static constexpr auto pressureIdx = Variables<freeFlowMassIndex>::Indices::pressureIdx;
145 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> momentumProblem,
146 std::shared_ptr<Problem<freeFlowMassIndex>> massProblem,
147 GridVariablesTuple&& gridVariables,
148 const SolutionVector&
curSol)
150 this->
setSubProblems(std::make_tuple(momentumProblem, massProblem));
151 gridVariables_ = gridVariables;
155 computeCouplingStencils_();
159 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> momentumProblem,
160 std::shared_ptr<Problem<freeFlowMassIndex>> massProblem,
161 GridVariablesTuple&& gridVariables,
162 const SolutionVector&
curSol,
163 const SolutionVector& prevSol)
165 init(momentumProblem, massProblem, std::forward<GridVariablesTuple>(gridVariables),
curSol);
170 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> momentumProblem,
171 std::shared_ptr<Problem<freeFlowMassIndex>> massProblem,
172 GridVariablesTuple&& gridVariables,
175 this->
setSubProblems(std::make_tuple(momentumProblem, massProblem));
176 gridVariables_ = gridVariables;
180 computeCouplingStencils_();
193 [[deprecated(
"This method will be removed after release (3.11). Use pressure(..., ipData) instead!")]]
194 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
195 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
196 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
197 const bool considerPreviousTimeStep =
false)
const
199 const auto& globalPos = scvf.ipGlobal();
200 const auto& localPos = element.geometry().local(globalPos);
201 return this->
pressure(element, fvGeometry, IpData<freeFlowMassIndex>(localPos, globalPos), considerPreviousTimeStep);
207 [[deprecated(
"This method will be removed after release (3.11). Use pressure(..., ipData) instead!")]]
208 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
209 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
210 const SubControlVolume<freeFlowMomentumIndex>& scv,
211 const bool considerPreviousTimeStep =
false)
const
213 return this->
pressure(element, fvGeometry, ipData(fvGeometry, scv), considerPreviousTimeStep);
219 template <
class IpData>
220 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
221 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
222 const IpData& ipData,
223 const bool considerPreviousTimeStep =
false)
const
225 assert(!(considerPreviousTimeStep && !isTransient_()));
236 [[deprecated(
"This method will be removed after release (3.11). Use density(..., ipData) instead!")]]
237 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
238 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
239 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
240 const bool considerPreviousTimeStep =
false)
const
242 const auto& globalPos = scvf.ipGlobal();
243 const auto& localPos = element.geometry().local(globalPos);
244 return this->
density(element, fvGeometry, IpData<freeFlowMassIndex>(localPos, globalPos), considerPreviousTimeStep);
250 [[deprecated(
"This method will be removed after release (3.11). Use density(..., ipData) instead!")]]
251 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
252 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
253 const SubControlVolume<freeFlowMomentumIndex>& scv,
254 const bool considerPreviousTimeStep =
false)
const
256 return this->
density(element, fvGeometry, ipData(fvGeometry, scv), considerPreviousTimeStep);
262 template <
class IpData>
263 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
264 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
265 const IpData& ipData,
266 const bool considerPreviousTimeStep =
false)
const
268 assert(!(considerPreviousTimeStep && !isTransient_()));
274 massFvGeometry.bind(element);
275 const auto context = makeMomentumCouplingContext_(massFvGeometry, sol);
276 const auto& gridVarsCache = subDomainGridVars_(Dune::index_constant<freeFlowMassIndex>{}, considerPreviousTimeStep);
280 const auto eIdx = fvGeometry.elementIndex();
281 const auto& scv = massFvGeometry.scv(eIdx);
283 const auto& variables = context.vars(gridVarsCache, massFvGeometry, scv);
285 return variables.density();
291 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
292 const auto& localBasis = massFvGeometry.feLocalBasis();
293 std::vector<ShapeValue> shapeValues;
294 localBasis.evaluateFunction(ipData.local(), shapeValues);
297 for (
const auto& scv :
scvs(massFvGeometry))
299 const auto& variables = context.vars(gridVarsCache, massFvGeometry, scv);
300 rho += variables.density()*shapeValues[scv.localDofIndex()][0];
306 DUNE_THROW(Dune::NotImplemented,
307 "Density interpolation for discretization scheme " << MassDiscretizationMethod{}
314 [[deprecated(
"This method will be removed after release (3.11). Use effectiveViscosity(..., ipData) instead!")]]
316 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
317 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
318 const bool considerPreviousTimeStep =
false)
const
320 const auto& globalPos = scvf.ipGlobal();
321 const auto& localPos = element.geometry().local(globalPos);
322 return this->
effectiveViscosity(element, fvGeometry, IpData<freeFlowMassIndex>(localPos, globalPos), considerPreviousTimeStep);
328 [[deprecated(
"This method will be removed after release (3.11). Use effectiveViscosity(..., ipData) instead!")]]
330 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
331 const SubControlVolume<freeFlowMomentumIndex>& scv,
332 const bool considerPreviousTimeStep =
false)
const
334 return this->
effectiveViscosity(element, fvGeometry, ipData(fvGeometry, scv), considerPreviousTimeStep);
340 template <
class IpData>
342 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
343 const IpData& ipData,
344 const bool considerPreviousTimeStep =
false)
const
346 assert(!(considerPreviousTimeStep && !isTransient_()));
352 massFvGeometry.bind(element);
353 const auto context = makeMomentumCouplingContext_(massFvGeometry, sol);
354 const auto& gridVarsCache = subDomainGridVars_(Dune::index_constant<freeFlowMassIndex>{}, considerPreviousTimeStep);
358 const auto eIdx = fvGeometry.elementIndex();
359 const auto& scv = massFvGeometry.scv(eIdx);
361 const auto& variables = context.vars(gridVarsCache, massFvGeometry, scv);
363 return variables.viscosity();
369 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
370 const auto& localBasis = massFvGeometry.feLocalBasis();
371 std::vector<ShapeValue> shapeValues;
372 localBasis.evaluateFunction(ipData.local(), shapeValues);
375 for (
const auto& scv :
scvs(massFvGeometry))
377 const auto& variables = context.vars(gridVarsCache, massFvGeometry, scv);
378 mu += variables.viscosity()*shapeValues[scv.localDofIndex()][0];
384 DUNE_THROW(Dune::NotImplemented,
385 "Viscosity interpolation for discretization scheme " << MassDiscretizationMethod{}
392 VelocityVector
faceVelocity(
const Element<freeFlowMassIndex>& element,
393 const SubControlVolumeFace<freeFlowMassIndex>& scvf)
const
397 fvGeometry.bindElement(element);
399 const auto& localBasis = fvGeometry.feLocalBasis();
401 std::vector<ShapeValue> shapeValues;
402 const auto ipLocal = element.geometry().local(scvf.ipGlobal());
403 localBasis.evaluateFunction(ipLocal, shapeValues);
407 for (
const auto& localDof :
localDofs(fvGeometry))
416 VelocityVector
elementVelocity(
const FVElementGeometry<freeFlowMassIndex>& fvGeometry)
const
419 momentumFvGeometry.bindElement(fvGeometry.element());
421 const auto& localBasis = momentumFvGeometry.feLocalBasis();
425 std::vector<ShapeValue> shapeValues;
426 localBasis.evaluateFunction(referenceElement(fvGeometry.element()).position(0,0), shapeValues);
428 for (
const auto& localDof :
localDofs(momentumFvGeometry))
437 template <
class IpData>
438 VelocityVector
velocity(
const FVElementGeometry<freeFlowMassIndex>& fvGeometry,
439 const IpData& ipData,
440 const bool considerPreviousTimeStep =
false)
const
442 assert(!(considerPreviousTimeStep && !isTransient_()));
444 const auto& element = fvGeometry.element();
447 momentumFvGeometry.bindElement(fvGeometry.element());
460 template<std::
size_t j>
461 const CouplingStencilType&
couplingStencil(Dune::index_constant<freeFlowMomentumIndex> domainI,
462 const Element<freeFlowMomentumIndex>& elementI,
463 const SubControlVolume<freeFlowMomentumIndex>& scvI,
464 Dune::index_constant<j> domainJ)
const
465 {
return emptyStencil_; }
481 const CouplingStencilType&
couplingStencil(Dune::index_constant<freeFlowMassIndex> domainI,
482 const Element<freeFlowMassIndex>& elementI,
483 Dune::index_constant<freeFlowMomentumIndex> domainJ)
const
486 return massAndEnergyToMomentumStencils_[eIdx];
497 const CouplingStencilType&
couplingStencil(Dune::index_constant<freeFlowMomentumIndex> domainI,
498 const Element<freeFlowMomentumIndex>& elementI,
499 Dune::index_constant<freeFlowMassIndex> domainJ)
const
502 return momentumToMassAndEnergyStencils_[eIdx];
531 template<std::
size_t i, std::
size_t j,
class LocalAssemblerI>
533 const LocalAssemblerI& localAssemblerI,
534 Dune::index_constant<j> domainJ,
535 std::size_t dofIdxGlobalJ,
536 const PrimaryVariables<j>& priVarsJ,
539 this->
curSol(domainJ)[dofIdxGlobalJ][pvIdxJ] = priVarsJ[pvIdxJ];
541 if constexpr (GridVariablesCache<freeFlowMassIndex>::cachingEnabled)
548 const auto& deflectedElement = Deprecated::gridGeometry(
problem).element(dofIdxGlobalJ);
551 fvGeometry.bind(deflectedElement);
552 const auto& scv = fvGeometry.scv(dofIdxGlobalJ);
554 if constexpr (Concept::FVGridVariables<GridVariables<freeFlowMassIndex>>)
555 subDomainVariables_(Dune::index_constant<freeFlowMassIndex>{},
true, scv).update(std::move(elemSol),
problem, deflectedElement, scv);
557 subDomainVariables_(Dune::index_constant<freeFlowMassIndex>{},
true, ipData(fvGeometry, scv)).update(std::move(elemSol),
problem, deflectedElement, scv);
566 const auto deflectedElementIdx = Deprecated::gridGeometry(
problem).elementMapper().index(localAssemblerI.element());
567 const auto& deflectedElement = Deprecated::gridGeometry(
problem).element(deflectedElementIdx);
570 fvGeometry.bind(deflectedElement);
573 for (
const auto& scv :
scvs(fvGeometry))
575 if (scv.dofIndex() == dofIdxGlobalJ)
577 if constexpr (Concept::FVGridVariables<GridVariables<freeFlowMassIndex>>)
578 this->subDomainVariables_(Dune::index_constant<freeFlowMassIndex>{},
true, scv).update(std::move(elemSol),
problem, deflectedElement, scv);
580 this->subDomainVariables_(Dune::index_constant<freeFlowMassIndex>{},
true, scv).update(std::move(elemSol),
problem, fvGeometry, ipData(fvGeometry, scv));
586 DUNE_THROW(Dune::NotImplemented,
587 "Context update for discretization scheme " << MassDiscretizationMethod{}
618 template<std::
size_t i,
class AssembleElementFunc>
619 void assembleMultithreaded(Dune::index_constant<i> domainId, AssembleElementFunc&& assembleElement)
const
621 if (elementSets_.empty())
622 DUNE_THROW(Dune::InvalidStateException,
"Call computeColorsForAssembly before assembling in parallel!");
629 for (
const auto& elements : elementSets_)
633 const auto element = grid.entity(elements[eIdx]);
634 assembleElement(element);
640 template<std::
size_t i>
641 const auto& subDomainGridVars_(Dune::index_constant<i> domainIdx,
bool current)
const
643 if constexpr (Concept::FVGridVariables<GridVariables<i>>)
644 return current ? gridVars_(domainIdx).curGridVolVars()
645 : gridVars_(domainIdx).prevGridVolVars();
647 return current ? gridVars_(domainIdx).curGridVars()
648 : gridVars_(domainIdx).prevGridVars();
651 template<std::
size_t i>
652 auto& subDomainGridVars_(Dune::index_constant<i> domainIdx,
bool current)
654 if constexpr (Concept::FVGridVariables<GridVariables<i>>)
655 return current ? gridVars_(domainIdx).curGridVolVars()
656 : gridVars_(domainIdx).prevGridVolVars();
658 return current ? gridVars_(domainIdx).curGridVars()
659 : gridVars_(domainIdx).prevGridVars();
662 template<std::
size_t i,
class Scv>
663 auto& subDomainVariables_(Dune::index_constant<i> domainIdx,
bool current,
const Scv& scv)
665 if constexpr (Concept::FVGridVariables<GridVariables<i>>)
666 return subDomainGridVars_(domainIdx, current).volVars(scv);
668 return subDomainGridVars_(domainIdx, current).variables(scv);
671 template<std::
size_t i,
class Scv>
672 const auto& subDomainVariables_(Dune::index_constant<i> domainIdx,
bool current,
const Scv& scv)
const
674 if constexpr (Concept::FVGridVariables<GridVariables<i>>)
675 return subDomainGridVars_(domainIdx, current).volVars(scv);
677 return subDomainGridVars_(domainIdx, current).variables(scv);
680 template<
class SolutionVector>
681 auto makeMomentumCouplingContext_(
const FVElementGeometry<freeFlowMassIndex>& fvGeometry,
682 const SolutionVector& sol)
const
684 if constexpr (GridVariablesCache<freeFlowMassIndex>::cachingEnabled)
685 return MomentumCouplingContextGlobalCaching{};
687 return MomentumCouplingContextNoCaching{
elementSolution(fvGeometry.element(), sol, Deprecated::gridGeometry(fvGeometry))};
694 template<std::
size_t i>
695 const GridVariables<i>& gridVars_(Dune::index_constant<i> domainIdx)
const
697 if (std::get<i>(gridVariables_))
698 return *std::get<i>(gridVariables_);
700 DUNE_THROW(Dune::InvalidStateException,
"The gridVariables pointer was not set. Use setGridVariables() before calling this function");
707 template<std::
size_t i>
708 GridVariables<i>& gridVars_(Dune::index_constant<i> domainIdx)
710 if (std::get<i>(gridVariables_))
711 return *std::get<i>(gridVariables_);
713 DUNE_THROW(Dune::InvalidStateException,
"The gridVariables pointer was not set. Use setGridVariables() before calling this function");
716 void computeCouplingStencils_()
720 auto momentumFvGeometry =
localView(momentumGridGeometry);
721 auto massFvGeometry =
localView(massGridGeometry);
723 massAndEnergyToMomentumStencils_.clear();
724 massAndEnergyToMomentumStencils_.resize(massGridGeometry.gridView().size(0));
726 momentumToMassAndEnergyStencils_.clear();
727 momentumToMassAndEnergyStencils_.resize(momentumGridGeometry.gridView().size(0));
729 assert(massAndEnergyToMomentumStencils_.size() == momentumToMassAndEnergyStencils_.size());
730 bool hasCubeElements =
false;
732 for (
const auto& element : elements(momentumGridGeometry.gridView()))
735 hasCubeElements =
true;
737 momentumFvGeometry.bindElement(element);
738 massFvGeometry.bindElement(element);
739 const auto eIdx = momentumFvGeometry.elementIndex();
741 for (
const auto& localDof :
localDofs(momentumFvGeometry))
742 massAndEnergyToMomentumStencils_[eIdx].push_back(localDof.dofIndex());
745 for (
const auto& scv :
scvs(massFvGeometry))
746 momentumToMassAndEnergyStencils_[eIdx].push_back(scv.dofIndex());
752 if(hasCubeElements && !GridGeometry<freeFlowMomentumIndex>::enableHybridCVFE)
754 std::cerr <<
"Warning: Coupled Navier-Stokes problem on cube elements uses non-hybrid pq1bubble. "
755 <<
"The hybrid variant is recommended because it implements two bubble functions for stability reasons."
761 CouplingStencilType emptyStencil_;
762 std::vector<CouplingStencilType> momentumToMassAndEnergyStencils_;
763 std::vector<CouplingStencilType> massAndEnergyToMomentumStencils_;
766 GridVariablesTuple gridVariables_;
769 bool isTransient_()
const
770 {
return prevSol_ !=
nullptr; }
772 const SolutionVector* prevSol_ =
nullptr;
774 std::deque<std::vector<ElementSeed<freeFlowMomentumIndex>>> elementSets_;
780template<class Traits, class DiscretizationMethod = typename Detail::MomentumDiscretizationMethod<Traits>::type>
784template<
class Traits,
class D>
786{
using type = std::true_type; };
The interface of the coupling manager for free flow systems.
Definition couplingmanager_cvfe.hh:55
VelocityVector faceVelocity(const Element< freeFlowMassIndex > &element, const SubControlVolumeFace< freeFlowMassIndex > &scvf) const
Returns the velocity at a given sub control volume face.
Definition couplingmanager_cvfe.hh:391
void init(std::shared_ptr< Problem< freeFlowMomentumIndex > > momentumProblem, std::shared_ptr< Problem< freeFlowMassIndex > > massProblem, GridVariablesTuple &&gridVariables, const SolutionVector &curSol)
Methods to be accessed by main.
Definition couplingmanager_cvfe.hh:144
static constexpr auto freeFlowMomentumIndex
Definition couplingmanager_cvfe.hh:58
static constexpr auto pressureIdx
Definition couplingmanager_cvfe.hh:136
Scalar density(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf, const bool considerPreviousTimeStep=false) const
Returns the density at a given sub control volume face.
Definition couplingmanager_cvfe.hh:236
Scalar effectiveViscosity(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf, const bool considerPreviousTimeStep=false) const
Returns the effective viscosity at a given sub control volume face.
Definition couplingmanager_cvfe.hh:314
VelocityVector elementVelocity(const FVElementGeometry< freeFlowMassIndex > &fvGeometry) const
Returns the velocity at the element center.
Definition couplingmanager_cvfe.hh:415
void assembleMultithreaded(Dune::index_constant< i > domainId, AssembleElementFunc &&assembleElement) const
Execute assembly kernel in parallel.
Definition couplingmanager_cvfe.hh:618
Scalar pressure(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf, const bool considerPreviousTimeStep=false) const
Returns the pressure at a given sub control volume face.
Definition couplingmanager_cvfe.hh:193
void computeColorsForAssembly()
Compute colors for multithreaded assembly.
Definition couplingmanager_cvfe.hh:596
static constexpr auto freeFlowMassIndex
Definition couplingmanager_cvfe.hh:59
VelocityVector velocity(const FVElementGeometry< freeFlowMassIndex > &fvGeometry, const IpData &ipData, const bool considerPreviousTimeStep=false) const
Returns the velocity at an interpolation point.
Definition couplingmanager_cvfe.hh:437
const CouplingStencilType & couplingStencil(Dune::index_constant< freeFlowMomentumIndex > domainI, const Element< freeFlowMomentumIndex > &elementI, const SubControlVolume< freeFlowMomentumIndex > &scvI, Dune::index_constant< j > domainJ) const
The coupling stencil of domain I, i.e. which domain J DOFs the given domain I element's residual depe...
Definition couplingmanager_cvfe.hh:460
typename ParentType::SolutionVectorStorage SolutionVectorStorage
Definition couplingmanager_cvfe.hh:63
void attachSolution(const SolutionVectorStorage &curSol)
Attach a solution vector stored outside of this class.
Definition multidomain/couplingmanager.hh:331
void setSubProblems(const std::tuple< std::shared_ptr< SubProblems >... > &problems)
set the pointers to the sub problems
Definition multidomain/couplingmanager.hh:296
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition multidomain/couplingmanager.hh:318
SubSolutionVector< i > & curSol(Dune::index_constant< i > domainIdx)
the solution vector of the subproblem
Definition multidomain/couplingmanager.hh:347
void updateSolution(const SolutionVector &curSol)
Updates the entire solution vector, e.g. before assembly or after grid adaption Overload might want t...
Definition multidomain/couplingmanager.hh:228
CouplingManager()
Default constructor.
Definition multidomain/couplingmanager.hh:70
typename Traits::template TupleOfSharedPtr< SubSolutionVector > SolutionVectorStorage
the type in which the solution vector is stored in the manager
Definition multidomain/couplingmanager.hh:59
Coloring schemes for shared-memory-parallel assembly.
Defines all properties used in Dumux.
Classes representing interpolation point data for control-volume finite element schemes.
Element solution classes and factory functions.
free functions for the evaluation of primary variables inside elements.
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
PrimaryVariables evalSolutionAtLocalPos(const Element &element, const typename Element::Geometry &geometry, const typename FVElementGeometry::GridGeometry &gridGeometry, const CVFEElementSolution< FVElementGeometry, PrimaryVariables > &elemSol, const typename Element::Geometry::LocalCoordinate &localPos, bool ignoreState=false)
Interpolates a given cvfe element solution at a given local position. Uses the finite element cache o...
Definition evalsolution.hh:173
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)
updates all data and variables that are necessary to evaluate the residual of the element of domain i...
Definition couplingmanager_cvfe.hh:531
void parallelFor(const std::size_t count, const FunctorType &functor)
A parallel for loop (multithreading).
Definition parallel_for.hh:160
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
Class representing dofs on elements for control-volume finite element schemes.
The available discretization methods in Dumux.
The interface of the coupling manager for multi domain problems.
A linear system assembler (residual and Jacobian) for finite volume schemes with multiple domains.
Definition variablesadapter.hh:17
Definition cvfelocalresidual.hh:25
constexpr FCDiamond fcdiamond
Definition method.hh:184
constexpr CCTpfa cctpfa
Definition method.hh:174
constexpr Box box
Definition method.hh:176
constexpr PQ1Bubble pq1bubble
Definition method.hh:180
auto computeColoring(const GridGeometry &gg, int verbosity=1)
Compute iterable lists of element seeds partitioned by color.
Definition coloring.hh:243
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
auto localDofs(const FVElementGeometry &fvGeometry)
range over local dofs
Definition localdof.hh:50
Parallel for loop (multithreading).
Type trait that is specialized for coupling manager supporting multithreaded assembly.
Definition multistagemultidomainfvassembler.hh:78
std::true_type type
Definition couplingmanager_cvfe.hh:786
Definition couplingmanager_cvfe.hh:781