26#ifndef DUMUX_FVMPFAL2PFABOUND3DPRESSURE2P_HH
27#define DUMUX_FVMPFAL2PFABOUND3DPRESSURE2P_HH
72template<
class TypeTag>
81 dim = GridView::dimension, dimWorld = GridView::dimensionworld
88 using MaterialLaw =
typename SpatialParams::MaterialLaw;
99 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
100 using ScalarSolutionType =
typename SolutionTypes::ScalarSolution;
104 pw = Indices::pressureW,
105 pn = Indices::pressureNw,
106 pGlobal = Indices::pressureGlobal,
107 sw = Indices::saturationW,
108 sn = Indices::saturationNw,
109 vw = Indices::velocityW,
110 vn = Indices::velocityNw,
111 vt = Indices::velocityTotal
115 wPhaseIdx = Indices::wPhaseIdx,
116 nPhaseIdx = Indices::nPhaseIdx,
117 pressureIdx = Indices::pressureIdx,
118 saturationIdx = Indices::saturationIdx,
119 pressureEqIdx = Indices::pressureEqIdx,
120 satEqIdx = Indices::satEqIdx,
121 numPhases = getPropValue<TypeTag, Properties::NumPhases>()
128 dirichletDirichlet = 1,
129 dirichletNeumann = 2,
138 using Element =
typename GridView::Traits::template Codim<0>::Entity;
139 using Grid =
typename GridView::Grid;
140 using Geometry =
typename Element::Geometry;
141 using IntersectionIterator =
typename GridView::IntersectionIterator;
143 using GlobalPosition =
typename Geometry::GlobalCoordinate;
144 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
145 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
147 using DimVector = Dune::FieldVector<Scalar, dim>;
180 const auto element = *problem_.gridView().template begin<0>();
181 FluidState fluidState;
182 fluidState.setPressure(wPhaseIdx, problem_.referencePressure(element));
183 fluidState.setPressure(nPhaseIdx, problem_.referencePressure(element));
184 fluidState.setTemperature(problem_.temperature(element));
185 fluidState.setSaturation(wPhaseIdx, 1.);
186 fluidState.setSaturation(nPhaseIdx, 0.);
209 for (
const auto& element : elements(problem_.gridView()))
222 int eIdxGlobal = problem_.variables().index(element);
223 CellData& cellData = problem_.variables().cellData(eIdxGlobal);
225 switch (pressureType_)
229 Scalar potW = this->
pressure()[eIdxGlobal];
231 Scalar gravityDiff = (problem_.bBoxMax() - element.geometry().center()) * gravity_;
232 Scalar potPc = cellData.capillaryPressure()
233 + gravityDiff * (density_[nPhaseIdx] - density_[wPhaseIdx]);
235 cellData.setPotential(wPhaseIdx, potW);
236 cellData.setPotential(nPhaseIdx, potW + potPc);
238 Scalar pressW = potW - gravityDiff * density_[wPhaseIdx];
240 cellData.setPressure(wPhaseIdx, pressW);
241 cellData.setPressure(nPhaseIdx, pressW + cellData.capillaryPressure());
247 Scalar potNw = this->
pressure()[eIdxGlobal];
249 Scalar gravityDiff = (problem_.bBoxMax() - element.geometry().center()) * gravity_;
250 Scalar potPc = cellData.capillaryPressure()
251 + gravityDiff * (density_[nPhaseIdx] - density_[wPhaseIdx]);
253 cellData.setPotential(nPhaseIdx, potNw);
254 cellData.setPotential(wPhaseIdx, potNw - potPc);
256 Scalar pressNw = potNw - gravityDiff * density_[nPhaseIdx];
258 cellData.setPressure(wPhaseIdx, pressNw - cellData.capillaryPressure());
259 cellData.setPressure(nPhaseIdx, pressNw);
264 cellData.fluxData().resetVelocity();
274 int size = problem_.gridView().size(0);
278 timeStep_ = problem_.timeManager().timeStepSize();
280 for (
int i = 0; i < size; i++)
282 CellData& cellData = problem_.variables().cellData(i);
285 switch (saturationType_)
288 sat = cellData.saturation(wPhaseIdx);
291 sat = cellData.saturation(nPhaseIdx);
296 maxError_ = max(maxError_, (sat - 1.0) / timeStep_);
300 maxError_ = max(maxError_, (-sat) / timeStep_);
303 switch (pressureType_)
306 this->
pressure()[i] = cellData.pressure(wPhaseIdx);
309 this->
pressure()[i] = cellData.pressure(nPhaseIdx);
346 switch (saturationType_)
349 sat = cellData.saturation(wPhaseIdx);
352 sat = cellData.saturation(nPhaseIdx);
356 Scalar error = (sat > 1.0) ? sat - 1.0 : 0.0;
364 Scalar errorAbs = abs(error);
366 if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_)
367 && (!problem_.timeManager().willBeFinished()))
369 return ErrorTermFactor_ * error;
384 template<
class MultiWriter>
387 int size = problem_.gridView().size(0);
388 ScalarSolutionType *potential = writer.allocateManagedBuffer(size);
392 if (pressureType_ == pw)
394 writer.attachCellData(*potential,
"wetting potential");
397 if (pressureType_ == pn)
399 writer.attachCellData(*potential,
"nonwetting potential");
402 if (vtkOutputLevel_ > 0)
404 ScalarSolutionType *
pressure = writer.allocateManagedBuffer(size);
405 ScalarSolutionType *pressureSecond = writer.allocateManagedBuffer(size);
406 ScalarSolutionType *potentialSecond = writer.allocateManagedBuffer(size);
407 ScalarSolutionType *pc = writer.allocateManagedBuffer(size);
409 for (
const auto& element : elements(problem_.gridView()))
411 int idx = problem_.variables().index(element);
412 CellData& cellData = problem_.variables().cellData(idx);
414 (*pc)[idx] = cellData.capillaryPressure();
416 if (pressureType_ == pw)
418 (*pressure)[idx] = cellData.pressure(wPhaseIdx);
419 (*potentialSecond)[idx] = cellData.potential(nPhaseIdx);
420 (*pressureSecond)[idx] = cellData.pressure(nPhaseIdx);
423 if (pressureType_ == pn)
425 (*pressure)[idx] = cellData.pressure(nPhaseIdx);
426 (*potentialSecond)[idx] = cellData.potential(wPhaseIdx);
427 (*pressureSecond)[idx] = cellData.pressure(wPhaseIdx);
431 if (pressureType_ == pw)
433 writer.attachCellData(*
pressure,
"wetting pressure");
434 writer.attachCellData(*pressureSecond,
"nonwetting pressure");
435 writer.attachCellData(*potentialSecond,
"nonwetting potential");
438 if (pressureType_ == pn)
440 writer.attachCellData(*
pressure,
"nonwetting pressure");
441 writer.attachCellData(*pressureSecond,
"wetting pressure");
442 writer.attachCellData(*potentialSecond,
"wetting potential");
445 writer.attachCellData(*pc,
"capillary pressure");
472 gravity_(problem.gravity()),
473 maxError_(0.), timeStep_(1.)
475 if (pressureType_ != pw && pressureType_ != pn)
477 DUNE_THROW(Dune::NotImplemented,
"Pressure type not supported!");
479 if (saturationType_ != sw && saturationType_ != sn)
481 DUNE_THROW(Dune::NotImplemented,
"Saturation type not supported!");
483 if (getPropValue<TypeTag, Properties::EnableCompressibility>())
485 DUNE_THROW(Dune::NotImplemented,
"Compressibility not supported!");
489 DUNE_THROW(Dune::NotImplemented,
"Dimension not supported!");
492 ErrorTermFactor_ = getParam<Scalar>(
"Impet.ErrorTermFactor");
493 ErrorTermLowerBound_ = getParam<Scalar>(
"Impet.ErrorTermLowerBound");
494 ErrorTermUpperBound_ = getParam<Scalar>(
"Impet.ErrorTermUpperBound");
496 density_[wPhaseIdx] = 0.;
497 density_[nPhaseIdx] = 0.;
498 viscosity_[wPhaseIdx] = 0.;
499 viscosity_[nPhaseIdx] = 0.;
501 vtkOutputLevel_ = getParam<int>(
"Vtk.OutputLevel");
514 Implementation &asImp_()
515 {
return *
static_cast<Implementation *
>(
this);}
518 const Implementation &asImp_()
const
519 {
return *
static_cast<const Implementation *
>(
this);}
521 const GravityVector& gravity_;
525 Scalar ErrorTermFactor_;
526 Scalar ErrorTermLowerBound_;
527 Scalar ErrorTermUpperBound_;
529 Scalar density_[numPhases];
530 Scalar viscosity_[numPhases];
534 static constexpr Scalar threshold_ = 1e-15;
536 static const int pressureType_ = getPropValue<TypeTag, Properties::PressureFormulation>();
538 static const int saturationType_ = getPropValue<TypeTag, Properties::SaturationFormulation>();
540 static const int velocityType_ = getPropValue<TypeTag, Properties::VelocityFormulation>();
544template<
class TypeTag>
547 initializeMatrixRowSize();
548 this->A_.endrowsizes();
549 initializeMatrixIndices();
550 this->A_.endindices();
554template<
class TypeTag>
558 for (
const auto& element : elements(problem_.gridView()))
561 int eIdxGlobalI = problem_.variables().index(element);
563 std::set<int> neighborIndices;
565 int numVertices = element.geometry().corners();
567 for (
int vIdx = 0; vIdx < numVertices; vIdx++)
569 int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, vIdx, dim);
571 InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
573 for (
int subVolumeIdx = 0; subVolumeIdx < InteractionVolume::subVolumeTotalNum; subVolumeIdx++)
575 if (interactionVolume.hasSubVolumeElement(subVolumeIdx))
577 int eIdxGlobalJ = problem_.variables().index(interactionVolume.getSubVolumeElement(subVolumeIdx));
579 neighborIndices.insert(eIdxGlobalJ);
584 this->A_.setrowsize(eIdxGlobalI, neighborIndices.size());
591template<
class TypeTag>
595 for (
const auto& element : elements(problem_.gridView()))
598 int eIdxGlobalI = problem_.variables().index(element);
601 this->A_.addindex(eIdxGlobalI, eIdxGlobalI);
603 int numVertices = element.geometry().corners();
605 for (
int vIdx = 0; vIdx < numVertices; vIdx++)
607 int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, vIdx, dim);
609 InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
610 for (
int subVolumeIdx = 0; subVolumeIdx < InteractionVolume::subVolumeTotalNum; subVolumeIdx++)
612 if (interactionVolume.hasSubVolumeElement(subVolumeIdx))
614 int eIdxGlobalJ = problem_.variables().index(interactionVolume.getSubVolumeElement(subVolumeIdx));
616 this->A_.addindex(eIdxGlobalI, eIdxGlobalJ);
625template<
class TypeTag>
633 for (
const auto& vertex : vertices(problem_.gridView()))
635 int vIdxGlobal = problem_.variables().index(vertex);
637 InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
640 if (interactionVolume.isInnerVolume())
642 assembleInnerInteractionVolume(interactionVolume);
648 assembleBoundaryInteractionVolume(interactionVolume);
657template<
class TypeTag>
660 auto element1 = interactionVolume.getSubVolumeElement(0);
661 auto element2 = interactionVolume.getSubVolumeElement(1);
662 auto element3 = interactionVolume.getSubVolumeElement(2);
663 auto element4 = interactionVolume.getSubVolumeElement(3);
664 auto element5 = interactionVolume.getSubVolumeElement(4);
665 auto element6 = interactionVolume.getSubVolumeElement(5);
666 auto element7 = interactionVolume.getSubVolumeElement(6);
667 auto element8 = interactionVolume.getSubVolumeElement(7);
670 const GlobalPosition& globalPos1 = element1.geometry().center();
671 const GlobalPosition& globalPos2 = element2.geometry().center();
672 const GlobalPosition& globalPos3 = element3.geometry().center();
673 const GlobalPosition& globalPos4 = element4.geometry().center();
674 const GlobalPosition& globalPos5 = element5.geometry().center();
675 const GlobalPosition& globalPos6 = element6.geometry().center();
676 const GlobalPosition& globalPos7 = element7.geometry().center();
677 const GlobalPosition& globalPos8 = element8.geometry().center();
680 Scalar volume1 = element1.geometry().volume();
681 Scalar volume2 = element2.geometry().volume();
682 Scalar volume3 = element3.geometry().volume();
683 Scalar volume4 = element4.geometry().volume();
684 Scalar volume5 = element5.geometry().volume();
685 Scalar volume6 = element6.geometry().volume();
686 Scalar volume7 = element7.geometry().volume();
687 Scalar volume8 = element8.geometry().volume();
690 int eIdxGlobal1 = problem_.variables().index(element1);
691 int eIdxGlobal2 = problem_.variables().index(element2);
692 int eIdxGlobal3 = problem_.variables().index(element3);
693 int eIdxGlobal4 = problem_.variables().index(element4);
694 int eIdxGlobal5 = problem_.variables().index(element5);
695 int eIdxGlobal6 = problem_.variables().index(element6);
696 int eIdxGlobal7 = problem_.variables().index(element7);
697 int eIdxGlobal8 = problem_.variables().index(element8);
700 CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1);
701 CellData& cellData2 = problem_.variables().cellData(eIdxGlobal2);
702 CellData& cellData3 = problem_.variables().cellData(eIdxGlobal3);
703 CellData& cellData4 = problem_.variables().cellData(eIdxGlobal4);
704 CellData& cellData5 = problem_.variables().cellData(eIdxGlobal5);
705 CellData& cellData6 = problem_.variables().cellData(eIdxGlobal6);
706 CellData& cellData7 = problem_.variables().cellData(eIdxGlobal7);
707 CellData& cellData8 = problem_.variables().cellData(eIdxGlobal8);
710 Dune::FieldVector<Scalar, numPhases> lambda1(cellData1.mobility(wPhaseIdx));
711 lambda1[nPhaseIdx] = cellData1.mobility(nPhaseIdx);
714 Scalar lambdaTotal1 = lambda1[wPhaseIdx] + lambda1[nPhaseIdx];
717 Dune::FieldVector<Scalar, numPhases> lambda2(cellData2.mobility(wPhaseIdx));
718 lambda2[nPhaseIdx] = cellData2.mobility(nPhaseIdx);
721 Scalar lambdaTotal2 = lambda2[wPhaseIdx] + lambda2[nPhaseIdx];
724 Dune::FieldVector<Scalar, numPhases> lambda3(cellData3.mobility(wPhaseIdx));
725 lambda3[nPhaseIdx] = cellData3.mobility(nPhaseIdx);
728 Scalar lambdaTotal3 = lambda3[wPhaseIdx] + lambda3[nPhaseIdx];
731 Dune::FieldVector<Scalar, numPhases> lambda4(cellData4.mobility(wPhaseIdx));
732 lambda4[nPhaseIdx] = cellData4.mobility(nPhaseIdx);
735 Scalar lambdaTotal4 = lambda4[wPhaseIdx] + lambda4[nPhaseIdx];
738 Dune::FieldVector<Scalar, numPhases> lambda5(cellData5.mobility(wPhaseIdx));
739 lambda5[nPhaseIdx] = cellData5.mobility(nPhaseIdx);
742 Scalar lambdaTotal5 = lambda5[wPhaseIdx] + lambda5[nPhaseIdx];
745 Dune::FieldVector<Scalar, numPhases> lambda6(cellData6.mobility(wPhaseIdx));
746 lambda6[nPhaseIdx] = cellData6.mobility(nPhaseIdx);
749 Scalar lambdaTotal6 = lambda6[wPhaseIdx] + lambda6[nPhaseIdx];
752 Dune::FieldVector<Scalar, numPhases> lambda7(cellData7.mobility(wPhaseIdx));
753 lambda7[nPhaseIdx] = cellData7.mobility(nPhaseIdx);
756 Scalar lambdaTotal7 = lambda7[wPhaseIdx] + lambda7[nPhaseIdx];
759 Dune::FieldVector<Scalar, numPhases> lambda8(cellData8.mobility(wPhaseIdx));
760 lambda8[nPhaseIdx] = cellData8.mobility(nPhaseIdx);
763 Scalar lambdaTotal8 = lambda8[wPhaseIdx] + lambda8[nPhaseIdx];
765 std::vector<DimVector> lambda(8);
766 lambda[0][0] = lambdaTotal1;
767 lambda[0][1] = lambdaTotal1;
768 lambda[0][2] = lambdaTotal1;
769 lambda[1][0] = lambdaTotal2;
770 lambda[1][1] = lambdaTotal2;
771 lambda[1][2] = lambdaTotal2;
772 lambda[2][0] = lambdaTotal3;
773 lambda[2][1] = lambdaTotal3;
774 lambda[2][2] = lambdaTotal3;
775 lambda[3][0] = lambdaTotal4;
776 lambda[3][1] = lambdaTotal4;
777 lambda[3][2] = lambdaTotal4;
778 lambda[4][0] = lambdaTotal5;
779 lambda[4][1] = lambdaTotal5;
780 lambda[4][2] = lambdaTotal5;
781 lambda[5][0] = lambdaTotal6;
782 lambda[5][1] = lambdaTotal6;
783 lambda[5][2] = lambdaTotal6;
784 lambda[6][0] = lambdaTotal7;
785 lambda[6][1] = lambdaTotal7;
786 lambda[6][2] = lambdaTotal7;
787 lambda[7][0] = lambdaTotal8;
788 lambda[7][1] = lambdaTotal8;
789 lambda[7][2] = lambdaTotal8;
793 Dune::FieldVector<Scalar, 8> pc(0);
794 pc[0] = cellData1.capillaryPressure();
795 pc[1] = cellData2.capillaryPressure();
796 pc[2] = cellData3.capillaryPressure();
797 pc[3] = cellData4.capillaryPressure();
798 pc[4] = cellData5.capillaryPressure();
799 pc[5] = cellData6.capillaryPressure();
800 pc[6] = cellData7.capillaryPressure();
801 pc[7] = cellData8.capillaryPressure();
803 Dune::FieldVector<Scalar, 8> gravityDiff(0);
805 gravityDiff[0] = (problem_.bBoxMax() - globalPos1) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
806 gravityDiff[1] = (problem_.bBoxMax() - globalPos2) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
807 gravityDiff[2] = (problem_.bBoxMax() - globalPos3) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
808 gravityDiff[3] = (problem_.bBoxMax() - globalPos4) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
809 gravityDiff[4] = (problem_.bBoxMax() - globalPos5) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
810 gravityDiff[5] = (problem_.bBoxMax() - globalPos6) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
811 gravityDiff[6] = (problem_.bBoxMax() - globalPos7) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
812 gravityDiff[7] = (problem_.bBoxMax() - globalPos8) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
816 Dune::FieldVector<Dune::FieldVector<Scalar, 3>, 8> pcFlux(Dune::FieldVector<Scalar, 3>(0));
818 Scalar pcPotential0 = 0;
819 Scalar pcPotential1 = 0;
820 Scalar pcPotential2 = 0;
821 Scalar pcPotential3 = 0;
822 Scalar pcPotential4 = 0;
823 Scalar pcPotential5 = 0;
824 Scalar pcPotential6 = 0;
825 Scalar pcPotential7 = 0;
826 Scalar pcPotential8 = 0;
827 Scalar pcPotential9 = 0;
828 Scalar pcPotential10 = 0;
829 Scalar pcPotential11 = 0;
833 PrimaryVariables source(0.0);
834 problem_.source(source, element1);
835 this->f_[eIdxGlobal1] += volume1 / (8.0)
836 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
837 problem_.source(source, element2);
838 this->f_[eIdxGlobal2] += volume2 / (8.0)
839 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
840 problem_.source(source, element3);
841 this->f_[eIdxGlobal3] += volume3 / (8.0)
842 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
843 problem_.source(source, element4);
844 this->f_[eIdxGlobal4] += volume4 / (8.0)
845 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
846 problem_.source(source, element5);
847 this->f_[eIdxGlobal5] += volume5 / (8.0)
848 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
849 problem_.source(source, element6);
850 this->f_[eIdxGlobal6] += volume6 / (8.0)
851 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
852 problem_.source(source, element7);
853 this->f_[eIdxGlobal7] += volume7 / (8.0)
854 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
855 problem_.source(source, element8);
856 this->f_[eIdxGlobal8] += volume8 / (8.0)
857 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
859 this->f_[eIdxGlobal1] += evaluateErrorTerm(cellData1) * volume1 / (8.0);
860 this->f_[eIdxGlobal2] += evaluateErrorTerm(cellData2) * volume2 / (8.0);
861 this->f_[eIdxGlobal3] += evaluateErrorTerm(cellData3) * volume3 / (8.0);
862 this->f_[eIdxGlobal4] += evaluateErrorTerm(cellData4) * volume4 / (8.0);
863 this->f_[eIdxGlobal5] += evaluateErrorTerm(cellData5) * volume5 / (8.0);
864 this->f_[eIdxGlobal6] += evaluateErrorTerm(cellData6) * volume6 / (8.0);
865 this->f_[eIdxGlobal7] += evaluateErrorTerm(cellData7) * volume7 / (8.0);
866 this->f_[eIdxGlobal8] += evaluateErrorTerm(cellData8) * volume8 / (8.0);
869 Dune::FieldVector<Scalar, 2 * dim - dim + 1> u(0);
874 int caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 0, 1, 2, 3, 4,
878 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal1, 0, 0);
879 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal2, 1, 1);
883 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
884 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
885 this->A_[eIdxGlobal1][eIdxGlobal3] += T[0][2];
886 this->A_[eIdxGlobal1][eIdxGlobal5] += T[0][3];
888 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
889 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
890 this->A_[eIdxGlobal2][eIdxGlobal3] -= TSecond[0][2];
891 this->A_[eIdxGlobal2][eIdxGlobal5] -= TSecond[0][3];
900 pcFlux[0][0] = Tu[0];
901 pcPotential0 = Tu[0];
908 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
909 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
910 this->A_[eIdxGlobal1][eIdxGlobal4] += T[0][2];
911 this->A_[eIdxGlobal1][eIdxGlobal6] += T[0][3];
913 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
914 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
915 this->A_[eIdxGlobal2][eIdxGlobal4] -= TSecond[0][2];
916 this->A_[eIdxGlobal2][eIdxGlobal6] -= TSecond[0][3];
924 pcFlux[0][0] = Tu[0];
925 pcPotential0 = Tu[0];
932 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
933 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
934 this->A_[eIdxGlobal1][eIdxGlobal4] += T[0][2];
935 this->A_[eIdxGlobal1][eIdxGlobal5] += T[0][3];
937 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
938 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
939 this->A_[eIdxGlobal2][eIdxGlobal4] -= TSecond[0][2];
940 this->A_[eIdxGlobal2][eIdxGlobal5] -= TSecond[0][3];
948 pcFlux[0][0] = Tu[0];
949 pcPotential0 = Tu[0];
956 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
957 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
958 this->A_[eIdxGlobal1][eIdxGlobal3] += T[0][2];
959 this->A_[eIdxGlobal1][eIdxGlobal6] += T[0][3];
961 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
962 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
963 this->A_[eIdxGlobal2][eIdxGlobal3] -= TSecond[0][2];
964 this->A_[eIdxGlobal2][eIdxGlobal6] -= TSecond[0][3];
972 pcFlux[0][0] = Tu[0];
973 pcPotential0 = Tu[0];
980 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 1, 3, 0, 2, 5, 7);
983 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal2, 1, 0);
984 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal4, 3, 1);
988 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
989 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
990 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][2];
991 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][3];
993 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
994 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
995 this->A_[eIdxGlobal4][eIdxGlobal1] -= TSecond[0][2];
996 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][3];
1004 pcFlux[1][0] = Tu[0];
1005 pcPotential1 = Tu[0];
1008 pcFlux[3][1] = Tu[0];
1010 else if (caseL == 2)
1012 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1013 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
1014 this->A_[eIdxGlobal2][eIdxGlobal3] += T[0][2];
1015 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][3];
1017 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
1018 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1019 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][2];
1020 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][3];
1028 pcFlux[1][0] = Tu[0];
1029 pcPotential1 = Tu[0];
1032 pcFlux[3][1] = Tu[0];
1034 else if (caseL == 3)
1036 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1037 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
1038 this->A_[eIdxGlobal2][eIdxGlobal3] += T[0][2];
1039 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][3];
1041 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
1042 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1043 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][2];
1044 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][3];
1052 pcFlux[1][0] = Tu[0];
1053 pcPotential1 = Tu[0];
1056 pcFlux[3][1] = Tu[0];
1060 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1061 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
1062 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][2];
1063 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][3];
1065 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
1066 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1067 this->A_[eIdxGlobal4][eIdxGlobal1] -= TSecond[0][2];
1068 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][3];
1076 pcFlux[1][0] = Tu[0];
1077 pcPotential1 = Tu[0];
1080 pcFlux[3][1] = Tu[0];
1084 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 3, 2, 1, 0, 7, 6);
1087 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal4, 3, 0);
1088 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal3, 2, 1);
1092 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1093 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1094 this->A_[eIdxGlobal4][eIdxGlobal2] += T[0][2];
1095 this->A_[eIdxGlobal4][eIdxGlobal8] += T[0][3];
1097 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1098 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1099 this->A_[eIdxGlobal3][eIdxGlobal2] -= TSecond[0][2];
1100 this->A_[eIdxGlobal3][eIdxGlobal8] -= TSecond[0][3];
1108 pcPotential2 = Tu[0];
1109 pcFlux[3][0] = Tu[0];
1112 pcFlux[2][1] = Tu[0];
1114 else if (caseL == 2)
1116 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1117 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1118 this->A_[eIdxGlobal4][eIdxGlobal1] += T[0][2];
1119 this->A_[eIdxGlobal4][eIdxGlobal7] += T[0][3];
1121 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1122 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1123 this->A_[eIdxGlobal3][eIdxGlobal1] -= TSecond[0][2];
1124 this->A_[eIdxGlobal3][eIdxGlobal7] -= TSecond[0][3];
1132 pcPotential2 = Tu[0];
1133 pcFlux[3][0] = Tu[0];
1136 pcFlux[2][1] = Tu[0];
1138 else if (caseL == 3)
1140 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1141 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1142 this->A_[eIdxGlobal4][eIdxGlobal1] += T[0][2];
1143 this->A_[eIdxGlobal4][eIdxGlobal8] += T[0][3];
1145 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1146 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1147 this->A_[eIdxGlobal3][eIdxGlobal1] -= TSecond[0][2];
1148 this->A_[eIdxGlobal3][eIdxGlobal8] -= TSecond[0][3];
1156 pcPotential2 = Tu[0];
1157 pcFlux[3][0] = Tu[0];
1160 pcFlux[2][1] = Tu[0];
1164 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1165 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1166 this->A_[eIdxGlobal4][eIdxGlobal2] += T[0][2];
1167 this->A_[eIdxGlobal4][eIdxGlobal7] += T[0][3];
1169 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1170 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1171 this->A_[eIdxGlobal3][eIdxGlobal2] -= TSecond[0][2];
1172 this->A_[eIdxGlobal3][eIdxGlobal7] -= TSecond[0][3];
1180 pcPotential2 = Tu[0];
1181 pcFlux[3][0] = Tu[0];
1184 pcFlux[2][1] = Tu[0];
1188 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 2, 0, 3, 1, 6, 4);
1191 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal3, 2, 0);
1192 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal1, 0, 1);
1196 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1197 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1198 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][2];
1199 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][3];
1201 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1202 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1203 this->A_[eIdxGlobal1][eIdxGlobal4] -= TSecond[0][2];
1204 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][3];
1212 pcFlux[2][0] = Tu[0];
1213 pcPotential3 = Tu[0];
1216 pcFlux[0][1] = Tu[0];
1218 else if (caseL == 2)
1220 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1221 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1222 this->A_[eIdxGlobal3][eIdxGlobal2] += T[0][2];
1223 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][3];
1225 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1226 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1227 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][2];
1228 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][3];
1236 pcFlux[2][0] = Tu[0];
1237 pcPotential3 = Tu[0];
1240 pcFlux[0][1] = Tu[0];
1242 else if (caseL == 3)
1244 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1245 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1246 this->A_[eIdxGlobal3][eIdxGlobal2] += T[0][2];
1247 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][3];
1249 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1250 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1251 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][2];
1252 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][3];
1260 pcFlux[2][0] = Tu[0];
1261 pcPotential3 = Tu[0];
1264 pcFlux[0][1] = Tu[0];
1268 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1269 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1270 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][2];
1271 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][3];
1273 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1274 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1275 this->A_[eIdxGlobal1][eIdxGlobal4] -= TSecond[0][2];
1276 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][3];
1284 pcFlux[2][0] = Tu[0];
1285 pcPotential3 = Tu[0];
1288 pcFlux[0][1] = Tu[0];
1292 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 5, 4, 7, 6, 1, 0);
1295 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal6, 5, 2);
1296 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal5, 4, 1);
1300 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1301 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1302 this->A_[eIdxGlobal6][eIdxGlobal8] += T[0][2];
1303 this->A_[eIdxGlobal6][eIdxGlobal2] += T[0][3];
1305 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1306 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1307 this->A_[eIdxGlobal5][eIdxGlobal8] -= TSecond[0][2];
1308 this->A_[eIdxGlobal5][eIdxGlobal2] -= TSecond[0][3];
1316 pcFlux[5][2] = Tu[0];
1317 pcPotential4 = Tu[0];
1320 pcFlux[4][1] = Tu[0];
1322 else if (caseL == 2)
1324 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1325 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1326 this->A_[eIdxGlobal6][eIdxGlobal7] += T[0][2];
1327 this->A_[eIdxGlobal6][eIdxGlobal1] += T[0][3];
1329 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1330 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1331 this->A_[eIdxGlobal5][eIdxGlobal7] -= TSecond[0][2];
1332 this->A_[eIdxGlobal5][eIdxGlobal1] -= TSecond[0][3];
1340 pcFlux[5][2] = Tu[0];
1341 pcPotential4 = Tu[0];
1344 pcFlux[4][1] = Tu[0];
1346 else if (caseL == 3)
1348 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1349 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1350 this->A_[eIdxGlobal6][eIdxGlobal7] += T[0][2];
1351 this->A_[eIdxGlobal6][eIdxGlobal2] += T[0][3];
1353 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1354 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1355 this->A_[eIdxGlobal5][eIdxGlobal7] -= TSecond[0][2];
1356 this->A_[eIdxGlobal5][eIdxGlobal2] -= TSecond[0][3];
1364 pcFlux[5][2] = Tu[0];
1365 pcPotential4 = Tu[0];
1368 pcFlux[4][1] = Tu[0];
1372 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1373 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1374 this->A_[eIdxGlobal6][eIdxGlobal8] += T[0][2];
1375 this->A_[eIdxGlobal6][eIdxGlobal1] += T[0][3];
1377 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1378 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1379 this->A_[eIdxGlobal5][eIdxGlobal8] -= TSecond[0][2];
1380 this->A_[eIdxGlobal5][eIdxGlobal1] -= TSecond[0][3];
1388 pcFlux[5][2] = Tu[0];
1389 pcPotential4 = Tu[0];
1392 pcFlux[4][1] = Tu[0];
1396 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 7, 5, 6, 4, 3, 1);
1399 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal8, 7, 2);
1400 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal6, 5, 1);
1405 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1406 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1407 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][2];
1408 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][3];
1410 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1411 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1412 this->A_[eIdxGlobal6][eIdxGlobal7] -= TSecond[0][2];
1413 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][3];
1421 pcFlux[7][2] = Tu[0];
1422 pcPotential5 = Tu[0];
1425 pcFlux[5][1] = Tu[0];
1427 else if (caseL == 2)
1429 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1430 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1431 this->A_[eIdxGlobal8][eIdxGlobal5] += T[0][2];
1432 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][3];
1434 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1435 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1436 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][2];
1437 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][3];
1445 pcFlux[7][2] = Tu[0];
1446 pcPotential5 = Tu[0];
1449 pcFlux[5][1] = Tu[0];
1451 else if (caseL == 3)
1453 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1454 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1455 this->A_[eIdxGlobal8][eIdxGlobal5] += T[0][2];
1456 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][3];
1458 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1459 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1460 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][2];
1461 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][3];
1469 pcFlux[7][2] = Tu[0];
1470 pcPotential5 = Tu[0];
1473 pcFlux[5][1] = Tu[0];
1477 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1478 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1479 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][2];
1480 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][3];
1482 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1483 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1484 this->A_[eIdxGlobal6][eIdxGlobal7] -= TSecond[0][2];
1485 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][3];
1493 pcFlux[7][2] = Tu[0];
1494 pcPotential5 = Tu[0];
1497 pcFlux[5][1] = Tu[0];
1501 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 6, 7, 4, 5, 2, 3);
1504 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal7, 6, 2);
1505 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal8, 7, 1);
1509 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1510 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1511 this->A_[eIdxGlobal7][eIdxGlobal5] += T[0][2];
1512 this->A_[eIdxGlobal7][eIdxGlobal3] += T[0][3];
1514 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1515 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1516 this->A_[eIdxGlobal8][eIdxGlobal5] -= TSecond[0][2];
1517 this->A_[eIdxGlobal8][eIdxGlobal3] -= TSecond[0][3];
1525 pcFlux[6][2] = Tu[0];
1526 pcPotential6 = Tu[0];
1529 pcFlux[7][1] = Tu[0];
1531 else if (caseL == 2)
1533 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1534 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1535 this->A_[eIdxGlobal7][eIdxGlobal6] += T[0][2];
1536 this->A_[eIdxGlobal7][eIdxGlobal4] += T[0][3];
1538 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1539 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1540 this->A_[eIdxGlobal8][eIdxGlobal6] -= TSecond[0][2];
1541 this->A_[eIdxGlobal8][eIdxGlobal4] -= TSecond[0][3];
1549 pcFlux[6][2] = Tu[0];
1550 pcPotential6 = Tu[0];
1553 pcFlux[7][1] = Tu[0];
1555 else if (caseL == 3)
1557 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1558 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1559 this->A_[eIdxGlobal7][eIdxGlobal6] += T[0][2];
1560 this->A_[eIdxGlobal7][eIdxGlobal3] += T[0][3];
1562 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1563 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1564 this->A_[eIdxGlobal8][eIdxGlobal6] -= TSecond[0][2];
1565 this->A_[eIdxGlobal8][eIdxGlobal3] -= TSecond[0][3];
1573 pcFlux[6][2] = Tu[0];
1574 pcPotential6 = Tu[0];
1577 pcFlux[7][1] = Tu[0];
1581 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1582 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1583 this->A_[eIdxGlobal7][eIdxGlobal5] += T[0][2];
1584 this->A_[eIdxGlobal7][eIdxGlobal4] += T[0][3];
1586 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1587 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1588 this->A_[eIdxGlobal8][eIdxGlobal5] -= TSecond[0][2];
1589 this->A_[eIdxGlobal8][eIdxGlobal4] -= TSecond[0][3];
1597 pcFlux[6][2] = Tu[0];
1598 pcPotential6 = Tu[0];
1601 pcFlux[7][1] = Tu[0];
1605 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 4, 6, 5, 7, 0, 2);
1608 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal5, 4, 2);
1609 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal7, 6, 1);
1613 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1614 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1615 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][2];
1616 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][3];
1618 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1619 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1620 this->A_[eIdxGlobal7][eIdxGlobal6] -= TSecond[0][2];
1621 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][3];
1629 pcFlux[4][2] = Tu[0];
1630 pcPotential7 = Tu[0];
1633 pcFlux[6][1] = Tu[0];
1635 else if (caseL == 2)
1637 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1638 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1639 this->A_[eIdxGlobal5][eIdxGlobal8] += T[0][2];
1640 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][3];
1642 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1643 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1644 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][2];
1645 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][3];
1653 pcFlux[4][2] = Tu[0];
1654 pcPotential7 = Tu[0];
1657 pcFlux[6][1] = Tu[0];
1659 else if (caseL == 3)
1661 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1662 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1663 this->A_[eIdxGlobal5][eIdxGlobal8] += T[0][2];
1664 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][3];
1666 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1667 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1668 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][2];
1669 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][3];
1677 pcFlux[4][2] = Tu[0];
1678 pcPotential7 = Tu[0];
1681 pcFlux[6][1] = Tu[0];
1685 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1686 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1687 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][2];
1688 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][3];
1690 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1691 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1692 this->A_[eIdxGlobal7][eIdxGlobal6] -= TSecond[0][2];
1693 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][3];
1701 pcFlux[4][2] = Tu[0];
1702 pcPotential7 = Tu[0];
1705 pcFlux[6][1] = Tu[0];
1709 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 4, 0, 6, 2, 5, 1);
1712 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal5, 4, 0);
1713 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal1, 0, 2);
1717 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1718 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1719 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][2];
1720 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][3];
1722 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1723 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1724 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][2];
1725 this->A_[eIdxGlobal1][eIdxGlobal6] -= TSecond[0][3];
1733 pcFlux[4][0] = Tu[0];
1734 pcPotential8 = Tu[0];
1737 pcFlux[0][2] = Tu[0];
1739 else if (caseL == 2)
1741 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1742 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1743 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][2];
1744 this->A_[eIdxGlobal5][eIdxGlobal2] += T[0][3];
1746 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1747 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1748 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][2];
1749 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][3];
1757 pcFlux[4][0] = Tu[0];
1758 pcPotential8 = Tu[0];
1761 pcFlux[0][2] = Tu[0];
1763 else if (caseL == 3)
1765 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1766 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1767 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][2];
1768 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][3];
1770 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1771 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1772 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][2];
1773 this->A_[eIdxGlobal1][eIdxGlobal6] -= TSecond[0][3];
1781 pcFlux[4][0] = Tu[0];
1782 pcPotential8 = Tu[0];
1785 pcFlux[0][2] = Tu[0];
1789 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1790 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1791 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][2];
1792 this->A_[eIdxGlobal5][eIdxGlobal2] += T[0][3];
1794 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1795 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1796 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][2];
1797 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][3];
1805 pcFlux[4][0] = Tu[0];
1806 pcPotential8 = Tu[0];
1809 pcFlux[0][2] = Tu[0];
1813 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 1, 5, 3, 7, 0, 4);
1816 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal2, 1, 2);
1817 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal6, 5, 0);
1821 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1822 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1823 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][2];
1824 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][3];
1826 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1827 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1828 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][2];
1829 this->A_[eIdxGlobal6][eIdxGlobal1] -= TSecond[0][3];
1837 pcFlux[1][2] = Tu[0];
1838 pcPotential9 = Tu[0];
1841 pcFlux[5][0] = Tu[0];
1843 else if (caseL == 2)
1845 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1846 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1847 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][2];
1848 this->A_[eIdxGlobal2][eIdxGlobal5] += T[0][3];
1850 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1851 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1852 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][2];
1853 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][3];
1861 pcFlux[1][2] = Tu[0];
1862 pcPotential9 = Tu[0];
1865 pcFlux[5][0] = Tu[0];
1867 else if (caseL == 3)
1869 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1870 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1871 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][2];
1872 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][3];
1874 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1875 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1876 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][2];
1877 this->A_[eIdxGlobal6][eIdxGlobal1] -= TSecond[0][3];
1885 pcFlux[1][2] = Tu[0];
1886 pcPotential9 = Tu[0];
1889 pcFlux[5][0] = Tu[0];
1893 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1894 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1895 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][2];
1896 this->A_[eIdxGlobal2][eIdxGlobal5] += T[0][3];
1898 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1899 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1900 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][2];
1901 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][3];
1909 pcFlux[1][2] = Tu[0];
1910 pcPotential9 = Tu[0];
1913 pcFlux[5][0] = Tu[0];
1917 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 7, 3, 5, 1, 6, 2);
1920 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal8, 7, 0);
1921 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal4, 3, 2);
1925 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1926 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1927 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][2];
1928 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][3];
1930 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
1931 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1932 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][2];
1933 this->A_[eIdxGlobal4][eIdxGlobal7] -= TSecond[0][3];
1941 pcFlux[7][0] = Tu[0];
1942 pcPotential10 = Tu[0];
1945 pcFlux[3][2] = Tu[0];
1947 else if (caseL == 2)
1949 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1950 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1951 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][2];
1952 this->A_[eIdxGlobal8][eIdxGlobal3] += T[0][3];
1954 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
1955 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1956 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][2];
1957 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][3];
1965 pcFlux[7][0] = Tu[0];
1966 pcPotential10 = Tu[0];
1969 pcFlux[3][2] = Tu[0];
1971 else if (caseL == 3)
1973 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1974 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1975 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][2];
1976 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][3];
1978 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
1979 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1980 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][2];
1981 this->A_[eIdxGlobal4][eIdxGlobal7] -= TSecond[0][3];
1989 pcFlux[7][0] = Tu[0];
1990 pcPotential10 = Tu[0];
1993 pcFlux[3][2] = Tu[0];
1997 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1998 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1999 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][2];
2000 this->A_[eIdxGlobal8][eIdxGlobal3] += T[0][3];
2002 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
2003 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
2004 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][2];
2005 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][3];
2013 pcFlux[7][0] = Tu[0];
2014 pcPotential10 = Tu[0];
2017 pcFlux[3][2] = Tu[0];
2021 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 2, 6, 0, 4, 3, 7);
2024 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal3, 2, 2);
2025 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal7, 6, 0);
2029 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2030 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2031 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][2];
2032 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][3];
2034 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2035 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2036 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][2];
2037 this->A_[eIdxGlobal7][eIdxGlobal4] -= TSecond[0][3];
2045 pcFlux[2][2] = Tu[0];
2046 pcPotential11 = Tu[0];
2049 pcFlux[6][0] = Tu[0];
2051 else if (caseL == 2)
2053 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2054 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2055 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][2];
2056 this->A_[eIdxGlobal3][eIdxGlobal8] += T[0][3];
2058 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2059 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2060 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][2];
2061 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][3];
2069 pcFlux[2][2] = Tu[0];
2070 pcPotential11 = Tu[0];
2073 pcFlux[6][0] = Tu[0];
2075 else if (caseL == 3)
2077 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2078 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2079 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][2];
2080 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][3];
2082 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2083 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2084 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][2];
2085 this->A_[eIdxGlobal7][eIdxGlobal4] -= TSecond[0][3];
2093 pcFlux[2][2] = Tu[0];
2094 pcPotential11 = Tu[0];
2097 pcFlux[6][0] = Tu[0];
2101 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2102 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2103 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][2];
2104 this->A_[eIdxGlobal3][eIdxGlobal8] += T[0][3];
2106 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2107 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2108 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][2];
2109 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][3];
2117 pcFlux[2][2] = Tu[0];
2118 pcPotential11 = Tu[0];
2121 pcFlux[6][0] = Tu[0];
2124 if (pc[0] == 0 && pc[1] == 0 && pc[2] == 0 && pc[3] == 0 && pc[4] == 0 && pc[5] == 0 && pc[6] == 0
2131 Dune::FieldVector<Scalar, numPhases> lambda0Upw(0.0);
2132 lambda0Upw[wPhaseIdx] = (pcPotential0 >= 0) ? lambda1[wPhaseIdx] : lambda2[wPhaseIdx];
2133 lambda0Upw[nPhaseIdx] = (pcPotential0 >= 0) ? lambda1[nPhaseIdx] : lambda2[nPhaseIdx];
2136 Dune::FieldVector<Scalar, numPhases> lambda1Upw(0.0);
2137 lambda1Upw[wPhaseIdx] = (pcPotential1 >= 0) ? lambda2[wPhaseIdx] : lambda4[wPhaseIdx];
2138 lambda1Upw[nPhaseIdx] = (pcPotential1 >= 0) ? lambda2[nPhaseIdx] : lambda4[nPhaseIdx];
2141 Dune::FieldVector<Scalar, numPhases> lambda2Upw(0.0);
2142 lambda2Upw[wPhaseIdx] = (pcPotential2 >= 0) ? lambda4[wPhaseIdx] : lambda3[wPhaseIdx];
2143 lambda2Upw[nPhaseIdx] = (pcPotential2 >= 0) ? lambda4[nPhaseIdx] : lambda3[nPhaseIdx];
2146 Dune::FieldVector<Scalar, numPhases> lambda3Upw(0.0);
2147 lambda3Upw[wPhaseIdx] = (pcPotential3 >= 0) ? lambda3[wPhaseIdx] : lambda1[wPhaseIdx];
2148 lambda3Upw[nPhaseIdx] = (pcPotential3 >= 0) ? lambda3[nPhaseIdx] : lambda1[nPhaseIdx];
2151 Dune::FieldVector<Scalar, numPhases> lambda4Upw(0.0);
2152 lambda4Upw[wPhaseIdx] = (pcPotential4 >= 0) ? lambda6[wPhaseIdx] : lambda5[wPhaseIdx];
2153 lambda4Upw[nPhaseIdx] = (pcPotential4 >= 0) ? lambda6[nPhaseIdx] : lambda5[nPhaseIdx];
2156 Dune::FieldVector<Scalar, numPhases> lambda5Upw(0.0);
2157 lambda5Upw[wPhaseIdx] = (pcPotential5 >= 0) ? lambda8[wPhaseIdx] : lambda6[wPhaseIdx];
2158 lambda5Upw[nPhaseIdx] = (pcPotential5 >= 0) ? lambda8[nPhaseIdx] : lambda6[nPhaseIdx];
2161 Dune::FieldVector<Scalar, numPhases> lambda6Upw(0.0);
2162 lambda6Upw[wPhaseIdx] = (pcPotential6 >= 0) ? lambda7[wPhaseIdx] : lambda8[wPhaseIdx];
2163 lambda6Upw[nPhaseIdx] = (pcPotential6 >= 0) ? lambda7[nPhaseIdx] : lambda8[nPhaseIdx];
2166 Dune::FieldVector<Scalar, numPhases> lambda7Upw(0.0);
2167 lambda7Upw[wPhaseIdx] = (pcPotential7 >= 0) ? lambda5[wPhaseIdx] : lambda7[wPhaseIdx];
2168 lambda7Upw[nPhaseIdx] = (pcPotential7 >= 0) ? lambda5[nPhaseIdx] : lambda7[nPhaseIdx];
2171 Dune::FieldVector<Scalar, numPhases> lambda8Upw(0.0);
2172 lambda8Upw[wPhaseIdx] = (pcPotential8 >= 0) ? lambda5[wPhaseIdx] : lambda1[wPhaseIdx];
2173 lambda8Upw[nPhaseIdx] = (pcPotential8 >= 0) ? lambda5[nPhaseIdx] : lambda1[nPhaseIdx];
2176 Dune::FieldVector<Scalar, numPhases> lambda9Upw(0.0);
2177 lambda9Upw[wPhaseIdx] = (pcPotential9 >= 0) ? lambda2[wPhaseIdx] : lambda6[wPhaseIdx];
2178 lambda9Upw[nPhaseIdx] = (pcPotential9 >= 0) ? lambda2[nPhaseIdx] : lambda6[nPhaseIdx];
2181 Dune::FieldVector<Scalar, numPhases> lambda10Upw(0.0);
2182 lambda10Upw[wPhaseIdx] = (pcPotential10 >= 0) ? lambda8[wPhaseIdx] : lambda4[wPhaseIdx];
2183 lambda10Upw[nPhaseIdx] = (pcPotential10 >= 0) ? lambda8[nPhaseIdx] : lambda4[nPhaseIdx];
2186 Dune::FieldVector<Scalar, numPhases> lambda11Upw(0.0);
2187 lambda11Upw[wPhaseIdx] = (pcPotential11 >= 0) ? lambda3[wPhaseIdx] : lambda7[wPhaseIdx];
2188 lambda11Upw[nPhaseIdx] = (pcPotential11 >= 0) ? lambda3[nPhaseIdx] : lambda7[nPhaseIdx];
2190 for (
int i = 0; i < numPhases; i++)
2192 Scalar lambdaT0 = lambda0Upw[wPhaseIdx] + lambda0Upw[nPhaseIdx];
2193 Scalar lambdaT1 = lambda1Upw[wPhaseIdx] + lambda1Upw[nPhaseIdx];
2194 Scalar lambdaT2 = lambda2Upw[wPhaseIdx] + lambda2Upw[nPhaseIdx];
2195 Scalar lambdaT3 = lambda3Upw[wPhaseIdx] + lambda3Upw[nPhaseIdx];
2196 Scalar lambdaT4 = lambda4Upw[wPhaseIdx] + lambda4Upw[nPhaseIdx];
2197 Scalar lambdaT5 = lambda5Upw[wPhaseIdx] + lambda5Upw[nPhaseIdx];
2198 Scalar lambdaT6 = lambda6Upw[wPhaseIdx] + lambda6Upw[nPhaseIdx];
2199 Scalar lambdaT7 = lambda7Upw[wPhaseIdx] + lambda7Upw[nPhaseIdx];
2200 Scalar lambdaT8 = lambda8Upw[wPhaseIdx] + lambda8Upw[nPhaseIdx];
2201 Scalar lambdaT9 = lambda9Upw[wPhaseIdx] + lambda9Upw[nPhaseIdx];
2202 Scalar lambdaT10 = lambda10Upw[wPhaseIdx] + lambda10Upw[nPhaseIdx];
2203 Scalar lambdaT11 = lambda11Upw[wPhaseIdx] + lambda11Upw[nPhaseIdx];
2204 Scalar fracFlow0 = (lambdaT0 > threshold_) ? lambda0Upw[i] / (lambdaT0) : 0.0;
2205 Scalar fracFlow1 = (lambdaT1 > threshold_) ? lambda1Upw[i] / (lambdaT1) : 0.0;
2206 Scalar fracFlow2 = (lambdaT2 > threshold_) ? lambda2Upw[i] / (lambdaT2) : 0.0;
2207 Scalar fracFlow3 = (lambdaT3 > threshold_) ? lambda3Upw[i] / (lambdaT3) : 0.0;
2208 Scalar fracFlow4 = (lambdaT4 > threshold_) ? lambda4Upw[i] / (lambdaT4) : 0.0;
2209 Scalar fracFlow5 = (lambdaT5 > threshold_) ? lambda5Upw[i] / (lambdaT5) : 0.0;
2210 Scalar fracFlow6 = (lambdaT6 > threshold_) ? lambda6Upw[i] / (lambdaT6) : 0.0;
2211 Scalar fracFlow7 = (lambdaT7 > threshold_) ? lambda7Upw[i] / (lambdaT7) : 0.0;
2212 Scalar fracFlow8 = (lambdaT8 > threshold_) ? lambda8Upw[i] / (lambdaT8) : 0.0;
2213 Scalar fracFlow9 = (lambdaT9 > threshold_) ? lambda9Upw[i] / (lambdaT9) : 0.0;
2214 Scalar fracFlow10 = (lambdaT10 > threshold_) ? lambda10Upw[i] / (lambdaT10) : 0.0;
2215 Scalar fracFlow11 = (lambdaT11 > threshold_) ? lambda11Upw[i] / (lambdaT11) : 0.0;
2217 switch (pressureType_)
2224 this->f_[eIdxGlobal1] -= (fracFlow0 * pcFlux[0][0] - fracFlow3 * pcFlux[0][1] - fracFlow8 * pcFlux[0][2]);
2225 this->f_[eIdxGlobal2] -= (fracFlow1 * pcFlux[1][0] - fracFlow0 * pcFlux[1][1] + fracFlow9 * pcFlux[1][2]);
2226 this->f_[eIdxGlobal3] -= (fracFlow3 * pcFlux[2][0] - fracFlow2 * pcFlux[2][1] + fracFlow11 * pcFlux[2][2]);
2227 this->f_[eIdxGlobal4] -= (fracFlow2 * pcFlux[3][0] - fracFlow1 * pcFlux[3][1] - fracFlow10 * pcFlux[3][2]);
2228 this->f_[eIdxGlobal5] -= (fracFlow8 * pcFlux[4][0] - fracFlow4 * pcFlux[4][1] + fracFlow7 * pcFlux[4][2]);
2229 this->f_[eIdxGlobal6] -= (-fracFlow9 * pcFlux[5][0] - fracFlow5 * pcFlux[5][1] + fracFlow4 * pcFlux[5][2]);
2230 this->f_[eIdxGlobal7] -= (-fracFlow11 * pcFlux[6][0] - fracFlow7 * pcFlux[6][1] + fracFlow6 * pcFlux[6][2]);
2231 this->f_[eIdxGlobal8] -= (fracFlow10 * pcFlux[7][0] - fracFlow6 * pcFlux[7][1] + fracFlow5 * pcFlux[7][2]);
2240 this->f_[eIdxGlobal1] += (fracFlow0 * pcFlux[0][0] - fracFlow3 * pcFlux[0][1] - fracFlow8 * pcFlux[0][2]);
2241 this->f_[eIdxGlobal2] += (fracFlow1 * pcFlux[1][0] - fracFlow0 * pcFlux[1][1] + fracFlow9 * pcFlux[1][2]);
2242 this->f_[eIdxGlobal3] += (fracFlow3 * pcFlux[2][0] - fracFlow2 * pcFlux[2][1] + fracFlow11 * pcFlux[2][2]);
2243 this->f_[eIdxGlobal4] += (fracFlow2 * pcFlux[3][0] - fracFlow1 * pcFlux[3][1] - fracFlow10 * pcFlux[3][2]);
2244 this->f_[eIdxGlobal5] += (fracFlow8 * pcFlux[4][0] - fracFlow4 * pcFlux[4][1] + fracFlow7 * pcFlux[4][2]);
2245 this->f_[eIdxGlobal6] += (-fracFlow9 * pcFlux[5][0] - fracFlow5 * pcFlux[5][1] + fracFlow4 * pcFlux[5][2]);
2246 this->f_[eIdxGlobal7] += (-fracFlow11 * pcFlux[6][0] - fracFlow7 * pcFlux[6][1] + fracFlow6 * pcFlux[6][2]);
2247 this->f_[eIdxGlobal8] += (fracFlow10 * pcFlux[7][0] - fracFlow6 * pcFlux[7][1] + fracFlow5 * pcFlux[7][2]);
2256template<
class TypeTag>
2259 for (
int elemIdx = 0; elemIdx < 8; elemIdx++)
2261 if (!interactionVolume.hasSubVolumeElement(elemIdx))
2265 bool isOutside =
false;
2266 for (
int fIdx = 0; fIdx < dim; fIdx++)
2268 int intVolFaceIdx = interactionVolume.getFaceIndexFromSubVolume(elemIdx, fIdx);
2269 if (interactionVolume.isOutsideFace(intVolFaceIdx))
2280 auto element = interactionVolume.getSubVolumeElement(elemIdx);
2283 const GlobalPosition& globalPos = element.geometry().center();
2286 Scalar volume = element.geometry().volume();
2289 int eIdxGlobal = problem_.variables().index(element);
2292 CellData& cellData = problem_.variables().cellData(eIdxGlobal);
2295 DimMatrix
permeability(problem_.spatialParams().intrinsicPermeability(element));
2298 PrimaryVariables source(0);
2299 problem_.source(source, element);
2300 this->f_[eIdxGlobal] += volume / (8.0)
2301 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
2303 this->f_[eIdxGlobal] += evaluateErrorTerm(cellData) * volume / (8.0);
2306 Dune::FieldVector<Scalar, numPhases> lambda(cellData.mobility(wPhaseIdx));
2307 lambda[nPhaseIdx] = cellData.mobility(nPhaseIdx);
2309 Scalar pc = cellData.capillaryPressure();
2311 Scalar gravityDiff = (problem_.bBoxMax() - globalPos) * gravity_
2312 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
2316 for (
int fIdx = 0; fIdx < dim; fIdx++)
2318 int intVolFaceIdx = interactionVolume.getFaceIndexFromSubVolume(elemIdx, fIdx);
2320 if (interactionVolume.isBoundaryFace(intVolFaceIdx))
2322 if (interactionVolume.getBoundaryType(intVolFaceIdx).isDirichlet(pressureEqIdx))
2324 const GlobalPosition& globalPosFace = interactionVolume.getFacePosition(elemIdx, fIdx);
2326 DimVector distVec(globalPosFace - globalPos);
2327 Scalar dist = distVec.two_norm();
2328 DimVector& normal = interactionVolume.getNormal(elemIdx, fIdx);
2330 Scalar faceArea = interactionVolume.getFaceArea(elemIdx, fIdx);
2333 Scalar satWBound = cellData.saturation(wPhaseIdx);
2335 if (interactionVolume.getBoundaryType(intVolFaceIdx).isDirichlet(satEqIdx))
2337 Scalar satBound = interactionVolume.getDirichletValues(intVolFaceIdx)[saturationIdx];
2338 switch (saturationType_)
2342 satWBound = satBound;
2347 satWBound = 1 - satBound;
2354 Scalar pcBound = MaterialLaw::pc(
2355 problem_.spatialParams().materialLawParams(element), satWBound);
2357 Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_
2358 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
2360 pcBound += gravityDiffBound;
2362 Dune::FieldVector<Scalar, numPhases>
2363 lambdaBound(MaterialLaw::krw(problem_.spatialParams().materialLawParams(element),satWBound));
2364 lambdaBound[nPhaseIdx] = MaterialLaw::krn(
2365 problem_.spatialParams().materialLawParams(element), satWBound);
2366 lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
2367 lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
2369 Scalar potentialBound = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx];
2370 Scalar gdeltaZ = (problem_.bBoxMax()-globalPosFace) * gravity_;
2373 Scalar potentialDiffW = 0;
2374 Scalar potentialDiffNw = 0;
2375 switch (pressureType_)
2379 potentialBound += density_[wPhaseIdx]*gdeltaZ;
2380 potentialDiffW = (cellData.potential(wPhaseIdx) - potentialBound) / dist;
2381 potentialDiffNw = (cellData.potential(nPhaseIdx) - potentialBound - pcBound) / dist;
2386 potentialBound += density_[nPhaseIdx]*gdeltaZ;
2387 potentialDiffW = (cellData.potential(wPhaseIdx) - potentialBound + pcBound) / dist;
2388 potentialDiffNw = (cellData.potential(nPhaseIdx) - potentialBound) / dist;
2393 Scalar lambdaTotal = (potentialDiffW >= 0.) ? lambda[wPhaseIdx] : lambdaBound[wPhaseIdx];
2394 lambdaTotal += (potentialDiffNw >= 0.) ? lambda[nPhaseIdx] : lambdaBound[nPhaseIdx];
2396 DimVector permTimesNormal(0);
2398 Scalar scalarPerm = permTimesNormal.two_norm();
2401 Scalar entry = lambdaTotal * scalarPerm / dist * faceArea;
2404 this->A_[eIdxGlobal][eIdxGlobal] += entry;
2405 this->f_[eIdxGlobal] += entry * potentialBound;
2407 if (pc == 0 && pcBound == 0)
2415 switch (pressureType_)
2420 pcFlux = 0.5 * (lambda[nPhaseIdx] + lambdaBound[nPhaseIdx])
2421 * scalarPerm * (pc - pcBound) / dist * faceArea;
2428 pcFlux = 0.5 * (lambda[wPhaseIdx] + lambdaBound[wPhaseIdx])
2429 * scalarPerm * (pc - pcBound) / dist * faceArea;
2435 for (
int i = 0; i < numPhases; i++)
2437 switch (pressureType_)
2444 this->f_[eIdxGlobal] -= pcFlux;
2453 this->f_[eIdxGlobal] += pcFlux;
2460 else if (interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx))
2462 Scalar J = interactionVolume.getNeumannValues(intVolFaceIdx)[wPhaseIdx]
2463 / density_[wPhaseIdx];
2464 J += interactionVolume.getNeumannValues(intVolFaceIdx)[nPhaseIdx] / density_[nPhaseIdx];
2465 this->f_[eIdxGlobal] -= J;
2469 std::cout <<
"interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx)"
2470 << interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx) <<
"\n";
2471 DUNE_THROW(Dune::NotImplemented,
2472 "No valid boundary condition type defined for pressure equation!");
2480template<
class TypeTag>
2484 for (
const auto& element : elements(problem_.gridView()))
2486 int eIdxGlobal = problem_.variables().index(element);
2488 CellData& cellData = problem_.variables().cellData(eIdxGlobal);
2490 Scalar satW = cellData.saturation(wPhaseIdx);
2492 Scalar pc = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW);
2494 cellData.setCapillaryPressure(pc);
2497 Scalar mobilityW = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW)
2498 / viscosity_[wPhaseIdx];
2499 Scalar mobilityNw = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW)
2500 / viscosity_[nPhaseIdx];
2503 cellData.setMobility(wPhaseIdx, mobilityW);
2504 cellData.setMobility(nPhaseIdx, mobilityNw);
2507 cellData.setFracFlowFunc(wPhaseIdx, mobilityW / (mobilityW + mobilityNw));
2508 cellData.setFracFlowFunc(nPhaseIdx, mobilityNw / (mobilityW + mobilityNw));
Interactionvolume container for 3-d MPFA L-method.
Provides methods for transmissibility calculation in 3-d.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition: propertysystem.hh:140
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string permeability() noexcept
I/O name of permeability.
Definition: name.hh:143
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
3-d finite volume MPFA L-method discretization of a two-phase flow pressure equation of the sequentia...
Definition: 3dpressure.hh:74
Scalar evaluateErrorTerm(CellData &cellData)
Volume correction term to correct for unphysical saturation overshoots/undershoots.
Definition: 3dpressure.hh:341
void initializeMatrixRowSize()
Initializes the row size of the sparse matrix for the pressure solution.
Definition: 3dpressure.hh:555
void assembleInnerInteractionVolume(InteractionVolume &interactionVolume)
assembles the matrix entries of one interaction volume into the global matrix
Definition: 3dpressure.hh:658
typename TransmissibilityCalculator::TransmissibilityType TransmissibilityType
Type including methods for calculation of MPFA transmissibilities.
Definition: 3dpressure.hh:153
void assemble()
function which assembles the system of equations to be solved
Definition: 3dpressure.hh:626
void update()
Pressure update.
Definition: 3dpressure.hh:272
InteractionVolumeContainer interactionVolumes_
Definition: 3dpressure.hh:508
GetPropType< TypeTag, Properties::MPFAInteractionVolume > InteractionVolume
Type for storing interaction volume information.
Definition: 3dpressure.hh:155
void assembleBoundaryInteractionVolume(InteractionVolume &interactionVolume)
Definition: 3dpressure.hh:2257
TransmissibilityCalculator transmissibilityCalculator_
The transmissibility calculator including methods for the MPFA transmissibility calculation.
Definition: 3dpressure.hh:510
void initialize(bool solveTwice=true)
Initializes the pressure model.
Definition: 3dpressure.hh:178
InteractionVolumeContainer & interactionVolumes()
Returns the global container of the stored interaction volumes.
Definition: 3dpressure.hh:450
TransmissibilityCalculator & transmissibilityCalculator()
Returns the transmissibility calculator.
Definition: 3dpressure.hh:460
void initializeMatrix()
Initializes the sparse matrix for the pressure solution.
Definition: 3dpressure.hh:545
FvMpfaL3dPressure2p(Problem &problem)
Constructs a FvMpfaL3dPressure2p object.
Definition: 3dpressure.hh:469
void storePressureSolution()
Globally stores the pressure solution.
Definition: 3dpressure.hh:206
void addOutputVtkFields(MultiWriter &writer)
Adds pressure output to the output file.
Definition: 3dpressure.hh:385
void storePressureSolution(const Element &element)
Stores the pressure solution of a cell.
Definition: 3dpressure.hh:220
void updateMaterialLaws()
constitutive functions are initialized and stored in the variables object
Definition: 3dpressure.hh:2481
void initializeMatrixIndices()
Initializes the indices of the sparse matrix for the pressure solution.
Definition: 3dpressure.hh:592
Provides methods for transmissibility calculation in 3-d.
Definition: 3dtransmissibilitycalculator.hh:51
Dune::FieldMatrix< Scalar, dim, 2 *dim - dim+1 > TransmissibilityType
Type of the transmissibility matrix.
Definition: 3dtransmissibilitycalculator.hh:78
The finite volume base class for the solution of a pressure equation.
Definition: sequential/cellcentered/pressure.hh:49
void initialize()
Initialize pressure model.
Definition: sequential/cellcentered/pressure.hh:213
PressureSolution & pressure()
Returns the vector containing the pressure solution.
Definition: sequential/cellcentered/pressure.hh:120
void solve()
Solves the global system of equations to get the spatial distribution of the pressure.
Definition: sequential/cellcentered/pressure.hh:527
Specifies the properties for immiscible 2p diffusion/pressure models.
Finite Volume Diffusion Model.