12#ifndef DUMUX_MULTIDOMAIN_FREEFLOW_COUPLING_MANAGER_CVFE_HH
13#define DUMUX_MULTIDOMAIN_FREEFLOW_COUPLING_MANAGER_CVFE_HH
20#include <dune/common/exceptions.hh>
21#include <dune/common/indices.hh>
22#include <dune/common/float_cmp.hh>
23#include <dune/geometry/referenceelements.hh>
60 template<std::
size_t id>
using SubDomainTypeTag =
typename Traits::template SubDomain<id>::TypeTag;
63 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
64 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
65 template<std::
size_t id>
using ElementSeed =
typename GridView<id>::Grid::template Codim<0>::EntitySeed;
66 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
67 template<std::
size_t id>
using SubControlVolume =
typename FVElementGeometry<id>::SubControlVolume;
68 template<std::
size_t id>
using SubControlVolumeFace =
typename FVElementGeometry<id>::SubControlVolumeFace;
69 template<std::
size_t id>
using GridVariables =
typename Traits::template SubDomain<id>::GridVariables;
70 template<std::
size_t id>
using ElementVolumeVariables =
typename GridVariables<id>::GridVolumeVariables::LocalView;
71 template<std::
size_t id>
using GridFluxVariablesCache =
typename GridVariables<id>::GridFluxVariablesCache;
75 using Scalar =
typename Traits::Scalar;
76 using SolutionVector =
typename Traits::SolutionVector;
80 using GridVariablesTuple =
typename Traits::template TupleOfSharedPtr<GridVariables>;
82 using FluidSystem =
typename VolumeVariables<freeFlowMassIndex>::FluidSystem;
84 using VelocityVector =
typename SubControlVolumeFace<freeFlowMassIndex>::GlobalPosition;
85 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
87 static_assert(std::is_same_v<VelocityVector, typename SubControlVolumeFace<freeFlowMomentumIndex>::GlobalPosition>);
89 struct MomentumCouplingContext
91 FVElementGeometry<freeFlowMassIndex> fvGeometry;
92 ElementVolumeVariables<freeFlowMassIndex> curElemVolVars;
93 ElementVolumeVariables<freeFlowMassIndex> prevElemVolVars;
97 struct MassAndEnergyCouplingContext
99 MassAndEnergyCouplingContext(FVElementGeometry<freeFlowMomentumIndex>&& f,
const std::size_t i)
100 : fvGeometry(std::move(f))
104 FVElementGeometry<freeFlowMomentumIndex> fvGeometry;
108 using MomentumDiscretizationMethod =
typename GridGeometry<freeFlowMomentumIndex>::DiscretizationMethod;
109 using MassDiscretizationMethod =
typename GridGeometry<freeFlowMassIndex>::DiscretizationMethod;
113 static constexpr auto pressureIdx = VolumeVariables<freeFlowMassIndex>::Indices::pressureIdx;
121 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> momentumProblem,
122 std::shared_ptr<Problem<freeFlowMassIndex>> massProblem,
123 GridVariablesTuple&& gridVariables,
124 const SolutionVector&
curSol)
126 this->
setSubProblems(std::make_tuple(momentumProblem, massProblem));
127 gridVariables_ = gridVariables;
130 computeCouplingStencils_();
134 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> momentumProblem,
135 std::shared_ptr<Problem<freeFlowMassIndex>> massProblem,
136 GridVariablesTuple&& gridVariables,
137 const SolutionVector&
curSol,
138 const SolutionVector& prevSol)
140 init(momentumProblem, massProblem, std::forward<GridVariablesTuple>(gridVariables),
curSol);
146 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> momentumProblem,
147 std::shared_ptr<Problem<freeFlowMassIndex>> massProblem,
148 GridVariablesTuple&& gridVariables,
151 this->
setSubProblems(std::make_tuple(momentumProblem, massProblem));
152 gridVariables_ = gridVariables;
155 computeCouplingStencils_();
168 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
169 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
170 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
171 const bool considerPreviousTimeStep =
false)
const
173 assert(!(considerPreviousTimeStep && !this->isTransient_));
184 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
185 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
186 const SubControlVolume<freeFlowMomentumIndex>& scv,
187 const bool considerPreviousTimeStep =
false)
const
189 assert(!(considerPreviousTimeStep && !this->isTransient_));
200 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
201 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
202 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
203 const bool considerPreviousTimeStep =
false)
const
205 assert(!(considerPreviousTimeStep && !this->isTransient_));
206 bindCouplingContext_(Dune::index_constant<freeFlowMomentumIndex>(), element, fvGeometry.elementIndex());
210 const auto eIdx = fvGeometry.elementIndex();
211 const auto& scv = this->momentumCouplingContext_()[0].fvGeometry.scv(eIdx);
213 const auto& volVars = considerPreviousTimeStep ?
214 this->momentumCouplingContext_()[0].prevElemVolVars[scv]
215 : this->momentumCouplingContext_()[0].curElemVolVars[scv];
217 return volVars.density();
223 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
224 const auto& localBasis = this->momentumCouplingContext_()[0].fvGeometry.feLocalBasis();
225 std::vector<ShapeValue> shapeValues;
226 const auto ipLocal = element.geometry().local(scvf.ipGlobal());
227 localBasis.evaluateFunction(ipLocal, shapeValues);
230 for (
const auto& scv : scvs(this->momentumCouplingContext_()[0].fvGeometry))
232 const auto& volVars = considerPreviousTimeStep ?
233 this->momentumCouplingContext_()[0].prevElemVolVars[scv]
234 : this->momentumCouplingContext_()[0].curElemVolVars[scv];
235 rho += volVars.density()*shapeValues[scv.indexInElement()][0];
241 DUNE_THROW(Dune::NotImplemented,
242 "Density interpolation for discretization scheme " << MassDiscretizationMethod{}
249 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
250 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
251 const SubControlVolume<freeFlowMomentumIndex>& scv,
252 const bool considerPreviousTimeStep =
false)
const
254 assert(!(considerPreviousTimeStep && !this->isTransient_));
255 bindCouplingContext_(Dune::index_constant<freeFlowMomentumIndex>(), element, scv.elementIndex());
259 const auto eIdx = scv.elementIndex();
260 const auto& scvI = this->momentumCouplingContext_()[0].fvGeometry.scv(eIdx);
262 const auto& volVars = considerPreviousTimeStep ?
263 this->momentumCouplingContext_()[0].prevElemVolVars[scvI]
264 : this->momentumCouplingContext_()[0].curElemVolVars[scvI];
266 return volVars.density();
272 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
273 const auto& localBasis = this->momentumCouplingContext_()[0].fvGeometry.feLocalBasis();
274 std::vector<ShapeValue> shapeValues;
275 const auto ipLocal = element.geometry().local(scv.dofPosition());
276 localBasis.evaluateFunction(ipLocal, shapeValues);
279 for (
const auto& scvI : scvs(this->momentumCouplingContext_()[0].fvGeometry))
281 const auto& volVars = considerPreviousTimeStep ?
282 this->momentumCouplingContext_()[0].prevElemVolVars[scvI]
283 : this->momentumCouplingContext_()[0].curElemVolVars[scvI];
284 rho += volVars.density()*shapeValues[scvI.indexInElement()][0];
289 DUNE_THROW(Dune::NotImplemented,
290 "Density interpolation for discretization scheme " << MassDiscretizationMethod{}
298 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
299 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
300 const bool considerPreviousTimeStep =
false)
const
302 assert(!(considerPreviousTimeStep && !this->isTransient_));
303 bindCouplingContext_(Dune::index_constant<freeFlowMomentumIndex>(), element, fvGeometry.elementIndex());
307 const auto eIdx = fvGeometry.elementIndex();
308 const auto& scv = this->momentumCouplingContext_()[0].fvGeometry.scv(eIdx);
309 const auto& volVars = considerPreviousTimeStep ?
310 this->momentumCouplingContext_()[0].prevElemVolVars[scv]
311 : this->momentumCouplingContext_()[0].curElemVolVars[scv];
312 return volVars.viscosity();
318 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
319 const auto& localBasis = this->momentumCouplingContext_()[0].fvGeometry.feLocalBasis();
320 std::vector<ShapeValue> shapeValues;
321 const auto ipLocal = element.geometry().local(scvf.ipGlobal());
322 localBasis.evaluateFunction(ipLocal, shapeValues);
325 for (
const auto& scv : scvs(this->momentumCouplingContext_()[0].fvGeometry))
327 const auto& volVars = considerPreviousTimeStep ?
328 this->momentumCouplingContext_()[0].prevElemVolVars[scv]
329 : this->momentumCouplingContext_()[0].curElemVolVars[scv];
330 mu += volVars.viscosity()*shapeValues[scv.indexInElement()][0];
336 DUNE_THROW(Dune::NotImplemented,
337 "Viscosity interpolation for discretization scheme " << MassDiscretizationMethod{}
345 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
346 const SubControlVolume<freeFlowMomentumIndex>& scv,
347 const bool considerPreviousTimeStep =
false)
const
349 assert(!(considerPreviousTimeStep && !this->isTransient_));
350 bindCouplingContext_(Dune::index_constant<freeFlowMomentumIndex>(), element, fvGeometry.elementIndex());
354 const auto eIdx = fvGeometry.elementIndex();
355 const auto& scvI = this->momentumCouplingContext_()[0].fvGeometry.scv(eIdx);
356 const auto& volVars = considerPreviousTimeStep ?
357 this->momentumCouplingContext_()[0].prevElemVolVars[scvI]
358 : this->momentumCouplingContext_()[0].curElemVolVars[scvI];
359 return volVars.viscosity();
365 using ShapeValue =
typename Dune::FieldVector<Scalar, 1>;
366 const auto& localBasis = this->momentumCouplingContext_()[0].fvGeometry.feLocalBasis();
367 std::vector<ShapeValue> shapeValues;
368 const auto ipLocal = element.geometry().local(scv.dofPosition());
369 localBasis.evaluateFunction(ipLocal, shapeValues);
372 for (
const auto& scvI : scvs(this->momentumCouplingContext_()[0].fvGeometry))
374 const auto& volVars = considerPreviousTimeStep ?
375 this->momentumCouplingContext_()[0].prevElemVolVars[scvI]
376 : this->momentumCouplingContext_()[0].curElemVolVars[scvI];
377 mu += volVars.viscosity()*shapeValues[scvI.indexInElement()][0];
383 DUNE_THROW(Dune::NotImplemented,
384 "Viscosity interpolation for discretization scheme " << MassDiscretizationMethod{}
392 const SubControlVolumeFace<freeFlowMassIndex>& scvf)
const
397 bindCouplingContext_(Dune::index_constant<freeFlowMassIndex>(), element, eIdx);
399 const auto& fvGeometry = this->massAndEnergyCouplingContext_()[0].fvGeometry;
400 const auto& localBasis = fvGeometry.feLocalBasis();
402 std::vector<ShapeValue> shapeValues;
403 const auto ipLocal = element.geometry().local(scvf.ipGlobal());
404 localBasis.evaluateFunction(ipLocal, shapeValues);
407 VelocityVector velocity(0.0);
408 for (
const auto& scv : scvs(fvGeometry))
409 velocity.axpy(shapeValues[scv.localDofIndex()][0], this->curSol(
freeFlowMomentumIndex)[scv.dofIndex()]);
417 VelocityVector
elementVelocity(
const FVElementGeometry<freeFlowMassIndex>& fvGeometry)
const
419 bindCouplingContext_(Dune::index_constant<freeFlowMassIndex>(), fvGeometry.element());
421 const auto& momentumFvGeometry = this->massAndEnergyCouplingContext_()[0].fvGeometry;
422 const auto& localBasis = momentumFvGeometry.feLocalBasis();
425 VelocityVector velocity(0.0);
426 std::vector<ShapeValue> shapeValues;
427 localBasis.evaluateFunction(referenceElement(fvGeometry.element()).position(0,0), shapeValues);
429 for (
const auto& scv : scvs(momentumFvGeometry))
430 velocity.axpy(shapeValues[scv.localDofIndex()][0], this->curSol(
freeFlowMomentumIndex)[scv.dofIndex()]);
439 template<std::
size_t j>
441 const Element<freeFlowMomentumIndex>& elementI,
442 const SubControlVolume<freeFlowMomentumIndex>& scvI,
443 Dune::index_constant<j> domainJ)
const
444 {
return emptyStencil_; }
461 const Element<freeFlowMassIndex>& elementI,
462 Dune::index_constant<freeFlowMomentumIndex> domainJ)
const
465 return massAndEnergyToMomentumStencils_[eIdx];
477 const Element<freeFlowMomentumIndex>& elementI,
478 Dune::index_constant<freeFlowMassIndex> domainJ)
const
481 return momentumToMassAndEnergyStencils_[eIdx];
510 template<std::
size_t i, std::
size_t j,
class LocalAssemblerI>
512 const LocalAssemblerI& localAssemblerI,
513 Dune::index_constant<j> domainJ,
514 std::size_t dofIdxGlobalJ,
515 const PrimaryVariables<j>& priVarsJ,
518 this->
curSol(domainJ)[dofIdxGlobalJ][pvIdxJ] = priVarsJ[pvIdxJ];
524 bindCouplingContext_(domainI, localAssemblerI.element());
527 const auto& deflectedElement =
problem.gridGeometry().element(dofIdxGlobalJ);
529 const auto& fvGeometry = momentumCouplingContext_()[0].fvGeometry;
530 const auto& scv = fvGeometry.scv(dofIdxGlobalJ);
532 if constexpr (ElementVolumeVariables<freeFlowMassIndex>::GridVolumeVariables::cachingEnabled)
533 gridVars_(
freeFlowMassIndex).curGridVolVars().volVars(scv).update(std::move(elemSol),
problem, deflectedElement, scv);
535 momentumCouplingContext_()[0].curElemVolVars[scv].update(std::move(elemSol),
problem, deflectedElement, scv);
543 bindCouplingContext_(domainI, localAssemblerI.element());
546 const auto& deflectedElement =
problem.gridGeometry().element(this->momentumCouplingContext_()[0].eIdx);
548 const auto& fvGeometry = this->momentumCouplingContext_()[0].fvGeometry;
550 for (
const auto& scv : scvs(fvGeometry))
552 if(scv.dofIndex() == dofIdxGlobalJ)
554 if constexpr (ElementVolumeVariables<freeFlowMassIndex>::GridVolumeVariables::cachingEnabled)
555 this->gridVars_(
freeFlowMassIndex).curGridVolVars().volVars(scv).update(std::move(elemSol),
problem, deflectedElement, scv);
557 this->momentumCouplingContext_()[0].curElemVolVars[scv].update(std::move(elemSol),
problem, deflectedElement, scv);
563 DUNE_THROW(Dune::NotImplemented,
564 "Context update for discretization scheme " << MassDiscretizationMethod{}
594 template<std::
size_t i,
class AssembleElementFunc>
597 if (elementSets_.empty())
598 DUNE_THROW(Dune::InvalidStateException,
"Call computeColorsForAssembly before assembling in parallel!");
605 for (
const auto& elements : elementSets_)
609 const auto element = grid.entity(elements[eIdx]);
610 assembleElement(element);
616 void bindCouplingContext_(Dune::index_constant<freeFlowMomentumIndex> domainI,
617 const Element<freeFlowMomentumIndex>& elementI)
const
620 if (momentumCouplingContext_().empty())
623 bindCouplingContext_(domainI, elementI, momentumCouplingContext_()[0].fvGeometry.gridGeometry().elementMapper().index(elementI));
626 void bindCouplingContext_(Dune::index_constant<freeFlowMomentumIndex> domainI,
627 const Element<freeFlowMomentumIndex>& elementI,
628 const std::size_t eIdx)
const
630 if (momentumCouplingContext_().empty())
633 fvGeometry.bind(elementI);
642 prevElemVolVars.bindElement(elementI, fvGeometry, (*prevSol_)[
freeFlowMassIndex]);
644 momentumCouplingContext_().emplace_back(MomentumCouplingContext{std::move(fvGeometry), std::move(curElemVolVars), std::move(prevElemVolVars), eIdx});
646 else if (eIdx != momentumCouplingContext_()[0].eIdx)
648 momentumCouplingContext_()[0].eIdx = eIdx;
649 momentumCouplingContext_()[0].fvGeometry.bind(elementI);
650 momentumCouplingContext_()[0].curElemVolVars.bind(elementI, momentumCouplingContext_()[0].fvGeometry, this->
curSol(freeFlowMassIndex));
653 momentumCouplingContext_()[0].prevElemVolVars.bindElement(elementI, momentumCouplingContext_()[0].fvGeometry, (*prevSol_)[
freeFlowMassIndex]);
657 void bindCouplingContext_(Dune::index_constant<freeFlowMassIndex> domainI,
658 const Element<freeFlowMassIndex>& elementI)
const
661 if (massAndEnergyCouplingContext_().empty())
662 bindCouplingContext_(domainI, elementI, this->
problem(freeFlowMassIndex).gridGeometry().elementMapper().index(elementI));
664 bindCouplingContext_(domainI, elementI, massAndEnergyCouplingContext_()[0].fvGeometry.gridGeometry().elementMapper().index(elementI));
667 void bindCouplingContext_(Dune::index_constant<freeFlowMassIndex> domainI,
668 const Element<freeFlowMassIndex>& elementI,
669 const std::size_t eIdx)
const
671 if (massAndEnergyCouplingContext_().empty())
674 auto fvGeometry =
localView(gridGeometry);
675 fvGeometry.bindElement(elementI);
676 massAndEnergyCouplingContext_().emplace_back(std::move(fvGeometry), eIdx);
678 else if (eIdx != massAndEnergyCouplingContext_()[0].eIdx)
680 massAndEnergyCouplingContext_()[0].eIdx = eIdx;
681 massAndEnergyCouplingContext_()[0].fvGeometry.bindElement(elementI);
689 template<std::
size_t i>
690 const GridVariables<i>& gridVars_(Dune::index_constant<i> domainIdx)
const
692 if (std::get<i>(gridVariables_))
693 return *std::get<i>(gridVariables_);
695 DUNE_THROW(Dune::InvalidStateException,
"The gridVariables pointer was not set. Use setGridVariables() before calling this function");
702 template<std::
size_t i>
703 GridVariables<i>& gridVars_(Dune::index_constant<i> domainIdx)
705 if (std::get<i>(gridVariables_))
706 return *std::get<i>(gridVariables_);
708 DUNE_THROW(Dune::InvalidStateException,
"The gridVariables pointer was not set. Use setGridVariables() before calling this function");
712 void computeCouplingStencils_()
715 const auto& massGridGeometry = this->
problem(freeFlowMassIndex).gridGeometry();
716 auto momentumFvGeometry =
localView(momentumGridGeometry);
717 auto massFvGeometry =
localView(massGridGeometry);
719 massAndEnergyToMomentumStencils_.clear();
720 massAndEnergyToMomentumStencils_.resize(massGridGeometry.gridView().size(0));
722 momentumToMassAndEnergyStencils_.clear();
723 momentumToMassAndEnergyStencils_.resize(momentumGridGeometry.gridView().size(0));
725 assert(massAndEnergyToMomentumStencils_.size() == momentumToMassAndEnergyStencils_.size());
727 for (
const auto& element : elements(momentumGridGeometry.gridView()))
729 momentumFvGeometry.bindElement(element);
730 massFvGeometry.bindElement(element);
731 const auto eIdx = momentumFvGeometry.elementIndex();
733 for (
const auto& scv : scvs(momentumFvGeometry))
734 massAndEnergyToMomentumStencils_[eIdx].push_back(scv.dofIndex());
736 for (
const auto& scv : scvs(massFvGeometry))
737 momentumToMassAndEnergyStencils_[eIdx].push_back(scv.dofIndex());
741 CouplingStencilType emptyStencil_;
742 std::vector<CouplingStencilType> momentumToMassAndEnergyStencils_;
743 std::vector<CouplingStencilType> massAndEnergyToMomentumStencils_;
748 std::vector<MomentumCouplingContext>& momentumCouplingContext_()
const
750 thread_local static std::vector<MomentumCouplingContext> c;
755 std::vector<MassAndEnergyCouplingContext>& massAndEnergyCouplingContext_()
const
757 thread_local static std::vector<MassAndEnergyCouplingContext> c;
762 GridVariablesTuple gridVariables_;
764 const SolutionVector* prevSol_;
767 std::deque<std::vector<ElementSeed<freeFlowMomentumIndex>>> elementSets_;
773template<class Traits, class DiscretizationMethod = typename Detail::MomentumDiscretizationMethod<Traits>::type>
781template<
class Traits,
class D>
783{
using type = std::false_type; };
The interface of the coupling manager for free flow systems.
Definition: couplingmanager_cvfe.hh:50
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:121
void init(std::shared_ptr< Problem< freeFlowMomentumIndex > > momentumProblem, std::shared_ptr< Problem< freeFlowMassIndex > > massProblem, GridVariablesTuple &&gridVariables, const typename ParentType::SolutionVectorStorage &curSol)
use as binary coupling manager in multi model context
Definition: couplingmanager_cvfe.hh:146
Scalar effectiveViscosity(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolume< freeFlowMomentumIndex > &scv, const bool considerPreviousTimeStep=false) const
Returns the effective viscosity at a given sub control volume.
Definition: couplingmanager_cvfe.hh:344
static constexpr auto freeFlowMomentumIndex
Definition: couplingmanager_cvfe.hh:53
static constexpr auto pressureIdx
Definition: couplingmanager_cvfe.hh:113
const CouplingStencilType & couplingStencil(Dune::index_constant< freeFlowMassIndex > domainI, const Element< freeFlowMassIndex > &elementI, Dune::index_constant< freeFlowMomentumIndex > domainJ) const
returns an iterable container of all indices of degrees of freedom of domain j that couple with / inf...
Definition: couplingmanager_cvfe.hh:460
const CouplingStencilType & couplingStencil(Dune::index_constant< freeFlowMomentumIndex > domainI, const Element< freeFlowMomentumIndex > &elementI, Dune::index_constant< freeFlowMassIndex > domainJ) const
returns an iterable container of all indices of degrees of freedom of domain j that couple with / inf...
Definition: couplingmanager_cvfe.hh:476
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:200
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:297
VelocityVector elementVelocity(const FVElementGeometry< freeFlowMassIndex > &fvGeometry) const
Returns the velocity at the element center.
Definition: couplingmanager_cvfe.hh:417
Scalar density(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolume< freeFlowMomentumIndex > &scv, const bool considerPreviousTimeStep=false) const
Returns the density at a given sub control volume.
Definition: couplingmanager_cvfe.hh:249
Scalar pressure(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolume< freeFlowMomentumIndex > &scv, const bool considerPreviousTimeStep=false) const
Returns the pressure at a given sub control volume.
Definition: couplingmanager_cvfe.hh:184
void assembleMultithreaded(Dune::index_constant< i > domainId, AssembleElementFunc &&assembleElement) const
Execute assembly kernel in parallel.
Definition: couplingmanager_cvfe.hh:595
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:168
void init(std::shared_ptr< Problem< freeFlowMomentumIndex > > momentumProblem, std::shared_ptr< Problem< freeFlowMassIndex > > massProblem, GridVariablesTuple &&gridVariables, const SolutionVector &curSol, const SolutionVector &prevSol)
use as regular coupling manager in a transient setting
Definition: couplingmanager_cvfe.hh:134
void computeColorsForAssembly()
Compute colors for multithreaded assembly.
Definition: couplingmanager_cvfe.hh:573
static constexpr auto freeFlowMassIndex
Definition: couplingmanager_cvfe.hh:54
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:440
The interface of the coupling manager for multi domain problems.
Definition: multidomain/couplingmanager.hh:37
void attachSolution(const SolutionVectorStorage &curSol)
Attach a solution vector stored outside of this class.
Definition: multidomain/couplingmanager.hh:311
void setSubProblems(const std::tuple< std::shared_ptr< SubProblems >... > &problems)
set the pointers to the sub problems
Definition: multidomain/couplingmanager.hh:276
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition: multidomain/couplingmanager.hh:298
std::vector< std::size_t > CouplingStencilType
default type used for coupling element stencils
Definition: multidomain/couplingmanager.hh:53
SubSolutionVector< i > & curSol(Dune::index_constant< i > domainIdx)
the solution vector of the subproblem
Definition: multidomain/couplingmanager.hh:327
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:208
typename Traits::template TupleOfSharedPtr< SubSolutionVector > SolutionVectorStorage
the type in which the solution vector is stored in the manager
Definition: multidomain/couplingmanager.hh:60
Coloring schemes for shared-memory-parallel assembly.
Defines all properties used in Dumux.
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
PrimaryVariables evalSolution(const Element &element, const typename Element::Geometry &geometry, const typename FVElementGeometry::GridGeometry &gridGeometry, const CVFEElementSolution< FVElementGeometry, PrimaryVariables > &elemSol, const typename Element::Geometry::GlobalCoordinate &globalPos, bool ignoreState=false)
Interpolates a given box element solution at a given global position. Uses the finite element cache o...
Definition: evalsolution.hh:152
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
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:511
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
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.
constexpr FCDiamond fcdiamond
Definition: method.hh:152
constexpr CCTpfa cctpfa
Definition: method.hh:145
constexpr Box box
Definition: method.hh:147
auto computeColoring(const GridGeometry &gg, int verbosity=1)
Compute iterable lists of element seeds partitioned by color.
Definition: coloring.hh:239
Parallel for loop (multithreading)
Type trait that is specialized for coupling manager supporting multithreaded assembly.
Definition: multistagemultidomainfvassembler.hh:78
std::false_type type
Definition: couplingmanager_cvfe.hh:783
Definition: couplingmanager_cvfe.hh:774