13#ifndef DUMUX_STOKES_DARCY_COUPLINGDATA_HH
14#define DUMUX_STOKES_DARCY_COUPLINGDATA_HH
41 harmonic, arithmetic, ffOnly, pmOnly
50 if (diffusionCoefficientAveragingType ==
"Harmonic")
52 else if (diffusionCoefficientAveragingType ==
"Arithmetic")
54 else if (diffusionCoefficientAveragingType ==
"FreeFlowOnly")
56 else if (diffusionCoefficientAveragingType ==
"PorousMediumOnly")
59 DUNE_THROW(Dune::IOError,
"Unknown DiffusionCoefficientAveragingType");
71template<
class FFFS,
class PMFS>
74 static_assert(FFFS::numPhases == 1,
"Only single-phase fluidsystems may be used for free flow.");
75 static constexpr bool value = std::is_same<typename FFFS::MultiPhaseFluidSystem, PMFS>::value;
86 static_assert(FS::numPhases == 1,
"Only single-phase fluidsystems may be used for free flow.");
87 static constexpr bool value = std::is_same<FS, FS>::value;
91template <
class TypeTag,
class DiscretizationMethod, ReferenceSystemFormulation referenceSystem>
99template<
class DiffLaw>
107template<
class T,
class DiscretizationMethod, ReferenceSystemFormulation referenceSystem>
119template<std::
size_t stokesIdx, std::
size_t darcyIdx,
class FFFS,
bool hasAdapter>
130template<std::
size_t stokesIdx, std::
size_t darcyIdx,
class FFFS>
136 template<std::
size_t i>
138 {
return coupledPhaseIdx; }
143 template<std::
size_t i>
145 {
return coupledCompdIdx; }
156template<std::
size_t stokesIdx, std::
size_t darcyIdx,
class FFFS>
162 static constexpr auto couplingPhaseIdx(Dune::index_constant<stokesIdx>,
int coupledPhaseIdx = 0)
168 static constexpr auto couplingPhaseIdx(Dune::index_constant<darcyIdx>,
int coupledPhaseIdx = 0)
169 {
return FFFS::multiphaseFluidsystemPhaseIdx; }
174 static constexpr auto couplingCompIdx(Dune::index_constant<stokesIdx>,
int coupledCompdIdx)
175 {
return coupledCompdIdx; }
180 static constexpr auto couplingCompIdx(Dune::index_constant<darcyIdx>,
int coupledCompdIdx)
181 {
return FFFS::compIdx(coupledCompdIdx); }
185template <
class TypeTag,
class DiscretizationMethod>
186class DarcysLawImplementation;
189template <
class TypeTag,
class DiscretizationMethod>
190class ForchheimersLawImplementation;
193template<
class MDTraits,
class CouplingManager,
bool enableEnergyBalance,
bool isCompositional>
201template<
class MDTraits,
class CouplingManager>
210template<
class MDTraits,
class CouplingManager>
213 using Scalar =
typename MDTraits::Scalar;
215 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
217 template<std::
size_t id>
using Element =
typename GridGeometry<id>::GridView::template Codim<0>::Entity;
218 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
219 template<std::
size_t id>
using SubControlVolumeFace =
typename GridGeometry<id>::LocalView::SubControlVolumeFace;
220 template<std::
size_t id>
using SubControlVolume =
typename GridGeometry<id>::LocalView::SubControlVolume;
227 template<std::
size_t id>
using GlobalPosition =
typename Element<id>::Geometry::GlobalCoordinate;
228 static constexpr auto stokesIdx = CouplingManager::stokesIdx;
229 static constexpr auto darcyIdx = CouplingManager::darcyIdx;
235 static constexpr bool adapterUsed = ModelTraits<darcyIdx>::numFluidPhases() > 1;
240 "All submodels must both be either isothermal or non-isothermal");
243 FluidSystem<darcyIdx>>::value,
244 "All submodels must use the same fluid system");
254 template<std::
size_t i>
255 static constexpr auto couplingPhaseIdx(Dune::index_constant<i>
id,
int coupledPhaseIdx = 0)
256 {
return IndexHelper::couplingPhaseIdx(
id, coupledPhaseIdx); }
261 template<std::
size_t i>
262 static constexpr auto couplingCompIdx(Dune::index_constant<i>
id,
int coupledCompdIdx)
263 {
return IndexHelper::couplingCompIdx(
id, coupledCompdIdx); }
269 {
return couplingManager_; }
274 auto darcyPermeability(
const Element<stokesIdx>& element,
const SubControlVolumeFace<stokesIdx>& scvf)
const
276 const auto& stokesContext =
couplingManager().stokesCouplingContext(element, scvf);
277 return stokesContext.volVars.permeability();
287 template<
class ElementFaceVariables>
289 const FVElementGeometry<stokesIdx>& fvGeometry,
290 const ElementVolumeVariables<stokesIdx>& stokesElemVolVars,
291 const ElementFaceVariables& stokesElemFaceVars,
292 const SubControlVolumeFace<stokesIdx>& scvf)
const
296 Scalar momentumFlux(0.0);
297 const auto& stokesContext = couplingManager_.stokesCouplingContext(element, scvf);
301 const Scalar darcyPressure = stokesContext.volVars.pressure(darcyPhaseIdx);
303 if(numPhasesDarcy > 1)
304 momentumFlux = darcyPressure;
310 if(
getPropValue<SubDomainTypeTag<stokesIdx>, Properties::NormalizePressure>())
311 momentumFlux -= couplingManager_.
problem(stokesIdx).initial(scvf)[Indices<stokesIdx>::pressureIdx];
313 momentumFlux *= scvf.directionSign();
321 Scalar
advectiveFlux(
const Scalar insideQuantity,
const Scalar outsideQuantity,
const Scalar volumeFlow,
bool insideIsUpstream)
const
323 const Scalar upwindWeight = 1.0;
326 return (upwindWeight * insideQuantity + (1.0 - upwindWeight) * outsideQuantity) * volumeFlow;
328 return (upwindWeight * outsideQuantity + (1.0 - upwindWeight) * insideQuantity) * volumeFlow;
336 template<std::
size_t i, std::
size_t j>
338 Dune::index_constant<j> domainJ,
339 const Scalar insideDistance,
340 const Scalar outsideDistance,
341 const Scalar avgQuantityI,
342 const Scalar avgQuantityJ,
343 const DiffusionCoefficientAveragingType diffCoeffAvgType)
const
345 const Scalar totalDistance = insideDistance + outsideDistance;
346 if(diffCoeffAvgType == DiffusionCoefficientAveragingType::harmonic)
348 return harmonicMean(avgQuantityI, avgQuantityJ, insideDistance, outsideDistance)
351 else if(diffCoeffAvgType == DiffusionCoefficientAveragingType::arithmetic)
353 return arithmeticMean(avgQuantityI, avgQuantityJ, insideDistance, outsideDistance)
356 else if(diffCoeffAvgType == DiffusionCoefficientAveragingType::ffOnly)
357 return domainI == stokesIdx
358 ? avgQuantityI / totalDistance
359 : avgQuantityJ / totalDistance;
362 return domainI == darcyIdx
363 ? avgQuantityI / totalDistance
364 : avgQuantityJ / totalDistance;
370 template<
class Scv,
class Scvf>
373 return (scv.dofPosition() - scvf.ipGlobal()).two_norm();
379 template<std::
size_t i, std::
size_t j,
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
381 Dune::index_constant<j> domainJ,
382 const FVElementGeometry<i>& fvGeometryI,
383 const FVElementGeometry<j>& fvGeometryJ,
384 const SubControlVolumeFace<i>& scvfI,
385 const SubControlVolume<i>& scvI,
386 const SubControlVolume<j>& scvJ,
387 const VolumeVariables<i>& volVarsI,
388 const VolumeVariables<j>& volVarsJ,
389 const DiffusionCoefficientAveragingType diffCoeffAvgType)
const
391 const Scalar insideDistance =
getDistance_(scvI, scvfI);
392 const Scalar outsideDistance =
getDistance_(scvJ, scvfI);
394 const Scalar deltaT = volVarsJ.temperature() - volVarsI.temperature();
399 volVarsI.effectiveThermalConductivity(),
400 volVarsJ.effectiveThermalConductivity(),
403 return -tij * deltaT;
409 template<
class ElementFaceVariables,
class CouplingContext>
411 const SubControlVolumeFace<stokesIdx>& scvf,
412 const ElementFaceVariables& elemFaceVars,
413 const CouplingContext& context)
const
415 GlobalPosition<stokesIdx> velocity(0.0);
416 velocity[scvf.directionIndex()] = elemFaceVars[scvf].velocitySelf();
417 const auto& darcyScvf = context.fvGeometry.scvf(context.darcyScvfIdx);
425 const FVElementGeometry<darcyIdx>& fvGeometry,
426 const SubControlVolumeFace<darcyIdx>& scvf,
427 const VolumeVariables<darcyIdx>& volVars,
428 const typename Element<stokesIdx>::Geometry::GlobalCoordinate& couplingPhaseVelocity,
432 const Scalar cellCenterPressure = volVars.pressure(darcyPhaseIdx);
439 const auto velocity = couplingPhaseVelocity;
440 const Scalar mu = volVars.viscosity(darcyPhaseIdx);
441 const Scalar rho = volVars.density(darcyPhaseIdx);
442 const auto K = volVars.permeability();
443 const auto alpha =
vtmv(scvf.unitOuterNormal(), K, couplingManager_.
problem(darcyIdx).spatialParams().gravity(scvf.center()));
445 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
449 Scalar cF = couplingManager_.
problem(darcyIdx).spatialParams().forchCoeff(scvf);
451 const Scalar interfacePressure = ((-mu*(scvf.unitOuterNormal() * velocity))
452 + (-(scvf.unitOuterNormal() * velocity) * velocity.two_norm() * rho * sqrt(
darcyPermeability(element, scvf)) * cF)
453 + rho * alpha)/ti + cellCenterPressure;
454 return interfacePressure;
461 const FVElementGeometry<darcyIdx>& fvGeometry,
462 const SubControlVolumeFace<darcyIdx>& scvf,
463 const VolumeVariables<darcyIdx>& volVars,
464 const typename Element<stokesIdx>::Geometry::GlobalCoordinate& couplingPhaseVelocity,
468 const Scalar couplingPhaseCellCenterPressure = volVars.pressure(darcyPhaseIdx);
469 const Scalar couplingPhaseMobility = volVars.mobility(darcyPhaseIdx);
470 const Scalar couplingPhaseDensity = volVars.density(darcyPhaseIdx);
471 const auto K = volVars.permeability();
477 const auto alpha =
vtmv(scvf.unitOuterNormal(), K, couplingManager_.
problem(darcyIdx).spatialParams().gravity(scvf.center()));
479 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
482 return (-1/couplingPhaseMobility * (scvf.unitOuterNormal() * couplingPhaseVelocity) + couplingPhaseDensity * alpha)/ti
483 + couplingPhaseCellCenterPressure;
496template<
class MDTraits,
class CouplingManager,
bool enableEnergyBalance>
501 using Scalar =
typename MDTraits::Scalar;
502 static constexpr auto stokesIdx = CouplingManager::stokesIdx;
503 static constexpr auto darcyIdx = CouplingManager::darcyIdx;
504 static constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx;
505 static constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx;
508 template<std::
size_t id>
509 using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
512 template<std::
size_t id>
using Element =
typename GridGeometry<id>::GridView::template Codim<0>::Entity;
513 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
514 template<std::
size_t id>
using SubControlVolumeFace =
typename GridGeometry<id>::LocalView::SubControlVolumeFace;
515 template<std::
size_t id>
using SubControlVolume =
typename GridGeometry<id>::LocalView::SubControlVolume;
522 "Darcy Model must not be compositional");
527 using ParentType::ParentType;
528 using ParentType::couplingPhaseIdx;
534 const FVElementGeometry<darcyIdx>& fvGeometry,
535 const ElementVolumeVariables<darcyIdx>& darcyElemVolVars,
536 const SubControlVolumeFace<darcyIdx>& scvf)
const
538 const auto& darcyContext = this->couplingManager().darcyCouplingContext(element, scvf);
539 const Scalar velocity = darcyContext.velocity * scvf.unitOuterNormal();
540 const Scalar darcyDensity = darcyElemVolVars[scvf.insideScvIdx()].density(couplingPhaseIdx(darcyIdx));
541 const Scalar stokesDensity = darcyContext.volVars.density();
542 const bool insideIsUpstream = velocity > 0.0;
544 return massFlux_(velocity, darcyDensity, stokesDensity, insideIsUpstream);
551 const FVElementGeometry<stokesIdx>& fvGeometry,
552 const ElementVolumeVariables<stokesIdx>& stokesElemVolVars,
553 const ElementFaceVariables<stokesIdx>& stokesElemFaceVars,
554 const SubControlVolumeFace<stokesIdx>& scvf)
const
556 const auto& stokesContext = this->couplingManager().stokesCouplingContext(element, scvf);
557 const Scalar velocity = stokesElemFaceVars[scvf].velocitySelf();
558 const Scalar stokesDensity = stokesElemVolVars[scvf.insideScvIdx()].density();
559 const Scalar darcyDensity = stokesContext.volVars.density(couplingPhaseIdx(darcyIdx));
560 const bool insideIsUpstream =
sign(velocity) == scvf.directionSign();
562 return massFlux_(velocity * scvf.directionSign(), stokesDensity, darcyDensity, insideIsUpstream);
568 template<
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
570 const FVElementGeometry<darcyIdx>& fvGeometry,
571 const ElementVolumeVariables<darcyIdx>& darcyElemVolVars,
572 const SubControlVolumeFace<darcyIdx>& scvf,
573 const DiffusionCoefficientAveragingType diffCoeffAvgType = DiffusionCoefficientAveragingType::ffOnly)
const
575 const auto& darcyContext = this->couplingManager().darcyCouplingContext(element, scvf);
576 const auto& darcyVolVars = darcyElemVolVars[scvf.insideScvIdx()];
577 const auto& stokesVolVars = darcyContext.volVars;
579 const Scalar velocity = darcyContext.velocity * scvf.unitOuterNormal();
580 const bool insideIsUpstream = velocity > 0.0;
582 return energyFlux_(darcyIdx, stokesIdx, fvGeometry, darcyContext.fvGeometry, scvf,
583 darcyVolVars, stokesVolVars, velocity, insideIsUpstream, diffCoeffAvgType);
589 template<
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
591 const FVElementGeometry<stokesIdx>& fvGeometry,
592 const ElementVolumeVariables<stokesIdx>& stokesElemVolVars,
593 const ElementFaceVariables<stokesIdx>& stokesElemFaceVars,
594 const SubControlVolumeFace<stokesIdx>& scvf,
595 const DiffusionCoefficientAveragingType diffCoeffAvgType = DiffusionCoefficientAveragingType::ffOnly)
const
597 const auto& stokesContext = this->couplingManager().stokesCouplingContext(element, scvf);
598 const auto& stokesVolVars = stokesElemVolVars[scvf.insideScvIdx()];
599 const auto& darcyVolVars = stokesContext.volVars;
601 const Scalar velocity = stokesElemFaceVars[scvf].velocitySelf();
602 const bool insideIsUpstream =
sign(velocity) == scvf.directionSign();
604 return energyFlux_(stokesIdx, darcyIdx, fvGeometry, stokesContext.fvGeometry, scvf,
605 stokesVolVars, darcyVolVars, velocity * scvf.directionSign(), insideIsUpstream, diffCoeffAvgType);
613 Scalar massFlux_(
const Scalar velocity,
614 const Scalar insideDensity,
615 const Scalar outSideDensity,
616 bool insideIsUpstream)
const
618 return this->advectiveFlux(insideDensity, outSideDensity, velocity, insideIsUpstream);
624 template<std::
size_t i, std::
size_t j,
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
625 Scalar energyFlux_(Dune::index_constant<i> domainI,
626 Dune::index_constant<j> domainJ,
627 const FVElementGeometry<i>& insideFvGeometry,
628 const FVElementGeometry<j>& outsideFvGeometry,
629 const SubControlVolumeFace<i>& scvf,
630 const VolumeVariables<i>& insideVolVars,
631 const VolumeVariables<j>& outsideVolVars,
632 const Scalar velocity,
633 const bool insideIsUpstream,
634 const DiffusionCoefficientAveragingType diffCoeffAvgType)
const
638 const auto& insideScv = (*scvs(insideFvGeometry).begin());
639 const auto& outsideScv = (*scvs(outsideFvGeometry).begin());
642 const Scalar insideTerm = insideVolVars.density(couplingPhaseIdx(domainI)) * insideVolVars.enthalpy(couplingPhaseIdx(domainI));
643 const Scalar outsideTerm = outsideVolVars.density(couplingPhaseIdx(domainJ)) * outsideVolVars.enthalpy(couplingPhaseIdx(domainJ));
645 flux += this->advectiveFlux(insideTerm, outsideTerm, velocity, insideIsUpstream);
647 flux += this->conductiveEnergyFlux_(domainI, domainJ, insideFvGeometry, outsideFvGeometry, scvf, insideScv, outsideScv, insideVolVars, outsideVolVars, diffCoeffAvgType);
658template<
class MDTraits,
class CouplingManager,
bool enableEnergyBalance>
663 using Scalar =
typename MDTraits::Scalar;
664 static constexpr auto stokesIdx = CouplingManager::stokesIdx;
665 static constexpr auto darcyIdx = CouplingManager::darcyIdx;
666 static constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx;
667 static constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx;
670 template<std::
size_t id>
671 using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
674 template<std::
size_t id>
using Element =
typename GridGeometry<id>::GridView::template Codim<0>::Entity;
675 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
676 template<std::
size_t id>
using SubControlVolumeFace =
typename FVElementGeometry<id>::SubControlVolumeFace;
677 template<std::
size_t id>
using SubControlVolume =
typename GridGeometry<id>::LocalView::SubControlVolume;
690 static_assert(getPropValue<SubDomainTypeTag<darcyIdx>, Properties::UseMoles>() == useMoles,
"Both submodels must either use moles or not");
691 static_assert(getPropValue<SubDomainTypeTag<darcyIdx>, Properties::ReplaceCompEqIdx>() == replaceCompEqIdx,
"Both submodels must use the same replaceCompEqIdx");
693 "Both submodels must use the same reference system formulation for diffusion");
695 using NumEqVector = Dune::FieldVector<Scalar, numComponents>;
701 "Both submodels must use the same diffusion law.");
703 using ReducedComponentVector = Dune::FieldVector<Scalar, numComponents-1>;
704 using ReducedComponentMatrix = Dune::FieldMatrix<Scalar, numComponents-1, numComponents-1>;
708 using ParentType::ParentType;
709 using ParentType::couplingPhaseIdx;
710 using ParentType::couplingCompIdx;
716 const FVElementGeometry<darcyIdx>& fvGeometry,
717 const ElementVolumeVariables<darcyIdx>& darcyElemVolVars,
718 const SubControlVolumeFace<darcyIdx>& scvf,
719 const DiffusionCoefficientAveragingType diffCoeffAvgType = DiffusionCoefficientAveragingType::ffOnly)
const
721 NumEqVector flux(0.0);
722 const auto& darcyContext = this->couplingManager().darcyCouplingContext(element, scvf);
723 const auto& darcyVolVars = darcyElemVolVars[scvf.insideScvIdx()];
724 const auto& stokesVolVars = darcyContext.volVars;
725 const auto& outsideScv = (*scvs(darcyContext.fvGeometry).begin());
727 const Scalar velocity = darcyContext.velocity * scvf.unitOuterNormal();
728 const bool insideIsUpstream = velocity > 0.0;
730 return massFlux_(darcyIdx, stokesIdx, fvGeometry,
731 scvf, darcyVolVars, stokesVolVars,
732 outsideScv, velocity, insideIsUpstream,
740 const FVElementGeometry<stokesIdx>& fvGeometry,
741 const ElementVolumeVariables<stokesIdx>& stokesElemVolVars,
742 const ElementFaceVariables<stokesIdx>& stokesElemFaceVars,
743 const SubControlVolumeFace<stokesIdx>& scvf,
744 const DiffusionCoefficientAveragingType diffCoeffAvgType = DiffusionCoefficientAveragingType::ffOnly)
const
746 NumEqVector flux(0.0);
747 const auto& stokesContext = this->couplingManager().stokesCouplingContext(element, scvf);
748 const auto& stokesVolVars = stokesElemVolVars[scvf.insideScvIdx()];
749 const auto& darcyVolVars = stokesContext.volVars;
750 const auto& outsideScv = (*scvs(stokesContext.fvGeometry).begin());
752 const Scalar velocity = stokesElemFaceVars[scvf].velocitySelf();
753 const bool insideIsUpstream =
sign(velocity) == scvf.directionSign();
755 return massFlux_(stokesIdx, darcyIdx, fvGeometry,
756 scvf, stokesVolVars, darcyVolVars,
757 outsideScv, velocity * scvf.directionSign(),
758 insideIsUpstream, diffCoeffAvgType);
764 template<
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
766 const FVElementGeometry<darcyIdx>& fvGeometry,
767 const ElementVolumeVariables<darcyIdx>& darcyElemVolVars,
768 const SubControlVolumeFace<darcyIdx>& scvf,
769 const DiffusionCoefficientAveragingType diffCoeffAvgType = DiffusionCoefficientAveragingType::ffOnly)
const
771 const auto& darcyContext = this->couplingManager().darcyCouplingContext(element, scvf);
772 const auto& darcyVolVars = darcyElemVolVars[scvf.insideScvIdx()];
773 const auto& stokesVolVars = darcyContext.volVars;
775 const Scalar velocity = darcyContext.velocity * scvf.unitOuterNormal();
776 const bool insideIsUpstream = velocity > 0.0;
778 return energyFlux_(darcyIdx, stokesIdx, fvGeometry, darcyContext.fvGeometry, scvf,
779 darcyVolVars, stokesVolVars, velocity, insideIsUpstream, diffCoeffAvgType);
785 template<
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
787 const FVElementGeometry<stokesIdx>& fvGeometry,
788 const ElementVolumeVariables<stokesIdx>& stokesElemVolVars,
789 const ElementFaceVariables<stokesIdx>& stokesElemFaceVars,
790 const SubControlVolumeFace<stokesIdx>& scvf,
791 const DiffusionCoefficientAveragingType diffCoeffAvgType = DiffusionCoefficientAveragingType::ffOnly)
const
793 const auto& stokesContext = this->couplingManager().stokesCouplingContext(element, scvf);
794 const auto& stokesVolVars = stokesElemVolVars[scvf.insideScvIdx()];
795 const auto& darcyVolVars = stokesContext.volVars;
797 const Scalar velocity = stokesElemFaceVars[scvf].velocitySelf();
798 const bool insideIsUpstream =
sign(velocity) == scvf.directionSign();
800 return energyFlux_(stokesIdx, darcyIdx, fvGeometry, stokesContext.fvGeometry, scvf,
801 stokesVolVars, darcyVolVars, velocity * scvf.directionSign(), insideIsUpstream, diffCoeffAvgType);
809 template<std::
size_t i, std::
size_t j>
811 Dune::index_constant<j> domainJ,
812 const FVElementGeometry<i>& insideFvGeometry,
813 const SubControlVolumeFace<i>& scvf,
814 const VolumeVariables<i>& insideVolVars,
815 const VolumeVariables<j>& outsideVolVars,
816 const SubControlVolume<j>& outsideScv,
817 const Scalar velocity,
818 const bool insideIsUpstream,
819 const DiffusionCoefficientAveragingType diffCoeffAvgType)
const
821 NumEqVector flux(0.0);
822 NumEqVector diffusiveFlux(0.0);
824 auto moleOrMassFraction = [&](
const auto& volVars,
int phaseIdx,
int compIdx)
825 {
return useMoles ? volVars.moleFraction(phaseIdx, compIdx) : volVars.massFraction(phaseIdx, compIdx); };
827 auto moleOrMassDensity = [&](
const auto& volVars,
int phaseIdx)
828 {
return useMoles ? volVars.molarDensity(phaseIdx) : volVars.density(phaseIdx); };
831 auto insideTerm = [&](
int compIdx)
832 {
return moleOrMassFraction(insideVolVars, couplingPhaseIdx(domainI), compIdx) * moleOrMassDensity(insideVolVars, couplingPhaseIdx(domainI)); };
834 auto outsideTerm = [&](
int compIdx)
835 {
return moleOrMassFraction(outsideVolVars, couplingPhaseIdx(domainJ), compIdx) * moleOrMassDensity(outsideVolVars, couplingPhaseIdx(domainJ)); };
838 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
840 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
841 const int domainJCompIdx = couplingCompIdx(domainJ, compIdx);
842 flux[domainICompIdx] += this->advectiveFlux(insideTerm(domainICompIdx), outsideTerm(domainJCompIdx), velocity, insideIsUpstream);
846 const auto& insideScv = insideFvGeometry.scv(scvf.insideScvIdx());
849 diffusiveFlux += diffusiveMolecularFluxFicksLaw_(domainI, domainJ, scvf, insideScv, outsideScv, insideVolVars, outsideVolVars, diffCoeffAvgType);
851 diffusiveFlux += diffusiveMolecularFluxMaxwellStefan_(domainI, domainJ, scvf, insideScv, outsideScv, insideVolVars, outsideVolVars);
856 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
858 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
859 diffusiveFlux[domainICompIdx] *= 1/FluidSystem<i>::molarMass(domainICompIdx);
864 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
866 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
867 diffusiveFlux[domainICompIdx] *= FluidSystem<i>::molarMass(domainICompIdx);
871 flux += diffusiveFlux;
873 if (replaceCompEqIdx < numComponents)
874 flux[replaceCompEqIdx] = std::accumulate(flux.begin(), flux.end(), 0.0);
881 return FluidSystem<stokesIdx>::componentEnthalpy(volVars.fluidState(), 0, compIdx);
886 return FluidSystem<darcyIdx>::componentEnthalpy(volVars.fluidState(), phaseIdx, compIdx);
892 template<std::
size_t i, std::
size_t j>
894 Dune::index_constant<j> domainJ,
895 const SubControlVolumeFace<i>& scvfI,
896 const SubControlVolume<i>& scvI,
897 const SubControlVolume<j>& scvJ,
898 const VolumeVariables<i>& volVarsI,
899 const VolumeVariables<j>& volVarsJ)
const
901 NumEqVector diffusiveFlux(0.0);
903 const Scalar insideDistance = this->getDistance_(scvI, scvfI);
904 const Scalar outsideDistance = this->getDistance_(scvJ, scvfI);
906 ReducedComponentVector moleFracInside(0.0);
907 ReducedComponentVector moleFracOutside(0.0);
908 ReducedComponentVector reducedFlux(0.0);
909 ReducedComponentMatrix reducedDiffusionMatrixInside(0.0);
910 ReducedComponentMatrix reducedDiffusionMatrixOutside(0.0);
913 for (
int compIdx = 0; compIdx < numComponents-1; compIdx++)
915 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
916 const int domainJCompIdx = couplingCompIdx(domainJ, compIdx);
918 assert(FluidSystem<i>::componentName(domainICompIdx) == FluidSystem<j>::componentName(domainJCompIdx));
921 const Scalar xInside = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompIdx);
923 const Scalar xOutside = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompIdx);
924 moleFracInside[domainICompIdx] = xInside;
925 moleFracOutside[domainICompIdx] = xOutside;
933 for (
int compKIdx = 0; compKIdx < numComponents-1; compKIdx++)
935 const int domainICompKIdx = couplingCompIdx(domainI, compKIdx);
936 const Scalar xk = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompKIdx);
937 const Scalar avgMolarMass = volVarsI.averageMolarMass(couplingPhaseIdx(domainI));
938 const Scalar Mn = FluidSystem<i>::molarMass(numComponents-1);
939 const Scalar tkn = volVarsI.effectiveDiffusionCoefficient(couplingPhaseIdx(domainI), domainICompKIdx, couplingCompIdx(domainI, numComponents-1));
942 reducedDiffusionMatrixInside[domainICompKIdx][domainICompKIdx] += xk*avgMolarMass/(tkn*Mn);
944 for (
int compLIdx = 0; compLIdx < numComponents; compLIdx++)
946 const int domainICompLIdx = couplingCompIdx(domainI, compLIdx);
949 if (domainICompKIdx == domainICompLIdx)
952 const Scalar xl = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompLIdx);
953 const Scalar Mk = FluidSystem<i>::molarMass(domainICompKIdx);
954 const Scalar Ml = FluidSystem<i>::molarMass(domainICompLIdx);
955 const Scalar tkl = volVarsI.effectiveDiffusionCoefficient(couplingPhaseIdx(domainI), domainICompKIdx, domainICompLIdx);
956 reducedDiffusionMatrixInside[domainICompKIdx][domainICompKIdx] += xl*avgMolarMass/(tkl*Mk);
957 reducedDiffusionMatrixInside[domainICompKIdx][domainICompLIdx] += xk*(avgMolarMass/(tkn*Mn) - avgMolarMass/(tkl*Ml));
961 for (
int compKIdx = 0; compKIdx < numComponents-1; compKIdx++)
963 const int domainJCompKIdx = couplingCompIdx(domainJ, compKIdx);
964 const int domainICompKIdx = couplingCompIdx(domainI, compKIdx);
966 const Scalar xk = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompKIdx);
967 const Scalar avgMolarMass = volVarsJ.averageMolarMass(couplingPhaseIdx(domainJ));
968 const Scalar Mn = FluidSystem<j>::molarMass(numComponents-1);
969 const Scalar tkn = volVarsJ.effectiveDiffusionCoefficient(couplingPhaseIdx(domainJ), domainJCompKIdx, couplingCompIdx(domainJ, numComponents-1));
972 reducedDiffusionMatrixOutside[domainICompKIdx][domainICompKIdx] += xk*avgMolarMass/(tkn*Mn);
974 for (
int compLIdx = 0; compLIdx < numComponents; compLIdx++)
976 const int domainJCompLIdx = couplingCompIdx(domainJ, compLIdx);
977 const int domainICompLIdx = couplingCompIdx(domainI, compLIdx);
980 if (domainJCompLIdx == domainJCompKIdx)
983 const Scalar xl = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompLIdx);
984 const Scalar Mk = FluidSystem<j>::molarMass(domainJCompKIdx);
985 const Scalar Ml = FluidSystem<j>::molarMass(domainJCompLIdx);
986 const Scalar tkl = volVarsJ.effectiveDiffusionCoefficient(couplingPhaseIdx(domainJ), domainJCompKIdx, domainJCompLIdx);
987 reducedDiffusionMatrixOutside[domainICompKIdx][domainICompKIdx] += xl*avgMolarMass/(tkl*Mk);
988 reducedDiffusionMatrixOutside[domainICompKIdx][domainICompLIdx] += xk*(avgMolarMass/(tkn*Mn) - avgMolarMass/(tkl*Ml));
992 const Scalar omegai = 1/insideDistance;
993 const Scalar omegaj = 1/outsideDistance;
995 reducedDiffusionMatrixInside.invert();
996 reducedDiffusionMatrixInside *= omegai*volVarsI.density(couplingPhaseIdx(domainI));
997 reducedDiffusionMatrixOutside.invert();
998 reducedDiffusionMatrixOutside *= omegaj*volVarsJ.density(couplingPhaseIdx(domainJ));
1001 ReducedComponentVector helperVector(0.0);
1002 ReducedComponentVector gradientVectori(0.0);
1003 ReducedComponentVector gradientVectorj(0.0);
1005 reducedDiffusionMatrixInside.mv(moleFracInside, gradientVectori);
1006 reducedDiffusionMatrixOutside.mv(moleFracOutside, gradientVectorj);
1008 auto gradientVectorij = (gradientVectori + gradientVectorj);
1011 reducedDiffusionMatrixOutside += reducedDiffusionMatrixInside;
1013 reducedDiffusionMatrixOutside.solve(helperVector, gradientVectorij);
1016 helperVector -=moleFracInside;
1017 reducedDiffusionMatrixInside.mv(helperVector, reducedFlux);
1021 for (
int compIdx = 0; compIdx < numComponents-1; compIdx++)
1023 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
1024 diffusiveFlux[domainICompIdx] = reducedFlux[domainICompIdx];
1025 diffusiveFlux[couplingCompIdx(domainI, numComponents-1)] -= reducedFlux[domainICompIdx];
1027 return diffusiveFlux;
1030 template<std::
size_t i, std::
size_t j>
1032 Dune::index_constant<j> domainJ,
1033 const SubControlVolumeFace<i>& scvfI,
1034 const SubControlVolume<i>& scvI,
1035 const SubControlVolume<j>& scvJ,
1036 const VolumeVariables<i>& volVarsI,
1037 const VolumeVariables<j>& volVarsJ,
1038 const DiffusionCoefficientAveragingType diffCoeffAvgType)
const
1040 NumEqVector diffusiveFlux(0.0);
1042 const Scalar rhoInside =
massOrMolarDensity(volVarsI, referenceSystemFormulation, couplingPhaseIdx(domainI));
1043 const Scalar rhoOutside =
massOrMolarDensity(volVarsJ, referenceSystemFormulation, couplingPhaseIdx(domainJ));
1044 const Scalar avgDensity = 0.5 * rhoInside + 0.5 * rhoOutside;
1046 const Scalar insideDistance = this->getDistance_(scvI, scvfI);
1047 const Scalar outsideDistance = this->getDistance_(scvJ, scvfI);
1049 for (
int compIdx = 1; compIdx < numComponents; ++compIdx)
1051 const int domainIMainCompIdx = couplingPhaseIdx(domainI);
1052 const int domainJMainCompIdx = couplingPhaseIdx(domainJ);
1053 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
1054 const int domainJCompIdx = couplingCompIdx(domainJ, compIdx);
1056 assert(FluidSystem<i>::componentName(domainICompIdx) == FluidSystem<j>::componentName(domainJCompIdx));
1058 const Scalar massOrMoleFractionInside =
massOrMoleFraction(volVarsI, referenceSystemFormulation, couplingPhaseIdx(domainI), domainICompIdx);
1059 const Scalar massOrMoleFractionOutside =
massOrMoleFraction(volVarsJ, referenceSystemFormulation, couplingPhaseIdx(domainJ), domainJCompIdx);
1061 const Scalar deltaMassOrMoleFrac = massOrMoleFractionOutside - massOrMoleFractionInside;
1062 const Scalar tij = this->transmissibility_(domainI,
1066 volVarsI.effectiveDiffusionCoefficient(couplingPhaseIdx(domainI), domainIMainCompIdx, domainICompIdx),
1067 volVarsJ.effectiveDiffusionCoefficient(couplingPhaseIdx(domainJ), domainJMainCompIdx, domainJCompIdx),
1069 diffusiveFlux[domainICompIdx] += -avgDensity * tij * deltaMassOrMoleFrac;
1072 const Scalar cumulativeFlux = std::accumulate(diffusiveFlux.begin(), diffusiveFlux.end(), 0.0);
1073 diffusiveFlux[couplingCompIdx(domainI, 0)] = -cumulativeFlux;
1075 return diffusiveFlux;
1081 template<std::
size_t i, std::
size_t j,
bool isNI = enableEnergyBalance,
typename std::enable_if_t<isNI,
int> = 0>
1083 Dune::index_constant<j> domainJ,
1084 const FVElementGeometry<i>& insideFvGeometry,
1085 const FVElementGeometry<j>& outsideFvGeometry,
1086 const SubControlVolumeFace<i>& scvf,
1087 const VolumeVariables<i>& insideVolVars,
1088 const VolumeVariables<j>& outsideVolVars,
1089 const Scalar velocity,
1090 const bool insideIsUpstream,
1091 const DiffusionCoefficientAveragingType diffCoeffAvgType)
const
1095 const auto& insideScv = (*scvs(insideFvGeometry).begin());
1096 const auto& outsideScv = (*scvs(outsideFvGeometry).begin());
1099 const Scalar insideTerm = insideVolVars.density(couplingPhaseIdx(domainI)) * insideVolVars.enthalpy(couplingPhaseIdx(domainI));
1100 const Scalar outsideTerm = outsideVolVars.density(couplingPhaseIdx(domainJ)) * outsideVolVars.enthalpy(couplingPhaseIdx(domainJ));
1102 flux += this->advectiveFlux(insideTerm, outsideTerm, velocity, insideIsUpstream);
1104 flux += this->conductiveEnergyFlux_(domainI, domainJ, insideFvGeometry, outsideFvGeometry, scvf, insideScv, outsideScv, insideVolVars, outsideVolVars, diffCoeffAvgType);
1106 auto diffusiveFlux = isFicksLaw ? diffusiveMolecularFluxFicksLaw_(domainI, domainJ, scvf, insideScv, outsideScv, insideVolVars, outsideVolVars, diffCoeffAvgType)
1107 : diffusiveMolecularFluxMaxwellStefan_(domainI, domainJ, scvf, insideScv, outsideScv, insideVolVars, outsideVolVars);
1110 for (
int compIdx = 0; compIdx < diffusiveFlux.size(); ++compIdx)
1112 const int domainICompIdx = couplingCompIdx(domainI, compIdx);
1113 const int domainJCompIdx = couplingCompIdx(domainJ, compIdx);
1115 const bool insideDiffFluxIsUpstream = diffusiveFlux[domainICompIdx] > 0;
1116 const Scalar componentEnthalpy = insideDiffFluxIsUpstream ?
1117 getComponentEnthalpy(insideVolVars, couplingPhaseIdx(domainI), domainICompIdx)
1118 : getComponentEnthalpy(outsideVolVars, couplingPhaseIdx(domainJ), domainJCompIdx);
1121 flux += diffusiveFlux[domainICompIdx] * componentEnthalpy;
1123 flux += diffusiveFlux[domainICompIdx] * FluidSystem<i>::molarMass(domainICompIdx) * componentEnthalpy;
The interface of the coupling manager for multi domain problems.
Definition: multidomain/couplingmanager.hh:48
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition: multidomain/couplingmanager.hh:309
forward declaration of the method-specific implementation
Definition: flux/ccmpfa/darcyslaw.hh:27
forward declaration of the method-specific implementation
Definition: flux/box/fickslaw.hh:32
forward declare
Definition: forchheimerslaw_fwd.hh:27
NumEqVector massCouplingCondition(const Element< stokesIdx > &element, const FVElementGeometry< stokesIdx > &fvGeometry, const ElementVolumeVariables< stokesIdx > &stokesElemVolVars, const ElementFaceVariables< stokesIdx > &stokesElemFaceVars, const SubControlVolumeFace< stokesIdx > &scvf, const DiffusionCoefficientAveragingType diffCoeffAvgType=DiffusionCoefficientAveragingType::ffOnly) const
Returns the mass flux across the coupling boundary as seen from the free-flow domain.
Definition: couplingdata.hh:739
Scalar energyCouplingCondition(const Element< darcyIdx > &element, const FVElementGeometry< darcyIdx > &fvGeometry, const ElementVolumeVariables< darcyIdx > &darcyElemVolVars, const SubControlVolumeFace< darcyIdx > &scvf, const DiffusionCoefficientAveragingType diffCoeffAvgType=DiffusionCoefficientAveragingType::ffOnly) const
Returns the energy flux across the coupling boundary as seen from the Darcy domain.
Definition: couplingdata.hh:765
Scalar getComponentEnthalpy(const VolumeVariables< darcyIdx > &volVars, int phaseIdx, int compIdx) const
Definition: couplingdata.hh:884
Scalar getComponentEnthalpy(const VolumeVariables< stokesIdx > &volVars, int phaseIdx, int compIdx) const
Definition: couplingdata.hh:879
NumEqVector massFlux_(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const FVElementGeometry< i > &insideFvGeometry, const SubControlVolumeFace< i > &scvf, const VolumeVariables< i > &insideVolVars, const VolumeVariables< j > &outsideVolVars, const SubControlVolume< j > &outsideScv, const Scalar velocity, const bool insideIsUpstream, const DiffusionCoefficientAveragingType diffCoeffAvgType) const
Evaluate the compositional mole/mass flux across the interface.
Definition: couplingdata.hh:810
Scalar energyFlux_(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const FVElementGeometry< i > &insideFvGeometry, const FVElementGeometry< j > &outsideFvGeometry, const SubControlVolumeFace< i > &scvf, const VolumeVariables< i > &insideVolVars, const VolumeVariables< j > &outsideVolVars, const Scalar velocity, const bool insideIsUpstream, const DiffusionCoefficientAveragingType diffCoeffAvgType) const
Evaluate the energy flux across the interface.
Definition: couplingdata.hh:1082
NumEqVector massCouplingCondition(const Element< darcyIdx > &element, const FVElementGeometry< darcyIdx > &fvGeometry, const ElementVolumeVariables< darcyIdx > &darcyElemVolVars, const SubControlVolumeFace< darcyIdx > &scvf, const DiffusionCoefficientAveragingType diffCoeffAvgType=DiffusionCoefficientAveragingType::ffOnly) const
Returns the mass flux across the coupling boundary as seen from the Darcy domain.
Definition: couplingdata.hh:715
Scalar energyCouplingCondition(const Element< stokesIdx > &element, const FVElementGeometry< stokesIdx > &fvGeometry, const ElementVolumeVariables< stokesIdx > &stokesElemVolVars, const ElementFaceVariables< stokesIdx > &stokesElemFaceVars, const SubControlVolumeFace< stokesIdx > &scvf, const DiffusionCoefficientAveragingType diffCoeffAvgType=DiffusionCoefficientAveragingType::ffOnly) const
Returns the energy flux across the coupling boundary as seen from the free-flow domain.
Definition: couplingdata.hh:786
NumEqVector diffusiveMolecularFluxMaxwellStefan_(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const SubControlVolumeFace< i > &scvfI, const SubControlVolume< i > &scvI, const SubControlVolume< j > &scvJ, const VolumeVariables< i > &volVarsI, const VolumeVariables< j > &volVarsJ) const
Evaluate the diffusive mole/mass flux across the interface.
Definition: couplingdata.hh:893
NumEqVector diffusiveMolecularFluxFicksLaw_(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const SubControlVolumeFace< i > &scvfI, const SubControlVolume< i > &scvI, const SubControlVolume< j > &scvJ, const VolumeVariables< i > &volVarsI, const VolumeVariables< j > &volVarsJ, const DiffusionCoefficientAveragingType diffCoeffAvgType) const
Definition: couplingdata.hh:1031
Scalar energyCouplingCondition(const Element< stokesIdx > &element, const FVElementGeometry< stokesIdx > &fvGeometry, const ElementVolumeVariables< stokesIdx > &stokesElemVolVars, const ElementFaceVariables< stokesIdx > &stokesElemFaceVars, const SubControlVolumeFace< stokesIdx > &scvf, const DiffusionCoefficientAveragingType diffCoeffAvgType=DiffusionCoefficientAveragingType::ffOnly) const
Returns the energy flux across the coupling boundary as seen from the free-flow domain.
Definition: couplingdata.hh:590
Scalar massCouplingCondition(const Element< stokesIdx > &element, const FVElementGeometry< stokesIdx > &fvGeometry, const ElementVolumeVariables< stokesIdx > &stokesElemVolVars, const ElementFaceVariables< stokesIdx > &stokesElemFaceVars, const SubControlVolumeFace< stokesIdx > &scvf) const
Returns the mass flux across the coupling boundary as seen from the free-flow domain.
Definition: couplingdata.hh:550
Scalar energyCouplingCondition(const Element< darcyIdx > &element, const FVElementGeometry< darcyIdx > &fvGeometry, const ElementVolumeVariables< darcyIdx > &darcyElemVolVars, const SubControlVolumeFace< darcyIdx > &scvf, const DiffusionCoefficientAveragingType diffCoeffAvgType=DiffusionCoefficientAveragingType::ffOnly) const
Returns the energy flux across the coupling boundary as seen from the Darcy domain.
Definition: couplingdata.hh:569
Scalar massCouplingCondition(const Element< darcyIdx > &element, const FVElementGeometry< darcyIdx > &fvGeometry, const ElementVolumeVariables< darcyIdx > &darcyElemVolVars, const SubControlVolumeFace< darcyIdx > &scvf) const
Returns the mass flux across the coupling boundary as seen from the Darcy domain.
Definition: couplingdata.hh:533
A base class which provides some common methods used for Stokes-Darcy coupling.
Definition: couplingdata.hh:212
auto darcyPermeability(const Element< stokesIdx > &element, const SubControlVolumeFace< stokesIdx > &scvf) const
Returns the intrinsic permeability of the coupled Darcy element.
Definition: couplingdata.hh:274
static constexpr auto couplingPhaseIdx(Dune::index_constant< i > id, int coupledPhaseIdx=0)
Returns the corresponding phase index needed for coupling.
Definition: couplingdata.hh:255
Scalar conductiveEnergyFlux_(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const FVElementGeometry< i > &fvGeometryI, const FVElementGeometry< j > &fvGeometryJ, const SubControlVolumeFace< i > &scvfI, const SubControlVolume< i > &scvI, const SubControlVolume< j > &scvJ, const VolumeVariables< i > &volVarsI, const VolumeVariables< j > &volVarsJ, const DiffusionCoefficientAveragingType diffCoeffAvgType) const
Returns the conductive energy flux across the interface.
Definition: couplingdata.hh:380
static constexpr auto couplingCompIdx(Dune::index_constant< i > id, int coupledCompdIdx)
Returns the corresponding component index needed for coupling.
Definition: couplingdata.hh:262
Scalar pressureAtInterface_(const Element< stokesIdx > &element, const SubControlVolumeFace< stokesIdx > &scvf, const ElementFaceVariables &elemFaceVars, const CouplingContext &context) const
Returns the pressure at the interface.
Definition: couplingdata.hh:410
Scalar advectiveFlux(const Scalar insideQuantity, const Scalar outsideQuantity, const Scalar volumeFlow, bool insideIsUpstream) const
Evaluate an advective flux across the interface and consider upwinding.
Definition: couplingdata.hh:321
Scalar computeCouplingPhasePressureAtInterface_(const Element< darcyIdx > &element, const FVElementGeometry< darcyIdx > &fvGeometry, const SubControlVolumeFace< darcyIdx > &scvf, const VolumeVariables< darcyIdx > &volVars, const typename Element< stokesIdx >::Geometry::GlobalCoordinate &couplingPhaseVelocity, DarcysLaw) const
Returns the pressure at the interface using Darcy's law for reconstruction.
Definition: couplingdata.hh:460
Scalar getDistance_(const Scv &scv, const Scvf &scvf) const
Returns the distance between an scvf and the corresponding scv center.
Definition: couplingdata.hh:371
Scalar momentumCouplingCondition(const Element< stokesIdx > &element, const FVElementGeometry< stokesIdx > &fvGeometry, const ElementVolumeVariables< stokesIdx > &stokesElemVolVars, const ElementFaceVariables &stokesElemFaceVars, const SubControlVolumeFace< stokesIdx > &scvf) const
Returns the momentum flux across the coupling boundary.
Definition: couplingdata.hh:288
Scalar computeCouplingPhasePressureAtInterface_(const Element< darcyIdx > &element, const FVElementGeometry< darcyIdx > &fvGeometry, const SubControlVolumeFace< darcyIdx > &scvf, const VolumeVariables< darcyIdx > &volVars, const typename Element< stokesIdx >::Geometry::GlobalCoordinate &couplingPhaseVelocity, ForchheimersLaw) const
Returns the pressure at the interface using Forchheimers's law for reconstruction.
Definition: couplingdata.hh:424
const CouplingManager & couplingManager() const
Returns a reference to the coupling manager.
Definition: couplingdata.hh:268
StokesDarcyCouplingDataImplementationBase(const CouplingManager &couplingmanager)
Definition: couplingdata.hh:249
Scalar transmissibility_(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const Scalar insideDistance, const Scalar outsideDistance, const Scalar avgQuantityI, const Scalar avgQuantityJ, const DiffusionCoefficientAveragingType diffCoeffAvgType) const
Returns the transmissibility used for either molecular diffusion or thermal conductivity.
Definition: couplingdata.hh:337
Definition: couplingdata.hh:194
Defines all properties used in Dumux.
Tensor::field_type computeTpfaTransmissibility(const FVElementGeometry &fvGeometry, const typename FVElementGeometry::SubControlVolumeFace &scvf, const typename FVElementGeometry::SubControlVolume &scv, const Tensor &T, typename FVElementGeometry::SubControlVolume::Traits::Scalar extrusionFactor)
Free function to evaluate the Tpfa transmissibility associated with the flux (in the form of flux = T...
Definition: tpfa/computetransmissibility.hh:36
constexpr Scalar harmonicMean(Scalar x, Scalar y, Scalar wx=1.0, Scalar wy=1.0) noexcept
Calculate the (weighted) harmonic mean of two scalar values.
Definition: math.hh:57
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:851
constexpr int sign(const ValueType &value) noexcept
Sign or signum function.
Definition: math.hh:629
constexpr Scalar arithmeticMean(Scalar x, Scalar y, Scalar wx=1.0, Scalar wy=1.0) noexcept
Calculate the (weighted) arithmetic mean of two scalar values.
Definition: math.hh:38
VolumeVariables::PrimaryVariables::value_type massOrMoleFraction(const VolumeVariables &volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx, const int compIdx)
returns the mass or mole fraction to be used in Fick's law based on the reference system
Definition: referencesystemformulation.hh:54
VolumeVariables::PrimaryVariables::value_type massOrMolarDensity(const VolumeVariables &volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx)
evaluates the density to be used in Fick's law based on the reference system
Definition: referencesystemformulation.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition: propertysystem.hh:310
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Define some often used mathematical functions.
The available discretization methods in Dumux.
The interface of the coupling manager for multi domain problems.
static constexpr auto couplingCompIdx(Dune::index_constant< i >, int coupledCompdIdx)
No adapter is used, just return the input index.
Definition: couplingdata.hh:144
static constexpr auto couplingPhaseIdx(Dune::index_constant< i >, int coupledPhaseIdx=0)
No adapter is used, just return the input index.
Definition: couplingdata.hh:137
static constexpr auto couplingPhaseIdx(Dune::index_constant< darcyIdx >, int coupledPhaseIdx=0)
The phase index of the porous-medium-flow model is given by the adapter fluidsytem (i....
Definition: couplingdata.hh:168
static constexpr auto couplingCompIdx(Dune::index_constant< stokesIdx >, int coupledCompdIdx)
The free-flow model does not need any change of the component index.
Definition: couplingdata.hh:174
static constexpr auto couplingCompIdx(Dune::index_constant< darcyIdx >, int coupledCompdIdx)
The component index of the porous-medium-flow model is mapped by the adapter fluidsytem.
Definition: couplingdata.hh:180
static constexpr auto couplingPhaseIdx(Dune::index_constant< stokesIdx >, int coupledPhaseIdx=0)
The free-flow model always uses phase index 0.
Definition: couplingdata.hh:162
Helper struct to choose the correct index for phases and components. This is need if the porous-mediu...
Definition: couplingdata.hh:120
This structs indicates that Fick's law is not used for diffusion.
Definition: couplingdata.hh:100
This structs helps to check if the two sub models use the same fluidsystem. Specialization for the ca...
Definition: couplingdata.hh:73
static constexpr bool value
Definition: couplingdata.hh:75
This structs holds a set of options which allow to modify the Stokes-Darcy coupling mechanism during ...
Definition: couplingdata.hh:33
DiffusionCoefficientAveragingType
Defines which kind of averanging of diffusion coefficiencients (moleculat diffusion or thermal conduc...
Definition: couplingdata.hh:40
static DiffusionCoefficientAveragingType stringToEnum(DiffusionCoefficientAveragingType, const std::string &diffusionCoefficientAveragingType)
Convenience function to convert user input given as std::string to the corresponding enum class used ...
Definition: couplingdata.hh:48
Free functions to evaluate the transmissibilities associated with flux evaluations across sub-control...